Skip to content

Commit 7952632

Browse files
committed
set nominal length
1 parent 029cf19 commit 7952632

13 files changed

Lines changed: 55 additions & 55 deletions

dyad/cascade_ff.dyad

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -384,7 +384,7 @@ the discrete-time model `DiscreteCascadeFFDyadBot` is identical except that
384384
`controller` is a `DiscreteCascadeFFController`.
385385
"""
386386
component CascadeFFDyadBot
387-
world = MultibodyComponents.PlanarMechanics.World(g = 9.82) {^world}
387+
world = MultibodyComponents.PlanarMechanics.World(g = 9.82, nominal_length = 0.1) {^world}
388388
plant = PlanarDyadBot(phi0 = phi0) {^plant}
389389
square = BlockComponents.Sources.Square(amplitude = 0.05, frequency = 1 / 10) {^square}
390390
"""
@@ -498,7 +498,7 @@ are sampled inside the controller. The sample interval is set by the top-level
498498
structural parameter `Ts`.
499499
"""
500500
component DiscreteCascadeFFDyadBot
501-
world = MultibodyComponents.PlanarMechanics.World(g = 9.82) {^world}
501+
world = MultibodyComponents.PlanarMechanics.World(g = 9.82, nominal_length = 0.1) {^world}
502502
plant = PlanarDyadBot(phi0 = phi0) {^plant}
503503
square = BlockComponents.Sources.Square(amplitude = 0.05, frequency = 1 / 10) {^square}
504504
"""

dyad/closed_loop.dyad

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ discrete-time model `DiscreteAngleControlledDyadBot` is identical except that
166166
The controller gains can be tuned with the script `scripts/tune_angle_pid.jl`.
167167
"""
168168
component AngleControlledDyadBot
169-
world = MultibodyComponents.PlanarMechanics.World(g = 9.82) {^world}
169+
world = MultibodyComponents.PlanarMechanics.World(g = 9.82, nominal_length = 0.1) {^world}
170170
plant = PlanarDyadBot(phi0 = phi0) {^plant}
171171
controller = AngleController(k_angle = k_angle, Ti_angle = Ti_angle, Td_angle = Td_angle) {^controller}
172172
"Proportional gain of the angle controller"
@@ -237,7 +237,7 @@ model except that the control system is a sampled-data `DiscreteAngleController`
237237
The sample interval is set by the top-level structural parameter `Ts`.
238238
"""
239239
component DiscreteAngleControlledDyadBot
240-
world = MultibodyComponents.PlanarMechanics.World(g = 9.82) {^world}
240+
world = MultibodyComponents.PlanarMechanics.World(g = 9.82, nominal_length = 0.1) {^world}
241241
plant = PlanarDyadBot(phi0 = phi0) {^plant}
242242
controller = DiscreteAngleController(k_angle = k_angle, Ti_angle = Ti_angle, Td_angle = Td_angle, Ts = Ts) {^controller}
243243
"Proportional gain of the angle controller"
@@ -611,7 +611,7 @@ and `scripts/tune_cascade_pid.jl`, or all simultaneously with
611611
`scripts/tune_cascade_structured.jl`.
612612
"""
613613
component CascadeControlledDyadBot
614-
world = MultibodyComponents.PlanarMechanics.World(g = 9.82) {^world}
614+
world = MultibodyComponents.PlanarMechanics.World(g = 9.82, nominal_length = 0.1) {^world}
615615
plant = PlanarDyadBot(phi0 = phi0) {^plant}
616616
square = BlockComponents.Sources.Square(amplitude = 0.05, frequency = 1 / 10) {^square}
617617
firstorder = BlockComponents.Continuous.FirstOrder(T = 0.1) {^firstorder}
@@ -636,10 +636,10 @@ relations
636636
initial firstorder1.x = 0.0
637637
connect(square.y, firstorder.u) {^id7}
638638
connect(firstorder.y, firstorder1.u) {^id8}
639-
connect(firstorder1.y, controller.pos_reference) {^id9}
640-
connect(plant.x, controller.pos_measurement) {^id10}
641-
connect(plant.theta, controller.angle_measurement) {^id11}
642-
connect(controller.torque, plant.torque) {^id12}
639+
connect(controller.torque, plant.torque) {^id9}
640+
connect(plant.theta, controller.angle_measurement) {^id10}
641+
connect(plant.x, controller.pos_measurement) {^id11}
642+
connect(firstorder1.y, controller.pos_reference) {^id12}
643643
metadata {
644644
"Dyad": {
645645
"tests": {"case1": {"stop": 20}},
@@ -663,30 +663,31 @@ metadata {
663663
}
664664
},
665665
"square": {
666-
"Dyad": {"placement": {"diagram": {"x1": -660, "y1": 430, "x2": -560, "y2": 530}}}
666+
"Dyad": {"placement": {"diagram": {"x1": -230, "y1": 450, "x2": -130, "y2": 550}}}
667667
},
668668
"firstorder": {
669-
"Dyad": {"placement": {"diagram": {"x1": -510, "y1": 430, "x2": -410, "y2": 530}}}
669+
"Dyad": {"placement": {"diagram": {"x1": -90, "y1": 450, "x2": 10, "y2": 550}}}
670670
},
671671
"firstorder1": {
672-
"Dyad": {"placement": {"diagram": {"x1": -350, "y1": 430, "x2": -250, "y2": 530}}}
672+
"Dyad": {"placement": {"diagram": {"x1": 60, "y1": 450, "x2": 160, "y2": 550}}}
673673
},
674674
"controller": {
675-
"Dyad": {"placement": {"diagram": {"x1": -180, "y1": 430, "x2": 60, "y2": 620}}}
675+
"Dyad": {"placement": {"diagram": {"x1": 240, "y1": 410, "x2": 480, "y2": 600}}}
676676
},
677677
"id7": {"Dyad": {"edges": [{"S": 1, "M": [], "E": 2}]}},
678678
"id8": {"Dyad": {"edges": [{"S": 1, "M": [], "E": 2}]}},
679-
"id9": {"Dyad": {"edges": [{"S": 1, "M": [], "E": 2}]}},
679+
"id9": {
680+
"Dyad": {"edges": [{"S": 1, "M": [{"x": 501, "y": 505}, {"x": 501, "y": 500}], "E": 2}]}
681+
},
680682
"id10": {
681683
"Dyad": {
682684
"edges": [
683685
{
684686
"S": 1,
685687
"M": [
686-
{"x": 840, "y": 468},
687-
{"x": 840, "y": 760},
688-
{"x": -190, "y": 760},
689-
{"x": -190, "y": 620}
688+
{"x": 820, "y": 492},
689+
{"x": 820, "y": 710},
690+
{"x": 412.79999999999995, "y": 710}
690691
],
691692
"E": 2
692693
}
@@ -698,18 +699,17 @@ metadata {
698699
"edges": [
699700
{
700701
"S": 1,
701-
"M": [
702-
{"x": 820, "y": 492},
703-
{"x": 820, "y": 700},
704-
{"x": 30, "y": 700},
705-
{"x": 30, "y": 620}
706-
],
702+
"M": [{"x": 850, "y": 468}, {"x": 850, "y": 760}, {"x": 304.8, "y": 760}],
707703
"E": 2
708704
}
709705
]
710706
}
711707
},
712-
"id12": {"Dyad": {"edges": [{"S": 1, "M": [], "E": 2}]}}
708+
"id12": {
709+
"Dyad": {
710+
"edges": [{"S": 1, "M": [{"x": 196.5, "y": 500}, {"x": 196.5, "y": 505}], "E": 2}]
711+
}
712+
}
713713
}
714714
}
715715
end
@@ -720,7 +720,7 @@ model except that the control system is a sampled-data `DiscreteCascadeControlle
720720
running on a common clock with period `Ts`.
721721
"""
722722
component DiscreteCascadeControlledDyadBot
723-
world = MultibodyComponents.PlanarMechanics.World(g = 9.82) {^world}
723+
world = MultibodyComponents.PlanarMechanics.World(g = 9.82, nominal_length = 0.1) {^world}
724724
plant = PlanarDyadBot(phi0 = phi0) {^plant}
725725
square = BlockComponents.Sources.Square(amplitude = 0.05, frequency = 1 / 10) {^square}
726726
firstorder = BlockComponents.Continuous.FirstOrder(T = 0.1) {^firstorder}

