Skip to content

Commit 1c30113

Browse files
add a runner script and change the parameters to give a nice plot
1 parent 5291124 commit 1c30113

File tree

3 files changed

+20
-7
lines changed

3 files changed

+20
-7
lines changed

Project.toml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,16 @@ DynamicQuantities = "06fc5a27-2a28-4c7c-a15d-362465fb6821"
88
JuliaSimBase = "9c9cc66b-a38b-4ec4-8b59-87b54775939f"
99
ModelingToolkit = "961ee093-0014-501f-94e3-6117800e7a78"
1010
OrdinaryDiffEq = "1dea7af3-3e70-54e6-95c3-0bf5283fa5ed"
11+
Plots = "91a5bcdd-55d7-5caf-9e0b-520d859cae80"
1112
PrecompileTools = "aea7be01-6a6a-4083-8856-8a6e6704d82a"
1213
RuntimeGeneratedFunctions = "7e49a35a-f44a-4d26-94aa-eba1b4ca6b47"
1314
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
1415

1516
[compat]
1617
DynamicQuantities = "=0.13.1"
17-
JuliaSimBase = "=1.1"
18-
ModelingToolkit = "=9.22.0"
19-
OrdinaryDiffEq = "=6.83.0"
18+
JuliaSimBase = "0.1"
19+
ModelingToolkit = "9.22.0"
20+
OrdinaryDiffEq = "6.83.0"
2021
PrecompileTools = "=1.2.1"
2122
RuntimeGeneratedFunctions = "=0.5.12"
2223

jsml/SpringDamper.jsml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
11
component SpringDamper
2-
parameter k::Real = 1M
3-
parameter F::Real = 100
4-
parameter d::Real = 10
2+
parameter k::Real = 1
3+
parameter F::Real = 1
4+
parameter d::Real = 1
55
variable x::Real
66
variable x_dot::Real
77
variable x_ddot::Real
88
relations
99
der(x) = x_dot
1010
der(x_dot) = x_ddot
1111
F = d*x_dot+k*x
12-
end
12+
end
13+
14+
15+

test/springdamper.jl

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
using ExampleComponents
2+
using OrdinaryDiffEq, ModelingToolkit
3+
4+
@mtkbuild springdamper = SpringDamper()
5+
prob = ODEProblem(springdamper, [springdamper.x => 1.0], (0.0, 1.0))
6+
sol = solve(prob)
7+
8+
using Plots
9+
plot(sol)

0 commit comments

Comments
 (0)