Two calculator components

This example sets up two calculator components, where the first outputs a struct of type CommonVesselInfo, with increasing values for CommonVesselInfo.machinery.auxCons. The second Calculator reads this signal and uses some of the values to set the values of its own output.

Note
This example is contrieved and only for functionality demonstration.

calculator1.yml

Options:
PeriodMs: 1000
Constants:
k1: 0.1
InputSignals:
OutputSignals:
- { Type: CommonVesselInfo, Topic: CommonVesselInfo, Partition: }
TempValues:
- tmp1
Expressions:
- tmp1 = tmp1 + k1
- CommonVesselInfo.machinery.auxCons = tmp1 + 10
- CommonVesselInfo.machinery.auxElProd = 1000
- CommonVesselInfo.machinery.auxLoad_kW = 1000
- CommonVesselInfo.machinery.meCons = 200
- CommonVesselInfo.machinery.meLoad_kW = 1000
- CommonVesselInfo.machinery.meRpm = 600
- CommonVesselInfo.machinery.sumCons = 400
- CommonVesselInfo.machinery.sumElProd = 1000
- CommonVesselInfo.machinery.sumLoad_kW = 2000
- CommonVesselInfo.machinery.ptiPower = 0
- CommonVesselInfo.machinery.ptoPower = 0
- CommonVesselInfo.machinery.sfc = 0.2
- CommonVesselInfo.propulsion.efficiency = 0.5
- CommonVesselInfo.propulsion.pitchPd = 0.9
- CommonVesselInfo.propulsion.pitchPercent = 70
- CommonVesselInfo.propulsion.rpm = 140
- CommonVesselInfo.propulsion.thrust = 14
- CommonVesselInfo.propulsion.torque = 20
- CommonVesselInfo.propulsion.speed = 10
- CommonVesselInfo.propulsion.powerToPropellerJet = 1000
- CommonVesselInfo.propulsion.power = 1000

calculator2.yml

Options:
PeriodMs: 1000
Constants:
InputSignals:
- { Type: CommonVesselInfo, Topic: CommonVesselInfo, Partition: }
OutputSignals:
- {Type: Float3, Topic: Test3}
- {Type: PositionGlobal2D, Topic: TestPos}
TempValues:
Expressions:
- Test3.x = CommonVesselInfo.machinery.auxElProd
- Test3.y = CommonVesselInfo.machinery.auxLoad_kW
- Test3.z = CommonVesselInfo.machinery.meCons
- TestPos.lat = CommonVesselInfo.propulsion.pitchPercent
- TestPos.lon = CommonVesselInfo.propulsion.thrust