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

Merge branch 'multisampling' into 'master'

update syn gen load step

See merge request acs/public/simulation/dpsim!117

Former-commit-id: c9cc1e56
parents c63094b4 c86bbb42
......@@ -11,6 +11,9 @@ logs/
logs_*/
wheelhouse/
*.csv
*.pdf
*.svg
*.png
# Folders
Libraries/
......
......@@ -69,5 +69,10 @@ int main(int argc, char *argv[]) {
sim.addLogger(logger);
sim.run();
//std::ofstream ofTopo("topology_graph.svg");
//sys.topologyGraph().render(ofTopo);
//std::ofstream ofDep("task_dependencies.svg");
//sim.dependencyGraph().render(ofDep);
return 0;
}
......@@ -73,12 +73,13 @@ void DP_SynGenDq7odTrapez_LoadStep(Real timeStep, Real finalTime, Real breakerCl
auto n1 = CPS::DP::Node::make("n1", PhaseType::ABC, initVoltN1);
// Components
auto gen = CPS::DP::Ph3::SynchronGeneratorDQTrapez::make("SynGen");
auto gen = CPS::DP::Ph3::SynchronGeneratorDQTrapez::make("SynGen", CPS::Logger::Level::info);
gen->setParametersFundamentalPerUnit(
nomPower, nomPhPhVoltRMS, nomFreq, poleNum, nomFieldCurr,
Rs, Ll, Lmd, Lmq, Rfd, Llfd, Rkd, Llkd, Rkq1, Llkq1, Rkq2, Llkq2, H,
initActivePower, initReactivePower, initTerminalVolt,
initVoltAngle, fieldVoltage, initMechPower);
gen->setMultisamplingRate(1);
auto res = CPS::DP::Ph3::SeriesResistor::make("R_load", Logger::Level::info);
res->setParameters(Rload);
......
77960354055e49661ef52955ad345020992ac66b
\ No newline at end of file
2c8d300f0409ca5de25084665c39204588b9f4e2
\ No newline at end of file
fb098a7e90b7df2a13fcfdc4978f1d63f1c7e70f
\ No newline at end of file
afe858ad1dc9d7ec33b9174d970c9c0a524a5be2
\ No newline at end of file
5544e325461c096bbade6e4ba00a2277713b323f
\ No newline at end of file
98c0350b2efbe9b68f897aa55790a8f8d6f645b8
\ No newline at end of file
d29124ca9499ffc6f8c7d74e69d4aa65209b342f
\ No newline at end of file
ac382373f17f9bff98f0216dc162a18d137252bc
\ No newline at end of file
%% Cell type:markdown id: tags:
# Multimachine
%% Cell type:code id: tags:
``` python
%%capture
%%bash
TOP=${TOP:-$(git rev-parse --show-toplevel)}
PATH=${TOP}/build/Examples/Cxx
DP_Multimachine_DQ_Parallel
```
%% Cell type:code id: tags:
``` python
import pandas as pd
from dpsim.MeasurementUtils import Measurement
import numpy as np
import matplotlib.pyplot as plt
```
%% Cell type:code id: tags:
``` python
logs_dir = '../../../logs_multimachine/'
gen_mean = []
gen_max = []
gen_std = []
for gens in range(1,21):
for threads in range(0,13,2):
seq_meas = []
for seq in range(1,51):
log_path = logs_dir + 'DP_Multimachine_th' + str(threads) + '_gen' + str(gens) + '_rep' + str(seq) + '/' \
+ 'DP_Multimachine_th' + str(threads) + '_gen' + str(gens) + '_rep' + str(seq) + '_step_times.log'
#print(log_path)
meas = Measurement.read_timestep_csv(log_path)['step_time'].data
# aggregate the measurements from the different iterations
seq_meas = np.concatenate( (seq_meas, meas), axis=0)
#print(seq_meas.shape)
#coupled_meas.append({'copies': copies, 'threads': threads, 'values': meas['step_time'].data})
gen_mean.append({'copies': gens, 'threads': threads, 'values': seq_meas.mean()})
gen_max.append({'copies': gens, 'threads': threads, 'values': seq_meas.max()})
gen_std.append({'copies': gens, 'threads': threads, 'values': seq_meas.std()})
#pd_coupled_meas = pd.DataFrame(coupled_meas)
pd_gen_mean = pd.DataFrame(gen_mean)
pd_gen_max = pd.DataFrame(gen_max)
pd_gen_std = pd.DataFrame(gen_std)
```
%% Cell type:code id: tags:
``` python
pd_gen_mean
```
%% Cell type:code id: tags:
``` python
import matplotlib.ticker as ticker
ax = plt.figure().gca()
ax.xaxis.set_major_locator(ticker.MultipleLocator(2))
xaxis = np.arange(1,21)
plt.plot(xaxis, pd_gen_mean.query('threads=='+str(0))['values'].values, label=str(0)+' threads', marker='o')
plt.plot(xaxis, pd_gen_mean.query('threads=='+str(2))['values'].values, label=str(2)+' threads', marker='o')
plt.plot(xaxis, pd_gen_mean.query('threads=='+str(4))['values'].values, label=str(4)+' threads', marker='o')
plt.plot(xaxis, pd_gen_mean.query('threads=='+str(8))['values'].values, label=str(8)+' threads', marker='o')
plt.plot(xaxis, pd_gen_mean.query('threads=='+str(12))['values'].values, label=str(12)+' threads', marker='o')
plt.plot(xaxis, pd_gen_mean.query('threads=='+str(0))['values'].values*1e3, label=str(0)+' threads', marker='o')
plt.plot(xaxis, pd_gen_mean.query('threads=='+str(2))['values'].values*1e3, label=str(2)+' threads', marker='o')
plt.plot(xaxis, pd_gen_mean.query('threads=='+str(4))['values'].values*1e3, label=str(4)+' threads', marker='o')
plt.plot(xaxis, pd_gen_mean.query('threads=='+str(8))['values'].values*1e3, label=str(8)+' threads', marker='o')
plt.plot(xaxis, pd_gen_mean.query('threads=='+str(12))['values'].values*1e3, label=str(12)+' threads', marker='o')
plt.ylim([0,0.0004])
#plt.ylim([0,0.0004])
plt.xlabel('number of system copies')
plt.ylabel('mean timestep duration (s)')
plt.ylabel('mean timestep duration (ms)')
plt.grid()
plt.legend()
plt.tight_layout()
plt.savefig('multimachine_parallel.pdf')
plt.savefig('multimachine_parallel.png', dpi=300)
```
%% Output
%% Cell type:code id: tags:
``` python
```
......
Supports Markdown
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