Thread: [Gcblue-commits] gcb_wx/include/sim tcSonarEnvironment.h, NONE, 1.1 tcSonarRay.h, NONE, 1.1 tcSenso
Status: Alpha
Brought to you by:
ddcforge
From: Dewitt C. <ddc...@us...> - 2006-12-20 00:45:49
|
Update of /cvsroot/gcblue/gcb_wx/include/sim In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv25403/include/sim Modified Files: tcSensorState.h Added Files: tcSonarEnvironment.h tcSonarRay.h Log Message: Index: tcSensorState.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/sim/tcSensorState.h,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** tcSensorState.h 22 Mar 2006 01:23:29 -0000 1.22 --- tcSensorState.h 20 Dec 2006 00:45:45 -0000 1.23 *************** *** 112,115 **** --- 112,116 ---- static tcSimState* simState; static tcDatabase* database; + static long nextSensorId; ///< for assigning sensorId bool isHidden; ///< hidden sensors are not displayed in object control view *************** *** 117,120 **** --- 118,122 ---- long fireControlId; ///< id of platform with fire control sensor (semi-active illuminator, or command guidance sensor) unsigned char fireControlIdx; ///< sensor index of fire control sensor platform + const long sensorId; ///< unique id for this sensor (used for sonar TL cache) bool RandomDetect(float margin_dB); --- NEW FILE: tcSonarEnvironment.h --- /** ** @file tcSonarEnvironment.h */ /* Copyright (C) 2006 Dewitt Colclough (de...@gc...) ** All rights reserved. ** This file is part of the Global Conflict Blue (GCB) program. ** GCB is free software; you can redistribute it and/or modify ** it under the terms of version 2 of the GNU General Public License as ** published by the Free Software Foundation. ** GCB is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. ** You should have received a copy of the GNU General Public License ** along with GCB; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA **/ #if _MSC_VER > 1000 #pragma once #endif #ifndef _TCSONARENVIRONMENT_H_ #define _TCSONARENVIRONMENT_H_ #include "simmath.h" #include <map> #include <vector> class tcSonarRay; /** * Class for sonar propagation modeling * * Initial version * - Assume bottom is always at 500 m (no bathy data yet) * - Calculate rays for sonar every 10 m depth from 0 to 500 m (50 sets of rays) * * Singleton class */ class tcSonarEnvironment { public: struct SVPData { float depth_m; float v_mps; float R_m; ///< radius of curvature for this segment float R2_m; ///< square of radius of curvature }; static tcSonarEnvironment* Get(); ///< singleton instance accessor const std::vector<SVPData>& GetSVP() const; void SetSVP(const std::vector<SVPData>& svp_); void ClearSVP(); void AddSVPPoint(float depth_m, float speed_mps); void SetDefaultSVP(); void SetSurfaceLoss(float val_dB); float GetSurfaceLoss() const; void SetBottomLoss(float val_dB); float GetBottomLoss() const; void SetSeaState(unsigned int val); unsigned int GetSeaState() const; float GetAmbientNL(float freq_Hz) const; float GetTL(long key, double t, float depth_m, float targetRange_m, float targetDepth_m); void Clear(); void Test(); private: struct BeamData { double t_update; ///< last update time float depth_m; ///< depth that rays were calculated at std::vector<tcSonarRay> beam; ///< rays over range of angles = "beam" }; std::map<long, BeamData> beamCache; float surfaceLoss_dB; ///< loss from surface reflection float bottomLoss_dB; ///< loss from bottom reflection float minAngle_rad; ///< min angle for ray calc float maxAngle_rad; ///< max angle for ray calc float angleStep_rad; ///< angle increment for ray calc float depthUpdateThreshold_m; ///< update rays if depth change exceeds const float fluxDecay; float rayCount_dB; ///< 10*log10(# rays per beam) std::vector<float> range_m; ///< ranges that TL is evaluated at std::vector<SVPData> svp; ///< sound velocity profile <depth [m], speed [m/s] points unsigned int seaState; ///< 0-7 sea state float noiseLevelBase; float noiseLevelSlope; const tcSonarRay& CalculateRay(float startDepth_m, float startAngle_rad); size_t GetSVPSegment(float& angle_rad, float& depth, float& reflectionLoss_dB); void UpdateBeam(std::vector<tcSonarRay>& beam, float depth_m); void WriteBeamToCSV(const std::vector<tcSonarRay>& beam, const std::string& filename); void WriteTLToCSV(const std::vector<float>& range_vect, const std::vector<float>& loss_vect, const std::string& fileName); float GetTLSimple(float depth_m, float targetRange_m, float targetDepth_m); bool ValidateSVP(); tcSonarEnvironment(); ~tcSonarEnvironment(); }; #endif --- NEW FILE: tcSonarRay.h --- /** ** @file tcSonarRay.h */ /* Copyright (C) 2006 Dewitt Colclough (de...@gc...) ** All rights reserved. ** This file is part of the Global Conflict Blue (GCB) program. ** GCB is free software; you can redistribute it and/or modify ** it under the terms of version 2 of the GNU General Public License as ** published by the Free Software Foundation. ** GCB is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. ** You should have received a copy of the GNU General Public License ** along with GCB; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA **/ #if _MSC_VER > 1000 #pragma once #endif #ifndef _TCSONARRAY_H_ #define _TCSONARRAY_H_ #include "simmath.h" #include <vector> /** * Describes path of sonar ray calculated by ray tracing */ class tcSonarRay { public: struct RayPoint { float x; float xmax; float y; float R; float R2; float xc; float yc; float reflectionLoss_dB; ///< accumulated reflection loss up to this segment }; std::vector<RayPoint> data; float CalculateDepth(float range_m, float& reflectionLoss_dB) const; tcSonarRay(); virtual ~tcSonarRay(); private: }; #endif |