![]() |
VR-Forces Developer's Guide
|
This class contains the functions that the VRF simulation uses to query the current state of the weather. All locations are terrain database ("local") coordinates.

Public Member Functions | |
| DtWeatherStateProvider (const DtSimulationServices *simManager) | |
| virtual | ~DtWeatherStateProvider () |
| virtual bool | init () |
| virtual void | tick () |
| virtual const DtSimulationServices * | simManager () const |
| const DtSimulationServices * | simulationServices () const |
Atmosphere | |
| virtual std::vector < CloudStateSegment > | cloudLayers (const DtVector &localPosition) const |
| virtual double | airVisibility (const DtVector &localPosition) const |
| virtual double | visibility (const DtVector &localPosition) const |
| virtual int | visibilityObscurant (const DtVector &localPosition) const |
| virtual double | averageVisibilityOnChord (const DtChord &path) const |
| virtual double | airTemperatureAtAltitude (const double mslTemperature, const double altitude) const |
| virtual double | airTemperature (const DtVector &localPosition) const |
| virtual double | mslTemperatureFromAirTemperatureAtAltitude (const double airTemperature, const double altitude) const |
| virtual double | airPressureAtAltitude (const double mslPressure, const double altitude, const double mslTemperature) const |
| virtual double | airPressure (const DtVector &localPosition) const |
| virtual double | mslPressureFromAirPressureAtAltitude (const double airPressure, const double altitude, const double mslTemperature) const |
| virtual double | airTemperatureAltitude (const DtVector &localPosition) const |
| virtual double | airPressureAltitude (const DtVector &localPosition) const |
| virtual double | humidity (const DtVector &localPosition) const |
| virtual double | relativeHumidity (const DtVector &localPosition) const |
| virtual double | windSpeed (const DtVector &localPosition) const |
| virtual double | windDirection (const DtVector &localPosition) const |
| virtual bool | windSpeedAndDirectionAtAltitude (const DtVector &localPosition, double altMSL, double &windSpeed, double &windDiection) const |
| virtual bool | visibilityAndObscurantAtAltitude (const DtVector &localPosition, double altMSL, double &visibility, int &obscurant) const |
| virtual DtRwWindLevels | windLevels (const DtVector &localPosition) const |
| virtual DtVrfTurbulenceLevel | airTurbulence (const DtVector &localPosition) const |
| virtual void | lineQueryAtmosphericState (const DtVector &startPosition, const DtVector &endPosition, double minSegmentLength, size_t maxSegmentCount, std::vector< AtmosphericStateSegment > &atmosphericStateSegments) const |
| virtual void | lineQueryCloudState (const DtVector &startPosition, const DtVector &endPosition, std::vector< CloudStateSegment > &cloudStateSegments, double tolerance=5.0) const |
| virtual bool | lightningPresent (const DtVector &localPosition) const |
Precipitation | |
The functions may make use of the altitude of the point; however, in the default implementation, altitude is not considered. | |
| virtual int | blowingParticulateMatter (const DtVector &localPosition) const |
| virtual double | precipitationIntensity (const DtVector &localPosition) const |
| virtual double | averagePrecipitationIntensity (const DtChord &) const |
| virtual DtVrfWeatherPrecipitationType | precipitationType (const DtVector &localPosition) const |
| virtual double | snowAccumulationDepth (const DtVector &localPosition) const |
| virtual double | snowDepthOnRoads (const DtVector &localPosition) const |
| virtual double | rainAccumulationDepth (const DtVector &localPosition) const |
| virtual void | lineQueryPrecipitationState (const DtVector &startPosition, const DtVector &endPosition, std::vector< PrecipitationStateSegment > &precipitationStateSegments, double tolerance=5.0) const |
Illumination | |
| virtual double | illuminationFromSky (const DtVector &localPosition) const |
| virtual double | illuminationAtTime (const DtVector &localPosition, const double dateTime) const |
Water | |
| virtual double | underwaterVisibility (const DtVector &localPosition) const |
| virtual double | averageWaterVisibilityOnChord (const DtChord &path) const |
| virtual double | waterCurrentSpeed (const DtVector &localPosition) const |
| virtual double | waterCurrentDirection (const DtVector &localPosition) const |
| virtual double | waterTemperature (const DtVector &localPosition) const |
| virtual double | tidalOffset (const DtVector &localPosition) const |
| virtual unsigned int | swellState (const DtVector &localPosition) const |
| virtual double | swellDirection (const DtVector &localPosition) const |
| virtual unsigned int | seaState (const DtVector &localPosition) const |
| virtual double | seaDirection (const DtVector &localPosition) const |
| virtual double | choppiness (const DtVector &localPosition) const |
| virtual double | surgeDepth (const DtVector &localPosition) const |
| virtual double | depthOffset (const DtVector &localPosition) const |
| virtual double | windFetch (const DtVector &localPosition) const |
| virtual double | thermoclineLayer1Depth (const DtVector &localPosition) const |
| virtual double | thermoclineLayer1Permeability (const DtVector &localPosition) const |
| virtual double | thermoclineLayer2Depth (const DtVector &localPosition) const |
| virtual double | thermoclineLayer2Permeability (const DtVector &localPosition) const |
| virtual double | thermoclineLayer3Depth (const DtVector &localPosition) const |
| virtual double | thermoclineLayer3Permeability (const DtVector &localPosition) const |
| virtual double | thermoclineLayer4Depth (const DtVector &localPosition) const |
| virtual double | thermoclineLayer4Permeability (const DtVector &localPosition) const |
| virtual double | thermoclineLayer5Depth (const DtVector &localPosition) const |
| virtual double | thermoclineLayer5Permeability (const DtVector &localPosition) const |
Static Public Member Functions | |
| static DtWeatherStateProvider * | creator (const DtSimulationServices *simMgr) |
Protected Member Functions | |
| std::vector< DtChord > | segmentsIntersectingPrecipitationAreas (const DtVector &startPosition, const DtVector &endPosition, const std::vector< DtSimObjectReference > &weatherObjects, double tolerance) const |
| void | setPrecipitationStateForWeatherObjectsSegments (const std::vector< DtChord > &chordIntersectingSegments, const std::vector< DtSimObjectReference > &weatherObjects, std::vector< PrecipitationStateSegment > &precipitationStateSegments, std::vector< DtChord > &globalWeatherChordIntersectingSegments, double tolerance) const |
| void | setPrecipitationStateForGlobalWeatherSegments (const DtVector &startPosition, const std::vector< DtChord > &globalWeatherChordIntersectingSegments, const std::vector< DtSimObjectReference > &weatherObjects, std::vector< PrecipitationStateSegment > &precipitationStateSegments, double tolerance) const |
| std::vector< DtChord > | segmentsIntersectingCloudLayers (const DtVector &startPosition, const DtVector &endPosition, const std::vector< DtSimObjectReference > &weatherObjects, double tolerance) const |
| void | setCloudStateForWeatherObjectsSegments (const std::vector< DtChord > &chordIntersectingSegments, const std::vector< DtSimObjectReference > &weatherObjects, std::vector< CloudStateSegment > &cloudStateSegments, std::vector< DtChord > &globalWeatherChordIntersectingSegments, double tolerance) const |
| void | setCloudStateForGlobalWeatherSegments (const DtVector &startPosition, const std::vector< DtChord > &globalWeatherChordIntersectingSegments, const std::vector< DtSimObjectReference > &weatherObjects, std::vector< CloudStateSegment > &cloudStateSegments, double tolerance) const |
| bool | chordIntersectsExtent (const DtChord &chord, const DtExtent &extent, DtPoint &intersectionEntryPoint, DtPoint &intersectionExitPoint, bool &chordPt0InExtent, bool &chordPt1InExtent) const |
| virtual double | defaultCloudVisibility () const |
Protected Attributes | |
| const DtSimulationServices * | mySimulationServices |
| double | myKoschmiederConstant |
Private Member Functions | |
| DtWeatherStateProvider (const DtWeatherStateProvider &orig) | |
| const DtWeatherStateProvider & | operator= (const DtWeatherStateProvider &orig) |
| DtWeatherStateProvider () | |
|
private |
Not implemented.
|
private |
Not implemented.
| DtWeatherStateProvider::DtWeatherStateProvider | ( | const DtSimulationServices * | simManager | ) |
constructor
|
virtual |
destructor
|
private |
Not implemented.
|
virtual |
This is called by the environmental state manager immediately after it creates a weather state provider. Any other code that creates a weather state provider should call this before calling other functions.
|
virtual |
Called by DtEnvironmentalStateManager::tick(). The default weather state provider does nothing here. It could be used to accumulate snow, or something.
|
virtual |
|
static |
The weatherStateProvider will be created by the environmentalStateManager using a factory, so that other weatherStateProviders can be used instead by registering a different creator function in the factory.
|
virtual |
Provides descriptions of each cloud layer. Not normally needed, but here in case a VRF component needs this detailed data, e.g. to find a cloud ceiling or something. Normally, visibility is the attribute of interest, and the visibility functions below use cloud layers in their calculations, so this cloud layer detail is not necessary.
Layers at a 2D location (i.e., above a point on the surface).
|
virtual |
Visibility of just the air (without clouds or precipitation). With weather areas, this is the value of visibility(). In meters.
|
virtual |
Visibility in meters. Accounts for base air visibility and precipitation (uses intensity in a formula).
|
virtual |
Visibility obscurant at the given position.
|
virtual |
Average visibility value along the given chord. This is visibility through the air (i.e., not water). The default computation finds all weather objects that the chord passes through. An attenuation value is calculated for air visibility and precipitation; these are averaged equally over the number of objects–there is no calculation of distance within each object. Clouds are not yet (VRF 4.8 IPB7) considered. These attenuations are added and then a net visibility is calculated.
|
virtual |
Air temperature at an altitude, given the MSL temperature. Temperature is in degrees C; altitude is in meters.
|
virtual |
Air temperature in degrees C at the given 3D location. In the default implementation, the ambient temperature in a weather object is taken to be the MSL temperature. airTemperatureAtAltitude is used to compute the net temperature.
Reimplemented in MyWeatherStateProvider.
|
virtual |
Return MSL temperature, given an air temperature at a specific altitude. Temperature is in degrees C; altitude is in meters. Max valid altitude value is 10000m.
|
virtual |
Air pressure at an altitude, given the MSL pressure and MSL temperature. Pressure is in kPa; altitude is in meters. temperature is in degrees C.
|
virtual |
Air pressure at the given 3D location. In kiloPascals. Uses airTemperature(). In the default implementation, there is no pressure attribute in weather objects, so this function assumes a default MSL pressure of 101.321 kPa.
|
virtual |
Return MSL temperature, given an air temperature at a specific altitude and the msl temperature. Pressure is in kPa; altitude is in meters. temperature in degrees C. Max valid altitude value is 10000m.
|
virtual |
Air temperature altitude in meters.
|
virtual |
Air pressure altitude in meters.
|
virtual |
Humidity in ppmv.
|
virtual |
Percentage humidity. Returns a value 0 - 100. No information about this in the default implementation, so by default returns 10.0.
|
virtual |
Wind speed in mps.
|
virtual |
Wind heading in radians.
|
virtual |
Gets both wind speed and direction.
|
virtual |
Gets both visibility and obscurant.
|
virtual |
Returns the wind levels object at the given location.
|
virtual |
Turbulence level.
|
virtual |
Query the atmospheric state along a line. The line is split into equal length segments and the atmospheric data is retrieved at sample positions.
| Input | |
| startPosition | the coordinates of the query line's starting point. |
| endPosition | the coordinates of the query line's end point. |
| minSegmentLength | the minimal length of the segments, the query line will be split into. This is the minimal distance between the data sampling points along the line. |
| maxSegmentCount | the maximal number of segments, the query line will be split into. minSegmentLength and maxSegmentCount are used to determine the number and the positions of of the sampling points along the query line. |
| Output | |
| atmosphericStateSegments | a collection of AtmosphericStateSegment structures. Each AtmosphericStateSegment structure contains the atmospheric data - e.g. air pressure, air temperature, etc. taken at a sampling position along the query line. Each line segment is determined by the position of the sampling point. See the AtmosphericStateSegment declaration in the current file. |
|
virtual |
Query the cloud layers state along a line. Returned are the segments along the line where there is cloud coverage, with the associated cloud layer data.
Note: For long query lines - the function may return incorrect intersection segments. That is due to the internal topographic conversions and the curvature of the earth. In these cases, it is suggested to split the query line into smaller sections and do multiple queries.
| Input | |
| startPosition | the coordinates of the query line's starting point. |
| endPosition | the coordinates of the query line's end point. |
| tolerance | the minimum required thickness of a cloud layer, so to be included in the returned cloudStateSegments collection. The tolerance default value is 5m , and the minimal value is 0.5m. |
| Output | |
| cloudStateSegments | a collection of CloudStateSegment structures. Each CloudStateSegment structure contains the cloud layer data - e.g. cloud type, visibility, etc. for a section along the query line where there is a cloud coverage. The cloud parameters have the same value along the entire line segment. The line segments without cloud coverage are not included in the collection. Each line segment is determined by its starting position and length. See the CloudStateSegment declaration in the current file. |
|
virtual |
Returns whether lightning is present.
|
virtual |
Returns mm/hr precipitation. Note that for snow, this value should be about 10x what it would be for rain for the same amount of water.
|
virtual |
Returns mm/hr precipitation. Note that for snow, this value should be about 10x what it would be for rain for the same amount of water.
|
virtual |
Returns mm/hr precipitation. Note that for snow, this value should be about 10x what it would be for rain for the same amount of water.
|
virtual |
Returns mm/hr precipitation. Note that for snow, this value should be about 10x what it would be for rain for the same amount of water.
|
virtual |
Returns mm/hr precipitation. Note that for snow, this value should be about 10x what it would be for rain for the same amount of water.
|
virtual |
Returns mm/hr precipitation. Note that for snow, this value should be about 10x what it would be for rain for the same amount of water.
|
virtual |
Returns mm/hr precipitation. Note that for snow, this value should be about 10x what it would be for rain for the same amount of water.
|
virtual |
Query the precipitation state along a line. Returned are the segments along the line where there is precipitation, with the associated precipitation data.
Note: For long query lines - the function may return incorrect intersection segments. That is due to the internal topographic conversions and the curvature of the earth. In these cases, it is suggested to split the query line into smaller sections and do multiple queries.
| Input | |
| startPosition | the coordinates of the query line's starting point. |
| endPosition | the coordinates of the query line's end point. |
| tolerance | the minimum required thickness of a cloud layer, so to be included in the returned cloudStateSegments collection. The tolerance default value is 5m , and the minimal value is 0.5m. |
| Output | |
| precipitationStateSegments | a collection of PrecipitationStateSegment structures. Each PrecipitationStateSegment structure contains the precipitation data - e.g. precipitation intensity, etc. for a section along the query line where there is a precipitation. The precipitation parameters have the same value along the entire line segment. The line segments without precipitation are not included in the collection. Each line segment is determined by its starting position and length. See the PrecipitationStateSegment declaration in the current file. |
|
virtual |
Illumination only from sun, moon, and stars. Returns a value [0-1] representing a fraction of full sunlight.
|
virtual |
This version of the illumination function calculates the light from sun/moon/stars at an arbitrary date-time.
|
virtual |
Visibility distance in meters.
|
virtual |
Provides a visibility value that can be used for sensing along the chord (e.g., computing loss of contrast).
|
virtual |
Visibility distance in meters.
|
virtual |
Visibility distance in meters.
|
virtual |
Heading in radians.
|
virtual |
Tidal offset in meters above the water surface in the database.
|
virtual |
Swell state according to the Douglas Sea Scale (integer 0 - 9)
|
virtual |
Visibility distance in meters.
|
virtual |
Heading in radians.
Sea state according to the Douglas Sea Scale (integer 0 - 9)
|
virtual |
Visibility distance in meters.
|
virtual |
Heading in radians.
Wave choppiness (0..1).
|
virtual |
Meters.
|
virtual |
Meters.
|
virtual |
Meters.
|
virtual |
Depths are the depth of the top of the thermocline. If the depth is 0, the layer is not present.
|
virtual |
Visibility distance in meters.
|
virtual |
Visibility distance in meters.
|
virtual |
Visibility distance in meters.
|
virtual |
Visibility distance in meters.
|
virtual |
Visibility distance in meters.
|
virtual |
Visibility distance in meters.
|
virtual |
Visibility distance in meters.
|
virtual |
Visibility distance in meters.
|
virtual |
Visibility distance in meters.
|
inline |
|
protected |
Check if a query chord intersects a list of weather objects Return an ordered vector of intersection sub-chords along the query chord The sub-chords are ordered based on the distance to the query chord starting point.
|
protected |
Set the precipitation data for chords segments intersecting with the weather objects. Returns the chord segments outside the weather objects - i.e. falling into the global weather area.
|
protected |
Set the precipitation data for chords segments falling into the global weather area.
|
protected |
Check if a query chord intersects the cloud layers within a list of weather objects Return an ordered vector of intersection sub-chords along the query chord The sub-chords are ordered based on the distance to the query chord starting point.
|
protected |
Set the cloud data for chords segments intersecting with the cloud layers within a list of weather objects. Returns the chord segments outside the weather objects - i.e. falling into the global weather area.
|
protected |
Set the cloud data for chords segments falling into the global weather area.
|
protected |
Check if a chord intersects or is contained entirely or partially within extent Return the intersection two end points Return flags indicating if the chord end points are within the extent.
|
protectedvirtual |
The visibility in clouds. Default value is 45m, taken from Table 8 in Collins, "Military Geography for Professionals and the Public", p. 74; for dense fog.
|
protected |
|
protected |
Constants for physical calculations that are computed from other constants, and cached to avoid recomputation.
Constant used to calculate visibility range from attenuation coefficient, and vice versa. Calculated from visual detection minimum contrast ratio.(see https://en.wikipedia.org/wiki/Visibility)