dyad/lqg.dyad

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ control input (`u`). The LQG design script `scripts/tune_lqg.jl` opens the
8282
loop at `u` and synthesizes an LQG controller from the linearized plant.
8383
"""
8484
component LQGTuningDyadBot
85-
world = MultibodyComponents.PlanarMechanics.World(g = 9.82) {^world}
85+
world = MultibodyComponents.PlanarMechanics.World(g = 9.82, nominal_length = 0.1) {^world}
8686
plant = PlanarDyadBot() {^plant}
8787
g_x = BlockComponents.Math.Gain(k = 1e-10) {^g_x}
8888
g_xd = BlockComponents.Math.Gain(k = 1e-10) {^g_xd}
@@ -197,7 +197,7 @@ measured position and tilt angle. Its single output is the motor torque.
197197
The position reference steps from zero to `step_height` at `step_time`.
198198
"""
199199
component LQGControlledDyadBot
200-
world = MultibodyComponents.PlanarMechanics.World(g = 9.82) {^world}
200+
world = MultibodyComponents.PlanarMechanics.World(g = 9.82, nominal_length = 0.1) {^world}
201201
plant = PlanarDyadBot(phi0 = phi0) {^plant}
202202
controller = BlockComponents.Continuous.StateSpace(nx = lqg_nx(), nu = 6, ny = 1, A = lqg_A(), B = lqg_B(), C = lqg_C(), D = lqg_D()) {^controller}
203203
step = BlockComponents.Sources.Step(final height = step_height, final start_time = step_time) {^step}

generated/AngleControlledDyadBot_definition.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ The controller gains can be tuned with the script `scripts/tune_angle_pid.jl`.
8787
### Components
8888
# Subcomponent world of type MultibodyComponents.PlanarMechanics.World
8989
world_overrides = __pop_subcomponent_overrides!(__overrides, "world")
90-
push!(__systems, @named world = MultibodyComponents.PlanarMechanics.World(; g=9.82, world_overrides...))
90+
push!(__systems, @named world = MultibodyComponents.PlanarMechanics.World(; g=9.82, nominal_length=0.1, world_overrides...))
9191
# Subcomponent plant of type DyadBotComponents.PlanarDyadBot
9292
plant_overrides = __pop_subcomponent_overrides!(__overrides, "plant")
9393
push!(__systems, @named plant = DyadBotComponents.PlanarDyadBot(; phi0=phi0, plant_overrides...))
@@ -106,8 +106,8 @@ The controller gains can be tuned with the script `scripts/tune_angle_pid.jl`.
106106
__assertions = []
107107

108108
### Equations
109-
push!(__eqs, connect(plant.theta, controller.measurement))
110109
push!(__eqs, connect(controller.torque, plant.torque))
110+
push!(__eqs, connect(plant.theta, controller.measurement))
111111

112112
# Return completely constructed System
113113
return System(__eqs, t, __vars, __params; systems=__systems, initial_conditions=__initial_conditions, guesses=__guesses, name, initialization_eqs=__initialization_eqs, bindings=__bindings, assertions=__assertions)

