VR-Vantage 3.1 API Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Sonar.h
Go to the documentation of this file.
1 /* © 2006 JRM Technologies, Inc.*/
2 
3 #ifndef _SIGSIM_SONAR
4 #define _SIGSIM_SONAR
5 
6 /***********************************
7 Copyright JRM Enterprises, Inc. 1998
8 All rights reserved.
9 
10 This code is the intellectual property of JRM Enterprises, Inc.
11 It may not be used or released as source or compiled binary form
12 without the prior written consent of JRM Enterprises, Inc.
13 ***********************************/
14 
15 
16 #include "SigSimStructs.h"
17 #include "sigsimDLLstub.h"
18 //#include "GetScenario.h"
19 
20 
21 #ifdef __cplusplus
22 extern "C"
23 {
24 #endif
25 
26  //----------Grabbed #define MINDB, stuck in .c file-----------------
27 
28  /* --------------- GENERAL TARGET and REQUEST INFORMATION --------------------------- */
29 
30  typedef struct
31  {
32  char name_acoustic_contact[SIGSIM_STRING_SIZE]; // The Name for the Acoustic Contact in the data set. This name includes all sound sources of waterborne radiated energy for a single contact. Included are aircraft, ships, submarines, biologics and all other manmade or natural sources.
33  char ctry_code_user[SIGSIM_STRING_SIZE]; // The country known or estimated to be operating or maintaining a system, weapon, or platform within its inventory.
34  char ac_trng_ver[SIGSIM_STRING_SIZE]; // The Acoustic training version number for the Equipment code and Country code user. This field identifies the different training versions of the radiated signature.
35  } CONTACT_ID; // ATAS Basic Unique Contact ID
36 
37  typedef struct
38  {
39  char vessel_class[SIGSIM_STRING_SIZE]; // Vessel class identifier (e.g. xxx_SS_CH_DD)
40  char vessel_type[SIGSIM_STRING_SIZE]; // Vessel type identifier (e.g. Ship)
41  char platform_type[SIGSIM_STRING_SIZE]; // Platform type (e.g. Submarine)
42  char threat_type[SIGSIM_STRING_SIZE]; // Threat type (e.g. Hostile)
43  } TARGET_VSSL; // Passive-mode vessel type information
44 
45  typedef struct
46  {
47  double length_ovrl_ft; // [ft] Long-axis length of target.
48  double beam_max_ft; // [ft] Width of target hull at maximum point.
49  double draft_min_ft; // [ft] Distance from hull bottom to waterline, measured at location of minimum value.
50  double draft_nom_ft; // [ft] Distance from hull bottom to waterline, measured at location of average value.
51  double draft_max_ft; // [ft] Distance from hull bottom to waterline, measured at location of maximum value.
52  double keel_depth_min_ft; // [ft] Minimum keel depth when surfaced
53  double keel_depth_nom_ft; // [ft] Nominal keel depth when surfaced
54  double keel_depth_max_ft; // [ft] Maximum keel depth when surfaced
55  double depth_periscope_ft; // [ft] Maximum target depth at which top of fully-extended periscope just breaches the waterline.
56  } TARGET_PHYC; // Passive-mode vessel physical characteristics
57 
58  typedef struct
59  {
60  CONTACT_ID ID; // Target unique identifier
61  int mode; // <0 is ACTIVE, >=0 is PASSIVE mode #
62  double freq_khz; // [kHz] Frequency
63  double bandwidth_khz; // [kHz] Full Bandwidth
64  double pulse_width_sec; // [s] Pulse width
65  double delay_sec; // [s] 1-way time delay
66  double asp_angle_deg; // [deg] Azimuth from the centerline.
67  double target_velocity_mps; // [m/s] target linear velocity along front direction (for passive level calcs)
68  } TS_REQUEST; // Target Strength Request
69 
71 
72  /* ----------------- SOURCE STRENGTH --------------------- */
73  SIGSIM49_API int AddACOUSTIC_TRANSDUCER(ACOUSTIC_TRANSDUCER **c, int *nc, ACOUSTIC_TRANSDUCER toadd);
74  SIGSIM49_API void Free_ACOUSTIC_TRANSDUCERArray(ACOUSTIC_TRANSDUCER **c, int *nc, jrmbool init);
75  SIGSIM49_API void SetDICASS62SourceParms(char* channel, ACOUSTIC_TRANSDUCER *dicass62);
76  SIGSIM49_API void SetSQS510HullMountSourceParms(ACOUSTIC_TRANSDUCER *c);
77  SIGSIM49_API void SetTAKRHullMountSourceParms(ACOUSTIC_TRANSDUCER *c);
78  SIGSIM49_API void SetTMS118ADSSourceParms(ACOUSTIC_TRANSDUCER *c);
79  SIGSIM49_API void SetCP140SonoBuoySourceParms(ACOUSTIC_TRANSDUCER *c);
80  SIGSIM49_API void SetCP140LFSourceParms(ACOUSTIC_TRANSDUCER *c);
81  SIGSIM49_API void SetSINTRA2040HullMountSourceParms(ACOUSTIC_TRANSDUCER *c);
82  SIGSIM49_API void SetCANTASSSQR501TowedArraySourceParms(ACOUSTIC_TRANSDUCER *c);
83  SIGSIM49_API void SetCANTASS2046TowedArraySourceParms(ACOUSTIC_TRANSDUCER *c);
84  SIGSIM49_API void SetTransducerByMALOSonarCode(int code, ACOUSTIC_TRANSDUCER *transduce);
85  SIGSIM49_API int FindMALOSonarCodeBySource_ID(char *sourceID);
86 
87 
88  // CalculateSourceLevelAndDirectivities : Calculates Source Level (*SL), transmitter Directivity Index (*DIT), and receiver Directivity Index (*DI) in [dB]
89  // at particular direction totargetFRD in transducer source's FRD frame.
90  SIGSIM49_API int CalculateSourceLevelAndDirectivities(ACOUSTIC_TRANSDUCER source, VECTOR totargetFRD, double *SL, double *DIT, double *DI);
91 
92 
93 
94  /* ----------------- SCENARIO --------------------- */
95 
96  typedef enum
97  {
98  UNKNOWN = 0,
99  SQS510HM = 1, // Halifax hull mount active (#1)
100  TAKRHM = 2, // T-AR Bob Hope hull mount active (#2)
101  TMS118ADS = 3, // CH148 dipper active (#3)
102  CP140SB = 4, // CP-140 Sonobuoy active (#4)
103  CP140LF = 5, // CP-140 LF active (#5)
104  SINTRA2040HM = 6, // Victoria Hull Mount passive (#6)
105  CANTASSSQR501TA = 7, // Halifax Towed Array passive (#7)
106  CANTASS2046TA = 8, // Victoria Towed Array passive (#8)
107  DICASS62A = 9, // DICASS62 Channel A active
108  DICASS62B = 10, // DICASS62 Channel B active
109  DICASS62C = 11, // DICASS62 Channel C active
110  DICASS62D = 12 // DICASS62 Channel D active
111  } MALO_CODE;
112 
113 
114 
115  /* ----------------- PASSIVE MODE TARGET STRENGTH --------------------- */
116 
117  typedef struct
118  {
119  int blades; // [unitless] Number of blades on this shaft
120  double area; // [ft2?] Blade disk area
121  double diameter; // [ft] Blade diameter
122  double delh; // [ft] Screw to keel distance
123  } PASSIVE_SHAFT;
124 
125  typedef struct
126  {
127  int nshafts; // [unitless] Number of shafts on this vessel
128  PASSIVE_SHAFT *shaft; // Blade info for each shaft
129  } PASSIVE_PROP; // Passive-mode vessel propulsion data
130 
131  typedef struct
132  {
133  int mode; // [cardinal] Mode identifier
134  int *family; // Array of Harmonic Family identifiers
135  int nfamily; // Number of harmonic families in array
136  } PASSIVE_FTRE; // Passive-mode harmonic family numbers for this mode.
137 
138  typedef struct
139  {
140  double speed; // [knots] Speed of forward motion of a contact for turn rate.
141  double radius; // [yards] The turning radius of the contact at the maximum speed for the contact.
142  double rate; // [deg/s] Minimum contact turn rate.
143  double ang; // [deg] Angle of the rudder associated with a particular turn rate.
144  double decr_pct; // [%] Rate at which the forward motion decreases as the contact enters a turn.
145  } TURN_RATE_DATAPOINT; // Turn Rate data table entry
146 
147  typedef struct
148  {
149  double speed; // [knots] Linear speed
150  double srpm; // [rpm] shaft rotation frequency
151  double tpk; // [rev/kts] Contact's turns per knot at a particular speed.
152  double shft_of_pct[3]; // [%] Offset srpm of extra shafts as percentage of first shaft
153  int nextra_shafts; // Number of extra shafts
154  } ROTATION_DATAPOINT; // Rotation data table entry
155 
156  typedef struct
157  {
158  int mode; // [cardinal] Mode identifier
159  double depth_min; // [ft?] Minimum depth
160  double depth_max; // [ft?] Maximum depth
161  double speed_min; // [knots] Minimum speed
162  double speed_max; // [knots] Maximum speed
163  double srpm_min; // [rpm] Minimum shaft rotation frequency
164  double srpm_max; // [rpm] Maximum shaft rotation frequency
165  double *accel; // [knots/s]? Array of acceleration options?
166  int naccel; // Number of entries in accel array
167  double *decel; // [knots/s]? Array of deceleration options?
168  int ndecel; // Number of entries in decel array
169  double *dive; // [ft/s]? Array of dive options?
170  int ndive; // Number of entries in dive array
171  double *climb; // [ft/s]? Array of climb options?
172  int nclimb; // Number of entries in climb array
173  TURN_RATE_DATAPOINT *turn; // Turn Rate data table
174  int nturn; // Number of entries in turn array
175  ROTATION_DATAPOINT *rotation; // Rotation data table
176  int nrotation; // Number of entries in rotation array
177  } PASSIVE_MANC; // Passive-mode kinematic capabilities data table
178 
179  typedef struct
180  {
181  double aspect; // [deg] aspect angle (Definition? Assumed azimuth relative to body FRD)
182  double atten; // [dB] attenuation
183  } ATTENUATION_DATAPOINT; // Attenuation data table entry
184 
185  typedef struct
186  {
187  int pattern; // [cardinal] Attenuation pattern identifier
188  ATTENUATION_DATAPOINT *aspdp; // Array of attenuation values per aspect angle
189  int naspdp; // Number of entries in aspdp array
190  } ATTENUATION_PATTERN; // Attenuation Pattern
191 
192  typedef struct
193  {
194  int mode; // [cardinal] Mode identifier
195  ATTENUATION_PATTERN *atp; // Array of attenuation patterns
196  int natp; // Number of elements in atp array
197  } PASSIVE_NBAS; // Passive-mode narrow-band aspect pattern data for this mode
198 
199  typedef struct
200  {
201  double speed; // [knots] Speed of forward motion of a contact.
202  double power; // [dB] The noise level in a frequency band 1/3 octave wide.
203  } BROADBAND_POWER_DATAPOINT; // One-Third-Octave Center Power data table entry
204 
205  typedef struct
206  {
207  double freq; // [Hz] The frequency of a band 1/3 octave wide used in sound pressure level measurement.
208  BROADBAND_POWER_DATAPOINT *spl; // Array of center power vs speed for this frequency
209  int nspl; // Number of elements in spl array
210  } BROADBAND_POWER_TABLE; // Broadband Power vs speed for given frequency and mode
211 
212  typedef struct
213  {
214  int mode; // [cardinal] Mode identifier
215  BROADBAND_POWER_TABLE *bbp; // Array of Broadband power tables, one for each frequency
216  int nbbp; // Number of elements in bbp array
217  } PASSIVE_BBMA; // Passive-mode Broadband power vs speed and OTO frequency
218 
219  typedef struct
220  {
221  int mode; // [cardinal] Mode identifier
222  ATTENUATION_PATTERN *atp; // Array of attenuation patterns
223  int natp; // Number of elements in atp array
224  } PASSIVE_BBAS; // Passive-mode broadband aspect pattern data for this mode
225 
226  typedef struct
227  {
228  double srpm_min; // [rpm] Minimum of shaft rotation frequency range
229  double srpm_max; // [rpm] Maximum of shaft rotation frequency range
230  double freq_min; // [kHz?] Minimum of independent fundamental frequency range
231  double freq_max; // [kHz?] Maximum of independent fundamental frequency range
232  } FUNDFREQ_RANGE; // Fundamental frequency range for given shaft rotation frequency range
233 
234  typedef struct
235  {
236  int model; // 0=NON-SPEED, 1=SRPM, 2=HULL : Type of Independent Harmonic Family Model
237  FUNDFREQ_RANGE *ffr; // Array of fundamental frequency range vs shaft rotation frequency range correlations
238  int nffr; // Number of elements in ffr array
239  } PASSIVE_HIND; // Passive-mode Independent Harmonic Family data
240 
241  typedef struct
242  {
243  double freq_min; // [kHz?] Minimum of dependent driver fundamental frequency range
244  double freq_max; // [kHz?] Maximum of dependent driver fundamental frequency range
245  double factor; // [unitless] mutiplier or divisor
246  } FUNDFREQ_SCALE_DATAPOINT; // Scale factor for this dependent-model driver fundamental frequency range
247 
248  typedef struct
249  {
250  int hind_family; // [cardinal] Source independent harmonic family identifier
251  jrmbool factor_type; // FALSE=multiplier, TRUE=divisor
252  FUNDFREQ_SCALE_DATAPOINT *ffs; // Array of scale factors vs driver fundamental frequency ranges
253  int nffs; // Number of elements in ffs array
254  } PASSIVE_HDEP; // Passive-mode Dependent Harmonic Family scaling data
255 
256  typedef struct
257  {
258  int harmonic; // [cardinal] Harmonic number identifier
259  int pattern; // [cardinal] Attenuation pattern identifier
260  int P_pattern; // [cardinal] P pattern identifier?
261  double *spl; // [dB] Array of Source Power Level values, one for each fundamental frequency range in the speed model (HIND or HDEP) table
262  int nspl; // Number of entries in the spl array. Should equal nffr in corresponding PASSIVE_HIND table OR nffs in corresponding PASSIVE_HDEP table
263  } HARMONIC_LINE; // Harmonic line data in harmonic family
264 
265  typedef struct
266  {
267  int model; // 0=NON-SPEED, 1=SRPM, 2=HULL : Type of Harmonic Family Model
268  HARMONIC_LINE *hl; // Array of harmonic lines and their SPL patterns in this harmonic family
269  int nhl; // Number of entries in the hl array = number of harmonic lines in the family
270  } PASSIVE_HLIN; // Passive-mode Harmonic Line data for a given harmonic family
271 
272  typedef struct
273  {
274  int family; // [cardinal] Harmonic Family identifier
275  char name[SIGSIM_STRING_SIZE]; // Name of harmonic family
276  } PASSIVE_HFAM; // Passive-mode Harmonic Family identification data
277 
278  typedef struct
279  {
280  PASSIVE_HFAM HFAM; // Harmonic family identification data
281  PASSIVE_HIND HIND; // Independent harmonic family data
282  PASSIVE_HLIN HLIN; // Harmonic line data
283  } INDEPENDENT_HARMONIC_FAMILY; // Harmonic family for a given mode
284 
285  typedef struct
286  {
287  PASSIVE_HFAM HFAM; // Harmonic family identification data
288  PASSIVE_HDEP HDEP; // Dependent harmonic family data (If dependency==FALSE, this is empty)
289  PASSIVE_HLIN HLIN; // Harmonic line data
290  } DEPENDENT_HARMONIC_FAMILY; // Harmonic family for a given mode
291 
292  typedef struct
293  {
294  int mode; // [cardinal] Mode identifier
295  PASSIVE_FTRE FTRE; // List of harmonic families for this mode
296  PASSIVE_MANC MANC; // Kinematic capabilities for this mode
297  PASSIVE_BBMA BBMA; // Broadband power data for this mode
298  PASSIVE_BBAS BBAS; // Broadband aspect pattern data for this mode
299  PASSIVE_NBAS NBAS; // Narrow-band aspect pattern data for this mode
300  INDEPENDENT_HARMONIC_FAMILY *IND; // Array of harmonic families for this mode
301  int NIND; // Number of harmonic families in this mode
302  DEPENDENT_HARMONIC_FAMILY *DEP; // Array of harmonic families for this mode
303  int NDEP; // Number of harmonic families in this mode
304  } OPERATING_MODE; // Vehicle operating mode
305 
306  typedef struct
307  {
308  PASSIVE_PROP PROP; // Vessel Propulsion data
309  OPERATING_MODE *MODE; // Array of Operating Modes
310  int NMODE; // Number of Operating Modes
311  } PASSIVE_TARGET; // Passive-mode target data main structure
312 
313  SIGSIM49_API int AddPASSIVE_SHAFT(PASSIVE_SHAFT **c, int *nc, PASSIVE_SHAFT toadd);
314  SIGSIM49_API void FreePASSIVE_SHAFTArray(PASSIVE_SHAFT **c, int *nc, jrmbool init);
315  SIGSIM49_API void FreePASSIVE_PROP(PASSIVE_PROP *c, jrmbool init);
316  SIGSIM49_API void FreePASSIVE_FTRE(PASSIVE_FTRE *c, jrmbool init);
317  SIGSIM49_API int AddTURN_RATE_DATAPOINT(TURN_RATE_DATAPOINT **c, int *nc, TURN_RATE_DATAPOINT toadd);
318  SIGSIM49_API void FreeTURN_RATE_DATAPOINTArray(TURN_RATE_DATAPOINT **c, int *nc, jrmbool init);
319  SIGSIM49_API int AddROTATION_DATAPOINT(ROTATION_DATAPOINT **c, int *nc, ROTATION_DATAPOINT toadd);
321  SIGSIM49_API void FreeROTATION_DATAPOINTArray(ROTATION_DATAPOINT **c, int *nc, jrmbool init);
322  SIGSIM49_API void FreePASSIVE_MANC(PASSIVE_MANC *c, jrmbool init);
323  SIGSIM49_API int AddATTENUATION_DATAPOINT(ATTENUATION_DATAPOINT **c, int *nc, ATTENUATION_DATAPOINT toadd);
325  SIGSIM49_API void FreeATTENUATION_DATAPOINTArray(ATTENUATION_DATAPOINT **c, int *nc, jrmbool init);
326  SIGSIM49_API int AddATTENUATION_PATTERN(ATTENUATION_PATTERN **c, int *nc, ATTENUATION_PATTERN toadd);
328  SIGSIM49_API void FreeATTENUATION_PATTERNArray(ATTENUATION_PATTERN **c, int *nc, jrmbool init);
329  SIGSIM49_API void FreePASSIVE_NBAS(PASSIVE_NBAS *c, jrmbool init);
330  SIGSIM49_API void FreePASSIVE_BBAS(PASSIVE_BBAS *c, jrmbool init);
333  SIGSIM49_API int AddBROADBAND_POWER_TABLE(BROADBAND_POWER_TABLE **c, int *nc, BROADBAND_POWER_TABLE toadd);
335  SIGSIM49_API void FreeBROADBAND_POWER_TABLEArray(BROADBAND_POWER_TABLE **c, int *nc, jrmbool init);
336  SIGSIM49_API void FreePASSIVE_BBMA(PASSIVE_BBMA *c, jrmbool init);
337  SIGSIM49_API int AddFUNDFREQ_RANGE(FUNDFREQ_RANGE **c, int *nc, FUNDFREQ_RANGE toadd);
338  SIGSIM49_API void FreeFUNDFREQ_RANGEArray(FUNDFREQ_RANGE **c, int *nc, jrmbool init);
339  SIGSIM49_API void FreePASSIVE_HIND(PASSIVE_HIND *c, jrmbool init);
342  SIGSIM49_API void FreePASSIVE_HDEP(PASSIVE_HDEP *c, jrmbool init);
343  SIGSIM49_API int AddHARMONIC_LINE(HARMONIC_LINE **c, int *nc, HARMONIC_LINE toadd);
344  SIGSIM49_API void FreeHARMONIC_LINE(HARMONIC_LINE *c, jrmbool init);
345  SIGSIM49_API void FreeHARMONIC_LINEArray(HARMONIC_LINE **c, int *nc, jrmbool init);
346  SIGSIM49_API void FreePASSIVE_HLIN(PASSIVE_HLIN *c, jrmbool init);
353  SIGSIM49_API int AddOPERATING_MODE(OPERATING_MODE **c, int *nc, OPERATING_MODE toadd);
354  SIGSIM49_API void FreeOPERATING_MODE(OPERATING_MODE *c, jrmbool init);
355  SIGSIM49_API void FreeOPERATING_MODEArray(OPERATING_MODE **c, int *nc, jrmbool init);
356  SIGSIM49_API int AddPASSIVE_TARGET(PASSIVE_TARGET **c, int *nc, PASSIVE_TARGET toadd);
357  SIGSIM49_API void FreePASSIVE_TARGET(PASSIVE_TARGET *c, jrmbool init);
358  SIGSIM49_API void FreePASSIVE_TARGETArray(PASSIVE_TARGET **c, int *nc, jrmbool init);
359 
360  int GetShaftSRPMs(double hull_speed, ROTATION_DATAPOINT *rotation, int nrotation, DOUBLE_TABLE *srpm_out);
363  double GetAspectAttenuationFactor(double asp_angle_deg, int pattern, ATTENUATION_PATTERN *atp, int natp);
364  int GetIndependentHarmonicSPLs(double asp_angle_deg, DOUBLE_TABLE FREQ, INDEPENDENT_HARMONIC_FAMILY IND, PASSIVE_NBAS NBAS, DOUBLE_TABLE **SPL);
365  int GetDependentHarmonicSPLs(double asp_angle_deg, DOUBLE_TABLE FREQ, DEPENDENT_HARMONIC_FAMILY DEP, PASSIVE_NBAS NBAS, DOUBLE_TABLE **SPL);
366 
367  typedef struct
368  {
369  double freq; // [kHz?]
370  double spl; // [dB]
371  } SPL_TABLE;
372 
373  SIGSIM49_API int AddSPL_TABLE(SPL_TABLE **c, int *nc, SPL_TABLE toadd);
374  SIGSIM49_API void FreeSPL_TABLEArray(SPL_TABLE **c, int *nc, jrmbool init);
375  void RemoveSPL_TABLEFromArray(SPL_TABLE **c, int *nc, int index);
376  int CompareSPLs(void *AV, void *BV);
377  void SortSPL_TABLEArray(SPL_TABLE *SPL, int NSPL);
378  void AddSPLsAtSameFrequency(SPL_TABLE **SPL, int *NSPL);
379  jrmbool IsUsedInThisMode(PASSIVE_FTRE FTRE, int familyID);
380  int AddNarrowBandSPLTableArrayEntriesForDependentFamily(double asp_angle_deg, DOUBLE_TABLE fund, OPERATING_MODE MODE, int family, SPL_TABLE **SPL, int *NSPL);
381  int AddNarrowBandSPLTableArrayEntriesForIndependentFamily(double hull_speed, double asp_angle_deg, OPERATING_MODE MODE, int family, SPL_TABLE **SPL, int *NSPL);
382  int GetBroadBandSPLTableForMode(double hull_speed, double asp_angle_deg, OPERATING_MODE MODE, SPL_TABLE **SPL, int *NSPL);
383  int CullMaskedNarrowbandSPLs(SPL_TABLE **SPL, int *NSPL, int NBB);
384  int GetFullSPLTableForMode(double hull_speed, double asp_angle_deg, OPERATING_MODE MODE, SPL_TABLE **SPL, int *NSPL);
385  int PrintSPLSpectrum(char *file, SPL_TABLE *SPL, int NSPL);
386  SIGSIM49_API int CalculatePassiveTargetStrength(PASSIVE_TARGET tgt, TS_REQUEST tsr, double *TS);
387 
388 
389 
390  /* ----------------- ACTIVE MODE TARGET STRENGTH --------------------- */
391 
392  typedef struct
393  {
394  double start; // [s]
395  double stop; // [s]
396  double strength; // [dB]
397  } RETURN_PING;
398 
399  typedef struct
400  {
401  double freq_target_strength_khz; // [kHz] Frequency.
402  double target_strength_db; // [dB] Azimuth dependent Target Strength (TS).
403  } BULK_TS_DATAPOINT; // Active-mode bulk target strength data table entry
404 
405  typedef struct
406  {
407  double target_strength_asp_angle_deg; // [deg] Azimuth from the centerline.
408  BULK_TS_DATAPOINT *bts; // Array of target strength as function of frequency for this angle.
409  int nbts; // Number of elements in BULK_TS_DATAPOINT array for this angle.
410  } BULK_TS_TABLE; // Active-mode bulk target strength data table, from ATAS CONTACT_TARGET_STRENGTH.
411 
412  typedef struct
413  {
414  double hilght_freq_khz; // [kHz] Highlight frequency.
415  double brg_vssl_center_deg; // [deg] Angle measured between lines drawn through the contact's centerline and the highlight or event.
416  double dst_vssl_center_ft; // [ft] Distance measured from the center of the contact to a highlight or special event location.
417  double max_target_str_db; // [dB] Maximum signal reflection return amplitude of a highlight.
418  int asp_ptrn_nbr; // [unitless] Index identifying an individual aspect pattern.
419  } ACTIVE_HIGHLIGHT; // Active-mode contact highlight, from ATAS CONTACT_HIGHLIGHT_DATA.
420 
421  typedef struct
422  {
423  BULK_TS_TABLE *bulk; // Array of bulk target strength tables, one per angle.
424  int nbulk; // Number of elements in bulk array.
425  ACTIVE_HIGHLIGHT *high; // Array of active highlights
426  int nhigh; // Number of elements in active highlight array.
427  ATTENUATION_PATTERN *atp; // Array of attenuation patterns for highlights.
428  int natp; // Number of elements in atp array.
429  } ACTIVE_TARGET; // Active-mode target data main structure
430 
433  int AddBULK_TS_TABLE(BULK_TS_TABLE **c, int *nc, BULK_TS_TABLE toadd);
438  int AddACTIVE_TARGET(ACTIVE_TARGET **c, int *nc, ACTIVE_TARGET toadd);
441 
444  double FindRelevantAttenHighlight(ACTIVE_TARGET tgt, TS_REQUEST tsr, int asp_ptrn_nbr, double maxdB);
445  int AddRETURN_PING(RETURN_PING **c, int *nc, RETURN_PING toadd);
446  void FreeRETURN_PINGArray(RETURN_PING **c, int *nc, jrmbool init);
447  int CompareRETURN_PINGs(void *AV, void *BV);
448  void SortRETURN_PINGs(RETURN_PING *ping, int npings);
449  SIGSIM49_API int CalculateActiveTargetStrength(ACTIVE_TARGET a, TS_REQUEST tsr, double *TS);
450 
451  /* ---------------- MORE GENERAL TARGET STRENGTH CALLS ------------------------------- */
452 
453  typedef struct
454  {
455  CONTACT_ID ID; // Target unique identifier
456  TARGET_VSSL VSSL; // Vessel Type data
457  TARGET_PHYC PHYC; // Vessel Physical Characteristics data
458  PASSIVE_TARGET PASSIVE; // Target passive-mode data
459  ACTIVE_TARGET ACTIVE; // Target active-mode data
460  } TARGET; // Target data main structure.
461 
462  typedef struct
463  {
464  TARGET *target; // Array of targets for which data is known
465  int ntargets; // Number of targets for which data is known
466  } TS_DATABASE; // Target Strength Database
467 
468  SIGSIM49_API int AddTARGET(TARGET **c, int *nc, TARGET toadd);
469  SIGSIM49_API void FreeTARGET(TARGET *c, jrmbool init);
470  SIGSIM49_API void FreeTARGETArray(TARGET **c, int *nc, jrmbool init);
471  SIGSIM49_API void RemoveTARGETFromArray(TARGET **c, int *nc, int index);
472  SIGSIM49_API int LoadTARGETFile(char *file, TARGET *c);
473  SIGSIM49_API void FreeTS_DATABASE(TS_DATABASE *tsd, jrmbool init);
474  SIGSIM49_API int LoadTS_DATABASE(TS_DATABASE *tsd, char *target_filelist, char *sigsim_data_dir);
475  int CompareTARGETs(void *AV, void *BV);
476  void SortTARGETs(TARGET *t, int nt);
477  SIGSIM49_API int FindTarget(TS_DATABASE tsd, char *contact_ID, TARGET *target);
478  SIGSIM49_API int FindTargetAndFreeTSD(TS_DATABASE *tsd, char *contact_ID, TARGET *target);
479  SIGSIM49_API int CalculateTargetStrengthForKnownTARGET(TARGET target, TS_REQUEST tsr, double *TS);
480  SIGSIM49_API int CalculateTargetStrength(TS_DATABASE tsd, TS_REQUEST tsr, double *TS);
481 
482  /* ----------------- ACOUSTIC PROPAGATION --------------------- */
483 
484  typedef struct
485  {
486  double pathlength; // [m]
487  int layerindex; // index into SUBSURFACE_1DPROFILE
488  } PROPAGATION_PATHINTERVAL; // Path interval within SUBSURFACE_1DPROFILE
489 
490  SIGSIM49_API double BeaufortWaveHeight(double windspeed_mps); // [m]
491  SIGSIM49_API double WMOSeaState(double waveheight_m); // [enum equivalent]
492  SIGSIM49_API double SeaWaterAmbientNoise(double windspeed_mps, double rainrate_mmphr, double freq_khz); // [dB/Hz]
493  SIGSIM49_API double VolumeReverbLevel(double SL, double range_m, double pulsewidth_s, double wavelength_m, double array_size_m, int array_type); // [dB]
494  SIGSIM49_API double SeaWaterDensity(double temp_degC, double salinity_ppt); // [kg/m3]
495  SIGSIM49_API double SeaWaterSoundSpeed(double temp_degC, double salinity_ppt, double pressure_atm); // [m/s]
496  SIGSIM49_API double SeaWaterAbsorptionCoefficient(double temp_degC, double salinity_ppt, double pressure_atm, double pH, double depth_km, double freq_khz); // [dB/m]
497 
498  SIGSIM49_API int GetSeaLayerIndex(SUBSURFACE_1DPROFILE seadata, double depth);
499  int CalcPropagationPathIntervals(ellipsoid E, SUBSURFACE_1DPROFILE seadata, ST_PLACEMENT plc, PROPAGATION_PATHINTERVAL **c, int *nc);
502  SIGSIM49_API int AcousticPropagator(ellipsoid E, SUBSURFACE_1DPROFILE seadata, ST_PLACEMENT plc, double freq_khz, double SL, double *TL, double *NL, double *RL, double *delay_sec, jrmbool ApplySpreading);
503  SIGSIM49_API int AddSUBSURFACE_1DPROFILE(SUBSURFACE_1DPROFILE **c, int *nc, SUBSURFACE_1DPROFILE toadd);
504  SIGSIM49_API void FreeSUBSURFACE_1DPROFILE(SUBSURFACE_1DPROFILE *seadata, jrmbool init);
505  SIGSIM49_API int LoadSubsurface1DProfile(char *file, SUBSURFACE_1DPROFILE *seadata);
506 
507  /* --------------- GENERAL SPL FUNCTIONS ---------------- */
508 
509  double AddSPLs(double SPL1, double SPL2);
510  double SubtractSPLs(double SPL1, double SPL2);
511  double IntegrateSPLArray(double *freq, double *spl, int n, double freq_lo, double freq_hi);
512  double IntegrateSPL_TABLEArray(SPL_TABLE *spl_table, int n, double freq_lo, double freq_hi);
513 
514  /* ---------------- FINAL RESULTS ---------------------- */
515 
516  typedef struct
517  {
518  double SL; // [dB] Source Level
519  double DIT; // [dB] Source Directivity Index
520  double DI; // [dB] Receiver Directivity Index
521  double TL1; // [dB] Source-to-target Transmission Loss
522  double TL2; // [dB] Target-to-sensor Transmission Loss
523  double RL; // [dB] Reverberation Level
524  double NL; // [dB] Noise Level
525  double TS; // [dB] Target Strength
526  double SNR; // [dB] Signal-to-Noise Ratio
527  double RTL; // [dB] Return Level
528  double RD; // [dB] Recognition Differential
529  double SE; // [dB] Signal Excess
530  int status; // Acquisition Status (0=nodetect, 1=detect, 2=classify, 3=recognize, 4=identify) based on SE and RD threshold
531  } MST_INTERACTION; // Monostatic Source-Target Interaction
532 
533 
534  SIGSIM49_API double ReturnLevel(double SL, double DIT, double TS, double DI, double TL1, double TL2, double NL);
535  SIGSIM49_API double SignalToNoiseRatio(double SL, double DIT, double TS, double DI, double TL1, double TL2, double NL);
536  SIGSIM49_API double SignalExcess(double SL, double DIT, double DI, double TL1, double TL2, double TS, double RL, double NL, double RD);
537  SIGSIM49_API void PrintMST_INTERACTION(ST_PLACEMENT plc, MST_INTERACTION msti);
538  SIGSIM49_API int PrintMST_INTERACTIONToFile(char *file, ST_PLACEMENT plc, MST_INTERACTION msti);
539  SIGSIM49_API int SonarAcquisitionStatus(double SE, double *DSEED);
540  SIGSIM49_API int SonarAcquisitionStatusKnownThresholds(double SE, double ThreshDetect, double ThreshClassify, double ThreshRecognize, double ThreshIdentify); // NOTE: Based on concept that ThreshIdentify<ThreshRecognize<ThreshClassify<ThreshDetect, not reverse!
541 
542 
543 
544 
545  /* ---------------------------------------------------------------------------------
546  SIGSIM SONAR RUNTIME API
547  CF070307
548  ------------------------
549 
550  1. Initialization (Do this once at the beginning of a scenario)
551 
552  a. Declare a TS_DATABASE (tsd) and fill its TS_FILELIST (tsf) :
553 
554  Example :
555 
556  TS_DATABASE tsd;
557  strcpy(tsd.tsf.contact_base_file,"../../../Data/object/Sonar/contact_base.txt\0");
558  strcpy(tsd.tsf.contact_target_strength_file,"../../../Data/object/Sonar/CONTACT_TARGET_STRENGTH.txt\0");
559  strcpy(tsd.tsf.contact_highlight_data_file,"../../../Data/object/Sonar/CONTACT_HIGHLIGHT_DATA.txt\0");
560  strcpy(tsd.tsf.aspect_pattern_horizontal_file,"../../../Data/object/Sonar/ASPECT_PATTERN_HORIZONTAL.txt\0");
561  strcpy(tsd.tsf.passive_file,"../../../Data/object/Sonar/passiveTS.txt\0");
562 
563  b. Run this code to fill the other data in the TS_DATABASE structure :
564 
565  // Set up TS database
566  err=LoadTS_DATABASE(&tsd, target_file_list, sigsim_data_dir);
567  if(err) return(err);
568 
569  c. Set the Earth ellipsoid
570 
571  ellipsoid E;
572  SetWGS84(&E); // JRMLibrary call
573 
574  d. Set the sea data profile, if Atlos not present. (Example below is for use of SigSim-read profile. For DRDC/Atlos/Modas, initialization will be different, and below is not needed) :
575 
576  SUBSURFACE_1DPROFILE seadata;
577  seadata.d=NULL;
578  seadata.nd=0;
579  err=LoadSubsurface1DProfile("../../../Data/terrain/Sonar/Subsurface1DProfile.txt\0", &seadata);
580  if(err) return(err);
581 
582 
583  2. Run-Time Request :
584 
585  a. (Optional) Declare an MST_INTERACTION to hold the results in one place :
586 
587  typedef struct
588  {
589  double range; // [m] source-target range
590  VECTOR totargetFRD; // [unitless cosines] direction to target in sensor's FRD frame
591  VECTOR tosourceFRD; // [unitless cosines] direction to source in target's FRD frame
592  double SL; // [dB] Source Level
593  double DIT; // [dB] Source Directivity Index
594  double DI; // [dB] Receiver Directivity Index
595  double TL1; // [dB] Source-to-target Transmission Loss
596  double TL2; // [dB] Target-to-sensor Transmission Loss
597  double RL; // [dB] Reverberation Level
598  double NL; // [dB] Noise Level
599  double TS; // [dB] Target Strength
600  double SNR; // [dB] Signal-to-Noise Ratio
601  double RTL; // [dB] Return Level
602  double RD; // [dB] Recognition Differential
603  double SE; // [dB] Signal Excess
604  int status; // Acquisition Status (0=nodetect, 1=detect, 2=classify, 3=recognize, 4=identify) based on SE and RD threshold
605  } MST_INTERACTION; // Monostatic Source-Target Interaction
606 
607  MST_INTERACTION msti;
608 
609  b. Set the geometry of the source-target interaction (use of ST_PLACEMENT structure is optional):
610 
611  typedef struct
612  {
613  GEODETIC_LOCATION sourceD; // source Geodetic location
614  EULERzyx sourceO; // source local orientation (FRD w.r.t. NED)
615  VECTOR sourceV; // source linear velocity ([m/s] in NED)
616  GEODETIC_LOCATION targetD; // target Geodetic location
617  EULERzyx targetO; // target local orientation (FRD w.r.t. NED)
618  VECTOR targetV; // target linear velocity ([m/s] in NED)
619  } ST_PLACEMENT; // Source-Target placement
620 
621  ST_PLACEMENT plc;
622  CalcSTGeometry(E, plc, &(msti.range), &(msti.totargetFRD), &(msti.tosourceFRD));
623 
624  c. Set the sensor and sensor channel in play :
625 
626  ACOUSTIC_TRANSDUCER transducer;
627  SetTransducerByMALOSonarCode(MALO_CODE=4,&transducer); // or whatever MALO_CODE comes in
628 
629  d. Get corresponding active emitter frequency and source level :
630 
631  err=CalculateSourceLevelAndDirectivities(transducer, msti.totargetFRD, &(msti.SL), &(msti.DIT), &(msti.DI));
632  if(err) return(err);
633 
634  e. Send the ST_PLACEMENT data, the sensor channel frequency, and possibly the source level (if Active Sonar request and reverberation is supported)
635  to ATLOS or other acoustic federate, to get LOS Transmission Loss, Reverberation, and Noise (TL1, TL2, RL, NL). Example :
636 
637  double delay_sec; // [s] time delay between source and target
638  if(transducer.active)
639  {
640  err=AcousticPropagator(E, seadata, plc, transducer.transmit_freq_hz, msti.SL, &(msti.TL1), &(msti.NL), &(msti.RL), &delay_sec, TRUE);
641  msti.TL2=msti.TL1; // monostatic active : must set both legs of journey equal
642  }
643  else
644  {
645  err=AcousticPropagator(E, seadata, plc, transducer.receive_freq_hz, msti.SL, &(msti.TL2), &(msti.NL), &(msti.RL), &delay_sec, TRUE);
646  msti.TL1=0.0; // passive mode : there is no forward path
647  }
648  if(err) return(err);
649 
650 
651  f. Set up a Target Strength Request :
652 
653  typedef struct
654  {
655  char name_acoustic_contact[SIGSIM_STRING_SIZE]; // Unique target type identifier
656  char ac_trng_ver[SIGSIM_STRING_SIZE]; // Version of target information
657  int mode; // <0 is ACTIVE, >=0 is PASSIVE mode #
658  double freq_khz; // [kHz] Frequency
659  double pulse_width_sec; // [s] Pulse width
660  double delay_sec; // [s] 1-way time delay
661  double asp_angle_deg; // [deg] Azimuth from the centerline.
662  double target_velocity_mps; // [m/s] target linear velocity along front direction (for passive level calcs)
663  } TS_REQUEST; // Target Strength Request
664 
665  TS_REQUEST tsr;
666  strcpy(tsr.name_acoustic_contact,"Merchant Test 01"); // or whatever target identifier is relevant for this interaction :
667  // Current choices are "Merchant Test 01", "Sub Test 01", "Sub Test 02", "Surface Test 01", and "Weapon Test 01".
668  // For passive requests, there is currently no choice so the above doesn't matter.
669  strcpy(tsr.ac_trng_ver,"1"); // All are ac_trng_ver "1" right now.
670  tsr.freq_khz=transducer.receive_operating_freq_khz; // Set request frequency to source frequency
671  tsr.pulse_width_sec=transducer.pulse_width_sec; // Set request pulse width to source pulse width
672  tsr.delay_sec=delay_sec; // Set request time delay to delay time from Propagator return
673  ExtractAngles(msti.tosourceFRD,&theta,&phi);
674  tsr.asp_angle_deg=phi/DEG2RAD; // Set request angle to LOS azimuth angle as seen in the target's frame
675  tsr.target_velocity_mps=vec_magnitude(plc.targetV);
676  if(transducer.active)
677  {
678  tsr.mode=-1;
679  }
680  else
681  {
682  tsr.mode=0;
683  }
684 
685 
686  g. Calculate the Target Strength (TS)
687 
688  err=CalculateTargetStrength(tsd, tsr, &(msti.TS)); // Calculate target strength TS
689  if(err) return(err);
690 
691 
692  h. Set Recognition Differential (RD) and calculate Signal Excess (SE), now that we have SL, DTI, DI, TL1, TL2, NL, RL, and TS :
693 
694  msti.RD = transducer.recognition_differential_db; // [dB] (only have data for passive at this point, but we'll use it anyway)
695  msti.SE = SignalExcess(msti.SL, msti.DIT, msti.DI, msti.TL1, msti.TL2, msti.TS, msti.RL, msti.NL, msti.RD);
696 
697  i. Calculate Acquisition Status based on SE and RD threshold
698 
699  msti.status = SonarAcquisitionStatus(msti.SE);
700 
701  3. Clean up when done :
702 
703  FreeTS_DATABASE(&tsd, FALSE); // Use FALSE when freeing, and TRUE when initializing
704  FreeSUBSURFACE_1DPROFILE(&seadata, FALSE); // Only needed if using the SigSim seadata profile (SUBSURFACE_1DPROFILE)
705 
706 
707  // --------------------------------------------------------------------------------- */
708 
709 #ifdef __cplusplus
710 }
711 #endif
712 
713 #endif


Copyright © 2005-2024 MAK Technologies. All Rights Reserved (www.mak.com)