LIBRARY
Sources.Tests.Torque2
Test for Torque2: two inertias driven by a torque acting between them, matching the MSL test topology.
VelocitySource (sine, f=1 Hz) → inertia_a (J=3) → Torque2 → inertia_b (J=3) ↑ sine (f=1 Hz)
inertia_b is free on its outer flange. With tau = sin(2πt), and the flow sign convention at the connection (connect sums flow to zero), inertia_b sees +tau:
J_b * a_b = +tau → a_b = sin(2πt)/3
w_b(t) = (1 - cos(2πt))/(6π)
At t=1.0: w_b = 0
phi_b(t) = t/(6π) - sin(2πt)/(12π²)
At t=1.0: phi_b ≈ 1/(6π) ≈ 0.05305
Usage
RotationalComponents.Sources.Tests.Torque2()
Behavior
Source
dyad
"""
Test for Torque2: two inertias driven by a torque acting between them, matching the MSL test topology.
VelocitySource (sine, f=1 Hz) → inertia_a (J=3) → Torque2 → inertia_b (J=3)
↑
sine (f=1 Hz)
inertia_b is free on its outer flange. With tau = sin(2πt), and the flow sign
convention at the connection (connect sums flow to zero), inertia_b sees +tau:
- J_b * a_b = +tau → a_b = sin(2πt)/3
- w_b(t) = (1 - cos(2πt))/(6π)
- At t=1.0: w_b = 0
- phi_b(t) = t/(6π) - sin(2πt)/(12π²)
- At t=1.0: phi_b ≈ 1/(6π) ≈ 0.05305
"""
test component Torque2
"Fixed support for velocity source"
fixed = RotationalComponents.Components.Fixed() {
"Dyad": {"placement": {"diagram": {"x1": 285, "x2": 385, "y1": 350, "y2": 450}}}
}
"Sine signal for velocity reference (amplitude=1, f=1 Hz)"
velocity_sine = BlockComponents.Sources.Sine(amplitude = 1, frequency = 1) {
"Dyad": {"placement": {"diagram": {"x1": 20, "x2": 120, "y1": 140, "y2": 240}}}
}
"Velocity source prescribing inertia_a velocity (Exact mode)"
velocity = RotationalComponents.Sources.VelocitySource(ref_type = RotationalComponents.Sources.ReferenceType.Exact()) {
"Dyad": {"placement": {"diagram": {"x1": 155, "x2": 255, "y1": 140, "y2": 240}}}
}
"First inertia (J=3), velocity-driven side"
inertia_a = RotationalComponents.Components.Inertia(J = 3) {
"Dyad": {"placement": {"diagram": {"x1": 285, "x2": 385, "y1": 140, "y2": 240}}}
}
"Torque2 under test"
torque2 = RotationalComponents.Sources.Torque2() {
"Dyad": {"placement": {"diagram": {"x1": 415, "x2": 515, "y1": 140, "y2": 240}}}
}
"Sine signal for torque input (amplitude=1, f=1 Hz)"
torque_sine = BlockComponents.Sources.Sine(amplitude = 1, frequency = 1) {"Dyad": {"placement": {"diagram": {"x1": 280, "x2": 380, "y1": 0, "y2": 100}}}}
"Second inertia (J=3), free side"
inertia_b = RotationalComponents.Components.Inertia(J = 3) {
"Dyad": {"placement": {"diagram": {"x1": 545, "x2": 645, "y1": 140, "y2": 240}}}
}
relations
initial inertia_a.phi = 0
initial inertia_b.phi = 0
initial inertia_b.w = 0
connect(velocity_sine.y, velocity.w_ref) {"Dyad": {"edges": [{"S": 1, "M": [], "E": 2}], "path": {}}}
connect(velocity.support, fixed.spline) {
"Dyad": {
"edges": [{"S": 1, "M": [{"x": 205, "y": 295}, {"x": 335, "y": 295}], "E": 2}],
"path": {}
}
}
connect(velocity.spline, inertia_a.spline_a) {"Dyad": {"edges": [{"S": 1, "M": [], "E": 2}], "path": {}}}
connect(inertia_a.spline_b, torque2.spline_a) {"Dyad": {"edges": [{"S": 1, "M": [], "E": 2}], "path": {}}}
connect(torque2.spline_b, inertia_b.spline_a) {"Dyad": {"edges": [{"S": 1, "M": [], "E": 2}], "path": {}}}
connect(torque_sine.y, torque2.tau) {"Dyad": {"edges": [{"S": 1, "M": [{"x": 465, "y": 50}], "E": 2}], "path": {}}}
metadata {
"Dyad": {
"icons": {"default": "dyad://RotationalComponents/Example.svg"},
"tests": {
"case1": {
"stop": 1,
"atol": {"inertia_b.phi": 0.001, "inertia_b.w": 0.001, "inertia_a.w": 0.001},
"expect": {
"initial": {"inertia_a.phi": 0, "inertia_b.phi": 0, "inertia_b.w": 0},
"final": {"inertia_b.phi": 0.05305, "inertia_b.w": 0, "inertia_a.w": 0},
"signals": ["inertia_b.phi", "inertia_b.w", "inertia_a.w", "inertia_a.phi"]
}
}
}
}
}
endFlattened Source
dyad
"""
Test for Torque2: two inertias driven by a torque acting between them, matching the MSL test topology.
VelocitySource (sine, f=1 Hz) → inertia_a (J=3) → Torque2 → inertia_b (J=3)
↑
sine (f=1 Hz)
inertia_b is free on its outer flange. With tau = sin(2πt), and the flow sign
convention at the connection (connect sums flow to zero), inertia_b sees +tau:
- J_b * a_b = +tau → a_b = sin(2πt)/3
- w_b(t) = (1 - cos(2πt))/(6π)
- At t=1.0: w_b = 0
- phi_b(t) = t/(6π) - sin(2πt)/(12π²)
- At t=1.0: phi_b ≈ 1/(6π) ≈ 0.05305
"""
test component Torque2
"Fixed support for velocity source"
fixed = RotationalComponents.Components.Fixed() {
"Dyad": {"placement": {"diagram": {"x1": 285, "x2": 385, "y1": 350, "y2": 450}}}
}
"Sine signal for velocity reference (amplitude=1, f=1 Hz)"
velocity_sine = BlockComponents.Sources.Sine(amplitude = 1, frequency = 1) {
"Dyad": {"placement": {"diagram": {"x1": 20, "x2": 120, "y1": 140, "y2": 240}}}
}
"Velocity source prescribing inertia_a velocity (Exact mode)"
velocity = RotationalComponents.Sources.VelocitySource(ref_type = RotationalComponents.Sources.ReferenceType.Exact()) {
"Dyad": {"placement": {"diagram": {"x1": 155, "x2": 255, "y1": 140, "y2": 240}}}
}
"First inertia (J=3), velocity-driven side"
inertia_a = RotationalComponents.Components.Inertia(J = 3) {
"Dyad": {"placement": {"diagram": {"x1": 285, "x2": 385, "y1": 140, "y2": 240}}}
}
"Torque2 under test"
torque2 = RotationalComponents.Sources.Torque2() {
"Dyad": {"placement": {"diagram": {"x1": 415, "x2": 515, "y1": 140, "y2": 240}}}
}
"Sine signal for torque input (amplitude=1, f=1 Hz)"
torque_sine = BlockComponents.Sources.Sine(amplitude = 1, frequency = 1) {"Dyad": {"placement": {"diagram": {"x1": 280, "x2": 380, "y1": 0, "y2": 100}}}}
"Second inertia (J=3), free side"
inertia_b = RotationalComponents.Components.Inertia(J = 3) {
"Dyad": {"placement": {"diagram": {"x1": 545, "x2": 645, "y1": 140, "y2": 240}}}
}
relations
initial inertia_a.phi = 0
initial inertia_b.phi = 0
initial inertia_b.w = 0
connect(velocity_sine.y, velocity.w_ref) {"Dyad": {"edges": [{"S": 1, "M": [], "E": 2}], "path": {}}}
connect(velocity.support, fixed.spline) {
"Dyad": {
"edges": [{"S": 1, "M": [{"x": 205, "y": 295}, {"x": 335, "y": 295}], "E": 2}],
"path": {}
}
}
connect(velocity.spline, inertia_a.spline_a) {"Dyad": {"edges": [{"S": 1, "M": [], "E": 2}], "path": {}}}
connect(inertia_a.spline_b, torque2.spline_a) {"Dyad": {"edges": [{"S": 1, "M": [], "E": 2}], "path": {}}}
connect(torque2.spline_b, inertia_b.spline_a) {"Dyad": {"edges": [{"S": 1, "M": [], "E": 2}], "path": {}}}
connect(torque_sine.y, torque2.tau) {"Dyad": {"edges": [{"S": 1, "M": [{"x": 465, "y": 50}], "E": 2}], "path": {}}}
metadata {
"Dyad": {
"icons": {"default": "dyad://RotationalComponents/Example.svg"},
"tests": {
"case1": {
"stop": 1,
"atol": {"inertia_b.phi": 0.001, "inertia_b.w": 0.001, "inertia_a.w": 0.001},
"expect": {
"initial": {"inertia_a.phi": 0, "inertia_b.phi": 0, "inertia_b.w": 0},
"final": {"inertia_b.phi": 0.05305, "inertia_b.w": 0, "inertia_a.w": 0},
"signals": ["inertia_b.phi", "inertia_b.w", "inertia_a.w", "inertia_a.phi"]
}
}
}
}
}
endTest Cases
Test Case case1
julia
pltjulia
pltjulia
pltjulia
pltRelated
Examples
Experiments
Analyses
Tests