generated/CascadeControlledDyadBot_definition.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ and `scripts/tune_cascade_pid.jl`, or all simultaneously with
102102
### Components
103103
# Subcomponent world of type MultibodyComponents.PlanarMechanics.World
104104
world_overrides = __pop_subcomponent_overrides!(__overrides, "world")
105-
push!(__systems, @named world = MultibodyComponents.PlanarMechanics.World(; g=9.82, world_overrides...))
105+
push!(__systems, @named world = MultibodyComponents.PlanarMechanics.World(; g=9.82, nominal_length=0.1, world_overrides...))
106106
# Subcomponent plant of type DyadBotComponents.PlanarDyadBot
107107
plant_overrides = __pop_subcomponent_overrides!(__overrides, "plant")
108108
push!(__systems, @named plant = DyadBotComponents.PlanarDyadBot(; phi0=phi0, plant_overrides...))

generated/CascadeFFDyadBot_definition.jl

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -114,15 +114,15 @@ the discrete-time model `DiscreteCascadeFFDyadBot` is identical except that
114114
__assertions = []
115115

116116
### Equations
117-
push!(__eqs, connect(square.y, mux1.u))
118-
push!(__eqs, connect(mux1.y, refgen.u))
119-
push!(__eqs, connect(refgen.y, angle_ff.u, pos_ref.u, torque_ff.u))
120-
push!(__eqs, connect(angle_ff.y, controller.angle_ff))
121-
push!(__eqs, connect(pos_ref.y, controller.pos_reference))
122-
push!(__eqs, connect(torque_ff.y, controller.torque_ff))
123117
push!(__eqs, connect(plant.theta, controller.angle_measurement))
124118
push!(__eqs, connect(plant.x, controller.pos_measurement))
125119
push!(__eqs, connect(controller.torque, plant.torque))
120+
push!(__eqs, connect(torque_ff.y, controller.torque_ff))
121+
push!(__eqs, connect(angle_ff.y, controller.angle_ff))
122+
push!(__eqs, connect(pos_ref.y, controller.pos_reference))
123+
push!(__eqs, connect(refgen.y, pos_ref.u, angle_ff.u, torque_ff.u))
124+
push!(__eqs, connect(square.y, mux1.u))
125+
push!(__eqs, connect(mux1.y, refgen.u))
126126

127127
# Return completely constructed System
128128
return System(__eqs, t, __vars, __params; systems=__systems, initial_conditions=__initial_conditions, guesses=__guesses, name, initialization_eqs=__initialization_eqs, bindings=__bindings, assertions=__assertions)

generated/DiscreteAngleControlledDyadBot_definition.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ The sample interval is set by the top-level structural parameter `Ts`.
8282
### Components
8383
# Subcomponent world of type MultibodyComponents.PlanarMechanics.World
8484
world_overrides = __pop_subcomponent_overrides!(__overrides, "world")
85-
push!(__systems, @named world = MultibodyComponents.PlanarMechanics.World(; g=9.82, world_overrides...))
85+
push!(__systems, @named world = MultibodyComponents.PlanarMechanics.World(; g=9.82, nominal_length=0.1, world_overrides...))
8686
# Subcomponent plant of type DyadBotComponents.PlanarDyadBot
8787
plant_overrides = __pop_subcomponent_overrides!(__overrides, "plant")
8888
push!(__systems, @named plant = DyadBotComponents.PlanarDyadBot(; phi0=phi0, plant_overrides...))
@@ -101,8 +101,8 @@ The sample interval is set by the top-level structural parameter `Ts`.
101101
__assertions = []
102102

103103
### Equations
104-
push!(__eqs, connect(plant.theta, controller.measurement))
105104
push!(__eqs, connect(controller.torque, plant.torque))
105+
push!(__eqs, connect(plant.theta, controller.measurement))
106106

107107
# Return completely constructed System
108108
return System(__eqs, t, __vars, __params; systems=__systems, initial_conditions=__initial_conditions, guesses=__guesses, name, initialization_eqs=__initialization_eqs, bindings=__bindings, assertions=__assertions)

