Ramp metering has been considered as a cost-effective strategy for advanced traffic and demand management (ATDM) on freeways. Basically, it utilizes traffic signal operation at ramps to manage the amount of traffic entering the mainline, in order to reduce overall freeway congestion. Conventional ramp metering approaches mainly rely on the traffic detection (from fixed location sensors) on the mainline to provide control signals (number of vehicles per green) at the on-ramps. However, the on-ramp queue effect is rarely considered which may potentially cause the hot spot of air pollution, especially when the truck volume is non-trivial. In addition, the safety concern about merging maneuvers (between mainline and on-ramp) cannot be mitigated due to the lack of detailed information of merging traffic. Thanks to the advances of connected and automated vehicle technology, this project will develop a hierarchical ramp merging control strategy which will first use mainline traffic information to determine entrance rates of ramp traffic and then control speeds of (both mainline and on-ramp) CAVs without unnecessary stops to achieve desired entrance rates while maintaining safe gaps during merging. Microscopic traffic simulation is used to verify the system and evaluate its performance including environmental impacts.