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

One platform to build and deploy the best data apps

Experiment and prototype by building visualizations in live JavaScript notebooks. Collaborate with your team and decide which concepts to build out.
Use Observable Framework to build data apps locally. Use data loaders to build in any language or library, including Python, SQL, and R.
Seamlessly deploy to Observable. Test before you ship, use automatic deploy-on-commit, and ensure your projects are always up-to-date.
Learn more