To cope with global energy-related problems, the effective use of renewable energy such as photovoltaic and wind power is required. As these energy sources are unstable, it is required to introduce batteries into the power grids. Vehicle to grid (V2G) is a technology that is receiving much attention as a method for achieving an efficient energy management system (EMS) by connecting electric vehicles (EVs) to an electric power grid. In this study, we constructed an EMS model using MATLAB/Simulink and determined the optimized capacity of the fixed batteries and EVs based on data sampled at an experimental site in terms of capital cost. Fixed batteries as well as EV batteries were modeled and evaluated using the actual parameters and constraints of the terminal. The main aim was to level the received energy and achieve the recharge level of the battery in one day to maintain a long battery lifetime. Through simulations, we determined the optimized capacity based on actually measured data. We could exploit the management method by considering the relation between fixed batteries and EV batteries. Using this relation, the proposed method could predict the optimized fixed or EV batteries capacity required.