## Tags and keywords

The *Modelica By Example* target code is:

```
connector Translational
Modelica.SIunits.Position x;
flow Modelica.SIunits.Force f;
end Translational;
```

Unfortunately, we can't just use `LMomFlowElement`

and `FlowingLMom`

from the SysPhS , because `FlowingLMom`

is based on velocity rather than position, which is not how the *Modelica By Example* chooses to approach it:

Modelica By Example: 'The following table covers four different engineering domains. In each domain, we see the choice of through and across variables that we will be using along with the SI units for those quantities.'

Domain | Through Variable | Across Variable |
---|---|---|

Electrical | Current [A] | Voltage [V] |

Thermal | Heat [W] | Temperature [K] |

Translational | Force [N] | Position [m] |

Rotational | Torque [N.m] | Angle [rad] |

Modelica By Example: 'The first constraint is that the through variable should be the time derivative of some conserved quantity. The reason for this constraint is that the through variable will be used to formulate generalized conservation equations in our system. As such, it is essential that the through variables be conserved quantities.'

Modelica By Example: 'The second constraint is that the across variable should be the lowest order derivative to appear in any of our constitutive or empirical equations in the domain. So, for example, we chose position for translational motion because position is used in describing the behavior of a spring (i.e., Hooke’s law). If we had chosen velocity (the derivative of position with respect to time), then we would have been in the awkward situation of trying to describe the behavior of a spring in terms of velocities, not positions. An essential point here is that differentiation is lossy. If we know position, we can easily express velocity. But if we only know velocity, we cannot compute position without knowing an additional integration constant. This is why we want to work with across variables that have not been overly differentiated.'

Therefore for this trail position-based `FlowingLinearMomentum`

and `LinearMomentumFlowElement`

are introduced, from which an equivalent Modelica connector can then be generated via SysPhS as part of a minimal translational system:

```
model TranslationalContext
TranslationalContext _TranslationalContext;
model TranslationalContext
TranslationalA a;
TranslationalB b;
equation
connect(a.io,b.io);
end TranslationalContext;
model TranslationalA
LinearMomentumFlowElement io;
end TranslationalA;
model TranslationalB
LinearMomentumFlowElement io;
end TranslationalB;
connector LinearMomentumFlowElement
flow Force f;
Position p;
end LinearMomentumFlowElement;
type Force=Real(unit="N");
type Position=Real(unit="m");
end TranslationalContext;
```