Commit 25cb420c authored by Steffen Vogel's avatar Steffen Vogel 🎅🏼
Browse files

some cleanups to the Python examples


Former-commit-id: d6d1d987
parent 2814b14e
......@@ -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
......@@ -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()
......
......@@ -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()
......
......@@ -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)
......
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