Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
ACS
Public
Power System Simulation and Optimization
DPsim
DPsim
Commits
25cb420c
Commit
25cb420c
authored
Oct 08, 2017
by
Steffen Vogel
🎅🏼
Browse files
some cleanups to the Python examples
Former-commit-id:
d6d1d987
parent
2814b14e
Changes
5
Hide whitespace changes
Inline
Side-by-side
.gitlab-ci.yml
View file @
25cb420c
...
...
@@ -42,10 +42,10 @@ docs:
test
:
stage
:
test
variables
:
PYTHONPATH
:
Source/build
script
:
-
mv Source/build/libdpsim.so Source/Tests/dpsim.so
-
cd Source/Tests
-
python3 run_tests.py
-
python3 Examples/Python/ci.py
image
:
${DOCKER_IMAGE}
tags
:
-
docker
Examples/Python/
ContinousIntegration
.py
→
Examples/Python/
ci
.py
View file @
25cb420c
File moved
Examples/Python/shmem1.py
View file @
25cb420c
...
...
@@ -2,13 +2,18 @@
import
dpsim
comps
=
[
dpsim
.
VoltSourceRes
(
"v_s"
,
1
,
0
,
10000
+
0j
,
1
),
dpsim
.
Inductor
(
"l_1"
,
1
,
2
,
1e-3
)]
evs
=
dpsim
.
ExternalVoltageSource
(
"v_ext"
,
2
,
0
,
0
+
0j
,
1
)
comps
.
append
(
evs
)
comps
=
[
dpsim
.
VoltSourceRes
(
"v_s"
,
1
,
0
,
10000
+
0j
,
1
),
dpsim
.
Inductor
(
"l_1"
,
1
,
2
,
1e-3
),
evs
]
intf
=
dpsim
.
open_shmem_interface
(
"/dpsim12"
,
"/dpsim21"
,
samplelen
=
2
)
intf
.
register_source
(
evs
,
0
,
1
)
intf
.
export_current
(
evs
,
0
,
1
)
sim
=
dpsim
.
Simulation
(
comps
,
duration
=
1
,
llog
=
"lvector-shmem1.csv"
)
sim
.
add_interface
(
intf
)
sim
.
start
()
...
...
Examples/Python/shmem2.py
View file @
25cb420c
...
...
@@ -2,12 +2,17 @@
import
dpsim
comps
=
[
dpsim
.
LinearResistor
(
"r_1"
,
1
,
0
,
1
)]
ecs
=
dpsim
.
ExternalCurrentSource
(
"i_ext"
,
1
,
0
,
0
+
0j
)
comps
.
append
(
ecs
)
comps
=
[
dpsim
.
LinearResistor
(
"r_1"
,
1
,
0
,
1
),
ecs
]
intf
=
dpsim
.
open_shmem_interface
(
"/dpsim21"
,
"/dpsim12"
,
samplelen
=
2
)
intf
.
register_source
(
ecs
,
0
,
1
)
intf
.
export_voltage
(
1
,
0
,
0
,
1
)
sim
=
dpsim
.
Simulation
(
comps
,
duration
=
1
,
llog
=
"lvector-shmem2.csv"
)
sim
.
add_interface
(
intf
)
sim
.
start
()
...
...
Examples/Python/
pyExamples
.py
→
Examples/Python/
sim1
.py
View file @
25cb420c
...
...
@@ -11,11 +11,14 @@ def doExample(basename, comps, timestep, duration):
sim
.
wait
()
def
simExample1
(
timestep
=
1e-3
):
comps
=
[
dpsim
.
VoltSourceRes
(
"v_in"
,
1
,
0
,
10
,
1
),
comps
=
[
dpsim
.
VoltSourceRes
(
"v_in"
,
1
,
0
,
10
,
1
),
dpsim
.
Inductor
(
"l_1"
,
1
,
2
,
0.02
),
dpsim
.
Inductor
(
"l_2"
,
2
,
0
,
0.1
),
dpsim
.
Inductor
(
"l_3"
,
2
,
3
,
0.05
),
dpsim
.
Inductor
(
"r_2"
,
3
,
0
,
2
)]
dpsim
.
Inductor
(
"r_2"
,
3
,
0
,
2
)
]
basename
=
"SimulationExample1_"
+
str
(
timestep
)
doExample
(
basename
,
comps
,
timestep
,
0.3
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment