LRAUV  revA
Simulator Class Reference

A simulator "evolved" from the Altex and Odyssey sims. More...

#include <Simulator.h>

Inheritance diagram for Simulator:
Collaboration diagram for Simulator:

Public Member Functions

 Simulator (bool simulateSensors, int nSteps)
 Constructor. More...
 
virtual ~Simulator ()
 Destructor. More...
 
void initialize (const SimInitStruct &initParams, SimResultStruct &results)
 Initialize the simulator. More...
 
void run (const SimRunStruct &runParams, SimResultStruct &results)
 Run the simulation. More...
 
virtual void uninitialize ()
 Uninitialize the simulation. More...
 
void motion (float propOmegaAction, float rudderAngleAction, float elevatorAngleAction, float massPositionAction, float buoyancyAction, int dropWeightState, float density, float dt, SimResultStruct &results)
 The "take one timestep" function for the simulator. More...
 
long setLocation (const double &latitude, const double &longitude)
 Set the current location to the indicated values in radians Returns error code conversion to UTM is unsuccessful. More...
 
void setDepth (float depth)
 Set the current depth to the indicated value. More...
 
void setHeading (float heading)
 Set the current heading to the indicated value. More...
 
void setPitch (float pitch)
 Set the current pitch to the indicated value. More...
 
void setRoll (float roll)
 Set the current roll to the indicated value. More...
 
void setPropOmega (float propOmega)
 Set the current prop omega to the indicated value. More...
 
void setRudderAngle (float rudderAngle)
 Set the current rudder angle to the indicated value. More...
 
void setElevatorAngle (float elevatorAngle)
 Set the current elevator angle to the indicated value. More...
 
void setMassPosition (float massPosition)
 Set the current mass position to the indicated value. More...
 
void setBuoyancyPosition (float buoyancyPosition)
 Set the current mass position to the indicated value. More...
 

Protected Types

enum  { LO_RUDD, PO_ELEV, UP_RUDD, ST_ELEV }
 Defines fins. More...
 

Protected Member Functions

virtual void publishState (SimResultStruct &results)
 
virtual void configureSensors ()
 
virtual void simulateSensors (double latDeg, double lonDeg, SimResultStruct &results)
 
bool loadParams (const SimInitStruct &initParams, SimResultStruct &results)
 Load the hydrodynamic properties from the slate and initialize some variables. More...
 
void invertMass (SimResultStruct &results)
 Calculate the LHS of the equation (the "1/mass" for solving a in ma = F). More...
 
void calcForce (Point6D &rate, Point6D &pos, float propOmegaAction, float rudderAngleAction, float elevatorAngleAction, float massPositionAction, float buoyancyAction, int dropWeightState, float density, float dt, float smallDt)
 Calculate the RHS of the equation (the "force" in ma = F). More...
 
void calcFinForces (Point6D &rate, float ruddAngleProj, float elevAngleProj, Point3D finForces[], Point3D finMoments[], float density)
 Given the vehicle state (rate) and fin angles, computes the forces and moments from the fins in body coords. More...
 

Protected Attributes

bool simulateSensors_
 indicates whether to simulate sensors (salinity, temp, u, v) More...
 
Str oceanModelData_
 filename of file that contains ocean model run More...
 
