Commit dcb29ecd authored by Jan Dinkelbach's avatar Jan Dinkelbach Committed by Markus Mirz
Browse files

fix vsi intf volt update

parent 269d3c5b
......@@ -3,12 +3,12 @@
``` python
%%bash
TOP=${TOP:-$(git rev-parse --show-toplevel)}
PATH=${TOP}/build/Examples/Cxx
TIMESTEP=0.1e-3
DURATION=1.0
TIMESTEP=1e-3
DURATION=10.0
EMT_Slack_PiLine_VSI_with_PF_Init --timestep=${TIMESTEP} --duration=${DURATION}
DP_Slack_PiLine_VSI_with_PF_Init --timestep=${TIMESTEP} --duration=${DURATION}
```
......@@ -30,36 +30,68 @@
ts_dpsim_EMT = read_timeseries_csv(dpsim_result_file_EMT)
```
%% Cell type:markdown id: tags:
## Plot voltage of interest
## Plot quantities of interest
%% Cell type:code id: tags:
``` python
import matplotlib.pyplot as plt
# %matplotlib widget
```
var_name = 'i12'
%% Cell type:code id: tags:
``` python
var_name = 'v2'
plt.figure(figsize=(12,8))
plt.plot(ts_dpsim_EMT[var_name+'_0'].interpolate(50e-6).time, np.sqrt(3/2)*ts_dpsim_EMT[var_name+'_0'].interpolate(50e-6).values, label='EMT')
plt.plot(ts_dpsim_DP[var_name].interpolate(50e-6).time, ts_dpsim_DP[var_name].interpolate(50e-6).frequency_shift(50).values, label='DP backshift', linestyle='--')
#plt.xlim([2.9, 4.4])
plt.legend()
plt.show()
```
%% Cell type:code id: tags:
``` python
var_name = 'v2'
var_name = 'i12'
plt.figure(figsize=(12,8))
plt.plot(ts_dpsim_EMT[var_name+'_0'].interpolate(50e-6).time, np.sqrt(3/2)*ts_dpsim_EMT[var_name+'_0'].interpolate(50e-6).values, label='EMT')
plt.plot(ts_dpsim_DP[var_name].interpolate(50e-6).time, ts_dpsim_DP[var_name].interpolate(50e-6).frequency_shift(50).values, label='DP backshift', linestyle='--')
#plt.xlim([2.9, 4.4])
plt.legend()
plt.show()
```
%% Cell type:code id: tags:
``` python
var_name = 'pv_v_intf'
plt.figure(figsize=(12,8))
plt.plot(ts_dpsim_EMT[var_name+'_0'].interpolate(50e-6).time, np.sqrt(3/2)*ts_dpsim_EMT[var_name+'_0'].interpolate(50e-6).values, label='EMT')
plt.plot(ts_dpsim_DP[var_name].interpolate(50e-6).time, ts_dpsim_DP[var_name].interpolate(50e-6).frequency_shift(50).values, label='DP backshift', linestyle='--')#
#plt.xlim([2.9, 4.4])
plt.legend()
plt.show()
```
%% Cell type:code id: tags:
``` python
var_name = 'pv_i_intf'
plt.figure(figsize=(12,8))
plt.plot(ts_dpsim_EMT[var_name+'_0'].interpolate(50e-6).time, np.sqrt(3/2)*ts_dpsim_EMT[var_name+'_0'].interpolate(50e-6).values, label='EMT')
plt.plot(ts_dpsim_DP[var_name].interpolate(50e-6).time, ts_dpsim_DP[var_name].interpolate(50e-6).frequency_shift(50).values, label='DP backshift', linestyle='--')#
#plt.xlim([2.9, 4.4])
plt.legend()
plt.show()
```
%% Cell type:code id: tags:
``` python
......@@ -134,11 +166,5 @@
plt.plot(ts_dpsim_EMT[var_name].interpolate(50e-6).time, ts_dpsim_EMT[var_name].interpolate(50e-6).values, label='EMT')
plt.plot(ts_dpsim_DP[var_name].interpolate(50e-6).time, ts_dpsim_DP[var_name].interpolate(50e-6).values, label='DP', linestyle='--')
plt.legend()
plt.show()
```
%% Cell type:code id: tags:
``` python
```
......
......@@ -7,11 +7,11 @@
``` python
%%bash
TOP=${TOP:-$(git rev-parse --show-toplevel)}
PATH=${TOP}/build/Examples/Cxx
TIMESTEP=0.05e-3
TIMESTEP=0.1e-3
DURATION=1
EMT_Slack_PiLine_VSI_with_PF_Init --timestep=${TIMESTEP} --duration=${DURATION}
```
......@@ -76,10 +76,34 @@
plt.plot(ts_obj.time, PEAK1PH_TO_RMS3PH*ts_obj.values, label=ts_name)
plt.legend()
plt.show()
```
%% Cell type:code id: tags:
``` python
plt.figure(figsize=(12,6))
for ts_name, ts_obj in ts_dpsim.items():
if ts_name in ['pv_v_intf_0']:
plt.plot(ts_obj.time, PEAK1PH_TO_RMS3PH*ts_obj.values, label=ts_name)
plt.legend()
plt.show()
```
%% Cell type:code id: tags:
``` python
plt.figure(figsize=(12,6))
for ts_name, ts_obj in ts_dpsim.items():
if ts_name in ['pv_i_intf_0']:
plt.plot(ts_obj.time, PEAK1PH_TO_RMS3PH*ts_obj.values, label=ts_name)
plt.legend()
plt.show()
```
%% Cell type:code id: tags:
``` python
......
......@@ -376,10 +376,7 @@ void DP::Ph1::AvVoltageSourceInverterDQ::mnaUpdateCurrent(const Matrix& leftvect
}
void DP::Ph1::AvVoltageSourceInverterDQ::mnaUpdateVoltage(const Matrix& leftVector) {
mVirtualNodes[3]->mnaUpdateVoltage(leftVector);
mIntfVoltage(0, 0) = 0;
if (terminalNotGrounded(1))
mIntfVoltage(0,0) = Math::complexFromVectorElement(leftVector, matrixNodeIndex(1));
if (terminalNotGrounded(0))
mIntfVoltage(0,0) = mIntfVoltage(0,0) - Math::complexFromVectorElement(leftVector, matrixNodeIndex(0));
for (auto virtualNode : mVirtualNodes)
virtualNode->mnaUpdateVoltage(leftVector);
mIntfVoltage(0,0) = Math::complexFromVectorElement(leftVector, matrixNodeIndex(0));
}
......@@ -434,8 +434,9 @@ void EMT::Ph3::AvVoltageSourceInverterDQ::mnaUpdateCurrent(const Matrix& leftvec
}
void EMT::Ph3::AvVoltageSourceInverterDQ::mnaUpdateVoltage(const Matrix& leftVector) {
mVirtualNodes[3]->mnaUpdateVoltage(leftVector);
// mIntfVoltage(0, 0) = Math::realFromVectorElement(leftVector, mVirtualNodes[3]->matrixNodeIndex(0, 0));
// mIntfVoltage(1, 0) = Math::realFromVectorElement(leftVector, mVirtualNodes[3]->matrixNodeIndex(0, 1));
// mIntfVoltage(2, 0) = Math::realFromVectorElement(leftVector, mVirtualNodes[3]->matrixNodeIndex(0, 2));
for (auto virtualNode : mVirtualNodes)
virtualNode->mnaUpdateVoltage(leftVector);
mIntfVoltage(0,0) = Math::realFromVectorElement(leftVector, matrixNodeIndex(0,0));
mIntfVoltage(1,0) = Math::realFromVectorElement(leftVector, matrixNodeIndex(0,1));
mIntfVoltage(2,0) = Math::realFromVectorElement(leftVector, matrixNodeIndex(0,2));
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment