Is it possible to put a virtual sensor on the hull and measure the distance of this point to the water surface while taking into account the wave height?
Alternatively, you can also use the custom block SonicDist01.js below which computes the altitude of a point Pos defined in a input Frame.
*.bic
Including the custom block in the *.bic file using:
dofile(spec.boatPath + "Blocks/SonicDist01.js");
The wave height altitude can then be defined as:
"Heave": BL.SonicDist01({
Pos: sensorSpec.rIMU,
}),
Where the sensorSpec.IMU is the 3D position of the sensor in the input Frame.
SonicDist01.js
Block.registerNewType("SonicDist01", function(name, r) {
var pos = clone(r.Pos);
var inputs = [
"InertialFrame",
"Frame",
"Ocean",
];
var fUpdate = function(input, callType) {
var sensorPosInInertial = input.Frame.pointInFrame(pos, input.InertialFrame);
var oceanHeight = input.Ocean.height(sensorPosInInertial[0], sensorPosInInertial[1]);
return sensorPosInInertial[2] - oceanHeight;
}
return {
block : Block.JS(name, inputs, fUpdate),
config : {
inputs : r.Inputs
},
};
});