int minNSteps_
 The simulator actually runs minNSteps_ times per "timestep" (i.e. More...
 
float maxDt_
 Largest allowable timestep. More...
 
bool ok_
 indicates whether things are ok to run the simulation More...
 
ActuatorModel elevatorModel_
 Actuator and thruster models. More...
 
ActuatorModel rudderModel_
 
ActuatorModel movableMassModel_
 
ActuatorModel buoyancyModel_
 
ThrusterModel thrusterModel_
 
Matrix6x6 massInvert_
 Inverse of "mass" matrix. Calculated just once in invertMass() called from initialize() More...
 
float netBuoy_
 buoyancy force More...
 
Point6D force_
 6-dimensional force vector More...
 
float propThrust_
 Thruster outputs. More...
 
float propTorque_
 
Point6D pos_
 6-dimensional position vector, body coordinates More...
 
Point6D posDot_
 
Point6D rate_
 6-dimensional rate vector, earth coordinates More...
 
Point6D rateDot_
 
double latitude_
 UTM zone gathered from initial position. More...
 
double longitude_
 
Point3D current_
 Ocean current (m/s north, east,down) More...
 
float northCurrent_
 
float eastCurrent_
 Static northward current. More...
 
float vertCurrent_
 Static eastward current. More...
 
float magneticVariation_
 Static vertical current (positive downward) More...
 
float soundSpeed_
 
float density_
 
float sst_
 
float tMixed_
 
float t300_
 
float sss_
 
float sMixed_
 
float s300_
 
float mixedLayerDepth_
 
float defaultDensity_
 Default density to use in calculating buoyancy if none is measured. More...
 
float buoyancyNeutral_
 
float lastDensity_
 Last measured density. More...
 
float mass_
 *-------------—— vehicle parameters --------------------——*/ More...
 
float movableMass_
 
float volume_
 
Point3D cOfMass_
 
Point3D cOfMovableMass_
 
Point3D cOfBuoy_
 
Point6D moment_
 
float dropWt1Volume_
 
float dropWt1Mass_
 
float dropWt1X_
 
float dropWt1Y_
 
float dropWt1Z_
 
float cylinderLength_
 
float cylinderRadius_
 
float kpDot_
 
float mqDot_
 
float nrDot_
 
float xuDot_
 
float yvDot_
 
float zwDot_
 
float kvDot_
 
float mwDot_
 
float nvDot_
 
float yrDot_
 
float ypDot_
 
float zqDot_
 
float kpabp_
 
float mqabq_
 
float nrabr_
 
float xuabu_
 
float yvabv_
 
float zwabw_
 
float mwabw_
 
float nvabv_
 
float yrabr_
 
float zqabq_
 
float muq_
 
float muw_
 
float mpr_
 
float nur_
 
float nuv_
 
float npq_
 
float xvv_
 
float xww_
 
float xvr_
 
float xwq_
 
float xrr_
 
float xqq_
 
float yur_
 
float yuv_
 
float ywp_
 
float zuq_
 
float zuw_
 
float zvp_
 
float kvt2_
 
float aspectRatio_
 
float stallAngle_
 
float finArea_
 
float coeffDrag_
 
float coeffLift_
 
Point3D fins_ [4]
 

Private Member Functions

 Simulator (const Simulator &old)
 

Detailed Description

A simulator "evolved" from the Altex and Odyssey sims.

The Simulator starts with the Odyssey and Altex simulation code but takes greater liberties to make the code easier to use (i.e. using matrix math libraries...)

All three simulators are very similar. All use an iterative fourth-order Runge-Kutta method (see Simulator::motion for more details) to solve (F = ma) where F are the various hydrodynamic forces on the vehicle (body drag, fins, thrust, etc). m is the "mass" of the vehicle including its actual mass as well as added mass terms to account for its shape. The state variable "a" (or more appropriately vdot) includes all three linear accelerations and all three angular accelerations.

The core state of the vehicle then (called "rate" and "pos" for most of the code) is the three linear velocities and three angular rates, plus the three cardinal axes (x,y,z) and three angles.

The function Simulator::invertMass() is responsible for generating the inverse mass matrix and is called once at initialization.

The functions Simulator::motion() performs one "step" of the simulation, running the R-K method once. It calls Simulator::calcForce() to calculate the forces on the vehicle, which in turn calls Simulator::calcFinForces() to calculate forces and moments from the fins. Small encapsulation classes (rudderModel_, elevatorModel_, thrusterModel_)are used to abstract away some of the simulated qualities (backlash, delay) of the fins and thruster.

Constructor & Destructor Documentation

Simulator::Simulator ( bool  simulateSensors,
int  nSteps 
)

Constructor.

Simulator::~Simulator ( )
virtual

Destructor.

References uninitialize().

Simulator::Simulator ( const Simulator old)
private

Member Function Documentation

*pre *void Simulator::calcFinForces ( Point6D rate,
float  ruddAngleProj,
float  elevAngleProj,
Point3D  finForces[],
Point3D  finMoments[],
float  density 
)
protected

Given the vehicle state (rate) and fin angles, computes the forces and moments from the fins in body coords.

Calculates the forces and moments on the vehicle from the fins (in vehicle body frame).

Parameters
rateThe "force/moment" state vector
ruddAngleProjThe rudder angle
elevAngleProjThe elevator angle
finForcesThe calculated fin forces (will be resized to 3 x 4)
finMomentsThe calculated fin moments (will be resized to 3 x 4)
densityDensity of seawater in kg/m3 Original comment: pre>
  • ---------------------------------------------------------------—

    Subroutine fins() computes forces generated by control surfaces

References aspectRatio_, coeffDrag_, coeffLift_, EFF_FACTOR, finArea_, fins_, Point6D::getP(), Point6D::getQ(), Point6D::getR(), Point3D::getU(), Point6D::getU(), Point3D::getV(), Point6D::getV(), Point3D::getW(), Point6D::getW(), LO_RUDD, PO_ELEV, Point3D::setU(), Point3D::setV(), Point3D::setW(), Point3D::setX(), Point3D::setY(), Point3D::setZ(), ST_ELEV, stallAngle_, and UP_RUDD.

Referenced by calcForce().

void Simulator::calcForce ( Point6D rate,
Point6D pos,
float  propOmegaAction,
float  rudderAngleAction,
float  elevatorAngleAction,
float  massPositionAction,
float  buoyancyAction,
int  dropWeightState,
float  density,
float  dt,
float  smallDt 
)
protected

Calculate the RHS of the equation (the "force" in ma = F).

Generates the "force" matrix in the "F=Ma".

Sums the various hydrodynamic forces acting on the vehicle (including various body lifts and drags, as well as forces from the prop (thrust, torque) and forces from the fins (drag and turning moments).

Original Comment:

-------------------------------------------------------------------------
  Subroutine calcForce() gets the right-hand sides of the dynamic equations.
-------------------------------------------------------------------------
 

References buoyancyModel_, buoyancyNeutral_, calcFinForces(), cOfBuoy_, cOfMass_, cOfMovableMass_, cylinderLength_, cylinderRadius_, dropWt1Mass_, dropWt1Volume_, dropWt1X_, dropWt1Y_, dropWt1Z_, elevatorModel_, fins_, force_, ActuatorModel::getCurrent(), Point6D::getHeading(), Point6D::getP(), Point6D::getPitch(), Point6D::getQ(), Point6D::getR(), Point6D::getRoll(), Point6D::getU(), Point6D::getV(), Point6D::getW(), Point3D::getX(), Point6D::getX(), Point3D::getY(), Point6D::getY(), Point3D::getZ(), Point6D::getZ(), kpabp_, kvt2_, LO_RUDD, mass_, moment_, movableMass_, mpr_, mqabq_, muq_, muw_, mwabw_, netBuoy_, npq_, nrabr_, nur_, nuv_, nvabv_, PO_ELEV, ThrusterModel::project(), ActuatorModel::project(), propThrust_, propTorque_, rudderModel_, Point6D::setHeading(), Point6D::setPitch(), Point6D::setRoll(), Point3D::setX(), Point6D::setX(), Point3D::setY(), Point6D::setY(), Point3D::setZ(), Point6D::setZ(), ST_ELEV, thrusterModel_, UP_RUDD, volume_, xqq_, xrr_, xuabu_, xvr_, xvv_, xwq_, xww_, yrabr_, yur_, yuv_, yvabv_, ywp_, zqabq_, zuq_, zuw_, zvp_, and zwabw_.

Referenced by motion().

virtual void Simulator::configureSensors ( )
inlineprotectedvirtual

Reimplemented in EnvSimulator.

Referenced by initialize().

void Simulator::initialize ( const SimInitStruct initParams,
SimResultStruct results 
)
void Simulator::invertMass ( SimResultStruct results)
protected

Calculate the LHS of the equation (the "1/mass" for solving a in ma = F).

Produces the "mass" matrix in the "F = Ma" ODEs describing the vehicle dynamics.

As long as the vehicle mass is constant, this only needs to be calculated once (though the simulator does not recalculate if a dropweight is dropped). The inversion (necessary to solve "a = M^-1 A") is also done in this function.

Converted and tested 28/6/07 AMM

Returns
The inverse of the mass matrix.

The A matrix is assembled as

\[ A = \left[ \begin{array}{cc} A & B \\ C & D \end{array} \right] \]

Todo:
Need to add check for singularity before inverting A

References cOfMass_, Matrix6x6::determinantZero(), SimResultStruct::errorMessage_, Point6D::getHeading(), Point6D::getPitch(), Point6D::getRoll(), Point3D::getX(), Point6D::getX(), Point3D::getY(), Point6D::getY(), Point3D::getZ(), Point6D::getZ(), Matrix6x6::invert(), kpDot_, kvDot_, mass_, massInvert_, moment_, mqDot_, mwDot_, nrDot_, nvDot_, xuDot_, ypDot_, yrDot_, yvDot_, zqDot_, and zwDot_.

Referenced by initialize().

bool Simulator::loadParams ( const SimInitStruct initParams,
SimResultStruct results 
)
protected

Load the hydrodynamic properties from the slate and initialize some variables.

Load simulator parameters.

References SimInitStruct::aspectRatio_, aspectRatio_, SimInitStruct::buoyancyHystCenter_, SimInitStruct::buoyancyHystWidth_, buoyancyModel_, SimInitStruct::buoyancyNeutral_, buoyancyNeutral_, SimInitStruct::buoyancySpeed_, SimInitStruct::centerOfBuoyX_, SimInitStruct::centerOfBuoyY_, SimInitStruct::centerOfBuoyZ_, SimInitStruct::centerOfMassX_, SimInitStruct::centerOfMassY_, SimInitStruct::centerOfMassZ_, SimInitStruct::centerOfMovableMassX_, SimInitStruct::centerOfMovableMassY_, SimInitStruct::centerOfMovableMassZ_, SimInitStruct::coeffDrag_, coeffDrag_, SimInitStruct::coeffLift_, coeffLift_, cOfBuoy_, cOfMass_, cOfMovableMass_, SimInitStruct::cylinderLength_, cylinderLength_, SimInitStruct::cylinderRadius_, cylinderRadius_, D2R, SimInitStruct::defaultDensity_, defaultDensity_, SimInitStruct::density_, density_, SimInitStruct::designOmega_, SimInitStruct::designPropEff_, SimInitStruct::designSpeed_, SimInitStruct::designThrust_, SimInitStruct::designTorque_, SimInitStruct::dropWt1Mass_, dropWt1Mass_, SimInitStruct::dropWt1Volume_, dropWt1Volume_, SimInitStruct::dropWt1X_, dropWt1X_, SimInitStruct::dropWt1Y_, dropWt1Y_, SimInitStruct::dropWt1Z_, dropWt1Z_, SimInitStruct::eastCurrent_, eastCurrent_, SimInitStruct::elevatorHystCenter_, SimInitStruct::elevatorHystWidth_, elevatorModel_, SimInitStruct::elevatorSpeed_, SimInitStruct::finArea_, finArea_, fins_, SimInitStruct::initBuoyancyPosition_, SimInitStruct::initHeading_, ThrusterModel::initialize(), SimInitStruct::initLat_, SimInitStruct::initLon_, SimInitStruct::initMassPosition_, SimInitStruct::initP_, SimInitStruct::initPitch_, SimInitStruct::initQ_, SimInitStruct::initR_, SimInitStruct::initRoll_, SimInitStruct::initU_, SimInitStruct::initV_, SimInitStruct::initW_, SimInitStruct::initZ_, SimInitStruct::kpabp_, kpabp_, SimInitStruct::kpDot_, kpDot_, SimInitStruct::kvDot_, kvDot_, SimInitStruct::kvt2_, kvt2_, latitude_, LO_RUDD, longitude_, SimInitStruct::lowerRudX_, SimInitStruct::lowerRudY_, SimInitStruct::lowerRudZ_, SimInitStruct::magneticVariation_, magneticVariation_, SimInitStruct::mass_, mass_, mixedLayerDepth_, moment_, SimInitStruct::momentXX_, SimInitStruct::momentYY_, SimInitStruct::momentZZ_, SimInitStruct::movableMass_, movableMass_, SimInitStruct::movableMassHystCenter_, SimInitStruct::movableMassHystWidth_, movableMassModel_, SimInitStruct::movableMassSpeed_, SimInitStruct::mpr_, mpr_, SimInitStruct::mqabq_, mqabq_, SimInitStruct::mqDot_, mqDot_, SimInitStruct::muq_, muq_, SimInitStruct::muw_, muw_, SimInitStruct::mwabw_, mwabw_, SimInitStruct::mwDot_, mwDot_, SimInitStruct::northCurrent_, northCurrent_, SimInitStruct::npq_, npq_, SimInitStruct::nrabr_, nrabr_, SimInitStruct::nrDot_, nrDot_, SimInitStruct::nur_, nur_, SimInitStruct::nuv_, nuv_, SimInitStruct::nvabv_, nvabv_, SimInitStruct::nvDot_, nvDot_, SimInitStruct::oceanModelData_, oceanModelData_, PO_ELEV, SimInitStruct::portElevX_, SimInitStruct::portElevY_, SimInitStruct::portElevZ_, pos_, rate_, SimInitStruct::rudderHystCenter_, SimInitStruct::rudderHystWidth_, rudderModel_, SimInitStruct::rudderSpeed_, SimInitStruct::s300_, s300_, Point6D::setHeading(), ActuatorModel::setHyst(), Point6D::setP(), Point6D::setPitch(), ActuatorModel::setPrevious(), Point6D::setQ(), Point6D::setR(), Point6D::setRoll(), ActuatorModel::setSpeed(), Point6D::setU(), Point6D::setV(), Point6D::setW(), Point3D::setX(), Point6D::setX(), Point3D::setY(), Point6D::setY(), Point3D::setZ(), Point6D::setZ(), SimInitStruct::sMixed_, sMixed_, SimInitStruct::soundSpeed_, soundSpeed_, SimInitStruct::sss_, sss_, SimInitStruct::sst_, sst_, ST_ELEV, SimInitStruct::stallAngle_, stallAngle_, SimInitStruct::stbdElevX_, SimInitStruct::stbdElevY_, SimInitStruct::stbdElevZ_, SimInitStruct::t300_, t300_, thrusterModel_, SimInitStruct::tMixed_, tMixed_, UP_RUDD, SimInitStruct::upperRudX_, SimInitStruct::upperRudY_, SimInitStruct::upperRudZ_, SimInitStruct::vertCurrent_, vertCurrent_, SimInitStruct::volume_, volume_, SimInitStruct::xqq_, xqq_, SimInitStruct::xrr_, xrr_, SimInitStruct::xuabu_, xuabu_, SimInitStruct::xuDot_, xuDot_, SimInitStruct::xvr_, xvr_, SimInitStruct::xvv_, xvv_, SimInitStruct::xwq_, xwq_, SimInitStruct::xww_, xww_, SimInitStruct::ypDot_, ypDot_, SimInitStruct::yrabr_, yrabr_, SimInitStruct::yrDot_, yrDot_, SimInitStruct::yur_, yur_, SimInitStruct::yuv_, yuv_, SimInitStruct::yvabv_, yvabv_, SimInitStruct::yvDot_, yvDot_, SimInitStruct::ywp_, ywp_, SimInitStruct::zqabq_, zqabq_, SimInitStruct::zqDot_, zqDot_, SimInitStruct::zuq_, zuq_, SimInitStruct::zuw_, zuw_, SimInitStruct::zvp_, zvp_, SimInitStruct::zwabw_, zwabw_, SimInitStruct::zwDot_, and zwDot_.

Referenced by initialize().

void Simulator::motion ( float  propOmegaAction,
float  rudderAngleAction,
float  elevatorAngleAction,
float  massPositionAction,
float  buoyancyAction,
int  dropWeightState,
float  density,
float  dt,
SimResultStruct results 
)

The "take one timestep" function for the simulator.

As with others member functions, motionAlternate is a rewritten form using the newmat Matrix library.

motion is a port performing as few changes as necessary.

Parameters
propOmegaActioncommanded prop rotation rate (rad/sec)
rudderAngleActionPosition of rudders (fins 1 and 3) in radians.
elevatorAngleActionPosition of elevators (fins 2 and 4) in radians.
massPositionActionPosition of movable mass in meters.
buoyancyActionPosition of buoyancy engine in cubic meters.
dropWeightStateTrue if drop weight intact
densityDensity of sea water in kg/m3.
dtTime step
resultsstruct for providing feedback

As a side note, the fourth order Runge-Kutta method (from http://en.wikipedia.org/wiki/Runge-Kutta) is an iterative method for solving ODEs. Given an initial value problem

\begin{eqnarray*} y^\prime = f( t, y ) \\ \\ y(t_0) = y_0 \end{eqnarray*}

Then the fourth order Runge-Kutta solution is:

\[ getY(){n+1} = y_n + \frac{ \Delta t }{6}\left( k_1 + 2k_2 + 2k_3 + k_4 \right) \]

Where

\begin{eqnarray*} k_1 &=& f(t_n,y_n ) \\ k_2 &=& f(t_n + \frac{\Delta t}{2}, y_n + \frac{\Delta t}{2}k_1 ) \\ k_3 &=& f(t_n + \frac{\Delta t}{2}, y_n + \frac{\Delta t}{2}k_2 ) \\ k_4 &=& f(t_n + \Delta t, y_n + \Delta t \cdot k_3 ) \\ \end{eqnarray*}

Original comment:

  Subroutine motion() uses 4th-order Runge-Kutta method.  Variables are:
  edot(1)  edot(2)  edot(3)  edot(4)  edot(5)  edot(6)
    ]        ]        ]        ]        ]        ]
   udot     vdot     wdot     pdot     qdot     rdot
  rate.getU()  rate.getV()  rate.getW()  rate.getP()  rate.getQ()   rate.getR()
    u        v        w        p        q        r
  xDot     yDot     zDot     rollDot  pitchDot  yawDot
  pos.getX()   pos.getY()   pos.getZ()    pos.getRoll()   pos.getPitch()   pos.getHeading()
    x        y        z        phi     theta     psi
                               roll    pitch     yaw

