Skip to Content
ElectronicsElectronics
  • Article
  • Open Access

22 April 2026

20 Pages

Co-Design Method for Energy Management Systems in Vehicle–Grid-Integrated Microgrids from HIL Simulation to Embedded Deployment

,
and
Division of Electronic and Informatics, Gunma University, Kiryu 376-8515, Japan
*
Author to whom correspondence should be addressed.

Abstract

With the widespread adoption of electric vehicles (EVs), the deep integration of transportation and power grids has emerged as a significant trend. EV charging stations, acting as dynamic loads, present challenges to real-time power balance and economic dispatch in microgrids, while EVs serving as mobile energy storage units offer new opportunities for system flexibility. To address these issues, this paper proposes a hardware-in-the-loop (HIL) co-design method for vehicle–grid-integrated microgrid energy management systems, covering the entire workflow from simulation to embedded deployment. This method resolves the core challenges of multi-objective optimization algorithm deployment on embedded platforms (i.e., high computational complexity, strict real-time constraints, and heterogeneous communication protocol integration) via deployability analysis, hybrid code generation, real-time task restructuring, and consistency validation. A prototype microgrid system integrating photovoltaic panels, wind turbines, diesel generators, an energy storage system, and EV charging loads was built on the RK3588 embedded platform. An improved multi-objective particle swarm optimization (MOPSO) algorithm is employed to optimize operational costs. Experimental results verify the effectiveness of the proposed co-design method. Compared with traditional rule-based control strategies, the MOPSO algorithm reduces the total daily operating cost of the VGIM system by approximately 50%. After integrating vehicle-to-grid (V2G) scheduling, the operating cost is further reduced. In addition, this method ensures the consistency of algorithm functionality and performance during the migration from HIL simulation to embedded deployment, and the RK3588-based embedded system can complete a single optimization iteration within 60 s, which fully satisfies the real-time requirements of industrial applications. This work provides a feasible technical pathway for the reliable deployment of vehicle–grid-integrated microgrids in practical industrial scenarios.

1. Introduction

The vehicle–grid-integrated microgrid (VGIM) represents an innovative application within distributed energy systems. Compared with traditional power grids, VGIM leverages electric vehicles and their energy storage units to achieve bidirectional energy interaction and intelligent regulation with the grid [1,2]. The system can operate in islanded mode or achieve flexible power balancing through grid-coordinated operation. The energy sources of VGIM primarily include two aspects: first, clean energy sources such as photovoltaic and wind power supply electricity to electric vehicles and microgrid loads; second, energy storage systems and energy conversion devices such as microturbines serve as regulatory means for power supply. VGIM integrates multiple energy sources and energy storage units, including solar panels, wind turbines, energy storage systems, and EV charging facilities, forming a “source-storage-load-vehicle-grid” microgrid architecture [3,4].
The key objectives of VGIM energy management include real-time power balance, optimal supply-demand matching, and maximizing energy utilization efficiency. The rapid growth of EV ownership and large-scale V2G application impose higher demands on energy management systems. VGIM energy management encompasses critical technologies such as energy forecasting, scheduling, power control, and load management, which must address the intermittency and unpredictability of renewable energy sources. Therefore, research is dedicated to developing efficient, robust, real-time intelligent scheduling algorithms and architectures to ensure economic viability and sustainability [5]. However, transitioning from simulation to embedded deployment still faces major challenges: high computational complexity, stringent real-time constraints, and heterogeneous communication protocol integration.
In the research field of energy management, control, and operation of vehicle–grid-integrated microgrids, existing work can be broadly categorized into several key directions. One stream focuses on energy regulation, coordinated dispatch, and operational optimization, often employing game-theoretic approaches or distributed frameworks [6,7,8]. In parallel, studies on bidirectional charger topologies and dynamic modeling of energy storage systems provide foundational support for system-level integration and simulation [9]. Together, these research directions constitute important pillars in the development of vehicle–grid-integrated microgrids. In terms of intelligent algorithm applications, deep reinforcement learning, V2G dispatchable capacity forecasting, and vehicle–grid-coordinated optimization control are employed to improve the utilization efficiency of distributed energy storage resources, reduce system operating costs, and enhance the robustness of vehicle–grid-integrated microgrids [10,11,12]. Smart grids and digital technologies, including smart sensors, communication technologies, and big data analytics, are implemented in microgrid systems to improve monitoring, control, and decision-making capabilities of energy systems [13,14]. As an effective system verification method, HIL simulation has attracted extensive attention for its engineering adaptability challenges and application progress, and relevant studies have focused on HIL modeling of distributed generation systems and HIL analysis of distributed energy resources in microgrids [15,16,17].
HIL technology has been widely applied in testing and validation across various specific energy systems and integrated scenarios. Case studies on distributed energy management in networked microgrids and dynamic power management strategies for DC microgrids demonstrate the role of HIL in validating advanced control algorithms [18,19]. In the integration of electric vehicles with microgrids, HIL testing has been conducted on energy management controllers for microgrids incorporating electric vehicles [20]. In terms of evaluating the grid integration impact of energy storage systems, real-time simulation has been used to analyze the dynamic effects of battery energy storage systems connected to the grid, providing insights for system planning and operation [21]. Collectively, these studies indicate that HIL simulation has become a crucial tool supporting the design, verification, and iterative refinement of control strategies for complex energy systems, particularly in applications with high reliability and stringent real-time requirements.
Current research on energy management systems for VGIM primarily focuses on V2G scheduling algorithms, while the seamless transition from HIL simulation to embedded deployment remains underexplored. To meet scalability requirements across diverse scenarios, embedded energy management systems should adopt an extensible and modular architecture adaptable to various energy system scales and types. To address this research gap, this paper presents a systematic co-design methodology for the energy management system of vehicle–grid-integrated microgrids, covering the entire development process from HIL simulation to embedded deployment. The methodology integrates deployability analysis, hybrid code generation, real-time task restructuring, and consistency validation into a unified workflow. A concrete case study deploys an improved MOPSO algorithm on an RK3588 embedded platform for coordinated operation optimization of a vehicle–grid-integrated microgrid incorporating EV clusters, PV, and energy storage. Experimental results demonstrate that the proposed method reduces system operating costs and ensures a smooth transition from simulation to embedded execution. The main contributions are as follows:
  • A systematic co-design methodology bridging HIL simulation to embedded deployment for VGIM energy management systems.
  • An improved MOPSO algorithm achieving approximately 50% reduction in daily operating cost.
  • A consistency validation framework ensuring functional and performance preservation from simulation to embedded execution.
  • A modular RK3588-based embedded architecture completing a single optimization iteration within 60 s.

2. Vehicle–Grid-Integrated Microgrid System Analysis and Modeling

A vehicle–grid-integrated microgrid is a localized energy system that incorporates EVs as mobile energy storage units. In addition to conventional components such as photovoltaic panels, wind turbines, diesel generators, and stationary energy storage systems, the system also integrates EV clusters through charging stations, enabling V2G energy interactions. The architecture, shown in Figure 1, reflects the multi-dimensional synergy of “source-storage-load-vehicle-grid” elements.
Figure 1. Vehicle–grid-integrated microgrid energy management system.

2.1. Photovoltaic Grid-Connected System

Photovoltaic power generation relies on solar radiation. Its optimized scheduling is necessitated by the intermittency of solar energy, requiring the rational utilization of photovoltaic power based on real-time weather conditions and load demands to prevent energy waste or supply interruptions caused by insufficient or excessive power generation. Based on electronic circuit theory, the equivalent circuit of a photovoltaic cell is shown in Figure 2, and its output current characteristic is described by the following equations:
Figure 2. Equivalent circuit of a photovoltaic cell.
I = I ph − I d − I p
I d = I o e q ( U + I R s ) A K T − 1
I p = U + I R p R p
I = I ph − I o e q ( U + I R s ) A K T − 1 − U + I R s R p
where Iph is the photocurrent, Id is the diode saturation current, Ip is the shunt resistance current, U is the output voltage of the photovoltaic cell, Rs is the series resistance, and Rp is the shunt resistance.
When the leakage resistance Rp is sufficiently large and the series resistance RS is relatively small, Equation (4) can be approximated as follows:
I = I ph − I o ( e q ( U + I R s ) A K T − 1 )
The output power expression of the photovoltaic cell is as follows:
P = U I ph − U I o ( e q ( U + I R s ) A K T − 1 )
As shown in Figure 3, the photovoltaic grid-connected system comprises four stages: photovoltaic array, Boost converter, three-phase full-bridge inverter, and three-phase transformer. To maximize power output, the photovoltaic system employs a Maximum Power Point Tracking (MPPT) controller, which adjusts the duty cycle of the Boost converter to track the maximum power point under varying irradiance and temperature conditions. The output power model of the photovoltaic array (Equation (7)) is based on the single-diode equivalent circuit model widely adopted in microgrid simulation studies [22,23].
Figure 3. Structure of the photovoltaic grid-connected system.
Photovoltaic cells typically operate in MPPT mode, and the output power model can be expressed as follows:
P pv = η pv A pv G ( 1 − τ ) [ 1 + β ( T − T stc ) ]
Ppv is the output power of the photovoltaic cell; ηpv is the conversion efficiency of the photovoltaic cell; Apv is the area of the photovoltaic panel; G is the ratio of the light intensity to the light intensity under standard test conditions; τ is the light transmittance of the photovoltaic cell; γ is the temperature coefficient of the photovoltaic cell; T is the current operating temperature of the photovoltaic cell; Tstc is the temperature under standard test conditions.
The photovoltaic cell model described by Equations (1)–(6) follows the standard single-diode model reported in [22,23,24]. The output power model in Equation (7) adopts the parameterization method from [25].

2.2. Wind Turbine Grid-Connected System

As shown in Figure 4, the wind power generation system operates as follows: a permanent magnet synchronous generator converts mechanical energy into three-phase AC, which is rectified to DC by a three-phase rectifier and smoothed by a parallel capacitor. A three-phase inverter then converts the DC into grid-compliant AC while controlling the voltage and frequency in real time. Finally, a three-phase LCL filter ensures the AC power meets grid requirements for voltage, frequency, and power factor.
Figure 4. Structure of the wind power grid-connected system.
The output power model of wind power generation can be expressed as follows:
P WT = 0 0 ≤ v ≤ v ci P r v 3 − v ci 3 v r 3 − v ci 3 v ci ≤ v ≤ v r P r v r ≤ v ≤ v co   0 v co ≤ v ≤ v
PWT is the output power of the wind turbine; Pr is the rated output power of the wind turbine; Vci, Vr, and Vco are the cut-in wind speed, rated wind speed, and cut-out wind speed, respectively.

2.3. Diesel Generator System

As shown in Figure 5, the core of a diesel generator system is its control system, which monitors and regulates operation. It provides automatic start/stop, protection functions, and parameter monitoring (voltage, frequency, current). The control system primarily consists of governor control and excitation control.
Figure 5. Diesel generator system structure.
The output power model of diesel generator set can be expressed as follows:
P DE = P rated ⋅ [ 1 − k 1 ⋅ ( P rated P rated _ fuel ) ] ⋅ [ 1 − k 2 ⋅ ( L L rated ) ]
PDE is the output power of the diesel generator; Prated is the rated power of the diesel generator; Prated_fuel is the fuel consumption of the diesel engine under rated load; L is the load demand of the diesel engine; Lrated is the rated load of the diesel engine; k1 is the fuel consumption coefficient of the diesel engine, used to describe the relationship between the generator output power and fuel consumption; k2 is the load loss coefficient of the diesel engine, used to describe the relationship between the generator output power and the load.

2.4. Battery Energy Storage System (BESS)

As shown in Figure 6, the BESS enables bidirectional energy transfer with the grid. A bidirectional DC-DC converter manages charging/discharging, while a three-phase full-bridge inverter handles AC/DC conversion.
Figure 6. Battery energy storage system structure.
The output power model of the battery energy storage system can be expressed through the charge–discharge state model:
S O C ( t + 1 ) = S O C ( t ) + η ES ⋅ [ P all ( t + 1 ) − P load ( t + 1 ) η inv ] ⋅ Δ t S O C ( t ) + η ES ′ ⋅ [ P load ( t + 1 ) η inv − P all ( t + 1 ) ] ⋅ Δ t
SOC(t + 1) and SOC(t) are the battery capacities at time t + 1 and time t, respectively; ηinv is the operating efficiency of the inverter; ηES and η’ES are the charging efficiency and discharging efficiency of the battery, respectively; Pall(t + 1) is the total output power of distributed generation at time t + 1; Pload(t + 1) is the total system load at time t + 1.

2.5. Electric Vehicle Integration System

As shown in Figure 7, EVs integrate into microgrids as both adjustable loads and mobile energy storage units, achieving synergy among vehicles, charging piles, the grid, storage, and generation sources. Their charging/discharging behaviors are influenced by battery characteristics, travel patterns, and grid dispatch. The system comprises three stages: grid AC connection, AC/DC conversion by the charging pile, and DC charging via the on-board charger.
Figure 7. Electric vehicle-integrated system structure.
The EV-related cost includes charging cost and V2G compensation revenue:
C E V ( t ) = ρ g r i d ( t ) ⋅ P E V c h ( t ) ⋅ Δ t R v 2 g ( t ) = ρ v 2 g ( t ) ⋅ P E V d i s ( t ) ⋅ Δ t
where ρgrid(t) is the time-of-use electricity price, and ρv2g(t) is the V2G compensation rate.
In the vehicle–grid-integrated microgrid, the power generation and energy storage systems from multiple sources need to operate collaboratively based on the demand on the load side to achieve optimal energy utilization. Analyzing the output characteristics of each unit in the VGIM provides quasi-real-time data for the simulation verification of embedded systems.

3. Analysis on Vehicle–Grid-Integrated Microgrid Energy Management Strategy

3.1. Vehicle–Grid-Integrated Microgrid Energy Management

Energy management systems optimize VGIM performance by monitoring generation, storage, and consumption and adjusting energy distribution based on real-time demand and electricity prices. As shown in Figure 8, a hierarchical control strategy is adopted, comprising three layers: power dispatch, in-place control, and communication control. This enables efficient coordinated operation, optimal energy utilization under varying conditions, and enhanced system reliability and stability.
Figure 8. Hierarchical control architecture of vehicle–grid-integrated microgrid.
  • Power dispatch layer: Intelligently dispatches energy resources to adapt to fluctuations in generation and load demand.
  • In-place control layer: Monitors equipment status and environmental parameters via sensors and actuators and adopts local optimization strategies to ensure energy supply and operational stability.
  • Communication control layer: Integrates IoT devices, processes data, and provides Node-RED visualization.

3.2. Vehicle–Grid-Integrated Microgrid Power Dispatch Decision Design

The core of VGIM energy management is coordinated optimization of “source-storage-load-vehicle-grid” through three mechanisms: real-time monitoring, dynamic adjustment, and safety assurance. The real-time monitoring mechanism achieves full perception of energy output, load demand, and equipment status via sensor networks—e.g., PV output considers light intensity and temperature, wind power considers wind speed and turbine status, and BESS tracks SOC and charge/discharge efficiency. This monitoring data provides a decision-making basis for the power dispatch layer, ensuring effective scheduling strategies.
When the VGIM system starts to operate, calculate the power of each unit of the microgrid system:
(1) When the total output power of photovoltaic and wind power generation is higher than the load demand, i.e., Ppv + Pwt > Pload, the diesel generator is shut down, and the surplus power is stored in the battery energy storage system (BESS). If the battery SoC > 98%, then orderly charging is initiated for the electric vehicle cluster (EV cluster). If the overall state of charge (SOC) of the EV cluster also reaches the preset upper limit, the remaining surplus is exported to the grid.
(2) When the power of photovoltaic power generation and wind power generation is less than the load value, i.e., Ppv + Pwt < Pload, the real-time optimization algorithm is activated, which comprehensively considers diesel generator power generation costs, fixed energy storage charging/discharging costs, electric vehicle V2G compensation costs, and grid electricity purchase prices, to select the dispatch combination with the lowest total cost.
If the diesel generator has the lowest operating cost, it is put into operation. When the total output power of photovoltaic, wind, and diesel generation is higher than the load demand (i.e., Ppv + Pwt + Pde > Pload) and the SOC of the BESS exceeds 98%, the surplus power is fed into the main grid; otherwise, the surplus power is continuously stored in the BESS. When the sum of the power of photovoltaic power generation, wind power generation, and diesel generator power generation is less than the load value, i.e., Ppv + Pwt + Pde < Pload, the battery energy storage system operates. If Ppv + Pwt + Pde + PBESS > Pload, the excess power is sold to the grid; otherwise, purchase power from the grid.
If the operating cost of battery energy storage is the lowest, the battery discharges. When the sum of the power of photovoltaic power generation, wind power generation, and battery energy storage system is greater than the load value, i.e., Ppv + Pwt + PBESS > Pload, the diesel generator does not operate, and power is sold to the grid. The excess power is sold to the grid. When the sum of the power of photovoltaic power generation, wind power generation, and battery energy storage system is less than the load value, i.e., Ppv + Pwt + PBESS < Pload, the diesel generator operates. At this time, if Ppv + Pwt + Pde + PBESS > Pload, sell power to the grid; otherwise, purchase power from the grid.

4. Energy Optimization Management Based on Improved MOPSO Algorithm

4.1. Energy Optimal Scheduling Model Architecture

Based on the component modeling and energy scheduling analysis above, a real-time rolling optimization approach is developed to adapt to varying data conditions across different time intervals. An optimal scheduling model for the “PV-wind-diesel-storage-vehicle”-integrated microgrid is constructed (Figure 9), where EVs participate as dispatchable mobile storage units and controllable loads.
Figure 9. System operational optimal scheduling model architecture.
The VGIM optimal scheduling model primarily consists of the following three components:
(1) Input Section: Initial parameters including PV output, wind turbine output, load data, BESS initial state, and diesel generator parameters.
(2) Operational Optimization Section: Multi-objective functions, operational constraints, improved MOPSO algorithm, optimization variables, and equipment output strategies.
(3) Output Optimization Results: Optimization results including BESS output, diesel generator power, and grid power.
The objective function of the VGIM dispatch model is to minimize the total operating cost, which consists of four components: power generation cost, equipment loss cost, environmental pollution cost, and EV-related cost. The mathematical expression is as follows:
W = α Y 1 + β Y 2 + γ Y 3 + θ Y 4
Y 1 = ∑ t = 1 T C p v ( t ) + C D E 1 ( t ) + C B A 1 ( t ) + C g r i d ( t ) Y 2 = ∑ t = 1 T C D E 2 ( t ) + C B A 2 ( t ) Y 3 = ∑ t = 1 T C D E _ E N ( t ) + C g r i d _ E N ( t ) Y 4 = ∑ t = 1 T C E V ( t ) − R v 2 g ( t )
W is the total cost of the VGIM; Y1, Y2, Y3, and Y4 are the cost of power generation, the cost of equipment, and the cost of environmental pollution and EV-related costs; α, β, γ, and θ are the proportions of power generation costs, equipment costs, environmental pollution costs, and EV-related costs in the total cost of the vehicle–grid-integrated microgrid, where α, β, γ, and θ are weighting coefficients and satisfy α + β + γ + θ = 1; CPV(t), CDE1(t), CBA1(t), and Cgird(t) are the total cost of photovoltaic power generation at time t, the power generation cost of the diesel generator, the power generation cost of the battery energy storage system, and the total cost of interaction between the microgrid and the external main power grid; CDE2(t) and CBA2(t) are the equipment cost of the diesel generator power generation and the equipment cost of the battery energy storage system at time t; CDE_EN(t) and Cgrid_EN(t) are the environmental pollution cost of diesel generators at time t and the environmental pollution treatment cost of the external main power grid; and CEV(t) and Rv2g(t) represent the EV charging cost and the EV scheduling participation revenue at time t, respectively.
In the VGIM system, the power balance constraint ensures that total generation from PV, WT, DE, BESS (discharging), and grid imports equals total load, including user demand, BESS charging, and EV charging. The expression is written as follows:
P P V ( t ) + P W T ( t ) + P D E ( t ) + P d i s ( t ) + P g r i d , i n ( t ) = P l o a d ( t ) + P c h ( t ) + P E V , c h ( t ) + P g r i d , o u t ( t )
where PEV,ch(t) and PEV,dis(t) are the charging and discharging power of the EV cluster, respectively;
Adaptive inertia weight enhances PSO’s search capability, convergence speed, robustness, and exploration-exploitation balance [23]. MOGA, MOSA, and MOPSO are population-based meta-heuristic algorithms requiring parameter tuning. To evaluate their applicability for microgrid optimization, this paper uses MATLAB2019a to test them on a standard multi-objective function (Equation (15)), comparing solution quality, convergence speed, and computational efficiency.
W = x 1 2 + x 2 2 ( x 1 − 2 ) 2 + ( x 2 − 2 ) 2
MOPSO is adopted for the following reasons. Particle swarm optimization (PSO) has a simple structure, few parameters, and is easy to implement [24]. It has been successfully applied in diverse fields, including neural modeling and fuzzy logic control for two-wheeled wheelchair systems, frequency control of multi-area interconnected hydrothermal power systems, and robust MEMS temperature control with GA-fuzzy PID. As shown by the red Pareto front in Figure 10, MOPSO achieves a superior trade-off distribution. It has been successfully applied in diverse fields, including improving frequency control of multi-area interconnected hydrothermal power systems [25] and robust MEMS temperature control with GA-PSO-fuzzy PID control [26]. These applications demonstrate PSO’s strong global search capability, fast convergence, and robustness against parameter variations, which are highly desirable for microgrid energy management problems involving multiple conflicting objectives. As shown by the red Pareto front in Figure 10, MOPSO achieves a superior trade-off distribution compared to other multi-objective algorithms, making it suitable for the vehicle–grid-integrated microgrid optimization task in this work.
Figure 10. Comparison of Pareto fronts in multi-objective optimization algorithms.
However, single-agent optimization algorithms (e.g., improved smoothing functional algorithms [27], normalized SPSA [28], modified safe experimentation dynamics [29]) are often preferred when computation time is critical, as they require no population maintenance and run faster. MOPSO, while offering better exploration and Pareto front coverage, has four main gaps compared to single-agent methods: (1) higher computational cost; (2) slower convergence under the same iterations; (3) high parameter sensitivity; (4) reliance on parallelization for efficiency. Simulation results confirm that MOPSO provides better solution quality and Pareto front distribution than simulated annealing, but at the cost of longer runtime. Thus, MOPSO is suitable for offline optimization where solution quality is prioritized over computation time.
The multi-objective optimization process of the microgrid is divided into two parts, namely the improved MOPSO algorithm process and the overall operation process, as shown in Figure 11a,b. The solution steps of the MOPSO-based multi-objective optimal dispatch model for VGIM are as follows:
Step 1: Establish the complete mathematical model of the VGIM system, including the modeling of PV, WT, DE, BESS and EV units.
Step 2: Determine that the multi-objective function is the minimum total cost, including three parts, namely power generation cost, equipment cost, environmental pollution, cost and EV-related costs.
Step 3: According to the improved MOPSO algorithm, the multi-objective optimization operation problem is solved.
Step 4: Solve the optimal dispatch decisions, including battery energy storage output, diesel generator power, and EV charging power, based on the improved MOPSO algorithm.
Step 5: According to the output of each power generation unit of the vehicle–grid-integrated microgrid, the effectiveness of the design is verified by building a micromodel in Simulink.
Figure 11. Flowchart. (a) Improved MOPSO algorithm flowchart; (b) operation flowchart.

4.2. Vehicle–Grid-Integrated Microgrid Energy Optimal Scheduling Verification

The Raspberry Pi CM4 was selected for preliminary algorithm validation due to its compact form factor, strong community support, and seamless integration with Simulink via TCP/IP. These features enable rapid prototyping and efficient debugging of the improved MOPSO algorithm under real-world load data conditions, without the need for complex embedded toolchain configuration. Raspberry Pi CM4 is adopted as the core computing board for preliminary data acquisition and optimization algorithm verification (Figure 12a) [30]. Its core processor is the Broadcom BCM2711, a 64-bit quad-core A72 chip with a main frequency of 1.8 GHz. Simulink successfully established a connection with the Raspberry Pi via TCP/IP, and load data from the user side of the vehicle–grid-integrated microgrid was input. The load data consisted of 24 distinct load values over a 24 h period. The flow for processing and optimizing the data is illustrated in Figure 12b below.
Figure 12. Verification process. (a) Raspberry Pi CM4 expansion board; (b) Raspberry Pi CM4 optimization processing data flow.
The operation results are shown in Figure 13, including photovoltaic power generation, wind power generation, battery energy storage, diesel generator, and main grid interaction. On the Raspberry Pi CM4 platform with a population size of 50 and a maximum of 200 iterations, the improved MOPSO algorithm achieves convergence after approximately 78 iterations. The total computation time per optimization cycle is 55.6 s, while the simulation runtime in Simulink is 10 s for the complete 24 h operational period. The system basically realizes the main functions in the design of the vehicle–grid-integrated microgrid energy management system, including energy optimization, data communication, etc. Through the predicted data of photovoltaic power generation, wind power generation, and main grid interaction, under the condition of meeting the multi-objective optimization of minimizing power generation cost, equipment cost, environmental pollution cost, and EV-related costs, it can simulate the output power of the battery energy storage system and diesel generator after rolling optimization in different time periods and different situations to meet the power supply needs of the vehicle–grid-integrated microgrid according to the load side. During periods of high renewable generation, surplus power is stored in the BESS; during peak load periods, the BESS discharges to supplement the diesel generator, reducing grid dependency. These simulation results serve as the baseline for the hardware-in-the-loop validation presented in Section 5.
Figure 13. Simulated operating power waveforms of each unit in the VGIM.

5. Embedded Deployment and Hardware-in-the-Loop Validation

5.1. Simulation Testing of the Microgrid Model

After constructing the vehicle–grid-integrated microgrid model in Simulink, the simulation design was validated through hardware-in-the-loop testing. Once a TCP/IP communication connection was established between Simulink and the RK3588 main control board, the microgrid simulation model began running, with real-time data on photovoltaic power generation, wind power generation, battery energy storage, diesel generator output, grid status, and load values being collected and transmitted via the TCP/IP module to the main control board. Using the received power values, the VGIM energy management system performed real-time optimization following the scheduling model (Figure 14). Additionally, the data visualization interface designed on Node-RED enabled real-time monitoring and display of the output from each unit, as shown in Figure 15.
Figure 14. Energy management system optimization testing.
Figure 15. Node-RED visualization interface for VGIM energy management.
The RK3588-based system completes the entire data processing and optimization cycle in approximately 60 s. As shown in Figure 16 and Table 1, the proposed improved MOPSO algorithm achieves a daily operating cost of 1.80 CNY after 78 iterations, which is 49.7% lower than the rule-based control strategy (3.58 CNY/day) and 50.0% lower than the traditional PSO algorithm (3.60 CNY/day after 124 iterations). This 50% reduction confirms the superior economic performance of the proposed improved MOPSO algorithm under the same system configuration and load conditions.
Figure 16. Operating cost comparison. (a) Traditional PSO; (b) Improved MOPSO. The x-axis represents iteration number, and the y-axis represents daily operating cost in CNY/day.
Table 1. Performance comparison of different energy management strategies.

5.2. Embedded Platform Design

The RK3588 was selected for final deployment due to its high-performance multi-core ARM architecture, which accelerates MOPSO parallel iterations [31]. Its rich industrial interfaces (RS485, CAN, Gigabit Ethernet, 5G) and strong community support facilitate Modbus-based smart meter and MQTT-based HMI integration, ensuring a smooth transition from HIL simulation to physical deployment. As shown in Figure 17, the scaled-down VGIM prototype comprises PV, wind, diesel, BESS, EV loads, and grid, with smart meters collecting data via RS485/Modbus communication. An isolated RS485 hub enables one-to-many Modbus connections. The HMI screen communicates via MQTT, providing a configurable interface for real-time monitoring and control.
Figure 17. Hardware block diagram of the VGIM energy management system.
The dispatch layer imposes real-time requirements, demanding that algorithms complete complex computations and generate optimized solutions within a short time frame. This requires a high-performance CPU with multi-core parallel architecture to ensure rapid MOPSO iterations. Based on this analysis, Table 2 presents key performance indicators of the ARM-based RK3588.
Table 2. RK3588 Performance Table.
When running a general optimization program, the RK3588 takes approximately 55 s in total. With its richer communication interfaces and higher-performance GPU, the RK3588 can provide comprehensive solutions for industrial IoT and multi-dimensional data visualization. Therefore, a vehicle–grid-integrated microgrid energy management system using the RK3588 as the core computing board in an embedded computing platform offers computational performance that better meets the requirements of the algorithm for data analysis and optimization processing.

5.3. Joint Debugging and Testing

A scaled-down VGIM prototype was developed on the RK3588 platform, integrating PV, WT, BESS, diesel generator, and EV loads. To validate the human–machine interface of the vehicle–grid-integrated microgrid energy management system and the actual hardware data acquisition, a hardware platform was constructed as shown in Figure 18. In this experiment, the RS485 interface of the main control board was connected to an RS485 hub, which in turn connected two smart meters to obtain real-time voltage and current measurements. The RK3588 main control board communicated with the smart meters in real time via Modbus, receiving corresponding data packets, extracting and converting them into voltage and current values, and finally calculating the corresponding power values, which were used to simulate the output of each unit. At the same time, the RK3588 main control board is equipped with an EM05-CE module (enabling M2M and IoT communication), allowing MQTT communication with the HMI (human–machine interface) screen via this module.
Figure 18. Hardware platform.
Under normal operating conditions, the output of each unit can be monitored properly through the upper computer. As shown in Figure 19, in the parameter configuration interface, the lower limit of the diesel generator output power is set to 1 kW, and the upper limit is 10 kW; for the energy storage system, the lower limit is set to 5 kW and the upper limit is 10 kW. The human–machine interface (HMI) allows for real-time monitoring of each unit and enables start–stop control commands.
Figure 19. Diesel generator and battery parameter configuration.
Based on the parameter configuration of the DE and BESS, the power distribution of each unit in the VGIM system under two operating conditions (DE on/off) was measured and summarized in Table 3, where the positive grid power indicates power fed into the main grid and the negative value indicates power drawn from the grid.
Table 3. Power distribution under diesel generator on/off conditions.
Table 3 presents the power distribution under two operating conditions. When the diesel generator is operating, it supplies 6.33 kW. Together with the PV (2.58 kW), wind (1.93 kW), and ESS (4.22 kW), the system meets the load demand of 14.11 kW while feeding 2.05 kW into the grid. After the diesel generator is switched off via the HMI control, the ESS output increases to 9.84 kW to compensate for the power shortage, and the system draws 0.24 kW from the grid to maintain power balance. This quantitative comparison demonstrates the effectiveness of the proposed energy management system in maintaining power balance under unit start–stop scenarios. At the same time, the battery SOC was maintained at 69.53% during diesel generator operation.
When the diesel generator is shut down, the corresponding switch button on the HMI screen is set to the “OFF” state, and the indicator light turns red (Figure 20). Therefore, the VGIM energy management system can realize on-site acquisition of actual hardware data and execution of start/stop control commands through the HMI.
Figure 20. Diesel generator shut down state on HMI.

6. Conclusions

This paper presented a systematic co-design methodology for energy management systems in vehicle–grid-integrated microgrids, covering the entire development process from HIL simulation to embedded deployment. The proposed approach addresses key challenges in deploying multi-objective optimization algorithms on embedded platforms through deployability analysis, hybrid code generation, real-time task restructuring, and consistency validation.
The main contributions and findings of this work are summarized as follows:
  • Excellent real-time performance: The RK3588-based embedded system can complete a single optimization iteration within 60 s, which is far less than the 15 min industrial dispatch interval requirement, and the Modbus communication protocol ensures the real-time nature and reliability of on-site data acquisition and equipment control.
  • Deployment Consistency: The consistency between HIL simulation and physical hardware deployment was validated. This confirms that the proposed co-design method successfully preserves algorithm functionality and performance during the transition from simulation to embedded execution.
  • Industrial Applicability: The modular hardware architecture and standardized communication protocols (Modbus, MQTT) enable easy adaptation to different microgrid scales and configurations. The Node-RED visualization interface provides intuitive real-time monitoring and control, facilitating practical deployment in industrial scenarios.
Future research will focus on three specific directions:
i.
Extending the proposed co-design method to the coordinated operation of multi-VGIM systems for large-scale industrial applications;
ii.
Integrating LSTM-based renewable energy output forecasting into the improved MOPSO algorithm to further improve the dispatch accuracy;
iii.
Conducting long-term field trials in actual industrial microgrid scenarios to verify the long-term stability and adaptability of the VGIM energy management system.
This study provides a feasible technical solution and engineering reference for the industrialization and reliable deployment of VGIM systems in actual industrial scenarios and lays a theoretical and experimental foundation for the deep integration of transportation and power grids.

Author Contributions

Conceptualization, Y.C.; Methodology, Y.C. and T.K.; Software and Validation, Y.C.; Resources, S.H. and T.K.; Writing—Original Draft, Y.C.; Writing—Review and Editing, Y.C. and S.H.; Visualization, Y.C.; Supervision, S.H.; Project Administration, S.H.; Funding Acquisition, S.H. All authors have read and agreed to the published version of the manuscript.

Funding

This research received no external funding.

Data Availability Statement

The original data presented in this study are openly available in Figshare.

Conflicts of Interest

The authors declare no conflicts of interest.

References

  1. Rehman, A.U.; Lu, J.; Du, B.; Bai, F.; Sanjari, M.J.; Hossain, M.A. Vehicle-to-grid technology for load balancing and energy management: A comprehensive review of technical, economic and environmental perspectives. Appl. Energy 2026, 402, 126974. [Google Scholar] [CrossRef] [Scilit]
  2. Alrubaie, A.J.; Salem, M.; Swadi, M.; Yahya, K.; Kamarol, M.; Al Dawsari, S. Electric vehicle integration in microgrid: Hierarchical control, emerging technologies, and future directions. Energy Rep. 2025, 14, 5590–5615. [Google Scholar] [CrossRef] [Scilit]
  3. Arévalo, P.; Ochoa-Correa, D.; Villa-Ávila, E. Systematic review of the effective integration of storage systems and electric vehicles in microgrid networks: Innovative approaches for energy management. Vehicles 2024, 6, 2075–2105. [Google Scholar] [CrossRef] [Scilit]
  4. Cavus, M.; Ayan, H.; Bell, M.; Dissanayake, D. Advances in Energy Storage, AI Optimisation, and Cybersecurity for Electric Vehicle Grid Integration. Energies 2025, 18, 4599. [Google Scholar] [CrossRef] [Scilit]
  5. Li, H.; Zhang, Y.; Wang, X. Real-time energy scheduling for V2G-integrated microgrids using deep reinforcement learning. IEEE Trans. Smart Grid 2025, 16, 2100–2115. [Google Scholar]
  6. Wan, Y.; Wang, Y.; Yu, H.; Zhang, H.; Chen, Z. Smart Mobile Power Bank: A Novel Grid-Friendly Mobile Microgrid for Power Grid with High Penetration of Renewable Vehicles. IEEE Trans. Transp. Electrif. 2025, 11, 2287–2298. [Google Scholar] [CrossRef] [Scilit]
  7. Wan, Y.; Wang, N.; Du, E.; Liu, X.; Wang, Y.; Chen, Z.; Kang, C. Coordinated operation of alternative fuel vehicle-integrated microgrid in a coupled power-transportation network: A Stackelberg–Nash game framework. Appl. Energy 2025, 401, 126800. [Google Scholar] [CrossRef] [Scilit]
  8. Liu, G.; Ferrari, M.F.; Ollis, T.B.; Sundararajan, A.; Olama, M.; Chen, Y. Distributed Energy Management for Networked Microgrids with Hardware-in-the-Loop Validation. Energies 2023, 16, 3014. [Google Scholar] [CrossRef] [Scilit]
  9. Upputuri, R.P.; Subudhi, B. A Comprehensive Review and Performance Evaluation of Bidirectional Charger Topologies for V2G/G2V Operations in EV Applications. IEEE Trans. Transp. Electrif. 2024, 10, 583–595. [Google Scholar] [CrossRef] [Scilit]
  10. Reiz, C.; Leite, J.B. Hardware-In-the-Loop Simulation to Test Advanced Automation Devices in Power Distribution Networks. IEEE Trans. Power Deliv. 2021, 36, 2194–2203. [Google Scholar] [CrossRef] [Scilit]
  11. Chamola, V.; Sancheti, A.; Chakravarty, S.; Kumar, N.; Guizani, M. An IoT and Edge Computing Based Framework for Charge Scheduling and EV Selection in V2G Systems. IEEE Trans. Veh. Technol. 2020, 69, 10569–10580. [Google Scholar] [CrossRef] [Scilit]
  12. Leandro, P.G.M.; Salvadori, F.; De Almeida Carlos, G.A. Modeling analysis and characterization of a distributed generation system based on Microgrid for Hardware-in-the-loop (HIL) Applications. In Proceedings of the 2022 IEEE Energy Conversion Congress and Exposition (ECCE), Detroit, MI, USA, 9–13 October 2022; pp. 1–6. [Google Scholar] [CrossRef] [Scilit]
  13. Caldeira, C.A.; de Almeida, A.D.D.; Schlickmann, H.R.; Gehrke, C.S.; Salvadori, F. Impact analysis of the BESS insertion in electric grid using real-time simulation. In Proceedings of the 2019 IEEE PES Innovative Smart Grid Technologies Conference—Latin America (ISGT Latin America), Gramado, Brazil, 15–18 September 2019; pp. 1–6. [Google Scholar] [CrossRef] [Scilit]
  14. Khooban, M.-H.; Niknam, T.; Shasadeghi, M.; Dragicevic, T.; Blaabjerg, F. Load frequency control in microgrids based on a stochastic noninteger controller. IEEE Trans. Sustain. Energy 2018, 9, 853–861. [Google Scholar] [CrossRef] [Scilit]
  15. Khooban, M.H.; Dragicevic, T.; Blaabjerg, F.; Delimar, M. Shipboard microgrids: A novel approach to load frequency control. IEEE Trans. Sustain. Energy 2018, 9, 843–852. [Google Scholar] [CrossRef] [Scilit]
  16. Farrokhabadi, M.; König, S.; Cañizares, C.A.; Bhattacharya, K.; Leibfried, T. Battery Energy Storage System Models for Microgrid Stability Analysis and Dynamic Simulation. IEEE Trans. Power Syst. 2018, 33, 2301–2312. [Google Scholar] [CrossRef] [Scilit]
  17. Wang, Y.; Yi, A.; Rousis, O.; Strbac, G. On microgrids and resilience: A comprehensive review on modeling and operational strategies. Renew. Sustain. Energy Rev. 2020, 134, 110313. [Google Scholar] [CrossRef] [Scilit]
  18. Chen, B.; Wang, J.; Lu, X.; Chen, C.; Zhao, S. Networked Microgrids for Grid Resilience, Robustness, and Efficiency: A Review. IEEE Trans. Smart Grid 2021, 12, 18–32. [Google Scholar] [CrossRef] [Scilit]
  19. Zou, H.; Mao, S.; Wang, Y.; Zhang, F.; Chen, X.; Cheng, L. A Survey of Energy Management in Interconnected Multi-Microgrids. IEEE Access 2019, 7, 72158–72169. [Google Scholar] [CrossRef] [Scilit]
  20. Xu, Q.; Zhao, T.; Xu, Y.; Xu, Z.; Wang, P.; Blaabjerg, F. A Distributed and Robust Energy Management System for Networked Hybrid AC/DC Microgrids. IEEE Trans. Smart Grid 2020, 11, 3496–3508. [Google Scholar] [CrossRef] [Scilit]
  21. Mohseni, S.; Pishvaee, M.; Dashti, R. Privacy-preserving energy trading management in networked microgrids via data-driven robust optimization assisted by machine learning. Sustain. Energy Grids Netw. 2023, 34, 101011. [Google Scholar] [CrossRef] [Scilit]
  22. Bendib, B.; Belmili, H.; Krim, F. A survey of the most used MPPT methods: Conventional and advanced algorithms applied for photovoltaic systems. Renew. Sustain. Energy Rev. 2015, 45, 637–648. [Google Scholar] [CrossRef] [Scilit]
  23. Spavieri, G.; Cavalca, D.L.; Fernandes, R.A.S.; Lage, G.G. An adaptive individual inertia weight based on best, worst and individual particle performances for the PSO algorithm. In Artificial Intelligence and Soft Computing. ICAISC 2018; Lecture Notes in Artificial Intelligence; Springer: Cham, Switzerland, 2018; Volume 10841, pp. 536–547. [Google Scholar] [CrossRef] [Scilit]
  24. Coello Coello, C.A.; Toscano Pulido, G.; Lechuga, M.S. MOPSO: A proposal for multiple objective particle swarm optimization. In Proceedings of the 2002 Congress on Evolutionary Computation, Honolulu, HI, USA, 12–17 May 2002; Volume 2, pp. 1051–1056. [Google Scholar]
  25. Vijaya Chandrakala, K.R.M.; Balamurugan, S.; Lakshmi, K. PSO Optimized Two-Degree-of-Freedom PID Controller for AGC of Multi-Area Interconnected Hydrothermal Power System. Int. J. Electr. Power Energy Syst. 2014, 61, 297–306. [Google Scholar]
  26. Wu, Y.; Xiao, H.; Xu, H.; Chen, H.; Zhang, Y.; Yuan, Q. Robust MEMS temperature control platform with GA PSO-fuzzy PID control. IEEE Sens. J. 2025, 25, 30570–30578. [Google Scholar] [CrossRef] [Scilit]
  27. Mastrototaro, A.; Olsson, J.; Alenlöv, J. Fast and numerically stable particle-based online additive smoothing: The AdaSmooth algorithm. J. Am. Stat. Assoc. 2024, 119, 356–367. [Google Scholar] [CrossRef] [Scilit]
  28. Mustapha, N.M.Z.A.; Ahmad, M.A. Normalized SPSA for Hammerstein model identification of twin rotor and electro-mechanical positioning systems. Int. J. Cogn. Comput. Eng. 2025, 6, 552–568. [Google Scholar] [CrossRef] [Scilit]
  29. Mohd Ikhmil Fadzrizan, M.H.; Ahmad, M.A.; Jui, J.J. PID tuning method using chaotic safe experimentation dynamics algorithm for elastic joint manipulator. J. Eur. Syst. Autom. 2021, 54, 693–698. [Google Scholar]
  30. Raspberry Pi Ltd. Raspberry Pi Compute Module 4 Product Brief. 2020. Available online: https://datasheets.raspberrypi.com/cm4/cm4-product-brief.pdf (accessed on 10 March 2026).
  31. Rockchip Electronics Co., Ltd. RK3588 Datasheet, Version 1.0. 2022. Available online: https://rockchips.net/wp-content/uploads/2025/03/Rockchip-RK3588-Datasheet-V1.9-20241212.pdf (accessed on 10 March 2025).
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content.

Article Metrics

Citations

Article Access Statistics

Multiple requests from the same IP address are counted as one view.