LIBRARY
Examples.ElasticBearing
Example to show possible usage of support flange.
The gearbox is not connected rigidly to the ground, but by a spring-damper system. This allows examination of the gearbox housing dynamics. A multi-sensor measures the angular velocity, torque, and power between the housing inertia and the spring-damper connected to the fixed ground.
Corresponds to Modelica.Mechanics.Rotational.Examples.ElasticBearing. StopTime=10.0, Interval=0.01.
Usage
RotationalComponents.Examples.ElasticBearing()
Behavior
julia
using RotationalComponents #hide
using ModelingToolkit #hide
@named sys = RotationalComponents.Examples.ElasticBearing() #hide
let eqs = full_equations(sys); Base.length(eqs) > 25 ? nothing : eqs end #hide<< @example-block not executed in draft mode >>Source
dyad
"""
Example to show possible usage of support flange.
The gearbox is not connected rigidly to the ground, but by a spring-damper
system. This allows examination of the gearbox housing dynamics. A multi-sensor
measures the angular velocity, torque, and power between the housing inertia
and the spring-damper connected to the fixed ground.
Corresponds to Modelica.Mechanics.Rotational.Examples.ElasticBearing.
StopTime=10.0, Interval=0.01.
"""
example component ElasticBearing
"Motor shaft inertia, J=1 kg.m^2."
shaft = RotationalComponents.Components.Inertia(J = 1) {
"Dyad": {"placement": {"diagram": {"x1": 405, "x2": 505, "y1": 20, "y2": 120}}}
}
"Load inertia, J=50 kg.m^2."
load = RotationalComponents.Components.Inertia(J = 50) {
"Dyad": {"placement": {"diagram": {"x1": 1060, "x2": 1160, "y1": 20, "y2": 120}}}
}
"Torsional spring between gear output and load, c=1e3 N.m/rad."
spring = RotationalComponents.Components.Spring(c = 1e3) {
"Dyad": {"placement": {"diagram": {"x1": 925, "x2": 1025, "y1": 20, "y2": 120}}}
}
"Fixed mechanical ground."
fixed = RotationalComponents.Components.Fixed() {
"Dyad": {"placement": {"diagram": {"x1": 280, "x2": 380, "y1": 245, "y2": 345}}}
}
"Spring-damper connecting housing to ground, c=1e5 N.m/rad, d=5 N.m.s/rad."
spring_damper = RotationalComponents.Components.SpringDamper(c = 1e5, d = 5) {
"Dyad": {"placement": {"diagram": {"x1": 405, "x2": 505, "y1": 140, "y2": 240}}}
}
"Torque source driven by ramp signal (useSupport=true in MSL)."
torque = RotationalComponents.Sources.TorqueSource() {
"Dyad": {"placement": {"diagram": {"x1": 155, "x2": 255, "y1": 20, "y2": 120}}}
}
"Ramp signal for driving torque, height=100 N.m over 5 s."
ramp = BlockComponents.Sources.Ramp(duration = 5, height = 100) {"Dyad": {"placement": {"diagram": {"x1": 20, "x2": 120, "y1": 20, "y2": 120}}}}
"Ideal gear with ratio=3 (useSupport=true in MSL)."
ideal_gear = RotationalComponents.Components.IdealGear(ratio = 3) {
"Dyad": {"placement": {"diagram": {"x1": 795, "x2": 895, "y1": 20, "y2": 120}}}
}
"Housing inertia, J=5 kg.m^2."
housing = RotationalComponents.Components.Inertia(J = 5) {
"Dyad": {"placement": {"diagram": {"x1": 665, "x2": 765, "y1": 140, "y2": 240}}}
}
"Multi-sensor measuring angular velocity, torque, and power."
multi_sensor = RotationalComponents.Sensors.MultiSensor() {
"Dyad": {"placement": {"diagram": {"x1": 535, "x2": 635, "y1": 140, "y2": 240}}}
}
relations
initial shaft.phi = 0
initial shaft.w = 0
initial load.w = 0
initial spring.phi_rel = 0
initial spring_damper.phi_rel = 0
initial spring_damper.w_rel = 0
connect(ramp.y, torque.tau) {"Dyad": {"edges": [{"S": 1, "M": [], "E": 2}], "path": {}}}
connect(torque.spline, shaft.spline_a) {"Dyad": {"edges": [{"S": 1, "M": [], "E": 2}], "path": {}}}
connect(torque.support, fixed.spline) {
"Dyad": {
"edges": [{"S": 1, "M": [{"x": 205, "y": 190}], "E": -1}, {"S": -1, "M": [], "E": 2}],
"junctions": [{"x": 330, "y": 190}],
"path": {}
}
}
connect(shaft.spline_b, ideal_gear.spline_a) {"Dyad": {"edges": [{"S": 1, "M": [], "E": 2}], "path": {}}}
connect(ideal_gear.spline_b, spring.spline_a) {"Dyad": {"edges": [{"S": 1, "M": [], "E": 2}], "path": {}}}
connect(spring.spline_b, load.spline_a) {"Dyad": {"edges": [{"S": 1, "M": [], "E": 2}], "path": {}}}
connect(ideal_gear.support, housing.spline_b) {"Dyad": {"edges": [{"S": 1, "M": [{"x": 845, "y": 190}], "E": 2}], "path": {}}}
connect(housing.spline_a, multi_sensor.spline_b) {"Dyad": {"edges": [{"S": 1, "M": [], "E": 2}], "path": {}}}
connect(multi_sensor.spline_a, spring_damper.spline_b) {"Dyad": {"edges": [{"S": 1, "M": [], "E": 2}], "path": {}}}
connect(spring_damper.spline_a, fixed.spline) {
"Dyad": {
"edges": [{"S": 1, "M": [], "E": -1}, {"S": -1, "M": [], "E": 2}],
"junctions": [{"x": 330, "y": 190}],
"path": {}
}
}
metadata {
"Dyad": {
"icons": {"default": "dyad://RotationalComponents/Example.svg"},
"tests": {
"case1": {"stop": 10, "expect": {"initial": {"shaft.phi": 0, "shaft.w": 0, "load.w": 0}}}
}
}
}
endFlattened Source
dyad
"""
Example to show possible usage of support flange.
The gearbox is not connected rigidly to the ground, but by a spring-damper
system. This allows examination of the gearbox housing dynamics. A multi-sensor
measures the angular velocity, torque, and power between the housing inertia
and the spring-damper connected to the fixed ground.
Corresponds to Modelica.Mechanics.Rotational.Examples.ElasticBearing.
StopTime=10.0, Interval=0.01.
"""
example component ElasticBearing
"Motor shaft inertia, J=1 kg.m^2."
shaft = RotationalComponents.Components.Inertia(J = 1) {
"Dyad": {"placement": {"diagram": {"x1": 405, "x2": 505, "y1": 20, "y2": 120}}}
}
"Load inertia, J=50 kg.m^2."
load = RotationalComponents.Components.Inertia(J = 50) {
"Dyad": {"placement": {"diagram": {"x1": 1060, "x2": 1160, "y1": 20, "y2": 120}}}
}
"Torsional spring between gear output and load, c=1e3 N.m/rad."
spring = RotationalComponents.Components.Spring(c = 1e3) {
"Dyad": {"placement": {"diagram": {"x1": 925, "x2": 1025, "y1": 20, "y2": 120}}}
}
"Fixed mechanical ground."
fixed = RotationalComponents.Components.Fixed() {
"Dyad": {"placement": {"diagram": {"x1": 280, "x2": 380, "y1": 245, "y2": 345}}}
}
"Spring-damper connecting housing to ground, c=1e5 N.m/rad, d=5 N.m.s/rad."
spring_damper = RotationalComponents.Components.SpringDamper(c = 1e5, d = 5) {
"Dyad": {"placement": {"diagram": {"x1": 405, "x2": 505, "y1": 140, "y2": 240}}}
}
"Torque source driven by ramp signal (useSupport=true in MSL)."
torque = RotationalComponents.Sources.TorqueSource() {
"Dyad": {"placement": {"diagram": {"x1": 155, "x2": 255, "y1": 20, "y2": 120}}}
}
"Ramp signal for driving torque, height=100 N.m over 5 s."
ramp = BlockComponents.Sources.Ramp(duration = 5, height = 100) {"Dyad": {"placement": {"diagram": {"x1": 20, "x2": 120, "y1": 20, "y2": 120}}}}
"Ideal gear with ratio=3 (useSupport=true in MSL)."
ideal_gear = RotationalComponents.Components.IdealGear(ratio = 3) {
"Dyad": {"placement": {"diagram": {"x1": 795, "x2": 895, "y1": 20, "y2": 120}}}
}
"Housing inertia, J=5 kg.m^2."
housing = RotationalComponents.Components.Inertia(J = 5) {
"Dyad": {"placement": {"diagram": {"x1": 665, "x2": 765, "y1": 140, "y2": 240}}}
}
"Multi-sensor measuring angular velocity, torque, and power."
multi_sensor = RotationalComponents.Sensors.MultiSensor() {
"Dyad": {"placement": {"diagram": {"x1": 535, "x2": 635, "y1": 140, "y2": 240}}}
}
relations
initial shaft.phi = 0
initial shaft.w = 0
initial load.w = 0
initial spring.phi_rel = 0
initial spring_damper.phi_rel = 0
initial spring_damper.w_rel = 0
connect(ramp.y, torque.tau) {"Dyad": {"edges": [{"S": 1, "M": [], "E": 2}], "path": {}}}
connect(torque.spline, shaft.spline_a) {"Dyad": {"edges": [{"S": 1, "M": [], "E": 2}], "path": {}}}
connect(torque.support, fixed.spline) {
"Dyad": {
"edges": [{"S": 1, "M": [{"x": 205, "y": 190}], "E": -1}, {"S": -1, "M": [], "E": 2}],
"junctions": [{"x": 330, "y": 190}],
"path": {}
}
}
connect(shaft.spline_b, ideal_gear.spline_a) {"Dyad": {"edges": [{"S": 1, "M": [], "E": 2}], "path": {}}}
connect(ideal_gear.spline_b, spring.spline_a) {"Dyad": {"edges": [{"S": 1, "M": [], "E": 2}], "path": {}}}
connect(spring.spline_b, load.spline_a) {"Dyad": {"edges": [{"S": 1, "M": [], "E": 2}], "path": {}}}
connect(ideal_gear.support, housing.spline_b) {"Dyad": {"edges": [{"S": 1, "M": [{"x": 845, "y": 190}], "E": 2}], "path": {}}}
connect(housing.spline_a, multi_sensor.spline_b) {"Dyad": {"edges": [{"S": 1, "M": [], "E": 2}], "path": {}}}
connect(multi_sensor.spline_a, spring_damper.spline_b) {"Dyad": {"edges": [{"S": 1, "M": [], "E": 2}], "path": {}}}
connect(spring_damper.spline_a, fixed.spline) {
"Dyad": {
"edges": [{"S": 1, "M": [], "E": -1}, {"S": -1, "M": [], "E": 2}],
"junctions": [{"x": 330, "y": 190}],
"path": {}
}
}
metadata {
"Dyad": {
"icons": {"default": "dyad://RotationalComponents/Example.svg"},
"tests": {
"case1": {"stop": 10, "expect": {"initial": {"shaft.phi": 0, "shaft.w": 0, "load.w": 0}}}
}
}
}
endTest Cases
julia
using RotationalComponents
using DyadInterface: TransientAnalysis, rebuild_sol, ODEAlg
using ModelingToolkit: toggle_namespacing, get_initial_conditions, @named
using CSV, DataFrames, Plots
snapshotsdir = joinpath(dirname(dirname(pathof(RotationalComponents))), "test", "snapshots")<< @setup-block not executed in draft mode >>Test Case case1
julia
@named model_case1 = RotationalComponents.Examples.ElasticBearing()
model_case1 = toggle_namespacing(model_case1, false)
model_case1 = toggle_namespacing(model_case1, true)
result_case1 = TransientAnalysis(; model = model_case1, alg = ODEAlg.Auto(), start = 0e+0, stop = 1e+1, abstol=1e-6, reltol=1e-6)
sol_case1 = rebuild_sol(result_case1)<< @setup-block not executed in draft mode >>Related
Examples
Experiments
Analyses
julia
<< @example-block not executed in draft mode >>