Train
IconTrain
Usage
Train(c=1e5, d=1e5, v0=10, a0=0)
Parameters:
Name | Description | Units | Default value |
---|---|---|---|
c | N/m | 100000 | |
d | s-1 | 100000 | |
v0 | Initial Velocity | m/s | 10 |
a0 | m/s2 | 0 |
Connectors
flange
- This connector represents a mechanical flange with position and force as the potential and flow variables, respectively. (Flange
)
Behavior
\[ \begin{equation} \left[ \begin{array}{c} \mathrm{connect}\left( car1_{+}flange_{b}, coupler1_{+}flange_{a} \right) \\ \mathrm{connect}\left( car2_{+}flange_{a}, coupler1_{+}flange_{b} \right) \\ \mathrm{connect}\left( car2_{+}flange_{b}, coupler2_{+}flange_{a} \right) \\ \mathrm{connect}\left( car3_{+}flange_{a}, coupler2_{+}flange_{b} \right) \\ \mathrm{connect}\left( car3_{+}flange_{b}, coupler3_{+}flange_{a} \right) \\ \mathrm{connect}\left( engine_{+}flange_{a}, coupler3_{+}flange_{b} \right) \\ \mathrm{connect}\left( engine_{+}flange_{b}, flange \right) \\ \mathtt{car1.flange\_a.s}\left( t \right) = - \frac{1}{2} \mathtt{car1.L} + \mathtt{car1.s}\left( t \right) \\ \mathtt{car1.flange\_b.s}\left( t \right) = \frac{1}{2} \mathtt{car1.L} + \mathtt{car1.s}\left( t \right) \\ \mathtt{car1.v}\left( t \right) = \frac{\mathrm{d} \mathtt{car1.s}\left( t \right)}{\mathrm{d}t} \\ \mathtt{car1.a}\left( t \right) = \frac{\mathrm{d} \mathtt{car1.v}\left( t \right)}{\mathrm{d}t} \\ \left( \mathtt{car1.a}\left( t \right) + \mathtt{car1.g} \sin\left( \mathtt{car1.theta} \right) \right) \mathtt{car1.m} = \mathtt{car1.flange\_b.f}\left( t \right) + \mathtt{car1.flange\_a.f}\left( t \right) \\ \mathtt{coupler1.s\_rel}\left( t \right) = \mathtt{coupler1.flange\_b.s}\left( t \right) - \mathtt{coupler1.flange\_a.s}\left( t \right) \\ \mathtt{coupler1.v\_rel}\left( t \right) = \frac{\mathrm{d} \mathtt{coupler1.s\_rel}\left( t \right)}{\mathrm{d}t} \\ \mathtt{coupler1.flange\_b.f}\left( t \right) = \mathtt{coupler1.f}\left( t \right) \\ \mathtt{coupler1.flange\_a.f}\left( t \right) = - \mathtt{coupler1.f}\left( t \right) \\ \mathtt{coupler1.f\_c}\left( t \right) = \mathtt{coupler1.c} \left( - \mathtt{coupler1.s\_rel0} + \mathtt{coupler1.s\_rel}\left( t \right) \right) \\ \mathtt{coupler1.f\_d}\left( t \right) = \mathtt{coupler1.d} \mathtt{coupler1.v\_rel}\left( t \right) \\ \mathtt{coupler1.f}\left( t \right) = \mathtt{coupler1.f\_c}\left( t \right) + \mathtt{coupler1.f\_d}\left( t \right) \\ \mathtt{coupler1.lossPower}\left( t \right) = \mathtt{coupler1.v\_rel}\left( t \right) \mathtt{coupler1.f\_d}\left( t \right) \\ \mathtt{car2.flange\_a.s}\left( t \right) = - \frac{1}{2} \mathtt{car2.L} + \mathtt{car2.s}\left( t \right) \\ \mathtt{car2.flange\_b.s}\left( t \right) = \frac{1}{2} \mathtt{car2.L} + \mathtt{car2.s}\left( t \right) \\ \mathtt{car2.v}\left( t \right) = \frac{\mathrm{d} \mathtt{car2.s}\left( t \right)}{\mathrm{d}t} \\ \mathtt{car2.a}\left( t \right) = \frac{\mathrm{d} \mathtt{car2.v}\left( t \right)}{\mathrm{d}t} \\ \left( \mathtt{car2.a}\left( t \right) + \mathtt{car2.g} \sin\left( \mathtt{car2.theta} \right) \right) \mathtt{car2.m} = \mathtt{car2.flange\_a.f}\left( t \right) + \mathtt{car2.flange\_b.f}\left( t \right) \\ \mathtt{coupler2.s\_rel}\left( t \right) = - \mathtt{coupler2.flange\_a.s}\left( t \right) + \mathtt{coupler2.flange\_b.s}\left( t \right) \\ \mathtt{coupler2.v\_rel}\left( t \right) = \frac{\mathrm{d} \mathtt{coupler2.s\_rel}\left( t \right)}{\mathrm{d}t} \\ \mathtt{coupler2.flange\_b.f}\left( t \right) = \mathtt{coupler2.f}\left( t \right) \\ \mathtt{coupler2.flange\_a.f}\left( t \right) = - \mathtt{coupler2.f}\left( t \right) \\ \mathtt{coupler2.f\_c}\left( t \right) = \mathtt{coupler2.c} \left( - \mathtt{coupler2.s\_rel0} + \mathtt{coupler2.s\_rel}\left( t \right) \right) \\ \mathtt{coupler2.f\_d}\left( t \right) = \mathtt{coupler2.d} \mathtt{coupler2.v\_rel}\left( t \right) \\ \mathtt{coupler2.f}\left( t \right) = \mathtt{coupler2.f\_d}\left( t \right) + \mathtt{coupler2.f\_c}\left( t \right) \\ \mathtt{coupler2.lossPower}\left( t \right) = \mathtt{coupler2.v\_rel}\left( t \right) \mathtt{coupler2.f\_d}\left( t \right) \\ \mathtt{car3.flange\_a.s}\left( t \right) = - \frac{1}{2} \mathtt{car3.L} + \mathtt{car3.s}\left( t \right) \\ \mathtt{car3.flange\_b.s}\left( t \right) = \frac{1}{2} \mathtt{car3.L} + \mathtt{car3.s}\left( t \right) \\ \mathtt{car3.v}\left( t \right) = \frac{\mathrm{d} \mathtt{car3.s}\left( t \right)}{\mathrm{d}t} \\ \mathtt{car3.a}\left( t \right) = \frac{\mathrm{d} \mathtt{car3.v}\left( t \right)}{\mathrm{d}t} \\ \left( \mathtt{car3.a}\left( t \right) + \mathtt{car3.g} \sin\left( \mathtt{car3.theta} \right) \right) \mathtt{car3.m} = \mathtt{car3.flange\_a.f}\left( t \right) + \mathtt{car3.flange\_b.f}\left( t \right) \\ \mathtt{coupler3.s\_rel}\left( t \right) = - \mathtt{coupler3.flange\_a.s}\left( t \right) + \mathtt{coupler3.flange\_b.s}\left( t \right) \\ \mathtt{coupler3.v\_rel}\left( t \right) = \frac{\mathrm{d} \mathtt{coupler3.s\_rel}\left( t \right)}{\mathrm{d}t} \\ \mathtt{coupler3.flange\_b.f}\left( t \right) = \mathtt{coupler3.f}\left( t \right) \\ \mathtt{coupler3.flange\_a.f}\left( t \right) = - \mathtt{coupler3.f}\left( t \right) \\ \mathtt{coupler3.f\_c}\left( t \right) = \mathtt{coupler3.c} \left( - \mathtt{coupler3.s\_rel0} + \mathtt{coupler3.s\_rel}\left( t \right) \right) \\ \mathtt{coupler3.f\_d}\left( t \right) = \mathtt{coupler3.d} \mathtt{coupler3.v\_rel}\left( t \right) \\ \mathtt{coupler3.f}\left( t \right) = \mathtt{coupler3.f\_d}\left( t \right) + \mathtt{coupler3.f\_c}\left( t \right) \\ \mathtt{coupler3.lossPower}\left( t \right) = \mathtt{coupler3.f\_d}\left( t \right) \mathtt{coupler3.v\_rel}\left( t \right) \\ \mathtt{engine.flange\_a.s}\left( t \right) = - \frac{1}{2} \mathtt{engine.L} + \mathtt{engine.s}\left( t \right) \\ \mathtt{engine.flange\_b.s}\left( t \right) = \frac{1}{2} \mathtt{engine.L} + \mathtt{engine.s}\left( t \right) \\ \mathtt{engine.v}\left( t \right) = \frac{\mathrm{d} \mathtt{engine.s}\left( t \right)}{\mathrm{d}t} \\ \mathtt{engine.a}\left( t \right) = \frac{\mathrm{d} \mathtt{engine.v}\left( t \right)}{\mathrm{d}t} \\ \left( \mathtt{engine.a}\left( t \right) + \mathtt{engine.g} \sin\left( \mathtt{engine.theta} \right) \right) \mathtt{engine.m} = \mathtt{engine.flange\_a.f}\left( t \right) + \mathtt{engine.flange\_b.f}\left( t \right) \\ \end{array} \right] \end{equation} \]
Source
component Train
car1 = TrainCar(m = 1000, L = 0.9) [{"Dyad": {"placement": {"icon": {"x1": 50, "y1": 100, "x2": 150, "y2": 200}}}}]
coupler1 = TrainCarCoupler(c = c, d = d) [{"Dyad": {"placement": {"icon": {"x1": 225, "y1": 100, "x2": 325, "y2": 200}}}}]
car2 = TrainCar(m = 1000, L = 0.9) [{"Dyad": {"placement": {"icon": {"x1": 400, "y1": 100, "x2": 500, "y2": 200}}}}]
coupler2 = TrainCarCoupler(c = c, d = d) [{"Dyad": {"placement": {"icon": {"x1": 575, "y1": 100, "x2": 675, "y2": 200}}}}]
car3 = TrainCar(m = 1000, L = 0.9) [{"Dyad": {"placement": {"icon": {"x1": 750, "y1": 100, "x2": 850, "y2": 200}}}}]
coupler3 = TrainCarCoupler(c = c, d = d) [{"Dyad": {"placement": {"icon": {"x1": 925, "y1": 100, "x2": 1025, "y2": 200}}}}]
engine = TrainCar(m = 2000, L = 0.9) [{
"Dyad": {"placement": {"icon": {"x1": 1100, "y1": 100, "x2": 1200, "y2": 200}}}
}]
flange = Flange() [{"Dyad": {"placement": {"icon": {"x1": 975, "y1": 475, "x2": 1025, "y2": 525}}}}]
parameter c::TranslationalSpringConstant = 1e5
parameter d::DampingCoefficient = 1e5
# Initial Velocity
parameter v0::Velocity = 10
parameter a0::Acceleration = 0
relations
initial car1.v = v0
initial car1.a = a0
initial car2.v = v0
initial car2.a = a0
initial car3.v = v0
initial car3.a = a0
initial engine.s = 3.55
initial engine.v = v0
connect(car1.flange_b, coupler1.flange_a) [{"Dyad": {"edges": [{"S": 1, "E": 2}]}}]
connect(car2.flange_a, coupler1.flange_b) [{"Dyad": {"edges": [{"S": 1, "E": 2}]}}]
connect(car2.flange_b, coupler2.flange_a) [{"Dyad": {"edges": [{"S": 1, "E": 2}]}}]
connect(car3.flange_a, coupler2.flange_b) [{"Dyad": {"edges": [{"S": 1, "E": 2}]}}]
connect(car3.flange_b, coupler3.flange_a) [{"Dyad": {"edges": [{"S": 1, "E": 2}]}}]
connect(engine.flange_a, coupler3.flange_b) [{"Dyad": {"edges": [{"S": 1, "E": 2}]}}]
connect(engine.flange_b, flange)
end
Flattened Source
component Train
car1 = TrainCar(m = 1000, L = 0.9) [{"Dyad": {"placement": {"icon": {"x1": 50, "y1": 100, "x2": 150, "y2": 200}}}}]
coupler1 = TrainCarCoupler(c = c, d = d) [{"Dyad": {"placement": {"icon": {"x1": 225, "y1": 100, "x2": 325, "y2": 200}}}}]
car2 = TrainCar(m = 1000, L = 0.9) [{"Dyad": {"placement": {"icon": {"x1": 400, "y1": 100, "x2": 500, "y2": 200}}}}]
coupler2 = TrainCarCoupler(c = c, d = d) [{"Dyad": {"placement": {"icon": {"x1": 575, "y1": 100, "x2": 675, "y2": 200}}}}]
car3 = TrainCar(m = 1000, L = 0.9) [{"Dyad": {"placement": {"icon": {"x1": 750, "y1": 100, "x2": 850, "y2": 200}}}}]
coupler3 = TrainCarCoupler(c = c, d = d) [{"Dyad": {"placement": {"icon": {"x1": 925, "y1": 100, "x2": 1025, "y2": 200}}}}]
engine = TrainCar(m = 2000, L = 0.9) [{
"Dyad": {"placement": {"icon": {"x1": 1100, "y1": 100, "x2": 1200, "y2": 200}}}
}]
flange = Flange() [{"Dyad": {"placement": {"icon": {"x1": 975, "y1": 475, "x2": 1025, "y2": 525}}}}]
parameter c::TranslationalSpringConstant = 1e5
parameter d::DampingCoefficient = 1e5
# Initial Velocity
parameter v0::Velocity = 10
parameter a0::Acceleration = 0
relations
initial car1.v = v0
initial car1.a = a0
initial car2.v = v0
initial car2.a = a0
initial car3.v = v0
initial car3.a = a0
initial engine.s = 3.55
initial engine.v = v0
connect(car1.flange_b, coupler1.flange_a) [{"Dyad": {"edges": [{"S": 1, "E": 2}]}}]
connect(car2.flange_a, coupler1.flange_b) [{"Dyad": {"edges": [{"S": 1, "E": 2}]}}]
connect(car2.flange_b, coupler2.flange_a) [{"Dyad": {"edges": [{"S": 1, "E": 2}]}}]
connect(car3.flange_a, coupler2.flange_b) [{"Dyad": {"edges": [{"S": 1, "E": 2}]}}]
connect(car3.flange_b, coupler3.flange_a) [{"Dyad": {"edges": [{"S": 1, "E": 2}]}}]
connect(engine.flange_a, coupler3.flange_b) [{"Dyad": {"edges": [{"S": 1, "E": 2}]}}]
connect(engine.flange_b, flange)
metadata {}
end
Test Cases
No test cases defined.
Related
- Examples
- Experiments
- Analyses