References Point6D::absSum(), Point6D::addProduct(), ThrusterModel::advance(), ActuatorModel::advance(), buoyancyModel_, calcForce(), Str::cStr(), current_, dt, elevatorModel_, SimResultStruct::errorMessage_, force_, Point6D::getX(), massInvert_, movableMassModel_, pos_, posDot_, rate_, rateDot_, rudderModel_, thrusterModel_, and Point6D::toString().

Referenced by run().

void Simulator::publishState ( SimResultStruct results)
protectedvirtual

References Location::AtBearing(), buoyancyModel_, SimResultStruct::buoyancyPosition_, current_, ThrusterModel::currentPropOmega(), SimResultStruct::depth_, SimResultStruct::eastCurrent_, eastCurrent_, SimResultStruct::elevatorAngle_, elevatorModel_, force_, SimResultStruct::forceX_, SimResultStruct::forceY_, SimResultStruct::forceZ_, ActuatorModel::getCurrent(), Point6D::getHeading(), Point6D::getP(), Point6D::getPitch(), Point6D::getQ(), Point6D::getR(), Point6D::getRoll(), Point3D::getU(), Point6D::getU(), Point3D::getV(), Point6D::getV(), Point3D::getW(), Point6D::getW(), Point6D::getX(), Point6D::getY(), Point6D::getZ(), SimResultStruct::heading_, latitude_, SimResultStruct::latitudeDeg_, longitude_, SimResultStruct::longitudeDeg_, SimResultStruct::massPosition_, movableMassModel_, SimResultStruct::netBuoy_, netBuoy_, SimResultStruct::northCurrent_, northCurrent_, SimResultStruct::northernHemi_, SimResultStruct::pitch_, pos_, posDot_, SimResultStruct::posHeading_, SimResultStruct::posPitch_, SimResultStruct::posRoll_, SimResultStruct::posX_, SimResultStruct::posXDot_, SimResultStruct::posY_, SimResultStruct::posYDot_, SimResultStruct::posZ_, SimResultStruct::posZDot_, SimResultStruct::propOmega_, SimResultStruct::propThrust_, propThrust_, SimResultStruct::propTorque_, propTorque_, R2D, rate_, SimResultStruct::rateP_, SimResultStruct::rateQ_, SimResultStruct::rateR_, SimResultStruct::rateU_, SimResultStruct::rateV_, SimResultStruct::rateW_, SimResultStruct::roll_, SimResultStruct::rudderAngle_, rudderModel_, Point3D::setU(), Point3D::setV(), Point6D::setX(), Point6D::setY(), simulateSensors(), SimResultStruct::speed_, thrusterModel_, SimResultStruct::utmZone_, and SimResultStruct::vertCurrent_.

