Skip to content

Commit d27d372

Browse files
ven-kAayushSabharwal
authored andcommitted
metadata(components): adds units and descriptions to TranslationalPosition components
1 parent d70bc05 commit d27d372

File tree

2 files changed

+27
-31
lines changed

2 files changed

+27
-31
lines changed

src/Mechanical/TranslationalPosition/components.jl

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Flange fixed in housing at a given position.
1313
"""
1414
@mtkmodel Fixed begin
1515
@parameters begin
16-
s_0 = 0
16+
s_0 = 0, [description = "Fixed offset position of housing", unit = u"m"]
1717
end
1818
@components begin
1919
flange = Flange(; s = s_0)
@@ -31,26 +31,28 @@ Sliding mass with inertia
3131
# Parameters:
3232
3333
- `m`: [kg] Mass of sliding mass
34-
- `s_0`: [m] Initial value of absolute position of sliding mass
35-
- `v_0`: [m/s] Initial value of absolute linear velocity of sliding mass
3634
3735
# States:
3836
39-
- `s`: [m] Absolute position of sliding mass
40-
- `v`: [m/s] Absolute linear velocity of sliding mass (= der(s))
37+
- `s`: [m] Absolute position of sliding mass. It accepts an initial value, which defaults to 0.0.
38+
- `v`: [m/s] Absolute linear velocity of sliding mass (= der(s)). It accepts an initial value, which defaults to 0.0.
39+
- `f`: [N] Force. It accepts an initial value, which defaults to 0.0.
4140
4241
# Connectors:
4342
4443
- `flange: 1-dim. translational flange of mass`
4544
"""
4645
@mtkmodel Mass begin
4746
@parameters begin
48-
m
47+
m, [description = "Mass of sliding mass", unit = u"kg"]
4948
end
5049
@variables begin
51-
s(t) = 0.0
52-
v(t) = 0.0
53-
f(t) = 0.0
50+
s(t) = 0.0, [description = "Absolute position of sliding mass", unit = u"m"]
51+
function v(t)
52+
0.0,
53+
[description = "Absolute linear velocity of sliding mass", unit = u"m*s^-1"]
54+
end
55+
f(t) = 0.0, [description = "Force", unit = u"N"]
5456
end
5557
@components begin
5658
flange = Flange(; s = s)
@@ -158,7 +160,7 @@ Linear 1D translational damper
158160
"""
159161
@mtkmodel Damper begin
160162
@parameters begin
161-
d
163+
d, [description = "Damping constant", unit = u"N.s/m"]
162164
end
163165
@variables begin
164166
va(t) = 0.0

src/Mechanical/TranslationalPosition/utils.jl

Lines changed: 15 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
@connector Flange begin
2-
s(t)
3-
f(t), [connect = Flow]
2+
s(t), [description = "Absolute position of flange", unit = u"m"]
3+
f(t), [connect = Flow, description = " Cut force into the flange", unit = u"N"]
44
end
55
Base.@doc """
66
Flange(;name)
@@ -13,8 +13,8 @@ Base.@doc """
1313
""" Flange
1414

1515
@connector Support begin
16-
s(t)
17-
f(t), [connect = Flow]
16+
s(t), [description = "Absolute position of the support/housing", unit = u"m"]
17+
f(t), [connect = Flow, description = "Cut force into the flange", unit = u"N"]
1818
end
1919
Base.@doc """
2020
Support(;name)
@@ -36,16 +36,16 @@ Partial model for the compliant connection of two translational 1-dim. flanges.
3636
- `s_rel`: [m] Relative distance (= flange_b.s - flange_a.s). It accepts an initial value, which defaults to 0.0.
3737
- `f`: [N] Force between flanges (= flange_b.f). It accepts an initial value, which defaults to 0.0.
3838
"""
39-
@mtkmodel PartialCompliant begin#(; name, s_rel_start = 0.0, f_start = 0.0)
39+
@mtkmodel PartialCompliant begin
4040
@components begin
4141
flange_a = Flange()
4242
flange_b = Flange()
4343
end
4444
@variables begin
4545
v_a(t) = 0.0
4646
v_b(t) = 0.0
47-
s_rel(t) = 0.0
48-
f(t) = 0.0
47+
s_rel(t) = 0.0, [description = "Relative distance ", unit = u"m"]
48+
f(t) = 0.0, [description = "Force between flanges", unit = u"N"]
4949
end
5050
@equations begin
5151
D(flange_a.s) ~ v_a
@@ -61,18 +61,9 @@ end
6161
6262
Partial model for the compliant connection of two translational 1-dim. flanges.
6363
64-
# Parameters:
65-
66-
- `s_rel_start`: [m] Initial relative distance
67-
- `v_rel_start`: [m/s] Initial relative linear velocity (= der(s_rel))
68-
- `a_rel_start`: [m/s²] Initial relative linear acceleration (= der(v_rel))
69-
- `f_start`: [N] Initial force between flanges
64+
# States:
7065
71-
# States:
72-
73-
- `s_rel`: [m] Relative distance (= flange_b.phi - flange_a.phi)
74-
- `v_rel`: [m/s] Relative linear velocity (= der(s_rel))
75-
- `a_rel`: [m/s²] Relative linear acceleration (= der(v_rel))
66+
- `delta_s`: [m]
7667
- `f`: [N] Force between flanges (= flange_b.f)
7768
"""
7869
@mtkmodel PartialCompliantWithRelativeStates begin
@@ -82,7 +73,7 @@ Partial model for the compliant connection of two translational 1-dim. flanges.
8273
end
8374
@variables begin
8475
delta_s(t) = 0.0
85-
f(t) = 0.0
76+
f(t) = 0.0, [description = "Force between flanges", unit = u"N"]
8677
end
8778
@equations begin
8879
delta_s ~ flange_a.s - flange_b.s
@@ -107,7 +98,8 @@ Partial model for a component with one translational 1-dim. shaft flange and a s
10798
@component function PartialElementaryOneFlangeAndSupport2(; name, use_support = false)
10899
@named flange = Flange()
109100
sys = [flange]
110-
@variables s_support(t)
101+
@variables s_support(t),
102+
[description = "Absolute position of support flange", unit = u"m"]
111103
if use_support
112104
@named support = Support()
113105
eqs = [support.s ~ s_support
@@ -136,7 +128,9 @@ Partial model for a component with two translational 1-dim. flanges and a suppor
136128
@named flange_a = Flange()
137129
@named flange_b = Flange()
138130
sys = [flange_a, flange_b]
139-
@variables s_support(t) = 0.0
131+
@variables function s_support(t)
132+
0.0, [description = "Absolute position of support flange", unit = u"m"]
133+
end
140134
if use_support
141135
@named support = Support()
142136
eqs = [support.s ~ s_support

0 commit comments

Comments
 (0)