function
RigidBody.potentialEnergy
Uniform-gravity potential energy with world z upward
Public declarations
Explicit source declarations; dimensions, modifications and defaults are shown as written, without evaluation.
| Role | Name | Type | Dimensions / attributes / default | Description |
|---|---|---|---|---|
| input | state | RigidBody.State | | |
| input | parameters | RigidBody.Parameters | | |
| output | energy | Real | |
Modelica declarations and implementation
Show parameters, interfaces and source
Parameters, inputs, outputs, defaults and equations from the source file.
function potentialEnergy "Uniform-gravity potential energy with world z upward"
input RigidBody.State state;
input RigidBody.Parameters parameters;
output Real energy;
algorithm
energy := parameters.mass * parameters.gravity * state.worldPosition[3];
end potentialEnergy;