Commit cb8c438b authored by Bichen Li's avatar Bichen Li

- Update the dockerfile, add the pull of py4mod package

parent 836bc55b
# ignore results
*.csv
*.mat
# ignore symbolic links
*.egg-info
*.eggs
# ignore compiled python files
*.pyc
# ignore logging files
*.log
# ignore generated dymola files
buildlog.txt
dsfinal.txt
dsin.txt
dslog.txt
dsmodel*
dymosim*
# ignore matlab dumping file
*.mdmp
# ignore spyder project
.spyderproject
.spyproject
# ignore pycharm files
.idea
__pycache__
# ignore jupyter notebook files
.ipynb_checkpoints
# ignore results
*.csv
*.mat
# ignore symbolic links
*.egg-info
*.eggs
# ignore compiled python files
*.pyc
# ignore logging files
*.log
# ignore generated dymola files
buildlog.txt
dsfinal.txt
dsin.txt
dslog.txt
dsmodel*
dymosim*
# ignore matlab dumping file
*.mdmp
# ignore spyder project
.spyderproject
.spyproject
# ignore pycharm files
.idea
__pycache__
# ignore jupyter notebook files
.ipynb_checkpoints
Test.py
\ No newline at end of file
# Dataprocessing toolkit for RWTH ACS simulators
## Copyright
2017, Institute for Automation of Complex Power Systems, EONERC, RWTH Aachen University
## License
This project is released under the terms of the [GPL version 3](COPYING.md).
```
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
```
For other licensing options please consult [Prof. Antonello Monti](mailto:amonti@eonerc.rwth-aachen.de).
## Contact
[![EONERC ACS Logo](doc/eonerc_logo.png)](http://www.acs.eonerc.rwth-aachen.de)
- Markus Mirz <mmirz@eonerc.rwth-aachen.de>
- Jan Dinkelbach <JDinkelbach@eonerc.rwth-aachen.de>
- Steffen Vogel <stvogel@eonerc.rwth-aachen.de>
[Institute for Automation of Complex Power Systems (ACS)](http://www.acs.eonerc.rwth-aachen.de)
[EON Energy Research Center (EONERC)](http://www.eonerc.rwth-aachen.de)
[RWTH University Aachen, Germany](http://www.rwth-aachen.de)
# Dataprocessing toolkit for RWTH ACS simulators
## Copyright
2017, Institute for Automation of Complex Power Systems, EONERC, RWTH Aachen University
## License
This project is released under the terms of the [GPL version 3](COPYING.md).
```
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
```
For other licensing options please consult [Prof. Antonello Monti](mailto:amonti@eonerc.rwth-aachen.de).
## Contact
[![EONERC ACS Logo](doc/eonerc_logo.png)](http://www.acs.eonerc.rwth-aachen.de)
- Markus Mirz <mmirz@eonerc.rwth-aachen.de>
- Jan Dinkelbach <JDinkelbach@eonerc.rwth-aachen.de>
- Steffen Vogel <stvogel@eonerc.rwth-aachen.de>
[Institute for Automation of Complex Power Systems (ACS)](http://www.acs.eonerc.rwth-aachen.de)
[EON Energy Research Center (EONERC)](http://www.eonerc.rwth-aachen.de)
[RWTH University Aachen, Germany](http://www.rwth-aachen.de)
from dataprocessing.readtools import *
from dataprocessing.timeseries import *
def get_node_voltage_phasors(dpsim_timeseries_list):
"""Calculate voltage phasors of all nodes
:param dpsim_timeseries_list: timeseries list retrieved from dpsim results
:return:
"""
voltage_phasor_list = {}
for ts in dpsim_timeseries_list:
ts_abs = ts.abs(ts.name + '_abs')
ts_phase = ts.phase(ts.name + '_phase')
ts_phasor = {}
ts_phasor['abs'] = ts_abs
ts_phasor['phase'] = ts_phase
voltage_phasor_list[ts.name] = ts_phasor
return voltage_phasor_list
def get_node_emt_voltages(timeseries_list, freq):
"""Calculate voltage phasors of all nodes
:param timeseries_list: timeseries list retrieved from dpsim results
:return:
"""
voltages_list = {}
for ts in timeseries_list:
ts_emt = ts.dynphasor_shift_to_emt(ts.name, freq)
voltages_list[ts.name] = ts_emt
return voltages_list
from dataprocessing.readtools import *
from dataprocessing.timeseries import *
def get_node_voltage_phasors(dpsim_timeseries_list):
"""Calculate voltage phasors of all nodes
:param dpsim_timeseries_list: timeseries list retrieved from dpsim results
:return:
"""
voltage_phasor_list = {}
for ts in dpsim_timeseries_list:
ts_abs = ts.abs(ts.name + '_abs')
ts_phase = ts.phase(ts.name + '_phase')
ts_phasor = {}
ts_phasor['abs'] = ts_abs
ts_phasor['phase'] = ts_phase
voltage_phasor_list[ts.name] = ts_phasor
return voltage_phasor_list
def get_node_emt_voltages(timeseries_list, freq):
"""Calculate voltage phasors of all nodes
:param timeseries_list: timeseries list retrieved from dpsim results
:return:
"""
voltages_list = {}
for ts in timeseries_list:
ts_emt = ts.dynphasor_shift_to_emt(ts.name, freq)
voltages_list[ts.name] = ts_emt
return voltages_list
import matplotlib.pyplot as plt
import numpy as np
from .timeseries import *
def plot_timeseries(figure_id, timeseries, plt_linestyle='-', plt_linewidth=2, plt_color=None, plt_legend_loc='lower right'):
"""
This function plots either a single timeseries or several timeseries in the figure defined by figure_id.
Several timeseries (handed over in a list) are plotted in several subplots.
In order to plot several timeseries in one plot, the function is to be called several times (hold is activated).
"""
plt.figure(figure_id)
if not isinstance(timeseries, list):
if plt_color:
plt.plot(timeseries.time, timeseries.values, linestyle=plt_linestyle, label=timeseries.label, linewidth=plt_linewidth, color=plt_color)
else:
plt.plot(timeseries.time, timeseries.values, linestyle=plt_linestyle, label=timeseries.label, linewidth=plt_linewidth)
plt.gca().autoscale(axis='x', tight=True)
plt.legend(loc=plt_legend_loc)
else:
for ts in timeseries:
plt.subplot(len(timeseries), 1, timeseries.index(ts) + 1)
if plt_color:
plt.plot(ts.time, ts.values, linestyle=plt_linestyle, label=ts.label, linewidth=plt_linewidth, color=plt_color)
else:
plt.plot(ts.time, ts.values, linestyle=plt_linestyle, label=ts.label, linewidth=plt_linewidth)
plt.gca().autoscale(axis='x', tight=True)
plt.legend()
def set_timeseries_labels(timeseries, timeseries_labels):
"""
Sets label attribute of timeseries, later used in plotting functions.
Suitable for single timeseries as well as for several timeseries (handed over in a list).
"""
if not isinstance(timeseries, list):
timeseries.label = timeseries_labels
else:
for ts in timeseries:
ts.label = timeseries_labels[timeseries.index(ts)]
import matplotlib.pyplot as plt
import numpy as np
from .timeseries import *
def plot_timeseries(figure_id, timeseries, plt_linestyle='-', plt_linewidth=2, plt_color=None, plt_legend_loc='lower right'):
"""
This function plots either a single timeseries or several timeseries in the figure defined by figure_id.
Several timeseries (handed over in a list) are plotted in several subplots.
In order to plot several timeseries in one plot, the function is to be called several times (hold is activated).
"""
plt.figure(figure_id)
if not isinstance(timeseries, list):
if plt_color:
plt.plot(timeseries.time, timeseries.values, linestyle=plt_linestyle, label=timeseries.label, linewidth=plt_linewidth, color=plt_color)
else:
plt.plot(timeseries.time, timeseries.values, linestyle=plt_linestyle, label=timeseries.label, linewidth=plt_linewidth)
plt.gca().autoscale(axis='x', tight=True)
plt.legend(loc=plt_legend_loc)
else:
for ts in timeseries:
plt.subplot(len(timeseries), 1, timeseries.index(ts) + 1)
if plt_color:
plt.plot(ts.time, ts.values, linestyle=plt_linestyle, label=ts.label, linewidth=plt_linewidth, color=plt_color)
else:
plt.plot(ts.time, ts.values, linestyle=plt_linestyle, label=ts.label, linewidth=plt_linewidth)
plt.gca().autoscale(axis='x', tight=True)
plt.legend()
def set_timeseries_labels(timeseries, timeseries_labels):
"""
Sets label attribute of timeseries, later used in plotting functions.
Suitable for single timeseries as well as for several timeseries (handed over in a list).
"""
if not isinstance(timeseries, list):
timeseries.label = timeseries_labels
else:
for ts in timeseries:
ts.label = timeseries_labels[timeseries.index(ts)]
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
import re
import os
import sys
sys.path.append(r"D:\HIWI\Git\data-processing\dataprocessing")
sys.path.append(r"D:\HIWI\Git\python-for-modelica-dev_interface\Py4Mod\py4mod")
from ModelicaModel import ModelicaModel
from validationtools import *
from readtools import *
os.chdir(r"D:\HIWI\Git")
def simulate_modelica(model_name, model_path):
interface = ModelicaModel(model_name, model_path)
# Initialization
interface.createInterface("OPENMODELICA")
interface.loadFile(model_path + '\ModPowerSystems\package.mo')
# Redirection
cwd = os.getcwd()
wd = os.path.join(cwd, 'test')
if not os.path.exists(wd):
os.makedirs(wd)
interface.changeWorkingDirectory(wd.replace("\\", "/"))
# Build & Run
interface.buildModel()
interface.simulate()
print("Test Start")
# We need to extract all the result files from git now
for files in os.listdir(
os.path.abspath("reference-results/Neplan/BasicGrids")):
# Assert the result, model result path read from cmd line
validate_modelica_res(os.path.splitext(files)[0],
os.path.abspath("reference-results/Modelica/BasicGrids/" +
os.path.splitext(files)[0] + ".mat"),
os.path.abspath("reference-results/Neplan/BasicGrids/" +
os.path.splitext(files)[0] + ".rlf"))
print("Test End")
import re
import os
import sys
sys.path.append(r".\data-processing\dataprocessing")
sys.path.append(r".\python-for-modelica-dev_interface\Py4Mod\py4mod")
from ModelicaModel import ModelicaModel
from validationtools import *
from readtools import *
os.chdir(r"D:\HIWI\Git")
def simulate_modelica(model_name, model_path):
interface = ModelicaModel(model_name, model_path)
# Initialization
interface.createInterface("OPENMODELICA")
interface.loadFile(model_path + '\ModPowerSystems\package.mo')
# Redirection
cwd = os.getcwd()
wd = os.path.join(cwd, 'test')
if not os.path.exists(wd):
os.makedirs(wd)
interface.changeWorkingDirectory(wd.replace("\\", "/"))
# Build & Run
interface.buildModel()
interface.simulate()
print("Test Start")
# We need to extract all the result files from git now
for files in os.listdir(
os.path.abspath("reference-results/Neplan/BasicGrids")):
# Assert the result, model result path read from cmd line
validate_modelica_res(os.path.splitext(files)[0],
os.path.abspath("reference-results/Modelica/BasicGrids/" +
os.path.splitext(files)[0] + ".mat"),
os.path.abspath("reference-results/Neplan/BasicGrids/" +
os.path.splitext(files)[0] + ".rlf"))
print("Test End")
from dataprocessing.readtools import *
from dataprocessing.plottools import *
import matplotlib.pyplot as plt
from plottingtools.config import *
current_emt_mod = read_timeseries_Modelica(r"\\tsclient\N\Research\German Public\ACS0049_SINERGIEN_bsc\Data\WorkData\SimulationResults\SynchronousGenerator\EMT\UnitTest_Kundur_FullModel_Euler_1us.mat", ["synchronousGenerator_Park.i[1]"]) # Note: both results include only one damper winding in q axis
current_emt_dpsim = read_timeseries_dpsim_real(r"\\tsclient\N\Research\German Public\ACS0049_SINERGIEN_bsc\Data\WorkData\SimulationResults\SynchronousGenerator\EMT\DPsim\UnitTest_FullModel_Trap_1us\data_j.csv")[0]
current_emt_dpsim.values = -current_emt_dpsim.values
# Comparison EMT
figure_id = 1
plt.figure(figure_id, figsize=(12,8))
set_timeseries_labels(current_emt_mod, ["EMT Modelica"])
plot_timeseries(figure_id, current_emt_mod)
set_timeseries_labels(current_emt_dpsim, "EMT DPsim") # TODO: modelica timeseries needs list element, dpsim timeseries needs string
plot_timeseries(figure_id, current_emt_dpsim, plt_linestyle=':')
plt.xlabel('Zeit [s]')
plt.ylabel('Strom [A]')
plt.show(block=False)
# Comparison DP
current_dp_mod = read_timeseries_Modelica(r"\\tsclient\N\Research\German Public\ACS0049_SINERGIEN_bsc\Data\WorkData\SimulationResults\SynchronousGenerator\DP\UnitTest_Kundur_FullModel_Euler_1us.mat", ["synchronousGenerator_Park.I[1]"]) # Note: both results include only one damper winding in q axis
current_dp_dpsim = read_timeseries_dpsim_cmpl(r"\\tsclient\N\Research\German Public\ACS0049_SINERGIEN_bsc\Data\WorkData\SimulationResults\SynchronousGenerator\DP\DPsim\UnitTest_FullModel_Trap_1us\data_j.csv")[0]
current_dp_dpsim.values = -current_dp_dpsim.values
current_dpabs_dpsim = current_dp_dpsim.abs(current_dp_dpsim.name + ' abs')
figure_id = 2
plt.figure(figure_id, figsize=(12,8))
set_timeseries_labels(current_dp_mod, ["DP Modelica"])
plot_timeseries(figure_id, current_dp_mod)
set_timeseries_labels(current_dpabs_dpsim, "DP DPsim") # TODO: modelica timeseries needs list element, dpsim timeseries needs string
plot_timeseries(figure_id, current_dpabs_dpsim, plt_linestyle=':')
plt.xlabel('Zeit [s]')
plt.ylabel('Strom [A]')
plt.show(block=True)
from dataprocessing.readtools import *
from dataprocessing.plottools import *
import matplotlib.pyplot as plt
from plottingtools.config import *
current_emt_mod = read_timeseries_Modelica(r"\\tsclient\N\Research\German Public\ACS0049_SINERGIEN_bsc\Data\WorkData\SimulationResults\SynchronousGenerator\EMT\UnitTest_Kundur_FullModel_Euler_1us.mat", ["synchronousGenerator_Park.i[1]"]) # Note: both results include only one damper winding in q axis
current_emt_dpsim = read_timeseries_dpsim_real(r"\\tsclient\N\Research\German Public\ACS0049_SINERGIEN_bsc\Data\WorkData\SimulationResults\SynchronousGenerator\EMT\DPsim\UnitTest_FullModel_Trap_1us\data_j.csv")[0]
current_emt_dpsim.values = -current_emt_dpsim.values
# Comparison EMT
figure_id = 1
plt.figure(figure_id, figsize=(12,8))
set_timeseries_labels(current_emt_mod, ["EMT Modelica"])
plot_timeseries(figure_id, current_emt_mod)
set_timeseries_labels(current_emt_dpsim, "EMT DPsim") # TODO: modelica timeseries needs list element, dpsim timeseries needs string
plot_timeseries(figure_id, current_emt_dpsim, plt_linestyle=':')
plt.xlabel('Zeit [s]')
plt.ylabel('Strom [A]')
plt.show(block=False)
# Comparison DP
current_dp_mod = read_timeseries_Modelica(r"\\tsclient\N\Research\German Public\ACS0049_SINERGIEN_bsc\Data\WorkData\SimulationResults\SynchronousGenerator\DP\UnitTest_Kundur_FullModel_Euler_1us.mat", ["synchronousGenerator_Park.I[1]"]) # Note: both results include only one damper winding in q axis
current_dp_dpsim = read_timeseries_dpsim_cmpl(r"\\tsclient\N\Research\German Public\ACS0049_SINERGIEN_bsc\Data\WorkData\SimulationResults\SynchronousGenerator\DP\DPsim\UnitTest_FullModel_Trap_1us\data_j.csv")[0]
current_dp_dpsim.values = -current_dp_dpsim.values
current_dpabs_dpsim = current_dp_dpsim.abs(current_dp_dpsim.name + ' abs')
figure_id = 2
plt.figure(figure_id, figsize=(12,8))
set_timeseries_labels(current_dp_mod, ["DP Modelica"])
plot_timeseries(figure_id, current_dp_mod)
set_timeseries_labels(current_dpabs_dpsim, "DP DPsim") # TODO: modelica timeseries needs list element, dpsim timeseries needs string
plot_timeseries(figure_id, current_dpabs_dpsim, plt_linestyle=':')
plt.xlabel('Zeit [s]')
plt.ylabel('Strom [A]')
plt.show(block=True)
from dataprocessing.readtools import *
from dataprocessing.plottools import *
import matplotlib.pyplot as plt
import numpy as np
results_path = r'\\tsclient\N\Research\German Public\ACS0049_SINERGIEN_bsc\Data\WorkData\SimulationResults\InductionMachine\results'
### --- Read in section --- ###
# Stator currents
stator_currents_mo = read_time_series_Modelica(results_path + r'\Modelica3hpMachineRRFs.mat', ['inductionMachineSquirrelCage.i[1]', 'inductionMachineSquirrelCage.i[2]', 'inductionMachineSquirrelCage.i[3]'])
stator_currents_pls = read_time_series_PLECS(results_path + r'\PLECS3hpMachineStatorCurrents.csv')
# Rotor currents
rotor_currents_mo = read_time_series_Modelica(results_path + r'\Modelica3hpMachineRRFs.mat', ['inductionMachineSquirrelCage.i_qd0r[1]', 'inductionMachineSquirrelCage.i_qd0r[2]'])
rotor_currents_pls = read_time_series_PLECS(results_path + r'\PLECS3hpMachineRotorCurrentsDqRRFs.csv')
rotor_currents_pls[1].values = -rotor_currents_pls[1].values # transformation DQ0->QD0
# Torque and speed
torque_speed_mo = read_time_series_Modelica(results_path + r'\Modelica3hpMachineRRFs.mat', ['inductionMachineSquirrelCage.T_e', 'inductionMachineSquirrelCage.omega_rm'])
torque_speed_pls = read_time_series_PLECS(results_path + r'\PLECS3hpMachineTorqueSpeed.csv')
torque_speed_mo[1].values = torque_speed_mo[1].values/2/np.pi*60 # transformation to r/min
### --- Plot section --- ###
# Stator currents
figure_id = 1
plt.figure(figure_id)
plt.title("Stator currents")
set_time_series_labels(stator_currents_mo, ['Modelica: Ias [A]', 'Modelica: Ibs [A]', 'Modelica: Ics [A]'])
plot_in_subplots(figure_id, stator_currents_mo)
set_time_series_labels(stator_currents_pls, ['PLECS: Ias [A]', 'PLECS: Ibs [A]', 'PLECS: Ics [A]'])
plot_in_subplots(figure_id, stator_currents_pls, plt_linestyle='--')
plt.xlabel('Time [s]')
plt.show(block=False)
# Rotor currents
figure_id = 2
plt.figure(figure_id)
plt.title("Rotor currents (in synchronously rotating reference frame)")
set_time_series_labels(rotor_currents_mo, ['Modelica: Iqr\' [A]', 'Modelica: Idr\' [A]'])
plot_in_subplots(figure_id, rotor_currents_mo)
set_time_series_labels(rotor_currents_pls, ['PLECS: Iqr\' [A]', 'PLECS: Idr\' [A]'])
plot_in_subplots(figure_id, rotor_currents_pls, plt_linestyle='--')
plt.xlabel('Time [s]')
plt.show(block=False)
# Torque and speed
figure_id = 3
plt.figure(figure_id)
plt.title("Rotor currents (in synchronously rotating reference frame)")
set_time_series_labels(torque_speed_mo, ['Modelica: Torque [Nm]', 'Modelica: Speed [r/min]'])
plot_in_subplots(figure_id, torque_speed_mo)
set_time_series_labels(torque_speed_pls, ['PLECS: Torque [Nm]', 'PLECS: Speed [r/min]'])
plot_in_subplots(figure_id, torque_speed_pls, plt_linestyle='--')
plt.xlabel('Time [s]')
from dataprocessing.readtools import *
from dataprocessing.plottools import *
import matplotlib.pyplot as plt
import numpy as np
results_path = r'\\tsclient\N\Research\German Public\ACS0049_SINERGIEN_bsc\Data\WorkData\SimulationResults\InductionMachine\results'
### --- Read in section --- ###
# Stator currents
stator_currents_mo = read_time_series_Modelica(results_path + r'\Modelica3hpMachineRRFs.mat', ['inductionMachineSquirrelCage.i[1]', 'inductionMachineSquirrelCage.i[2]', 'inductionMachineSquirrelCage.i[3]'])
stator_currents_pls = read_time_series_PLECS(results_path + r'\PLECS3hpMachineStatorCurrents.csv')
# Rotor currents
rotor_currents_mo = read_time_series_Modelica(results_path + r'\Modelica3hpMachineRRFs.mat', ['inductionMachineSquirrelCage.i_qd0r[1]', 'inductionMachineSquirrelCage.i_qd0r[2]'])
rotor_currents_pls = read_time_series_PLECS(results_path + r'\PLECS3hpMachineRotorCurrentsDqRRFs.csv')
rotor_currents_pls[1].values = -rotor_currents_pls[1].values # transformation DQ0->QD0
# Torque and speed
torque_speed_mo = read_time_series_Modelica(results_path + r'\Modelica3hpMachineRRFs.mat', ['inductionMachineSquirrelCage.T_e', 'inductionMachineSquirrelCage.omega_rm'])
torque_speed_pls = read_time_series_PLECS(results_path + r'\PLECS3hpMachineTorqueSpeed.csv')
torque_speed_mo[1].values = torque_speed_mo[1].values/2/np.pi*60 # transformation to r/min
### --- Plot section --- ###
# Stator currents
figure_id = 1
plt.figure(figure_id)
plt.title("Stator currents")
set_time_series_labels(stator_currents_mo, ['Modelica: Ias [A]', 'Modelica: Ibs [A]', 'Modelica: Ics [A]'])
plot_in_subplots(figure_id, stator_currents_mo)
set_time_series_labels(stator_currents_pls, ['PLECS: Ias [A]', 'PLECS: Ibs [A]', 'PLECS: Ics [A]'])
plot_in_subplots(figure_id, stator_currents_pls, plt_linestyle='--')
plt.xlabel('Time [s]')
plt.show(block=False)
# Rotor currents
figure_id = 2
plt.figure(figure_id)
plt.title("Rotor currents (in synchronously rotating reference frame)")
set_time_series_labels(rotor_currents_mo, ['Modelica: Iqr\' [A]', 'Modelica: Idr\' [A]'])
plot_in_subplots(figure_id, rotor_currents_mo)
set_time_series_labels(rotor_currents_pls, ['PLECS: Iqr\' [A]', 'PLECS: Idr\' [A]'])
plot_in_subplots(figure_id, rotor_currents_pls, plt_linestyle='--')
plt.xlabel('Time [s]')
plt.show(block=False)
# Torque and speed
figure_id = 3
plt.figure(figure_id)
plt.title("Rotor currents (in synchronously rotating reference frame)")
set_time_series_labels(torque_speed_mo, ['Modelica: Torque [Nm]', 'Modelica: Speed [r/min]'])
plot_in_subplots(figure_id, torque_speed_mo)
set_time_series_labels(torque_speed_pls, ['PLECS: Torque [Nm]', 'PLECS: Speed [r/min]'])
plot_in_subplots(figure_id, torque_speed_pls, plt_linestyle='--')
plt.xlabel('Time [s]')
plt.show()
\ No newline at end of file
from dataprocessing.readtools import *
from dataprocessing.timeseries import *
path = 'C:\\Users\\mmi\\git\\PowerSystemSimulation\\DPsim\\VisualStudio\\DPsimVS2017\\'
logName = 'lvector-cim';
dataType = '.csv';
logFilename = path + logName + dataType;
ts_dpsim = read_timeseries_dpsim_cmpl(logFilename)
for ts in ts_dpsim:
ts_abs = ts.abs(ts.name + ' abs')
ts_phase = ts.phase(ts.name + ' phase')
print(ts.name + ': ' + str(ts_abs.values[0]) + '<' + str(ts_phase.values[0] * 180/np.pi))
from dataprocessing.readtools import *
from dataprocessing.timeseries import *
path = 'C:\\Users\\mmi\\git\\PowerSystemSimulation\\DPsim\\VisualStudio\\DPsimVS2017\\'
logName = 'lvector-cim';
dataType = '.csv';
logFilename = path + logName + dataType;
ts_dpsim = read_timeseries_dpsim_cmpl(logFilename)
for ts in ts_dpsim:
ts_abs = ts.abs(ts.name + ' abs')
ts_phase = ts.phase(ts.name + ' phase')
print(ts.name + ': ' + str(ts_abs.values[0]) + '<' + str(ts_phase.values[0] * 180/np.pi))
from dataprocessing.dpsim import *
from dataprocessing.plottools import *
path = 'D:\\path\\to\\logs\\'
logName = 'simulation_name_LeftVector'
logFilename = path + logName + '.csv'
ts_dpsim = read_timeseries_dpsim_cmpl(logFilename)
phasors = get_node_voltage_phasors(ts_dpsim)
print('Print phasors for all nodes at first time step:')
for node, phasor in phasors.items():
print(node + ': ' + str(phasor['abs'].values[0]) + '<' + str(phasor['phase'].values[0]))
print('Print phasors for all nodes at last time step:')