Elements of this package do not create rigid connections and therefore do not close kinematic loops.
| Name | Description |
|---|---|
| a linear damper element | |
| a linear spring element |
MultiBondLib.PlanarMechanics.Forces.Damping
The damper generates a counteracting force that is proportional to the relative velocity.
The damping coefficient can be set by the parameter d.
| Type | Name | Default | Description |
|---|---|---|---|
| Real | d | 0 | Damping constant [N.s/m] |
| Type | Name | Description |
|---|---|---|
| Frame_a | frame_a | |
| Frame_b | frame_b |
model Damping "a linear damper element"
Interfaces.Frame_a frame_a;
Interfaces.Frame_b frame_b;
parameter Real d(
final unit="N.s/m",
final min=0) = 0 "Damping constant";
protected
inner Defaults MBG_defaults(n=3);
Interfaces.MBG2Mech MBG2Mech1;
Interfaces.Mech2MBG Mech2MBG1;
Junctions.J0 J0_1(n=3);
Bonds.MultiBond MultiBond1;
Bonds.Utilities.MultiBondTail MultiBondTail1;
Bonds.MultiBond MultiBond2;
Bonds.MultiBond MultiBond3;
Passive.R R1(n=3, R={d,d,0});
equation
connect(Mech2MBG1.frame_a, frame_a);
connect(MBG2Mech1.frame_b, frame_b);
connect(Mech2MBG1.MultiBondCon1, MultiBond1.MultiBondCon1);
connect(MultiBond1.MultiBondCon2, J0_1.MultiBondCon1);
connect(MultiBond2.MultiBondCon1, J0_1.MultiBondCon2);
connect(MultiBond2.MultiBondCon2, MBG2Mech1.MultiBondCon1);
connect(MultiBond3.MultiBondCon1, J0_1.MultiBondCon4);
connect(R1.MultiBondCon1, MultiBond3.MultiBondCon2);
end Damping;
MultiBondLib.PlanarMechanics.Forces.Spring
The spring generates a counteracting force that is linear dependent on the positional shift.
The spring coefficient can be set by the parameter c. The rest lenght can be specified by the parameter s0.
A spring with a rest length s0 unequal to zero, has a stiff behavior if its length is approaching zero. The parameter s_small in the advanced menu reduces this stiffness for spring lengths ranging from zero up to s_small.
| Type | Name | Default | Description |
|---|---|---|---|
| Boolean | animation | true | animate spring |
| Real | c | 0 | Spring constant [N/m] |
| Position | s0 | 0 | rest length of spring [m] |
| Advanced | |||
| Position | s_small | 1e-4 | critical Spring length [m] |
| Animation | |||
| if animation = true | |||
| Distance | width | planarWorld.defaultForceWidth | Width of spring [m] |
| Distance | coilWidth | width/5 | Width of spring coil [m] |
| Integer | numberOfWindings | 5 | Number of spring windings |
| Color | color[3] | planarWorld.defaultForceElem... | Color of spring |
| Type | Name | Description |
|---|---|---|
| Frame_a | frame_a | |
| Frame_b | frame_b |
model Spring "a linear spring element"
import SI = Modelica.SIunits;
import MB = Modelica.Mechanics.MultiBody;
Interfaces.Frame_a frame_a;
Interfaces.Frame_b frame_b;
parameter Boolean animation = true "animate spring";
parameter Real c(
final unit="N/m",
final min=0) = 0 "Spring constant";
parameter SI.Position s0 = 0 "rest length of spring";
parameter SI.Position s_small = 1e-4 "|Advanced||critical Spring length";
parameter SI.Distance width=planarWorld.defaultForceWidth
"|Animation|if animation = true| Width of spring";
parameter SI.Distance coilWidth=width/5
"|Animation|if animation = true| Width of spring coil";
parameter Integer numberOfWindings=5
"|Animation|if animation = true| Number of spring windings";
parameter MB.Types.Color color=planarWorld.defaultForceElementColor
"|Animation|if animation = true| Color of spring";
SI.Position s;
SI.Position sx;
SI.Position sy;
SI.Force fx;
SI.Force fy;
protected
outer PlanarWorld planarWorld;
inner Defaults MBG_defaults(n=3);
Interfaces.MBG2Mech MBG2Mech1;
Interfaces.Mech2MBG Mech2MBG1;
Junctions.J0 J0_1(n=3);
Bonds.MultiBond MultiBond1;
Bonds.Utilities.MultiBondTail MultiBondTail1;
Bonds.MultiBond MultiBond2;
Modelica.Blocks.Sources.Constant noTorque(k=0);
Sources.mSe mSe1(n=3);
Bonds.MultiBond MultiBond3;
parameter Integer ndim=if planarWorld.enableAnimation and animation then 1 else 0;
MB.Visualizers.Advanced.Shape springShape[ndim](
each shapeType="spring",
each color=color,
each length=s,
each width=width,
each height=coilWidth,
each lengthDirection={-sx,-sy,0},
each widthDirection={0,0,1},
each r_shape={0,0,0},
each r={Mech2MBG1.q[1],Mech2MBG1.q[2],0},
each extra=numberOfWindings,
each R=MB.Frames.planarRotation({0,0,-1},0,0));
equation
{sx,sy} = Mech2MBG1.q[1:2] - MBG2Mech1.q[1:2];
s = sqrt((sx^2) + (sy^2));
fx = if s >= s_small then c*sx - s0*c*(sx/s) else c*sx - s0*c*(sx/s_small);
fy = if s >= s_small then c*sy - s0*c*(sy/s) else c*sy - s0*c*(sy/s_small);
mSe1.s[1] = fx;
mSe1.s[2] = fy;
connect(Mech2MBG1.frame_a, frame_a);
connect(MBG2Mech1.frame_b, frame_b);
connect(Mech2MBG1.MultiBondCon1, MultiBond1.MultiBondCon1);
connect(MultiBond1.MultiBondCon2, J0_1.MultiBondCon1);
connect(MultiBond2.MultiBondCon1, J0_1.MultiBondCon2);
connect(MultiBond2.MultiBondCon2, MBG2Mech1.MultiBondCon1);
connect(MultiBond3.MultiBondCon2, J0_1.MultiBondCon4);
connect(mSe1.MultiBondCon1, MultiBond3.MultiBondCon1);
connect(mSe1.s[3], noTorque.y);
end Spring;