Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

One-step delay in Voltage source #195

Closed
martinmoraga opened this issue Mar 8, 2023 · 0 comments · Fixed by #210
Closed

One-step delay in Voltage source #195

martinmoraga opened this issue Mar 8, 2023 · 0 comments · Fixed by #210
Assignees
Labels
bug Something isn't working

Comments

@martinmoraga
Copy link
Contributor

@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) ...
@martinmoraga martinmoraga added the bug Something isn't working label Mar 8, 2023
@martinmoraga martinmoraga self-assigned this Mar 8, 2023
@martinmoraga martinmoraga linked a pull request Mar 27, 2023 that will close this issue
@stv0g stv0g changed the title one-step delay in Voltage source One-step delay in Voltage source May 15, 2023
dinkelbachjan added a commit that referenced this issue Nov 27, 2023
This PR ensures that the calculation of the first simulation step means
the calculation of the values for the time instant `t=mTimeStep`, while
`t=0` is covered by the initialization values. This was not consistently
the case, in particular for `EMT::Ph3::VoltageSource`, which caused
corresponding transients at the beginning of some simulations. Moreover,
a small error in the intialization of the EMT Power Transformer is
fixed. Besides, the scaling of voltages and currents has been
harmonised, which is documented now under `docs/Development/Guidelines`.

Closes #195
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants