Commit 27129672 authored by Markus Mirz's avatar Markus Mirz
Browse files

remove deprecated nbs

parent f7dc8838
This diff is collapsed.
%% Cell type:code id: tags:
``` python
import dpsim
import villas.dataprocessing.readtools as rt
import villas.dataprocessing.timeseries as ts
```
%% Cell type:code id: tags:
``` python
# Nodes
gnd = dpsim.dp.Node.GND()
n1 = dpsim.dp.Node("n1")
n2 = dpsim.dp.Node("n2")
n3 = dpsim.dp.Node("n3")
n4 = dpsim.dp.Node("n4")
# Components
v1 = dpsim.dp.ph1.VoltageSource("v_1", [gnd, n1], voltage_ref=345)
r1 = dpsim.dp.ph1.Resistor("r1", [n1, n2], resistance=5)
c1 = dpsim.dp.ph1.Capacitor("c_1", [n2, gnd], capacitance=0.002)
rL1 = dpsim.dp.ph1.Resistor("r_load1", [n2, n4], resistance=6.4)
l1 = dpsim.dp.ph1.Inductor("l_1", [n4, n3], inductance=0.186)
c2 = dpsim.dp.ph1.Capacitor("c_2", [n3, gnd], capacitance=0.002)
rL2 = dpsim.dp.ph1.Resistor("r_load2", [n3, gnd], resistance=150)
```
%% Cell type:code id: tags:
``` python
system = dpsim.SystemTopology(50, [gnd, n1, n2, n3, n4], [v1, r1, c1, rL1, l1, c2, rL2])
sim = dpsim.Simulation('IdealVS_PiLine_RLC_1', system, duration=0.2, timestep=0.00005)
sim.run()
```
%% Cell type:code id: tags:
``` python
results = rt.read_timeseries_dpsim_cmpl('Logs/' + sim.name + '_LeftVector.csv')
expected = rt.read_timeseries_dpsim_real('Examples/Results/Simulink/Circuits/SL_' + sim.name + '.csv')
err = 0
err += ts.TimeSeries.rmse(expected[0], results[0].dynphasor_shift_to_emt('n1_emt', 50))
err += ts.TimeSeries.rmse(expected[1], results[1].dynphasor_shift_to_emt('n2_emt', 50))
print("Total RMSE: %g" % (err))
assert err < 1e-4
```
%% Output
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-3-674cf6e92b01> in <module>()
5
6 # Nodes
----> 7 gnd = dpsim.dp.Node.GND()
8 n1 = dpsim.dp.Node("n1")
9 n2 = dpsim.dp.Node("n2")
AttributeError: module 'dpsim' has no attribute 'dp'
%% Cell type:code id: tags:
``` python
import dpsim
import villas.dataprocessing.readtools as rt
import villas.dataprocessing.timeseries as ts
```
%% Cell type:code id: tags:
``` python
# Nodes
gnd = dpsim.dp.Node.GND()
n1 = dpsim.dp.Node("n1")
n2 = dpsim.dp.Node("n2")
n3 = dpsim.dp.Node("n3")
# Components
v1 = dpsim.dp.ph1.VoltageSource("v_1", [gnd, n1], voltage_ref=10)
lL = dpsim.dp.ph1.Inductor("l_L", [n2, n3], inductance=0.001)
rL = dpsim.dp.ph1.Resistor("r_L", [n1, n2], resistance=0.1)
r1 = dpsim.dp.ph1.Resistor("r_1", [n3, gnd], resistance=20)
```
%% Cell type:code id: tags:
``` python
system = dpsim.SystemTopology(50, [gnd, n1, n2, n3], [v1, lL, rL, r1])
sim = dpsim.Simulation('IdealVS_RXLine_1_RL', system, duration=0.2, timestep=0.00005)
sim.run()
```
%% Cell type:code id: tags:
``` python
results = rt.read_timeseries_dpsim_cmpl('Logs/' + sim.name + '_LeftVector.csv')
expected = rt.read_timeseries_dpsim_real('Examples/Results/Simulink/Circuits/SL_' + sim.name() + '.csv')
err = 0
err += ts.TimeSeries.rmse(expected[0], results[0].dynphasor_shift_to_emt('n1_emt', 50))
err += ts.TimeSeries.rmse(expected[1], results[1].dynphasor_shift_to_emt('n2_emt', 50))
print("Total RMSE: %g" % (err))
assert err < 1e-4
```
%% Cell type:code id: tags:
``` python
import dpsim
import villas.dataprocessing.readtools as rt
import villas.dataprocessing.timeseries as ts
# Nodes
gnd = dpsim.dp.Node.GND()
n1 = dpsim.dp.Node("n1")
n2 = dpsim.dp.Node("n2")
# Components
vin = dpsim.dp.ph1.VoltageSource("v_in", [n1, n2], voltage_ref=10)
r1 = dpsim.dp.ph1.Resistor("r_1", [n1, gnd], resistance=1)
r2 = dpsim.dp.ph1.Resistor("r_2", [n2, gnd], resistance=1)
r3 = dpsim.dp.ph1.Resistor("r_3", [n2, gnd], resistance=1)
system = dpsim.SystemTopology(50, [gnd, n1, n2], [vin, r1, r2, r3])
sim = dpsim.Simulation('IdealVS_R_2', system, duration=0.2, timestep=0.00005)
sim.run()
results = rt.read_timeseries_dpsim_cmpl('Logs/' + sim.name + '_LeftVector.csv')
expected = rt.read_timeseries_dpsim_real('Examples/Results/Simulink/Circuits/SL_' + sim.name + '.csv')
err = 0
err += ts.TimeSeries.rmse(expected[0], results[0].dynphasor_shift_to_emt('n1_emt', 50))
err += ts.TimeSeries.rmse(expected[1], results[1].dynphasor_shift_to_emt('n2_emt', 50))
print("Total RMSE: %g" % (err))
assert err < 1e-4
```
%% Cell type:code id: tags:
``` python
import dpsim
import villas.dataprocessing.readtools as rt
import villas.dataprocessing.timeseries as ts
```
%% Cell type:code id: tags:
``` python
# Nodes
gnd = dpsim.dp.Node.GND()
n1 = dpsim.dp.Node("n1")
n2 = dpsim.dp.Node("n2")
n3 = dpsim.dp.Node("n3")
n4 = dpsim.dp.Node("n4")
# Components
v1 = dpsim.dp.ph1.VoltageSource("v_1", [gnd, n1], voltage_ref=10)
r1 = dpsim.dp.ph1.Resistor("r_1", [n1, n2], resistance=1)
r2 = dpsim.dp.ph1.Resistor("r_2", [n2, gnd], resistance=1)
r3 = dpsim.dp.ph1.Resistor("r_3", [n2, n3], resistance=1)
r4 = dpsim.dp.ph1.Resistor("r_4", [n3, gnd], resistance=1)
r5 = dpsim.dp.ph1.Resistor("r_5", [n3, n4], resistance=1)
v2 = dpsim.dp.ph1.VoltageSource("v_2", [n4, gnd], voltage_ref=20)
```
%% Cell type:code id: tags:
``` python
system = dpsim.SystemTopology(50, [gnd, n1, n2, n3, n4], [v1, v2, r1, r2, r3, r4, r5])
sim = dpsim.Simulation('IdealVS_R_3', system, duration=0.2, timestep=0.00005)
sim.run()
```
%% Cell type:code id: tags:
``` python
results = rt.read_timeseries_dpsim_cmpl('Logs/' + sim.name + '_LeftVector.csv')
expected = rt.read_timeseries_dpsim_real('Examples/Results/Simulink/Circuits/SL_' + sim.name() + '.csv')
err = 0
err += ts.TimeSeries.rmse(expected[0], results[0].dynphasor_shift_to_emt('n1_emt', 50))
err += ts.TimeSeries.rmse(expected[1], results[1].dynphasor_shift_to_emt('n2_emt', 50))
err += ts.TimeSeries.rmse(expected[2], results[2].dynphasor_shift_to_emt('n3_emt', 50))
err += ts.TimeSeries.rmse(expected[3], results[3].dynphasor_shift_to_emt('n4_emt', 50))
err = err / 4
print("Total RMSE: %g" % (err))
assert err < 1e-4
```