Skip to content

Commit eae592b

Browse files
committed
refactor: describe x as the state; pass name to SystemModel; phi_rel0 defaults to 0.0 instead of guessing.
1 parent 71d65cc commit eae592b

File tree

3 files changed

+8
-6
lines changed

3 files changed

+8
-6
lines changed

src/Blocks/continuous.jl

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@ Initial value of integrator state ``x`` can be set with `x`
1515
1616
# Unknowns:
1717
18-
- `x`: Unknown of Integrator (with initial guess of 0.0)
18+
- `x`: State of Integrator (with initial guess of 0.0)
1919
"""
2020
@mtkmodel Integrator begin
2121
@extend u, y = siso = SISO()
2222
@variables begin
23-
x(t), [description = "Unknown of Integrator", guess = 0.0]
23+
x(t), [description = "State of Integrator", guess = 0.0]
2424
end
2525
@parameters begin
2626
k = 1, [description = "Gain"]
@@ -30,6 +30,7 @@ Initial value of integrator state ``x`` can be set with `x`
3030
y ~ x
3131
end
3232
end
33+
3334
"""
3435
Derivative(; name, k = 1, T, x = 0.0)
3536

src/Mechanical/Rotational/components.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ Linear 1D rotational spring
8686
# Parameters:
8787
8888
- `c`: [`N.m/rad`] Spring constant
89-
- `phi_rel0`: [`rad`] Unstretched spring angle
89+
- `phi_rel0`: [`rad`] Unstretched spring angle. Defaults to 0.0.
9090
"""
9191
@mtkmodel Spring begin
9292
@extend phi_rel, tau = partial_comp = PartialCompliant()
@@ -156,7 +156,7 @@ Linear 1D rotational spring and damper
156156
157157
- `d`: [`N.m.s/rad`] Damping constant
158158
- `c`: [`N.m/rad`] Spring constant
159-
- `phi_rel0`: [`rad`] Unstretched spring angle
159+
- `phi_rel0`: [`rad`] Unstretched spring angle. Defaults to 0.0
160160
"""
161161
@mtkmodel SpringDamper begin
162162
@extend phi_rel, w_rel, tau = partial_comp = PartialCompliantWithRelativeStates()
@@ -167,7 +167,7 @@ Linear 1D rotational spring and damper
167167
@parameters begin
168168
d, [description = "Damping constant"]
169169
c, [description = "Spring constant"]
170-
phi_rel0, [description = "Unstretched spring angle", guess = 0.0]
170+
phi_rel0 = 0.0, [description = "Unstretched spring angle"]
171171
end
172172
@equations begin
173173
tau_c ~ c * (phi_rel - phi_rel0)

test/Blocks/test_analysis_points.jl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,8 @@ function SystemModel(u = nothing; name = :model)
174174
spring,
175175
damper,
176176
u
177-
])
177+
],
178+
name)
178179
end
179180
ODESystem(eqs, t; systems = [torque, inertia1, inertia2, spring, damper], name)
180181
end

0 commit comments

Comments
 (0)