LRAUV  revA
EnvSimulator Class Reference

The EnvSimulator adds lookup of environmental parameters to the base Simulator class. More...

#include <EnvSimulator.h>

Inheritance diagram for EnvSimulator:
Collaboration diagram for EnvSimulator:

Public Member Functions

 EnvSimulator (bool simulateSensors, int nSteps)
 Constructor. More...
 
virtual ~EnvSimulator ()
 Destructor. More...
 
virtual void uninitialize ()
 Uninitialize the simulation. More...
 
- Public Member Functions inherited from Simulator
 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...
 
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 Member Functions

virtual void configureSensors ()
 
virtual void simulateSensors (double latDeg, double lonDeg, SimResultStruct &results)
 
bool interpolate (const float &time, const float &depth, const float &lat, const float &lon, int &timeIndex, int &depthIndex, int &latIndex, int &lonIndex, int varIndices[4], float varArray[2][2][2][2], NetCdfReader::NetCdfVar *var, float &value)
 
float twoLineEstimate (const float x, const float y0, const float y1, const float y2, const float x0, const float x1, const float x2)
 Interpolates a value on two lines, from (x0, y0) to (x1, y1) to (x2, y2) Does not extrapolate – rather, it pins values. More...
 
- Protected Member Functions inherited from Simulator
virtual void publishState (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

NetCdfReadernetCdfReader_
 
float * modelTime_
 
unsigned int modelTimeSize_
 
float * modelDepth_
 
unsigned int modelDepthSize_
 
float * modelLatitude_
 
unsigned int modelLatitudeSize_
 
float * modelLongitude_
 
unsigned int modelLongitudeSize_
 size of longitude Array More...
 
NetCdfReader::NetCdfVarvarSalinity_
 NetCdf variable that contains salinity. More...
 
float salinityArray_ [2][2][2][2]
 salinity array data More...
 
int salinityIndices_ [4]
 preserve indices to cut down on NetCDF reads More...
 
NetCdfReader::NetCdfVarvarTemperature_
 
float temperatureArray_ [2][2][2][2]
 
int temperatureIndices_ [4]
 
NetCdfReader::NetCdfVarvarU_
 
float uArray_ [2][2][2][2]
 
int uIndices_ [4]
 
NetCdfReader::NetCdfVarvarV_
 
float vArray_ [2][2][2][2]
 
int vIndices_ [4]
 
- Protected Attributes inherited from Simulator
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

 EnvSimulator (const EnvSimulator &old)
 

Additional Inherited Members

- Protected Types inherited from Simulator
enum  { LO_RUDD, PO_ELEV, UP_RUDD, ST_ELEV }
 Defines fins. More...
 

Detailed Description

The EnvSimulator adds lookup of environmental parameters to the base Simulator class.

Constructor & Destructor Documentation

EnvSimulator::EnvSimulator ( bool  simulateSensors,
int  nSteps 
)
virtual EnvSimulator::~EnvSimulator ( )
inlinevirtual

Destructor.

References uninitialize().

EnvSimulator::EnvSimulator ( const EnvSimulator old)
private

Member Function Documentation

bool EnvSimulator::interpolate ( const float &  time,
const float &  depth,
const float &  lat,
const float &  lon,
int &  timeIndex,
int &  depthIndex,
int &  latIndex,
int &  lonIndex,
int  varIndices[4],
float  varArray[2][2][2][2],
NetCdfReader::NetCdfVar var,
float &  value 
)
protected
float EnvSimulator::twoLineEstimate ( const float  x,
const float  y0,
const float  y1,
const float  y2,
const float  x0,
const float  x1,
const float  x2 
)
protected

Interpolates a value on two lines, from (x0, y0) to (x1, y1) to (x2, y2) Does not extrapolate – rather, it pins values.

References AuvMath::Interpolate1D().

Referenced by simulateSensors().

void EnvSimulator::uninitialize ( void  )
virtual

Uninitialize the simulation.

Deinitialize.

Reimplemented from Simulator.

References modelDepth_, modelLatitude_, modelLongitude_, modelTime_, and netCdfReader_.

Referenced by ~EnvSimulator().

Member Data Documentation

float* EnvSimulator::modelDepth_
protected
unsigned int EnvSimulator::modelDepthSize_
protected
float* EnvSimulator::modelLatitude_
protected
unsigned int EnvSimulator::modelLatitudeSize_
protected
float* EnvSimulator::modelLongitude_
protected
unsigned int EnvSimulator::modelLongitudeSize_
protected

size of longitude Array

Referenced by configureSensors(), interpolate(), and simulateSensors().

float* EnvSimulator::modelTime_
protected
unsigned int EnvSimulator::modelTimeSize_
protected
NetCdfReader* EnvSimulator::netCdfReader_
protected
float EnvSimulator::salinityArray_[2][2][2][2]
protected

salinity array data

Referenced by EnvSimulator(), and simulateSensors().

int EnvSimulator::salinityIndices_[4]
protected

preserve indices to cut down on NetCDF reads

Referenced by EnvSimulator(), and simulateSensors().

float EnvSimulator::temperatureArray_[2][2][2][2]
protected

Referenced by EnvSimulator(), and simulateSensors().

int EnvSimulator::temperatureIndices_[4]
protected

Referenced by EnvSimulator(), and simulateSensors().

float EnvSimulator::uArray_[2][2][2][2]
protected

Referenced by EnvSimulator(), and simulateSensors().

int EnvSimulator::uIndices_[4]
protected

Referenced by EnvSimulator(), and simulateSensors().

float EnvSimulator::vArray_[2][2][2][2]
protected

Referenced by EnvSimulator(), and simulateSensors().

NetCdfReader::NetCdfVar* EnvSimulator::varSalinity_
protected

NetCdf variable that contains salinity.

Referenced by configureSensors(), and simulateSensors().

NetCdfReader::NetCdfVar* EnvSimulator::varTemperature_
protected
NetCdfReader::NetCdfVar* EnvSimulator::varU_
protected
NetCdfReader::NetCdfVar* EnvSimulator::varV_
protected
int EnvSimulator::vIndices_[4]
protected

Referenced by EnvSimulator(), and simulateSensors().


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