Skip to content

Commit 21df461

Browse files
ven-kChrisRackauckas
authored andcommitted
docs: set MTK to 8 and update docs with new Mass and Damper
1 parent fc86b99 commit 21df461

File tree

2 files changed

+13
-13
lines changed

2 files changed

+13
-13
lines changed

docs/src/connectors/connections.md

+12-12
Original file line numberDiff line numberDiff line change
@@ -134,8 +134,8 @@ Now using the Translational library based on velocity, we can see the same relat
134134
using ModelingToolkitStandardLibrary
135135
const TV = ModelingToolkitStandardLibrary.Mechanical.Translational
136136
137-
@named damping = TV.Damper(d = 1, va = 1)
138-
@named body = TV.Mass(m = 1, v_0 = 1)
137+
@named damping = TV.Damper(d = 1, flange_a.v = 1)
138+
@named body = TV.Mass(m = 1, v = 1)
139139
@named ground = TV.Fixed()
140140
141141
eqs = [connect(damping.flange_a, body.flange)
@@ -167,8 +167,8 @@ Now, let's consider the position-based approach. We can build the same model wi
167167
```@example connections
168168
const TP = ModelingToolkitStandardLibrary.Mechanical.TranslationalPosition
169169
170-
@named damping = TP.Damper(d = 1, va = 1)
171-
@named body = TP.Mass(m = 1, v_0 = 1)
170+
@named damping = TP.Damper(d = 1, va = 1, vb = 0.0)
171+
@named body = TP.Mass(m = 1, v = 1)
172172
@named ground = TP.Fixed(s_0 = 0)
173173
174174
eqs = [connect(damping.flange_a, body.flange)
@@ -197,10 +197,10 @@ plot(p1, p2, p3)
197197

198198
The question then arises, can the position be plotted when using the Mechanical Translational Domain based on the Velocity Across variable? Yes, we can! There are 2 solutions:
199199

200-
1. the `Mass` component will add the position variable when the `s_0` parameter is used to set an initial position. Otherwise, the component does not track the position.
200+
1. the `Mass` component will add the position variable when the `s` parameter is used to set an initial position. Otherwise, the component does not track the position.
201201

202202
```julia
203-
@named body = TV.Mass(m = 1, v_0 = 1, s_0 = 0)
203+
@named body = TV.Mass(m = 1, v = 1, s = 0)
204204
```
205205

206206
2. implement a `PositionSensor`
@@ -223,8 +223,8 @@ In this problem, we have a mass, spring, and damper which are connected to a fix
223223
The damper will connect the flange/flange 1 (`flange_a`) to the mass, and flange/flange 2 (`flange_b`) to the fixed point. For both position- and velocity-based domains, we set the damping constant `d=1` and `va=1` and leave the default for `v_b_0` at 0. For the position domain, we also need to set the initial positions for `flange_a` and `flange_b`.
224224

225225
```@example connections
226-
@named dv = TV.Damper(d = 1, va = 1)
227-
@named dp = TP.Damper(d = 1, va = 1, flange_a__s = 3, flange_b__s = 1)
226+
@named dv = TV.Damper(d = 1, flange_a.v = 1)
227+
@named dp = TP.Damper(d = 1, va = 1, vb = 0.0, flange_a__s = 3, flange_b__s = 1)
228228
nothing # hide
229229
```
230230

@@ -233,18 +233,18 @@ nothing # hide
233233
The spring will connect the flange/flange 1 (`flange_a`) to the mass, and flange/flange 2 (`flange_b`) to the fixed point. For both position- and velocity-based domains, we set the spring constant `k=1`. The velocity domain then requires the initial velocity `va` and initial spring stretch `delta_s`. The position domain instead needs the initial positions for `flange_a` and `flange_b` and the natural spring length `l`.
234234

235235
```@example connections
236-
@named sv = TV.Spring(k = 1, va = 1, delta_s = 1)
236+
@named sv = TV.Spring(k = 1, flange_a__v = 1, delta_s = 1)
237237
@named sp = TP.Spring(k = 1, flange_a__s = 3, flange_b__s = 1, l = 1)
238238
nothing # hide
239239
```
240240

241241
#### Mass
242242

243-
For both position- and velocity-based domains, we set the mass `m=1` and initial velocity `v_0=1`. Like the damper, the position domain requires the position initial conditions set as well.
243+
For both position- and velocity-based domains, we set the mass `m=1` and initial velocity `v=1`. Like the damper, the position domain requires the position initial conditions set as well.
244244

245245
```@example connections
246-
@named bv = TV.Mass(m = 1, v_0 = 1)
247-
@named bp = TP.Mass(m = 1, v_0 = 1, s_0 = 3)
246+
@named bv = TV.Mass(m = 1, v = 1)
247+
@named bp = TP.Mass(m = 1, v = 1, s = 3)
248248
nothing # hide
249249
```
250250

src/Mechanical/TranslationalPosition/components.jl

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ Flange fixed in housing at a given position.
1111
1212
- `flange: 1-dim. translational flange`
1313
"""
14-
@mtkmodel Fixed begin#(; name, s_0 = 0.0)
14+
@mtkmodel Fixed begin
1515
@parameters begin
1616
s_0
1717
end

0 commit comments

Comments
 (0)