generated/DiscreteCascadeControlledDyadBot_definition.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ running on a common clock with period `Ts`.
9393
### Components
9494
# Subcomponent world of type MultibodyComponents.PlanarMechanics.World
9595
world_overrides = __pop_subcomponent_overrides!(__overrides, "world")
96-
push!(__systems, @named world = MultibodyComponents.PlanarMechanics.World(; g=9.82, world_overrides...))
96+
push!(__systems, @named world = MultibodyComponents.PlanarMechanics.World(; g=9.82, nominal_length=0.1, world_overrides...))
9797
# Subcomponent plant of type DyadBotComponents.PlanarDyadBot
9898
plant_overrides = __pop_subcomponent_overrides!(__overrides, "plant")
9999
push!(__systems, @named plant = DyadBotComponents.PlanarDyadBot(; phi0=phi0, plant_overrides...))
@@ -125,10 +125,10 @@ running on a common clock with period `Ts`.
125125
### Equations
126126
push!(__eqs, connect(square.y, firstorder.u))
127127
push!(__eqs, connect(firstorder.y, firstorder1.u))
128-
push!(__eqs, connect(firstorder1.y, controller.pos_reference))
129128
push!(__eqs, connect(plant.x, controller.pos_measurement))
130129
push!(__eqs, connect(plant.theta, controller.angle_measurement))
131130
push!(__eqs, connect(controller.torque, plant.torque))
131+
push!(__eqs, connect(firstorder1.y, controller.pos_reference))
132132

133133
# Return completely constructed System
134134
return System(__eqs, t, __vars, __params; systems=__systems, initial_conditions=__initial_conditions, guesses=__guesses, name, initialization_eqs=__initialization_eqs, bindings=__bindings, assertions=__assertions)

generated/DiscreteCascadeController_definition.jl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -164,17 +164,17 @@ torque.
164164
__assertions = []
165165

166166
### Equations
167-
push!(__eqs, connect(pos_reference, sampler_ref.u))
168167
push!(__eqs, connect(sampler_ref.y, pos_controller.u_s))
169-
push!(__eqs, connect(pos_measurement, sampler_x.u))
170-
push!(__eqs, connect(sampler_x.y, pos_controller.u_m))
171168
push!(__eqs, connect(pos_controller.y, gain1.u))
172169
push!(__eqs, connect(gain1.y, angle_controller.u_s))
173-
push!(__eqs, connect(angle_measurement, sampler_theta.u))
174-
push!(__eqs, connect(sampler_theta.y, angle_controller.u_m, clock.y))
175170
push!(__eqs, connect(angle_controller.y, gain.u))
176171
push!(__eqs, connect(gain.y, zoh.u))
177172
push!(__eqs, connect(zoh.y, torque))
173+
push!(__eqs, connect(sampler_theta.u, angle_measurement))
174+
push!(__eqs, connect(pos_measurement, sampler_x.u))
175+
push!(__eqs, connect(sampler_x.y, pos_controller.u_m))
176+
push!(__eqs, connect(sampler_theta.y, angle_controller.u_m, clock.y))
177+
push!(__eqs, connect(pos_reference, sampler_ref.u))
178178

179179
# Return completely constructed System
180180
return System(__eqs, t, __vars, __params; systems=__systems, initial_conditions=__initial_conditions, guesses=__guesses, name, initialization_eqs=__initialization_eqs, bindings=__bindings, assertions=__assertions)

generated/DiscreteCascadeFFController_definition.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ controller.
142142
push!(__eqs, connect(torque_ff, sampler_torqueff.u))
143143
push!(__eqs, connect(sampler_torqueff.y, angle_controller.u_ff))
144144
push!(__eqs, connect(angle_measurement, sampler_theta.u))
145-
push!(__eqs, connect(sampler_theta.y, angle_controller.u_m, clock.y))
145+
push!(__eqs, connect(sampler_theta.y, angle_controller.u_m))
146146
push!(__eqs, connect(angle_controller.y, gain.u))
147147
push!(__eqs, connect(gain.y, zoh.u))
148148
push!(__eqs, connect(zoh.y, torque))

0 commit comments

Comments
 (0)