Our current transportation system faces a variety of issues in terms of safety, mobility, and environmental sustainability. The emergence of innovative intelligent transportation system (ITS) technologies such as connected and automated vehicles (CAVs) and transportation electrification unfold unprecedented opportunities to address aforementioned issues. In this project, we propose a hierarchical ramp control system that not only allows microscopic cooperative maneuvers for connected and automated electric vehicles (CAEVs) on the ramp to merge into mainline traffic flow under certain controlled ramp inflow rate, but also enables macroscopic corridor-level traffic flow control (i.e., coordinated ramp metering rate determination). A centralized optimal control-based approach is proposed to both smooth the merging flow and improve the system-wide mobility of the network. Linear quadratic trackers in both finite horizon and receding horizon forms are developed to solve the optimization problem in terms of path planning and sequence determination, and a microscopic electric vehicle (EV) energy consumption model is applied to estimate the energy consumption. Finally, traffic simulation is conducted through PTV VISSIM to evaluate the impact of the proposed system on a highway segment. The results confirm that under the regulated inflow rate, the proposed system can avoid potential traffic congestion and improve mobility significantly up to 102% compared to the conventional ramp metering and the ramp without any control approach.