Referenced by initialize(), and run().

void Simulator::setBuoyancyPosition ( float  buoyancyPosition)

Set the current mass position to the indicated value.

Set the base buoyancy position to the indicated value.

References buoyancyModel_, and ActuatorModel::setPrevious().

Referenced by run().

void Simulator::setDepth ( float  depth)

Set the current depth to the indicated value.

References pos_, and Point6D::setZ().

Referenced by InternalSim::run(), and NavigationSim::run().

void Simulator::setElevatorAngle ( float  elevatorAngle)

Set the current elevator angle to the indicated value.

Set the base elevator angle to the indicated value.

References elevatorModel_, and ActuatorModel::setPrevious().

Referenced by run().

void Simulator::setHeading ( float  heading)

Set the current heading to the indicated value.

References pos_, and Point6D::setHeading().

Referenced by InternalSim::run(), and NavigationSim::run().

long Simulator::setLocation ( const double &  latitude,
const double &  longitude 
)

Set the current location to the indicated values in radians Returns error code conversion to UTM is unsuccessful.

Set the current location to the indicated value Returns error code conversion to UTM is unsuccessful.

Otherwise returns 0. Use Wgs84::UtmErrorToString( error ) to decode the error (from Datum.h).

Otherwise returns 0. Use Wgs84::UtmErrorToString( error ) to decode the error.

