Class: SubmarineState

SubmarineState(currentTotalWaterMass, currentWaterMassFrontTank, currentWaterMassBackTank, currentRotorRPS, submergedVolume, currentDepth, currentSpeed, currentAcceleration, currentPosition, currentOrientation, angularVelocity, angularAcceleration, weight, buoyancy, drag, thrust, sternAngle, rudderAngle, fairwaterAngle, momentOfInertia, centerOfMass, submarineConstants)

Represents the variable state of the submarine during simulation.

Constructor

new SubmarineState(currentTotalWaterMass, currentWaterMassFrontTank, currentWaterMassBackTank, currentRotorRPS, submergedVolume, currentDepth, currentSpeed, currentAcceleration, currentPosition, currentOrientation, angularVelocity, angularAcceleration, weight, buoyancy, drag, thrust, sternAngle, rudderAngle, fairwaterAngle, momentOfInertia, centerOfMass, submarineConstants)

Creates an instance of SubmarineState.
Parameters:
Name Type Description
currentTotalWaterMass number The initial current total water mass inside the submarine.
currentWaterMassFrontTank number The initial current water mass in the front tank.
currentWaterMassBackTank number The initial current water mass in the back tank.
currentRotorRPS number The initial current rotor rounds per second (RPS).
submergedVolume number The initial submerged volume of the submarine.
currentDepth number The initial current depth of the submarine.
currentSpeed THREE.Vector3 The initial current speed of the submarine.
currentAcceleration THREE.Vector3 The initial current acceleration of the submarine.
currentPosition THREE.Vector3 The initial current position of the submarine.
currentOrientation THREE.Quaternion The initial current orientation of the submarine.
angularVelocity THREE.Vector3 The initial angular velocity of the submarine.
angularAcceleration THREE.Vector3 The initial angular acceleration of the submarine.
weight number The initial weight of the submarine.
buoyancy number The initial buoyancy force acting on the submarine.
drag number The initial drag force acting on the submarine.
thrust number The initial thrust force produced by the submarine.
sternAngle number The initial angle of the stern plane.
rudderAngle number The initial angle of the rudder plane.
fairwaterAngle number The initial angle of the fairwater plane.
momentOfInertia THREE.Matrix3 The moment of inertia of the submarine.
centerOfMass THREE.Vector3 The center of mass of the submarine.
submarineConstants SubmarineConstants The submarine constants for calculations.
Source:

Methods

getAngularAcceleration() → {THREE.Vector3}

Gets the current angular acceleration of the submarine.
Source:
Returns:
The current angular acceleration of the submarine in radians per second squared (rad/s²) as a Vector3.
Type
THREE.Vector3

getAngularVelocity() → {THREE.Vector3}

Gets the current angular velocity of the submarine.
Source:
Returns:
The current angular velocity of the submarine in radians per second (rad/s) as a Vector3.
Type
THREE.Vector3

getBuoyancy() → {number}

Gets the buoyancy force acting on the submarine.
Source:
Returns:
The buoyancy force acting on the submarine in newtons (N).
Type
number

getCenterOfMass() → {THREE.Vector3}

Gets the center of mass of the submarine.
Source:
Returns:
The center of mass.
Type
THREE.Vector3

getCurrentAcceleration() → {THREE.Vector3}

Gets the current acceleration of the submarine.
Source:
Returns:
The current acceleration of the submarine as a Vector3.
Type
THREE.Vector3

getCurrentDepth() → {number}

Gets the current depth of the submarine.
Source:
Returns:
The current depth of the submarine in meters (m).
Type
number

getCurrentMass() → {number}

Calculates the current mass of the submarine. This method computes the total mass of the submarine, which includes the current total water mass and the empty mass of the submarine defined by constants.
Source:
Returns:
The current mass of the submarine in newtons (N).
Type
number

getCurrentOrientation() → {THREE.Quaternion}

Gets the current orientation of the submarine.
Source:
Returns:
The current orientation of the submarine.
Type
THREE.Quaternion

getCurrentPosition() → {THREE.Vector3}

Gets the current position of the submarine.
Source:
Returns:
The current position of the submarine in 3D space as a Vector3.
Type
THREE.Vector3

getCurrentRotorRPS() → {number}

Gets the current rounds per second (RPS) of the rotor.
Source:
Returns:
The current rotor rounds per second (RPS).
Type
number

getCurrentSpeed() → {THREE.Vector3}

Gets the current speed of the submarine.
Source:
Returns:
The current speed of the submarine as a Vector3.
Type
THREE.Vector3

getCurrentTotalWaterMass() → {number}

Gets the current total water mass inside the submarine.
Source:
Returns:
The current total water mass inside the submarine in cubic meters (m³).
Type
number

getCurrentWaterMassBackTank() → {number}

Gets the current water mass in the back ballast tank.
Source:
Returns:
The current water mass in the back ballast tank in cubic meters (m³).
Type
number

getCurrentWaterMassFrontTank() → {number}

Gets the current water mass in the front ballast tank.
Source:
Returns:
The current water mass in the front ballast tank in cubic meters (m³).
Type
number

getDrag() → {number}

Gets the drag force acting on the submarine.
Source:
Returns:
The drag force acting on the submarine in newtons (N).
Type
number

getFairwaterAngle() → {number}

Gets the angle of the fairwater plane.
Source:
Returns:
The angle of the fairwater plane in radians (rad).
Type
number

getForwardAxis() → {THREE.Vector3}

Gets the forward axis of the submarine in its current orientation. This method defines a unit vector in the direction of the submarine's forward axis (typically along the +z-axis), then rotates this vector according to the submarine's current orientation.
Source:
Returns:
The forward axis of the submarine as a Vector3.
Type
THREE.Vector3

getMomentOfInertia() → {THREE.Matrix3}

Gets the moment of inertia of the submarine.
Source:
Returns:
The moment of inertia.
Type
THREE.Matrix3

getRightAxis() → {THREE.Vector3}

Gets the right axis of the submarine based on its current orientation. This method calculates the right axis (perpendicular to both the forward and up axes) by computing the cross product of the up and forward axes after rotation.
Source:
Returns:
The right axis of the submarine as a Vector3.
Type
THREE.Vector3

getRudderAngle() → {number}

Gets the angle of the rudder plane.
Source:
Returns:
The angle of the rudder plane in radians (rad).
Type
number

getSternAngle() → {number}

Gets the angle of the stern plane.
Source:
Returns:
The angle of the stern plane in radians (rad).
Type
number

getSubmergedVolume() → {number}

Gets the submerged volume of the submarine.
Source:
Returns:
The submerged volume of the submarine in cubic meters (m³).
Type
number

getTanksDifferenceMass() → {number}

Calculates the difference in water mass between the front and back ballast tanks. This method computes the absolute difference in water mass between the front and back ballast tanks.
Source:
Returns:
The difference in water mass between the front and back ballast tanks in cubic meters (m³).
Type
number

getThrust() → {number}

Gets the thrust force produced by the submarine.
Source:
Returns:
The thrust force produced by the submarine in newtons (N).
Type
number

getUpAxis() → {THREE.Vector3}

Gets the up axis of the submarine in its current orientation. This method defines a unit vector in the direction of the submarine's up axis (typically along the +y-axis), then rotates this vector according to the submarine's current orientation.
Source:
Returns:
The up axis of the submarine as a Vector3.
Type
THREE.Vector3

getWeight() → {number}

Gets the weight of the submarine.
Source:
Returns:
The weight of the submarine in newtons (N).
Type
number

setAngularAcceleration(angularAcceleration)

Sets the current angular acceleration of the submarine.
Parameters:
Name Type Description
angularAcceleration THREE.Vector3 The new current angular acceleration of the submarine in radians per second squared (rad/s²) as a Vector3.
Source:

setAngularVelocity(angularVelocity)

Sets the current angular velocity of the submarine.
Parameters:
Name Type Description
angularVelocity THREE.Vector3 The new current angular velocity of the submarine in radians per second (rad/s) as a Vector3.
Source:

setBuoyancy(buoyancy)

Sets the buoyancy force acting on the submarine.
Parameters:
Name Type Description
buoyancy number The new buoyancy force acting on the submarine in newtons (N).
Source:

setCenterOfMass(centerOfMass)

Sets the center of mass of the submarine.
Parameters:
Name Type Description
centerOfMass THREE.Vector3 The new center of mass.
Source:

setCurrentAcceleration(currentAcceleration)

Sets the current acceleration of the submarine.
Parameters:
Name Type Description
currentAcceleration THREE.Vector3 The new current acceleration of the submarine as a Vector3.
Source:

setCurrentDepth(currentDepth)

Sets the current depth of the submarine.
Parameters:
Name Type Description
currentDepth number The new current depth of the submarine.
Source:

setCurrentOrientation(currentOrientation)

Sets the current orientation of the submarine.
Parameters:
Name Type Description
currentOrientation THREE.Quaternion The new current orientation of the submarine.
Source:

setCurrentPosition(currentPosition)

Sets the current position of the submarine.
Parameters:
Name Type Description
currentPosition THREE.Vector3 The new current position of the submarine in 3D space as a Vector3.
Source:

setCurrentRotorRPS(currentRotorRPS)

Sets the current rounds per second (RPS) of the rotor.
Parameters:
Name Type Description
currentRotorRPS number The new current rotor rounds per second (RPS).
Source:

setCurrentSpeed(currentSpeed)

Sets the current speed of the submarine.
Parameters:
Name Type Description
currentSpeed THREE.Vector3 The new current speed of the submarine as a Vector3.
Source:

setCurrentTotalWaterMass(currentTotalWaterMass)

Sets the current total water mass inside the submarine.
Parameters:
Name Type Description
currentTotalWaterMass number The new current total water mass inside the submarine.
Source:

setCurrentWaterMassBackTank(currentWaterMassBackTank)

Sets the current water mass in the back ballast tank.
Parameters:
Name Type Description
currentWaterMassBackTank number The new current water mass in the back ballast tank.
Source:

setCurrentWaterMassFrontTank(currentWaterMassFrontTank)

Sets the current water mass in the front ballast tank.
Parameters:
Name Type Description
currentWaterMassFrontTank number The new current water mass in the front ballast tank.
Source:

setDrag(drag)

Sets the drag force acting on the submarine.
Parameters:
Name Type Description
drag number The new drag force acting on the submarine in newtons (N).
Source:

setFairwaterAngle(fairwaterAngle)

Sets the angle of the fairwater plane.
Parameters:
Name Type Description
fairwaterAngle number The new angle of the fairwater plane in radians (rad).
Source:

setMomentOfInertia(momentOfInertia)

Sets the moment of inertia of the submarine.
Parameters:
Name Type Description
momentOfInertia THREE.Matrix3 The new moment of inertia.
Source:

setRudderAngle(rudderAngle)

Sets the angle of the rudder plane.
Parameters:
Name Type Description
rudderAngle number The new angle of the rudder plane in radians (rad).
Source:

setSternAngle(sternAngle)

Sets the angle of the stern plane.
Parameters:
Name Type Description
sternAngle number The new angle of the stern plane in radians (rad).
Source:

setSubmergedVolume(submergedVolume)

Sets the submerged volume of the submarine.
Parameters:
Name Type Description
submergedVolume number The new submerged volume of the submarine.
Source:

setThrust(thrust)

Sets the thrust force produced by the submarine.
Parameters:
Name Type Description
thrust number The new thrust force produced by the submarine in newtons (N).
Source:

setWeight(weight)

Sets the weight of the submarine.
Parameters:
Name Type Description
weight number The new weight of the submarine in newtons (N).
Source: