**7. Model in the Loop Simulation (MILS)**

This chapter proposes an entire virtual environment for the inverter power supply design to optimize and test the embedded software parameters. This environment is based on the Model Based Design method. The MATLAB and Simulink (MathWorks web site) environment is used for building such a virtual system which is divided in two main parts, the analog part (controlled part) and the digital (control) part which are described as follows. The analog part consists of electrical circuits of DC/DC converter and DC/AC inverter. The second part is the digital part (controller part) consisting of the microcontroller and the embedded software. The embedded software has two tasks which are the generation of the pulses to control the operations of the electrical circuits and to implement the control algorithm that is necessary for regulating the output voltage against any disturbance. The entire virtual environment of the inverter power supply is described below.

The topology of the inverter power supply is DC-DC-AC. MILS of the inverter process is done in two stages. The first stage is the DC/DC converter and in this stage, the input DC voltage is converted to higher level DC output. This new DC output acts as an input of the second stage which is the DC/AC inverter. SH 7047 was used as a digital controller to control the generation of the PWM pulses and control the inverter power supply operation. Both the DC/DC and DC/AC stages are controlled individually, as shown in Figure 16.