References latitude_, and longitude_.

Referenced by InternalSim::run(), and NavigationSim::run().

void Simulator::setMassPosition ( float  massPosition)

Set the current mass position to the indicated value.

Set the base mass position to the indicated value.

References movableMassModel_, and ActuatorModel::setPrevious().

Referenced by run().

void Simulator::setPitch ( float  pitch)

Set the current pitch to the indicated value.

References pos_, and Point6D::setPitch().

Referenced by InternalSim::run(), and NavigationSim::run().

void Simulator::setPropOmega ( float  propOmega)

Set the current prop omega to the indicated value.

Set the base prop omega to the indicated value.

References ThrusterModel::setPrevious(), and thrusterModel_.

Referenced by run().

void Simulator::setRoll ( float  roll)

Set the current roll to the indicated value.

References pos_, and Point6D::setRoll().

Referenced by InternalSim::run(), and NavigationSim::run().

void Simulator::setRudderAngle ( float  rudderAngle)

Set the current rudder angle to the indicated value.

Set the base rudder angle to the indicated value.

References rudderModel_, and ActuatorModel::setPrevious().

Referenced by run().

virtual void Simulator::simulateSensors ( double  latDeg,
double  lonDeg,
SimResultStruct results 
)
inlineprotectedvirtual

Reimplemented in EnvSimulator.

Referenced by publishState().

virtual void Simulator::uninitialize ( void  )
inlinevirtual

Uninitialize the simulation.

Reimplemented in EnvSimulator.

Referenced by ~Simulator().

Member Data Documentation

float Simulator::aspectRatio_
protected

Referenced by calcFinForces(), and loadParams().

ActuatorModel Simulator::buoyancyModel_
protected
float Simulator::buoyancyNeutral_
protected

Referenced by calcForce(), and loadParams().

float Simulator::coeffDrag_
protected

Referenced by calcFinForces(), and loadParams().

float Simulator::coeffLift_
protected

Referenced by calcFinForces(), and loadParams().

Point3D Simulator::cOfBuoy_
protected

Referenced by calcForce(), and loadParams().

Point3D Simulator::cOfMass_
protected

Referenced by calcForce(), invertMass(), and loadParams().

Point3D Simulator::cOfMovableMass_
protected

Referenced by calcForce(), and loadParams().

Point3D Simulator::current_
protected

Ocean current (m/s north, east,down)

Referenced by motion(), publishState(), and EnvSimulator::simulateSensors().

float Simulator::cylinderLength_
protected

Referenced by calcForce(), and loadParams().

float Simulator::cylinderRadius_
protected

Referenced by calcForce(), and loadParams().

float Simulator::defaultDensity_
protected

Default density to use in calculating buoyancy if none is measured.

Referenced by loadParams(), and run().

float Simulator::density_
protected
float Simulator::dropWt1Mass_
protected

Referenced by calcForce(), and loadParams().

float Simulator::dropWt1Volume_
protected

Referenced by calcForce(), and loadParams().

float Simulator::dropWt1X_
protected

Referenced by calcForce(), and loadParams().

float Simulator::dropWt1Y_
protected

Referenced by calcForce(), and loadParams().

float Simulator::dropWt1Z_
protected

Referenced by calcForce(), and loadParams().

float Simulator::eastCurrent_
protected

Static northward current.

Referenced by loadParams(), and publishState().

ActuatorModel Simulator::elevatorModel_
protected

Actuator and thruster models.

Referenced by calcForce(), loadParams(), motion(), publishState(), run(), and setElevatorAngle().

float Simulator::finArea_
protected

Referenced by calcFinForces(), and loadParams().

Point3D Simulator::fins_[4]
protected
  • FINS. Note fin #1 is lower rudder, #2 is port elevator, #3 is

Referenced by calcFinForces(), calcForce(), and loadParams().

Point6D Simulator::force_
protected

6-dimensional force vector

Referenced by calcForce(), motion(), and publishState().

float Simulator::kpabp_
protected

Referenced by calcForce(), and loadParams().

float Simulator::kpDot_
protected
  • hydrodynamic parameters -------------------------------------------—*/

Referenced by invertMass(), and loadParams().

float Simulator::kvDot_
protected

Referenced by invertMass(), and loadParams().

float Simulator::kvt2_
protected

Referenced by calcForce(), and loadParams().

float Simulator::lastDensity_
protected

Last measured density.

Referenced by run(), and EnvSimulator::simulateSensors().

double Simulator::latitude_
protected

UTM zone gathered from initial position.

Referenced by loadParams(), publishState(), and setLocation().

double Simulator::longitude_
protected
float Simulator::magneticVariation_
protected

Static vertical current (positive downward)

Referenced by loadParams(), and EnvSimulator::simulateSensors().

float Simulator::mass_
protected

*-------------—— vehicle parameters --------------------——*/

  • translational and rotational body mass */

Referenced by calcForce(), invertMass(), and loadParams().

Matrix6x6 Simulator::massInvert_
protected

Inverse of "mass" matrix. Calculated just once in invertMass() called from initialize()

Referenced by invertMass(), and motion().

float Simulator::maxDt_
protected

Largest allowable timestep.

Referenced by run().

int Simulator::minNSteps_
protected

