Calculator

The Calculator component reads DDS signal, makes calculations and publish the result as different DDS signals. The component includes some hard-coded functions to facilitate calculations which would be demanding to specify using the input file (or slow). This currently includes functionality related to propulsion calculations. An explaination to the file:

  • Options -> PeriodMs is the period of the updates in milliseconds.
  • Propulsion -> Propeller and Propulsion -> Hull specifies some particulars of the propeller and the hull.
  • Constants is a list of constant values which can be used in the expressions.
  • InputSignals is a list of DDS input signals which can be used in the expressions.
  • OutputSignals is a list of DDS signals to output.
  • TempValues is a list of variables with a initial value, which can be changed at will in the expressions and used for relaying values between expressions.
  • Expressions is a list of mathematical expressions which are to be evalueated for each time step. The values from each expression is available for all subsequent expressions. Expressions can be built-in propulsion functions or expressions interpretable by the muparser library.

The signatures of the builtin functions are: - PropellerTorque_01(shipSpeed, propellerPith, propellerRpm) returns the propeller torque in kNm. - PropellerThrust_01(shipSpeed, propellerPith, propellerRpm) returns the propeller thrust in kN. - PropellerJetPower_01(shipSpeed, propellerPith, propellerRpm) returns the power transferred to the propeller jet in kW. - PropellerEfficiency_01(shipSpeed, propellerPith, propellerRpm) returns the propeller efficiency.

In these functions:

  • shipSpeed is the speed of the ship, in m/s.
  • propellerPith si the propeller pitch as P/D.
  • propellerRpm is the propeller rotational speed in revolutions per minute.

An example input file is shown below and in calculator.yml.

Options:
PeriodMs: 1000
Propulsion:
Propeller:
Diameter: 3.60
BladeAreaRatio: 0.597
BladeCount: 4
Hull:
WakeFraction: 0.286
ThrustDeduction: 0.215
RotationEfficiency: 1.036
Constants:
Incr1: 1
Incr2: -1
InputSignals:
- { Type: DoubleVal, Topic: Test1, Partition: , DdsSelectQuery: }
- { Type: DoubleVal, Topic: Test2, Partition: , DdsSelectQuery: }
OutputSignals:
- { Type: DoubleVal, Topic: Test1, Partition: }
- { Type: DoubleVal, Topic: Test2, Partition: }
- { Type: DoubleVal, Topic: PropThrust, Partition: }
- { Type: DoubleVal, Topic: PropTorque, Partition: }
- { Type: DoubleVal, Topic: PropJetPower, Partition: }
- { Type: DoubleVal, Topic: PropEfficiency, Partition: }
TempValues:
- Temp1
- Temp2
Expressions:
- Temp1 = Test1.val + Incr1
- Temp2 = Test2.val + Incr2
- Test1.val = Temp1
- Test2.val = Temp2
- PropThrust.val = PropellerThrust_01(10, 1.0, 120)
- PropTorque.val = PropellerTorque_01(10, 1.0, 120)
- PropJetPower.val = PropellerJetPower_01(10, 1.0, 120)
- PropEfficiency.val = PropellerEfficiency_01(10, 1.0, 120)