sogno-platform / dpsim

Real-time power system simulator including powerflow, (dynamic) phasors and EMT
https://sogno.energy/dpsim/
Mozilla Public License 2.0
70 stars 51 forks source link

One-step delay in Voltage source #195

Closed martinmoraga closed 11 months ago

martinmoraga commented 1 year ago

@dinkelbachjan @gnakti @m-mirz

When a simulation starts the initial values of all components are calculated for t=0. Hence, the first simulation step should calculate the results for the time $t=\Delta t$ because the results for $t=0$ are the initial values. However, this is not the case for the voltage sorces. In the first simulation step, voltage sources are stamping in the right side vector the value of $t=0$ and not for $t=\Delta t$ which introduces a one step delay between the voltage sources and all other components of DPsim. This behavior translates to transients in the first steps of the simulation. For examples, in a simple 3 phase RLC circuit (initialized with consistent values) we can observe transients in phase b and c of the current of the capacitor:

alt text

To fix this error, the parameter "time" of the functions EMT::Ph1::VoltageSource::updateVoltage(Real time) and EMT::Ph3::VoltageSource::updateVoltage(Real time) must be updated to time = time + timestep.

In addition, the log must be adapted accordingly. Currently, the column time of the log files also has a one-step delay, as shown in the table below: time variable1 variable2 ...
t=0 value of variable1 for t=timestep value of variable 2 for t=timestep ...
t=timestep value of variable1 for t=timestep*2 value of variable1 for t=timestep*2 ...
... ... ... ...
t=k value of variable1 for t=timestep*(k+1) value of variable2 for t=timestep*(k+1) ...
In my opinion, for time 0 we should log the initial values and the column time should not have a one-step delay: time variable1 variable2 ...
t=0 initial value of variable1 initial value of variable 2 ...
t=timestep value of variable1 for t=timestep value of variable2 for t=timestep ...
... ... ... ...
t=k value of variable1 for t=timestep*(k) value of variable2 for t=timestep*(k) ...