Simulation Parameters
Simulation Parameters : Tscreen, step size (dt)
In CASPOC, the setting of simulation parameter is very important for your simulation results. Most time users have to define some main parameters according to their simulation schematic, like screen width (Tscreen, simulation time), step size (dt) and numerical integration method (for circuit and block-diagram). For example, if you want to simulate a power electrics system with 50 Hz, you have to choose a small enough step size and a big enough screen length (one cycle 20ms) in order to observe the information you need. To get the simulation parameters, you can go to Simulation/Simulation Parameters or click the shortcut button to open the popup window.
Then in the popup window, we can see the following interface. In the left side, we can set up the screen width, step size, and the unit for simulation result as below. ‘Wait After Screen’ means the SCOPE will stop after the screen width time arrives. There is a check for the default.
As the previous tutorial, we know the screen width (Tscreen) stands for the time length of simulation results. If we set Tscreen =1 second and step size = 10us, that means the simulation results will be recorded every 10 us from 0 to 1 second. ‘Show each 1 timestep simulation results’ means the SCOPE will print the data according to each step size. If we change the setting to ‘Show each 3 timestep simulation results’, the simulation will still execute according the step size 10u but SCOPE will print the data every 3 step size as below.
If we disable the option ‘Wait After Screen’ and keep the screen width (Tscreen) 1 second (step 1), the simulation will continue next cycle (Tscreen=1 second) after the screen width arrives (step 2). The simulation won’t stop and will run cycle by cycle until you click ‘pauses the simulation’.
Numerical Integration Method Circuit
After we configure the main parameters, we also have to decide which numerical integration method to use in the current schematic. In Caspoc, there are two kinds of numerical integration methods. One is for circuit and the other is for block-diagram. For block-diagram, there is only Runge Kutta 4th order method.
For circuit, users can choose Euler, Trapezoidal and Gear. The third methods stand for Backward Euler, Trapezoidal Rule and Gear’s Backward Difference Formula. Notice that the trapezoidal rule is simply the sun of forward Euler and backward Euler.
The setting of numerical integration method will also be shown in the status bar of CASPOC by their own codes. They’re BE=Backward Euler, TR=Trapezoidal Rule, G2=Gear’s Backward Difference Formula, and RK4=Runge-Kutta 4th order. Each numerical integration method circuit will work with numerical integration method block-diagram in a system-level power electrics system. We will see a sample in this tutorial.
Thus, we will have the following expressions in the status bar according to which circuit numerical method we’re using:
- BE/RK4 = Backward Euler/ Runge-Kutta 4th order
- TR/RK4 = Trapezoidal Rule / Runge-Kutta 4th order
- G2/RK4 = Gear’s Backward Difference Formula / Runge-Kutta 4th order
Now we will build an LC circuit to see what the differences between three circuit numerical integration methods are.
Left-click one capacitor from Components/Circuit/RLC/C and release your mouse button (step 1). Left-click to put the capacitor on the workscreen (step 2). See a popup window of ‘Include Reference Label ‘Ground’ or ‘0’! Automatically Insert? ’ and click yes to insert a ground connection (step 3).
Make sure there is a ground connection on the capacitor (step 1). Left-click one inductor from Components/Circuit/RLC/L and release your mouse button (step 2). Before put the inductor on the workscreen, right-click one time to turn it from 90 to 180 degrees (step 3). After it’s turned, left-click to put it on the workscreen (step 4).
Left-click one voltage source from Components/Circuit/Sources/V and release your mouse button (step 1). Before put the voltage source on the workscreen, right-click three times to turn it to 90 degrees (step 2). After it’s turned, left-click to put it on the workscreen (step 3).
Then left-click the cathode of the voltage source (step 1) and drag a wire to the cathode of the capacitor (step 2). The same way to connect the inductor to the voltage source (step 3) and the capacitor (step 4).
Now the schematic is finished. Put one SCOPE to observe the simulation. Left-click the SCOPE component and release your mouse button (step 1) and then left-click the right side of the circuit. Enlarge the size of SCOPE (step 2) and connect the first input trace to the anode of the capacitor (step 3).
Right-click the SCOPE (step 1) and go Scale/Edit Scale Left (step2) to modify the scale setting. Change the Top to 30 and click ok.
Then go to simulation parameters (step 1) and configure the main parameters to Tscreen = 1 second and step size = 10 microseconds (10us) (step 2). Because we want to run the three numerical integration methods and compare the simulation results, later we won’t change any setting but only modify the numerical integration method and then re-execute the schematic. In the first simulation, we choose ‘Trapezoidal’ and click ok (step 3).
Click ‘Initializes and Starts the simulation’. And check if the result is similar to the following one: The voltage values are a periodic signal but with fixed amplitude.
Go to simulation parameters (step 1) and change the method to Gear (step 2).
Re-execute this simulation, you can see the simulation is similar to the previous one with Trapezoidal. But as time goes on, the amplitude will become smaller and smaller. You can also increase the screen width; the result will be more obvious.
Go to simulation parameters (step 1) and change the method to Euler (step 2).
Re-execute the schematic and observe the result.
Compare the three difference results, and them you will find how the three numerical integration methods solve the power electrics simulation according to their charactors.
In Caspoc, there is only one numerical integration method block-diagram: Runge-Kutta 4th order. Users don’t need to change it. It just gives an idea to users for a better understanding about numerical method if they need.
Algebraic Loop Solver
In the right side of simulation parameters, there is the option to enable ‘Algebraic Loop Solver’. Users have to enable this option only when you’re using the component ALS from Components/Library/Control/Controllers/AlgebraicLoopSolver (step 1).
To use ALS, you can refer to the following configuration (step 2) and then adjust the parameters (like VNTOL, ABSTOL and ITL) after you enable Algebraic Loop Solver (step 3)
Multiple Simulation Parameters
While users want to run batch experiences, in Caspoc we can use MULTISIM and run the schematic in multiple simulations. Notice that users still have to configure the simulation parameters even in multiple simulation modes.
To execute multiple simulations, you can go to the Simulation/Multiple Simulation Parameters and Simulation/Start Multiple Simulation (step 1). Multiple simulation parameters will decide the numbers of simulations in MULTISIM. The default is No=0 which is shown in MULTISIM. Users can also configure 'Start Multiple Simulation' (step 3) and 'Multiple Simulation Parameters' (step 4) by clicking the shortcut on menu bar. Keep the MULTISIM on the workscreen and we will use it later.
Then we can start to build an example in multiple simulations.
Left-click one resistor from Components/Circuit/RLC/R and release your mouse button, and then right-click on the workscreen as R1. Left-click one capacitor from Components/Circuit/RLC/C and release your mouse button, and then right-click on the workscreen as C1. Left-click one inductor from Components/Circuit/RLC/L and release your mouse button, and then right-click on the workscreen as L1. (step 1) Notice to turn the angle of the components in order to fix the following configuration.
Left-click one voltage source from Components/Circuit/Source/V and release your mouse button, and then right-click on the workscreen as V1. (step 2) Make sure there is a ground connection in the cathode of R1 (step 3).
Connect wires between all the components by the following configuration (step 4, the blue wires are the connections which shall be done by users). Right-click all the components R1, C1, L1 and V1, and then change their parameters to 10, 100uF, 1mF and 1 volt respectively (step 5, modify all the components marked with yellow round).
Left-click the SCOPE shortcut button and put it in the right side of the circuit. Notice that you shall connect the first input trace of SCOPE1 to the anode of R1 (step 6).
Here, we want to build multiple simulations by using different values in the resistor R1 and then observe the simulation results in SCOPE1.
Left-click ‘Add’ from Components/Blocks/Math/ADD and release your mouse button, and then right-click on the workscreen as ADD. Left-click ‘MUL’ from Components/Blocks/Math/MUL and release your mouse button, and then right-click on the workscreen as MUL. (step 1)
Connect MULTISIM and ADD by dragging a wire, the same as ADD and MUL as below (step 2).
Left-click ‘CHANGEE’ from Components/Blocks/Miscellaneous/CHANGEE and release your mouse button, and then right-click on the workscreen as CHANGEE (step 1).
Right-click the second input of ADD and enter a label ‘1’ (step 2).
Right-click the second input of MUL and enter a label ‘2’ (step 3).
Right-click the second input of CHANGEE and enter a label ‘0’ (step 4).
Left-click ‘CHANGEE’ from Components/Blocks/Miscellaneous/CHANGEE and release your mouse button, and then right-click on the workscreen as CHANGEE (step 1).
Right-click the second input of ADD and enter a label ‘1’ (step 2).
Right-click the second input of MUL and enter a label ‘2’ (step 3).
Right-click the second input of CHANGEE and enter a label ‘0’ (step 4).
or with numbered list:
Left-click ‘CHANGEE’ from Components/Blocks/Miscellaneous/CHANGEE and release your mouse button, and then right-click on the workscreen as CHANGEE (step 1).
Right-click the second input of ADD and enter a label ‘1’ (step 2).
Right-click the second input of MUL and enter a label ‘2’ (step 3).
Right-click the second input of CHANGEE and enter a label ‘0’ (step 4).
Right-click CHANGEE (step 1) and enter ‘R1’ in the text1 (step 2). You can see the function description: If i2 > 0 then the value of circuit component ‘Text1’ will change to i1. We already change the second input i2 of CHNAGEE to 0, thus the value of R1 will follow the value of i1 during the simulation. And the value of i1 will change by numbers of multiple simulations. It will be i1= (‘N0’+1) *2.
After entering R1 in CHANGEE, we can see there is a text ‘R1’ shown on the icon (step 1). Before running the simulation, we have to set up the simulation parameters by clicking the shortcut button (step 2). Configure the parameter to Tscreen = 20m (20 milliseconds) and step size = 100u (100 microseconds) (step3). Numerical integration method circuit = Trapezoidal (step 4).
According to the formula i1= (‘N0’+1) *2, we have to configure the values for ‘N0’. Click the shortcut button of multiple simulation parameters (step 1) and then set the number of simulations (N0) to 5. (In Caspoc, the maximum N0 is 19.) Then we can execute this simulation by clicking the shortcut button of ‘Start the multiple simulations’ (step 2) or go to Simulation/Start Multiple Simulation. Notice that you must not click ‘Initializes and Starts the simulation’ (icon:) but ‘Start the multiple simulations’ (icon:).
During the simulations, you can see the value of N0 changing from 0 to 5 (step 1). Right-click SCOPE1 (step 2) and observe the simulation results. We’ll find six voltage curves with index (0) ~ (5) (step 3). Click the shortcut button of ‘Enable/disable numeric display of simulation results’ (step 4) then we will see the numeric display under the chart as below (step 5). You can also save the simulation results to text file.