Adjusting the voltage level is essential for connecting the PV panel to the DC bus, as PV panels typically operate at voltage levels around 30 V. Because the grid-forming converter of the platform is not galvanically separated from the electric grid, it is needed to galvanically separate the PV panel from the DC bus, which is done by using a flyback converter. With this, the PV panels can be grounded, which is needed in practice. The maximum energy production from the PV panels is accomplished using the MPPT algorithm, because they are voltage-controlled current sources. This algorithm changes the PV panel voltage, which is changed by using the current controller to achieve the maximum PV panel power production. Additionally, a supervisory control algorithm is employed to adapt the settings of the MPPT algorithm and the current controller based on the microgrid’s state, thereby ensuring compliance with safety measures.
The control algorithm can be easily applied to large-scale systems with no modification, wherein it only requires changes to the parameters in the configuration file of the controllers and protection system. However, hardware changes will be necessary if higher-power PV panels or batteries are used, particularly in the power switches.
The microgrid is connected to the centralized utility, an AC grid, using a grid-forming converter. This converter is a one-phase converter, which transfers energy from the DC bus to the AC network. The main control algorithm consists of the voltage controller, which maintains the accumulated energy in the capacitors connected to the DC bus. In this way, depending on the voltage value of the DC bus, the controller will generate pulses to give energy to the AC grid or to obtain energy from the AC grid. For this control algorithm to work, it needs to measure the voltage of the AC grid to generate the sine current in phase with the voltage. Like the control algorithm of the PV panel and DCDC converters of the batteries, this control algorithm also has a supervision control algorithm for changing the configuration of the subordinate algorithm and satisfying the safety measures.
3.1. Flyback Converter
The more advanced version of the flyback converter, which has the additional components, is shown in
Figure 3. Its parameters are given in
Table 1. To reduce the voltage stress of the MOSFET
when switched off, an additional MOSFET is used with the capacitor
to discharge the magnetic energy of the flyback transformer
. This accumulated energy in the capacitor
is transferred back to the secondary circuit of the flyback transformer when the MOSFET
is turned off.
The input flyback transformer has capacitors and to obtain a continuous PV panel current. The current sensor with the hall effect is placed between these two capacitors. A resistor divider and an operation amplifier with optoisolators measure the panel’s voltage. The microcontroller mass is placed on the minus side of the DC bus using these galvanically separated sensors, while the minus side of the PV panel can be grounded. These separations are also made in the energy circuit using a flyback transformer. Its parameters are the primary leakage inductance , the secondary leakage inductance , and the magnetization inductance .
By using two capacitors, and , and two diodes, and , on the secondary of the flyback transformer, the output voltage is increased by a factor of two. The capacitor is placed to decrease the output voltage ripple in parallel with them. The flyback converter’s output will be maintained with a voltage of around 400 V. The flyback converter output is connected to the microgrid’s DC bus.
The PV panel is the voltage-controlled current source, which can be modeled like an ideal single diode model, a model which takes into account the resistance of electrodes and the contact resistance with output resistance (the real voltage source), and a model which takes into account the leakage current of the PN junction with the internal parallel resistance. The PV model, which is modeled like the ideal single diode model, uses the following equation:
where
Iph is the photocurrent of the PV cell,
is the reverse saturation diode current,
k is the Boltzmann’s constant (
J
),
q is the electron’s charge (
C),
T is the PV cell temperature [K], and
n is the ideality PV cell factor.
Using the averaging technique [
16], the mathematical model of the dynamics of the flyback converter is obtained for two-time subintervals. In the first subinterval, the MOSFET transistor
is in the on state, while
is in the off state. The flyback input current flows through the input resistor
and the flyback transformer primary winding
. The input capacitor
is discharging, and the input current is increasing because of an increase in the voltage difference between the input capacitor and the PV panel. The flyback dynamics are described with the following equations:
and
In the second subinterval, the MOSFET switch
is in the off state, and the
is in the on state. The current through the sensor is decreasing because the input capacitor’s voltage is increasing, and the voltage difference between the input voltage and input capacitor is lowering. The magnetic current is decreasing, and this energy is transferred to the DC bus. The following equations describe the flyback dynamics in this subinterval:
The current trough sensor, which the current controller controls, is calculated by using
Equations (
3) and (
5) describe the magnetic energy dynamics, while Equations (
2) and (
4) describe the electrostatic potential energy dynamics. By using the average integral for interval T (PWM period) and integrating Equations (
2)–(
5), the average model is derived:
The nonlinear model of the flyback can be linearized near the working point. The linearization of these equations within the working point gives
The control loop of the flyback DCDC converter is shown in
Figure 4. In this figure, it can be seen that to control the panel’s current, the current controller changes the voltage on the PV panel. The voltage change is done by changing the duty cycle of the MOSFETs
and
.
The maximum power point tracking (MPPT) algorithm called “Incremental Conductance” [
17] is employed to optimize the output of the PV panel, thus ensuring it operates at its peak power output. This algorithm dynamically adjusts the reference current
of the current controller
while monitoring the voltage
of the PV panel. The panel’s power is easily calculated by knowing its voltage and current. Through iterative adjustments, the algorithm continuously refines the operating point of the panel until it identifies the maximum power point. This algorithm works like any other optimization algorithm. The function that is minimized, but in this case maximized, is the power of the PV panel. The optimization variable is only the panel’s voltage, because the panel’s current directly depends on the panel’s voltage, which simplifies the problem to a one-dimensional optimization task.
The MPPT algorithm uses the first-order condition for optimality:
By arranging the above Equation (
11), the equation which must be satisfied at the maximum power point of the PV panel can be derived, which is
Because this is a convex optimization problem, and the optimization function is 1D optimization, it only needs to be known where the PV panel’s working point is: left or right of its maximum power point. When the working power point of the PV panel is positioned either to the left or to the right of the maximum power point, the different equations will be satisfied. Specifically, if the working power point is to the left of the maximum power point, Equation
will be satisfied. On the other hand, if the working power point is to the right of the maximum power point, Equation
will be satisfied. By knowing this, the algorithm can quickly know how to move the PV panel’s working point to reach its maximum power point.
The flyback converter’s current controller is achieved through the first-order transfer function
which is implemented using the IIR filter structure. The controller has the feature of programmable output saturation. The current controller’s transfer function is inverted due to the decrease in current with a higher duty cycle of the flyback’s PWM. This is because the upper transistor is switched on longer than the lower one (
Figure 3). The inverted function represents the PI controller with a gain of 0.07138 and an integral time constant of
s, thereby operating at a sample frequency of 50 kHz.
The MPPT algorithm has a sample time of 1 kHz because the solar temperature and irradiance of the PV panel have significant time dynamics constant. This algorithm changes the reference value of the current controller executed in the interrupt routine with a frequency of 50 kHz.
Two inverted PWM pulses are required to control the MOSFETs in
Figure 3. The ePWM peripheral of the microcontroller generates a PWM signal frequency of 100 kHz because of the very small dynamics constant of the flyback DCDC converter. The hardware of the ePWM peripheral of the microcontroller ensures that the upper and lower MOSFETs are not turned on simultaneously. The dead-band generator submodule of the ePWM module assures this.
Because the degradation in the resolution of the duty cycle is increased by using the higher PWM frequency of the ePWM module, a high-resolution pulse width modulator (HRPWM) is used. It is used to increase the resolution of the PWM. This microcontroller’s microedge position step size (MEP) is typically around 150 ps, depending on the temperature and the microcontroller’s voltage. By using this submodule, the resolution of the PWM is increased by 7 bits for a PWM frequency of 100 kHz and the frequency of the microcontroller of 60 MHz.
To ensure safety, the ePWM peripheral is equipped with the Trip-Zone (TZ) submodule, along with the Digital Compare submodule and internal comparator of the microcontroller. These are set up to trigger a trip when the current from the PV panel reaches 10 A. However, due to current spikes at duty cycles under 1%, the Digital Compare submodule employs black window filtering to provide filtering.
The flyback and inverter of the platform are closely integrated with the manufacturer’s advanced control algorithm. However, a separation between them is necessary for additional components to be connected to the platform’s DC bus. In addition, it is essential to modify the inverter to make it a grid-forming converter, thus enabling the energy to flow in both directions to and from the network. To achieve this, appropriate changes must be made to the state diagram of the platform shown in
Figure 5.
The platform’s control algorithm includes a single state diagram, which is depicted in
Figure 5. The “Idle” state represents the state where no energy conversion occurs. To activate the platform, the
Start variable is used. The platform transitions from the “Idle” state to the “Network” state by setting this variable to a logical one.
The electric grid parameters are continuously monitored in a particular state of the platform. The state will persist until all the parameters are within the prescribed limits. The voltage and frequency of the electrical network are the parameters that are checked. From this platform state, it can be returned to the “Idle” state with the variable “Stop”. The network voltage must be in the range of 185 to 255 VRMS, while the frequency must be between −47 and 53 Hz to proceed to the next “PV” state.
In any of the states in the platform state diagram, the errors continuously checked are the network undervoltage, network overvoltage, the network underfrequency, and the network overfrequency. In contrast, the DC overvoltage and undervoltage are additionally checked in the states “DC”, “MPPT”, and “Active”.
In the “PV” state, the PV panel voltage is checked. If this voltage is above 15 V, the current controller is activated, which maintains the current of a panel at 0.1 p.u. It controls the voltage at the panel clamps to achieve the desired constant panel current.
Now, the platform is in the “DC” state, where it waits for the voltage of the DC bus to rise to 386 V, which is defined with the constant variable . As in the previous state, the network parameters are also continuously checked in this state. When the DC bus voltage rises over 386 V, the platform goes to the next state, the “MPPT” state, where the MPPT algorithm is activated. This state is used to delay transitioning to the next state, “Active”. This delay is introduced to make the lightweight transition from the current control of the PV panel to its maximum power control. The value of this delay is one second.
In the “Active” state, the current and voltage control of the inverter is activated. The cascade control system is used, where the current control of the network is the inner control loop, while the voltage control is the outer control loop. The current controller controls the amplitude of the current to the network, while the PLL maintains that the network current is in phase with the network voltage, which achieves the power factor of one. This current controller can be called the power controller because the network voltage has a constant amplitude value, which implies that the network power is proportional to the network current.
With the inner control loop, power to the network is controlled, while with the outer control loop, the reference to the power controller is defined by the voltage controller, i.e., the DC bus accumulated energy controller. This reference is defined depending on the accumulated energy in capacity. This controller maintains the constant energy in the DC bus by maintaining the DC bus voltage.
The “Reset” is used to reset the platform’s controllers, block pulses of the MOSFETS, and to check if any error occurred. The platform will go to the “Error” state for errors. In this state, the platform stays permanent; if there are no errors, the platform goes to the “Idle” state.
Two variables were introduced to store their states: “FlybackState”—used for the flyback converter—and “GridFormingState”—used for the grid-forming converter—to separate these two converters. The platform flyback converter’s modified supervisor control state diagram is shown on
Figure 6. From the state diagram shown in
Figure 6, it can be seen that it contains only states relevant to the flyback converter.
The flyback converter is in the “Idle” state in the nonactive state. It must go through two intermediate states from the “Idle” to the “Active” state. The first intermediate state is the “PV” state, where the voltage of the PV panel is checked. If the panel’s voltage is below the required minimum value , it will stay in this state forever; if the PV voltage is above the minimum required, then it will go to the “MPPT” state, where the MPPT algorithm will be enabled if the variable EnableMPPT is in a logical one. The delay of one second is realized to achieve a smooth turn-on of this algorithm. After that, it will go to the “Active” state, where energy is converted between the PV panel and the DC bus.
From any of these states, the flyback converter goes to the “Reset” state by setting the variable “Stop” or if DC bus overvoltage occurs, which is around 405 V. From the “Reset” state, it goes to the “Idle” state if there were no errors. Otherwise, it goes to the “Error” state. To go from the “Error” state to the “Idle” state, the “ErrorFlag” needs to be reset by using the variable Reset of the flyback converter.
The error of the flyback converter can arise from bus overvoltage and/or overcurrent of the PV panel. The overcurrent can occur only in the “Active” state when the current controller and PWM are active. The “Reset” state is used to reset the controller and MPPT algorithm variables and to prepare the flyback converter for the following turn-on process.
3.2. Grid-Forming Converter
The grid-forming converter is used to connect the DC bus to the network. It consists of MOSFETs, which are used for its power switches. The voltage and current at the DCAC bridge’s output are shaped according to the grid’s needs to achieve the desired power flow. These waveforms are realized using the PWM modulation of the DC bus voltage. The lower harmonics at the grid-forming converter’s output are accomplished using a low-pass filter between the connection of the grid-forming converter’s bridge and the network.
Figure 7 shows the electric schematic of the DCAC platform’s converter, which has detailed parameters provided in
Table 2. To achieve energy flow from the DC bus to the network, the voltage of the DC bus must be higher than the highest value of the network voltage. The converter is made of two step-down DCAC converters. They form sinusoids in the way that one is the positive part of the sinusoid, and the other is the negative part.
During the positive and negative values of the grid voltage, transistor pairs − and − are used, respectively. The PWM frequency of the nonsymmetric PWM of the MOSFETs of the converter used is 50 kHz. For generating this PWM, the ePWM 1 and ePWM 2 peripherals of the microcontroller are used.
The coils Lac,3, Lac,4 and the choke transformer suppress higher harmonics going to the grid and the noise caused by the parasitic capacitance between the ground and the supply line. The microcontroller controls a relay to disconnect the DCAC converter from the network physically.
The converter control algorithm generates current toward the network to regulate the voltage of the DC bus. Since the network voltage is fixed and determined by the network, the current serves as the means for the control algorithm to adjust the output power. This enables the microgrid to achieve a stationary power flow.
The control is realized by nested loops, shown in
Figure 8, where the inner control loop is the current control, while the upper control loop is the voltage control of the DC bus. The current controller
changes the PWM duty cycle to ensure that the current of the grid-forming converter follows its reference value. A phase lock loop (PLL) system [
18] generates the current controller’s reference value, which is in phase with the network voltage, thereby assuring that the power factor one has a sine shape. To regulate the power flow, the voltage controller
changes the amplitude of the current reference, which is achieved by the multiplication operation between the PLL and the voltage controller output.
Minor hardware modification is needed to use the same energy circuit of the platform’s inverter to become the grid-forming converter. It involves bridging two inductors,
and
, with copper wires, as shown in
Figure 7. With this modification, the energy circuit now looks like the standard H bridge.
This modification also demands a change in the PWM and the platform’s linearization algorithm, as shown in
Figure 8. The standard PWM signals of this bridge are realized using the ePWM modules of the DSP. By changing the duty cycle
of this PWM, the voltage’s average value
at the output of this bridge is changed, and it can be changed from the minus to plus value of the DC bus voltage.
The voltage waveform generated at the grid-forming converter’s output is
The average value of this waveform for the PWM period is
The current controller gives the value of the voltage drop on the filter
, from which the linearization block in
Figure 8 needs to calculate the duty cycle (
) that will produce it. This voltage drop is calculated using the following equation:
This voltage drop can only be changed in discreet times
2kTPWM. The equation used for this linearization block, shown in
Figure 8 for the standard H bridge and its PWM and given after arrangement (
18), is
With this hardware and software modification, bidirectional energy flow becomes achievable. The voltage controller’s lower output signal saturation can now be set from 0 p.u. to −0.95 p.u. The current controller is realized using the transfer function
which achieves a bandwidth of 1.2 kHz and a gain of more than 20 dB for frequencies up to 200 Hz and the following parameters: b0 = 0.29,
= −0.32,
= −0.262,
= 1.584,
= −0.698, and
= 0.114.
The current dynamics of the grid-forming converter are described by Equation
where
takes into account the network impedance and the grid-forming converter filter. This impedance of the platform is
where
zAC is the network impedance,
zf is the filter impedance, and
zi is the grid-forming converter impedance.
The modified state diagram of the grid-forming converter is shown in
Figure 9. States “PV” and “MPPT” are no longer in the state diagram of the grid-forming converter because these states are closely associated with the flyback converter. From the “Idle” state, where the gird forming converter is nonactive, it goes to the “Active” state through two intermediate states. These states are “Network” and “DC”. When the grid-forming converter is inactive, it is in the “Idle” state shown in
Figure 9. By setting variable
Start, the grid-forming converter goes to the “Network” state, where the network parameters are checked. This state will stay until the network parameters are within limits. If these parameters are within limits, the grid-forming converter will go to the next state, the “DC” state. In this state, the DC voltage value is continuously checked. The grid-forming converter goes to the “Active” state when its value exceeds the minimum start voltage
. In this state, the transfer of energy from the DC bus to the network and vice versa is achieved, i.e., a two-way transfer of energy.
The grid-forming converter goes through the “Reset” state using the Stop variable, where all states of the controllers are reset and initialized. If this variable causes the grid-forming converter to go to the “Reset” state, then it will automatically go to the “Idle” state; otherwise, if the “ErrorFlag” caused this, then it will go to the “Error” state and stay in it. To go to the “Idle” state, the user must reset the error by setting this flag to one. The network overcurrent, the network overvoltage, the network undervoltage, the network overfrequency, the network underfrequency, and the DC bus undervoltage can set this flag.
3.3. DCDC Converters and BESS
The DCDC battery converter shown in
Figure 10 manages the charging and discharging of the i-th battery. Its parameters are shown in
Table 3. It establishes the connection between the battery pack and the DC bus. The energy circuit of the DCDC battery converter comprises a buck DC converter combined with a boost DC converter (the DCDC buck–boost converter). The buck DC converter controls the flow of electrical energy from the DC bus to the batteries, thus regulating the charging current. Conversely, the boost DC converter regulates the battery discharge current.
Figure 10 illustrates that the buck DC converter is implemented using the upper MOSFET transistor and the lower MOSFET diode.
In contrast, the boost DC converter utilizes the lower MOSFET transistor and the upper MOSFET diode. The control algorithm is executed within a microprocessor that generates control signals based on sensor inputs (the voltage and current measuring). These control signals are then sent to the transistors to control the system behavior.
An inductor is connected in series with the battery pack to mitigate the current ripple caused by pulse width modulation (PWM) regulation and reduce the stress on the microprocessor generating the PWM signal. A higher inductance allows for a lower switching frequency of the transistors, thereby achieving the same result and enabling the use of a less powerful (less expensive) microprocessor. This type of DCDC converter can operate in the first and fourth quadrants, meaning that the voltage polarity remains constant (the DC bus voltage must always be higher than the battery pack voltage; otherwise, the converter is turned off), while the current can flow in both directions (charging and discharging the batteries). The supervisory algorithm continuously measures the voltage of the DC bus and the battery stack to ensure a constant voltage polarity. An appropriate relay exclusively connects these two energy circuits under the corresponding conditions (when the DC bus voltage is higher than the battery pack voltage; otherwise, the batteries are physically disconnected).
The current control loop of the DCDC buck–boost converter is depicted in
Figure 10. This control loop comprises a single control loop that incorporates a current regulator
(PI controller realized with CNTL_PI_IQ algorithm of Texas Instruments library) responsible for maintaining the desired reference value for the batteries’ charging or discharging current, depending on the specified polarity.
In addition to the current controller, the control loop includes a linearization element that addresses the nonlinear dynamics associated with the battery charging or discharging process. Consequently, measuring the voltages of the DC bus and the connected battery pack, together with the battery stack’s current, is necessary.
The linearization is made in the way that the controller is controlling the voltage drop across the inductor
Lb,i, as shown in
Figure 10. To obtain linear characteristics in the control loop, first, it is needed to obtain a relation regarding how the average voltage on the inductor
depends according to the duty cycle
ddcdc,i of the PWM, which is generated by the ePWM module of the microcontroller F28035. It is necessary to emphasize that the PWM dead time is not considered. The voltage waveform generated at the DCDC converter’s output is
The generated waveform average value on the inductance
for the PWM period of the DCDC converter is
The linearization block of the current control, shown in
Figure 3, is realized by Equation (
24). Its output represents the average voltage on the inductance
. The dynamics of the current are described by the following equation:
The controller’s limits need to be adjusted so that there is no problem with the wind-up effect, which, without this adjustment, will arise. To calculate these limits of the controller, first, it is necessary to define the area in which the physical values of the DC voltage
, duty cycle
, and battery
will be. These are
and
These upper nonequations need to be satisfied all the time. The limits for the average voltage drop are given, thus ensuring that a wind-up effect will not arise and solving these nonequations. The limit values of the current controller
are
for the lower voltage drop, while
defines the upper voltage drop.
Each battery block connected to the system has its dedicated current regulator responsible for maintaining the charge and discharge current. A superior algorithm governs this regulator, thereby determining the operating state of the converter based on the present electrical quantities and user commands. Additionally, the algorithm establishes the permissible operating conditions for the regulator, considering the voltages of the DC bus and batteries, and implements protective functions that trigger a transition to the “Error” state in the event of irregularities. When the converter is turned off, it is in the “Idle” state, while during battery charging or discharging, it operates in the “Active” state. The operation of the superior algorithm, represented by the DCDC battery converter, is described using a state diagram depicted in
Figure 11.
In the “Idle” state, the power circuit of the DCDC battery converter is isolated from the DC bus using a relay, the current regulator is deactivated, and impulses to the MOSFET transistors are blocked. Setting the variable Start of the DCDC converter to a logical one transitions the battery DCDC converter to the “DC” state, where it verifies the voltage of the DC bus. The current DC bus voltage is compared with predetermined values. The algorithm ensures that the relay connecting the battery DCDC converters to the DC bus is activated when the DC bus voltage exceeds 20% over the maximum voltage value of the batteries connected in the serial with a 100% SOC (state of charge). From the “DC” state, it is possible to return to the “Idle” state by setting the variable Stop of the DCDC converter to a logical one. If the conditions for correct operation are met, the “DC” state transitions to the “Active” state. In the “Active” state, the current regulator is active, thus maintaining the specified charging or discharging current for the batteries. The DC bus and battery voltages are continuously monitored, thereby ensuring that they remain within permissible limits. The converter enters the “Reset” state if any value exceeds the permissible limits. In this state, the battery current regulator is deactivated (transistor impulses are blocked, thus preventing conduction), and the relay connecting the DC bus and the DCDC battery converter is disconnected, thereby physically separating the energy circuits. Subsequently, from the “Reset1,2” state, after blocking the transistors and disconnecting the relay, the converter automatically transitions to the “Error” state. Manual error checking and resetting are required to reactivate the converter. Setting the variable Reset confirms that the error has been resolved, thus allowing the DCDC converter to return to the “Idle” state.