The parameters of the inverter are in this screenshot
A few things to note:
- The voltage source is just 10V because with a short circuit, that's all I need to drive a large current. A dc voltage is specified by making the ac peak 0 and adding a dc offset. The reason is that the peak automatically means an ac signal of frequency specified in the next column.
- The switches S1 to S6 are shown to have control signals as s1gate to s6gate. However, when the parameter file is initialized, these values are arbitrary and may even be the same. The control signals can't be the same! The problem is not from the simulator point of view but for the control code. Each switch needs a unique control tag. So change as needed.
Before continuing, these are the main inputs the simulator wants from the user:
A quick description:
- Execute circuit_solver.py. Make sure all the simulator files and .csv files are in the same folder.
- It asks you for the circuit layout which is a csv file. In this case it is standalone_inv.csv but the .csv is dropped in the input as that is added automatically.
- If the network layout has just been created, the simulator will read all the components in the layout and will insert them into the parameter file (shown above) with default parameters. These default parameters are almost definitely not the ones you would like to use, so open the standalone_inv_params.csv file, make changes, save it and close it.
- It prints out the parameters for one last confirmation.
- Next it asks for control files. Now, these need not be control files but can also be signal processing or any processing file like heat/loss calculation etc. So you do not need to have controlled components to have a control file. Add these control files.
- Again for each control file the simulator creates a default "descriptor" file as a .csv file. More on this later. The default will have one input (usually a meter). If you would like to use another input or have more inputs, change or copy that row and make changes. There will be one output which will be a controlled entity if there is one. There is one time event. And there is a static variable. And there is one variable storage. More on these later.
- It asks you to make sure control code is ready in the control files.
- Then outputs the manner in which the output is saved in the data file. Here the first column is always the time so the other columns start from 2 onwards.
- Then the next columns will be the stored variables. More on these later.
- Next inputs are the time step (1 microsec), duration of simulation run (0.1 sec), storage time step (1 microsec but can be higher) and the name of the output data file.
- On completion tells you how long the simulation took to run.
Now about the descriptor file currcont_3ph_desc.csv
- In this case, the inputs are the three ammeter outputs. The next column are the names of the variables by which these ammeter outputs will be available in the control code. The simulator makes these meter outputs available with these variable names so you can directly use in the control code. Will be shown.
- The outputs are shown next. The first three columns are from the parameter file. The next two are specific to the control file. The desired variable name will be assigned to the control outputs at the end so the user can assign any value to the control outputs and they will be passed on. And finally an initial output.
- The next set are the static variables, these are the variables whose values need to be stored from one iteration to the next. Any variable not declared here but used in the control function is a local variable to that control function. It will exist only in that particular iteration and will cease to exist when the control is executed. So for any values that need to be stored between iterations like itegrals in PI controllers etc, use static variables. In general unless sure that you don't need to store a variable, declare it as a static variable.
- Two time events are generated - t1, and tcarr. t1 is the time step of the control algorithm. tcarr is the time step of generation of the carrier wave and comparison with the modulation to generate the control signals.
- The last are the control_signals 1 to 4. These are control signals that can be plotted for debugging like modulation signals, integrals, error signals etc. A note - these control signals are common to all control functions in a simulation. So declaring the same control signal for two control functions is a violation. Also, this is a way to share control signals between control functions. Similar to routing signals between blocks.
Finally the control code:
The control code shows the closed loop control using a PI controller with d-q transformation. Take a moment to find out which variables have not been declared static and the reason why. For that matter, all the variables used can be declared static. Python does not need variables to be declared and variables come into existence when they are used for the first time. So for example dt_sample=100.0e-6 is when dt_sample is declared.
A few results. First one is the current waveforms. The next one is the tracking performance. The reference for d is 10 and q is 0. From waveforms, the actual currents are begin to track the references.
Anyway, that's all for now folks. A long post after a long time.