Published
Edited
Jan 29, 2022
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
man = FileAttachment("man_sample.json").json()
Insert cell
Insert cell
{
mutable hullRes = new Vessel.HullResistance(ship, shipState, propeller, wave);
mutable hullRes.writeOutput();

mutable propellerInteraction = new Vessel.PropellerInteraction(
ship,
shipState,
propeller
);
mutable propellerInteraction.writeOutput();

mutable fuelCons = new Vessel.FuelConsumption(ship, shipState, powerPlant);
mutable fuelCons.writeOutput();

}
Insert cell
{
mutable manoeuvring = new Vessel.Manoeuvring(
ship,
shipState,
hullRes,
propellerInteraction,
fuelCons,
man
);
}
Insert cell
Insert cell
manoeuvringMovement = new ManoeuvringMovement(manoeuvring)
Insert cell
Insert cell
(manoeuvringMovement.states.V.u = 1)
Insert cell
manoeuvring.setSpeed(manoeuvringMovement.states.V.u)
Insert cell
Insert cell
angle = {
let propellerAngle = Math.PI / 4;
let cos = Math.cos(propellerAngle);
let sin = Math.sin(propellerAngle);
return { cos, sin };
}
Insert cell
Insert cell
rotationStates = {
manoeuvringMovement.states.n = 10;
var rotationStates = manoeuvring.getPropResult(manoeuvringMovement.states.n);
return rotationStates;
}
Insert cell
Insert cell
forceVector = {
var Rt = manoeuvring.getRes(manoeuvringMovement.states.V.u);

const distHel = manoeuvringMovement.manoeuvring.distHel;

var forceVector = [
rotationStates.Fp * angle.cos - Rt,
rotationStates.Fp * angle.sin,
rotationStates.Fp * angle.sin * distHel
];

return forceVector;
}
Insert cell
Insert cell
{
manoeuvringMovement.setMatrixes(forceVector, Math.PI / 4);
manoeuvringMovement.getDisplacements(0.1);
return manoeuvringMovement.states.DX;
}
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Vessel = require('@ferrari212/ntnu-vessel-dopri').catch(() => window["Vessel"])
Insert cell
numeric = require('numeric').catch(() => window["numeric"])
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more