This will be a lengthy one so bear with me. I am aiming to describe the following system using differential equations, and then translate that to state-space so that I can design a control scheme that obeys certain specifications mentioned in this question.
The system represents a possible(although simplified) DC microgrid installed in a home. It features an AC source from a standard AC outlet, and a battery used for storage. All the resistors, capacitors and inductors are either parts contained in the converters or are parasitic line impedances. The aim of the system is keep the DC bus voltages at a fixed, predetermined level( \$V_2, V_3, V_4\$). DC loads such as laptops, mobile phones etc. can be hooked up at the point \$V_3\$. Ideally, during nighttime there are no loads and the electricity from the AC grid is cheaper than during daytime, so the aim is to store that cheap energy into the batteries during the night. During the day all energy is to be drawn from the battery. However if there is a larger demand for energy(the bus voltages begin to drop) we can use both the battery and the ac in parallel to provide the needed energy. The AC-DC converter is a simple rectifier, and the DC-DC converter at node \$V_1\$ is a simple buck converter. The dc-dc converter at the battery end is a two way dc-dc converter as shown in the following schematic:
You can see that the inductor \$L_4\$ and the capacitor \$C_3\$ are actually parts of the converter but were included in the above microgrid scheme. This was, however possible only if certain transistors in the dc dc converter were constantly on or off, and one of them was used as a switching device(and thus the two way dc-dc behaved as a buck, but more on this later). The inductor \$L_1\$ and the capacitor \$C_1\$ are also elements of the buck converter on the left part of the schematic. \$R_1\$ and \$R_2\$ were set to zero for the sake of simplicity. This way, I can model the dynamics of the whole system(including the converters).
\$\textbf{STATE-SPACE}\$
The state variables are as follows: \$V_2,V_3,V_4, I_{12},I_{23},I_{34},I_{45}\$. \$V_1\$ and \$V_5\$ are to be considered as inputs to the system. The differential equations describing the system are as follows:
\$ C_1 \frac{dV_2}{dt}=I_{12}-I_{23}\$
\$ C_2 \frac{dV_3}{dt}=I_{23}-I_{34}-I_{LOAD}\$
\$ C_3 \frac{dV_4}{dt}=I_{34}-I_{45}\$
\$ V_1-V_2=I_{12}R_1+L_1\frac{dI_{12}}{dt}\$
\$ V_2-V_3=I_{23}R_2+L_2\frac{dI_{23}}{dt}\$
\$ V_3-V_4=I_{34}R_3+L_3\frac{dI_{34}}{dt}\$
\$ V_4-V_5=I_{45}R_4+L_4\frac{dI_{45}}{dt}\$
We can write the previous set of equations using matrices:
Since the dc-dc converters feature some sort of switching devices, they both make this system highly nonlinear. Using some sort of state space averaging we get that the mean value of \$V_1\$ is \$D_1 V_{in}\$, where \$D_1\$ is the duty-cycle of the first converter. We can see that from the following schematic:
Supposing that the converter on the right side operates as a buck converter(Q1 constantly ON, Q2 always off, Q4 always OFF, and Q3 is used as a switching device) we get that the mean value of \$V_5\$ is \$D_5 V_{batt}\$. We can see that from the following schematic:
We can use the previously mentioned mean values of V1 and V5 if we want to apply state space averaging and use those mean values as inputs in the input matrix in the state space equation. The load current \$I_{load}\$ is also to be considered as one of the systems inputs. Now what we have done is approximate the nonlinear circuit with a linear one. However I run into problems here when the right hand dc-dc converter operates as a buck converter but this time the voltage of V4 has risen and we are charging the battery (energy flow from left to right). The system has now a completely different topology(Q1-control transistor, Q2 always OFF, Q3 constantly ON, Q4 off). We can see the aforementioned structure in better detail in the schematic below:
Here we have two nonlinear devices, the diode and the transistor between the capacitor and the inductor. What should I do to describe the dynamics of this system? Also, I run into similar problem when the two way dc-dc converter operates as a Boost converter. Any suggestions, literature will be welcome.