## 3 Direct CSI SVM Modulator
### Major Simulation Blocks Based on Top-Level Drawing  
The modulator was implemented in MATLAB/Simulink 2023b with PLECS Blockset 4.9 (see Figure 6). Each of the main blocks shown here has multiple sub-blocks. The CSI parameters stay the same as those used in the previous approach. The top-down building block graphic below is meant to improve understanding of how to combine the components. The simulation model should be built from the bottom up so that every block operates as an independent entity in Simulink and PLECS. 1. Phase Generation for Standalone (Off-Grid RL) Operation:  
Figure 7 shows the phase generation and duty-cycle calculation block for the standalone CSI modulator. The integrator (with an initial phase of \(-\pi/6\) and reset at \(11\pi/6\)) generates the fundamental phase angle \((\theta)\) used to derive sinusoidal reference signals. Below this, the block implements Equations (2) and (3) to compute the duty cycles \((d_{(ac)},d_{(ab)},d_{(aa)})\) for Sector 1's base vectors (**ab**, **ac**, **aa**). Key operations include:  
* Trigonometric mapping: The reference phase \((\theta)\) is processed via \(sin(\pi/6\ \pm\ \theta)\) terms to determine vector weights. * Modulation Index Scaling: The output (\(m\)) adjusts the duty cycle to meet the desired current amplitude (Equation (4)). Figure 5: (a) Space vectors of CSI and sequences of FSM; (b) basic space vectors with different switch combinations. Asterisks denote reference values. This modular block is the fundamental component of the direct CSI SVM modulator. It allows for real-time generation of the reference current with a configurable modulation index and frequency. 2. Modulation index and the required frequency as the inputs. 3. Basic vector duty calculation in Sector 1:  
Figure 7 illustrates this process, utilizing Equations (1)-(3). This block calculates the duty cycles for the CSI's switching states based on the desired output current vector. 4. The Simulink Block Complex-to-Magnitude Angle:  
This block is used to find the amplitude and phase of the CSI from the complex function Equations (5) and (6) above, implemented in step 3 as seen in Figure 6. Determining the total current supplied by the inverter requires knowledge of the amplitude and phase angle of the current vector. Therefore, this block assists in calculating these values. Figure 6: Simulink main block and its internal subblocks. Figure 7: Phase-angle generator and duty-cycle calculation for Sector 1. The integrator (initialized at \(-\pi/6\)) outputs the phase (\(\theta\)), while the block on the right computes vector duties \((d_{(ab)},d_{(ac)},d_{(aa)})\) via Equations (2) and (3). Sector identification block, sector ID:  
Figure 8 shows Simulink building blocks, which are fundamental elements of model-based design and simulation. As shown in Figure A1 in Appendix A and Figure 6, these blocks are inside the top-level Simulink block. The sector identification block in Figure 8 is essential for identifying the proper switching patterns necessary to achieve the desired output current vector for a CSI. This identification provides the necessary angles to calculate duty cycles of the inverter switches required for successful modulation. Figure 10 illustrates the PLECS Blockset main block and its internal subblocks integrated within MATLAB/Simulink (see Figure A1), providing a detailed simulation model for CSI modulation. The image emphasizes a modular design of the simulation in which subblocks generate modulation signals, manage switching states, and control CSI general operation. Using PLECS together with MATLAB/Simulink makes the seamless simulation of control algorithms and power electronics circuits possible, enabling the analysis of SVM approaches. The model confirms correct switching patterns that reduce harmonic distortion and improve output current quality by extracting modulation signals from the reference space vector. 7.