The simulator actually runs minNSteps_ times per "timestep" (i.e.

if the control thread runs at 5Hz, the sim runs at 50Hz if nSteps = 10

Referenced by run().

float Simulator::mixedLayerDepth_
protected
Point6D Simulator::moment_
protected

Referenced by calcForce(), invertMass(), and loadParams().

float Simulator::movableMass_
protected

Referenced by calcForce(), and loadParams().

ActuatorModel Simulator::movableMassModel_
protected
float Simulator::mpr_
protected

Referenced by calcForce(), and loadParams().

float Simulator::mqabq_
protected

Referenced by calcForce(), and loadParams().

float Simulator::mqDot_
protected

Referenced by invertMass(), and loadParams().

float Simulator::muq_
protected

Referenced by calcForce(), and loadParams().

float Simulator::muw_
protected

Referenced by calcForce(), and loadParams().

float Simulator::mwabw_
protected

Referenced by calcForce(), and loadParams().

float Simulator::mwDot_
protected

Referenced by invertMass(), and loadParams().

float Simulator::netBuoy_
protected

buoyancy force

Referenced by calcForce(), and publishState().

float Simulator::northCurrent_
protected

Referenced by loadParams(), and publishState().

float Simulator::npq_
protected

Referenced by calcForce(), and loadParams().

float Simulator::nrabr_
protected

Referenced by calcForce(), and loadParams().

float Simulator::nrDot_
protected

Referenced by invertMass(), and loadParams().

float Simulator::nur_
protected

Referenced by calcForce(), and loadParams().

float Simulator::nuv_
protected

Referenced by calcForce(), and loadParams().

float Simulator::nvabv_
protected

Referenced by calcForce(), and loadParams().

float Simulator::nvDot_
protected

Referenced by invertMass(), and loadParams().

Str Simulator::oceanModelData_
protected

filename of file that contains ocean model run

Referenced by EnvSimulator::configureSensors(), initialize(), and loadParams().

bool Simulator::ok_
protected

indicates whether things are ok to run the simulation

Referenced by initialize(), and run().

Point6D Simulator::pos_
protected

6-dimensional position vector, body coordinates

Referenced by loadParams(), motion(), publishState(), run(), setDepth(), setHeading(), setPitch(), setRoll(), and EnvSimulator::simulateSensors().

Point6D Simulator::posDot_
protected

Referenced by motion(), and publishState().

float Simulator::propThrust_
protected

Thruster outputs.

Referenced by calcForce(), and publishState().

float Simulator::propTorque_
protected

Referenced by calcForce(), and publishState().

Point6D Simulator::rate_
protected

6-dimensional rate vector, earth coordinates

Referenced by loadParams(), motion(), and publishState().

Point6D Simulator::rateDot_
protected

Referenced by motion().

ActuatorModel Simulator::rudderModel_
protected
float Simulator::s300_
protected
bool Simulator::simulateSensors_
protected

indicates whether to simulate sensors (salinity, temp, u, v)

Referenced by initialize(), and EnvSimulator::simulateSensors().

float Simulator::sMixed_
protected
float Simulator::soundSpeed_
protected
float Simulator::sss_
protected
float Simulator::sst_
protected
float Simulator::stallAngle_
protected

Referenced by calcFinForces(), and loadParams().

float Simulator::t300_
protected
ThrusterModel Simulator::thrusterModel_
protected
float Simulator::tMixed_
protected
float Simulator::vertCurrent_
protected

Static eastward current.

Referenced by loadParams(), and EnvSimulator::simulateSensors().

float Simulator::volume_
protected

Referenced by calcForce(), and loadParams().

float Simulator::xqq_
protected

Referenced by calcForce(), and loadParams().

float Simulator::xrr_
protected

Referenced by calcForce(), and loadParams().

float Simulator::xuabu_
protected

Referenced by calcForce(), and loadParams().

float Simulator::xuDot_
protected

Referenced by invertMass(), and loadParams().

float Simulator::xvr_
protected

Referenced by calcForce(), and loadParams().

float Simulator::xvv_
protected

Referenced by calcForce(), and loadParams().

float Simulator::xwq_
protected

Referenced by calcForce(), and loadParams().

float Simulator::xww_
protected

Referenced by calcForce(), and loadParams().

float Simulator::ypDot_
protected

Referenced by invertMass(), and loadParams().

float Simulator::yrabr_
protected

Referenced by calcForce(), and loadParams().

float Simulator::yrDot_
protected

Referenced by invertMass(), and loadParams().

float Simulator::yur_
protected

Referenced by calcForce(), and loadParams().

float Simulator::yuv_
protected

Referenced by calcForce(), and loadParams().

float Simulator::yvabv_
protected

Referenced by calcForce(), and loadParams().

float Simulator::yvDot_
protected

Referenced by invertMass(), and loadParams().

float Simulator::ywp_
protected

Referenced by calcForce(), and loadParams().

float Simulator::zqabq_
protected

Referenced by calcForce(), and loadParams().

float Simulator::zqDot_
protected

Referenced by invertMass(), and loadParams().

float Simulator::zuq_
protected

Referenced by calcForce(), and loadParams().

float Simulator::zuw_
protected

Referenced by calcForce(), and loadParams().

float Simulator::zvp_
protected

Referenced by calcForce(), and loadParams().

float Simulator::zwabw_
protected

Referenced by calcForce(), and loadParams().

float Simulator::zwDot_
protected

Referenced by invertMass(), and loadParams().


The documentation for this class was generated from the following files: