forked from s-d-a/DCS-ExportScripts
-
Notifications
You must be signed in to change notification settings - Fork 35
Expand file tree
/
Copy pathA-10A.lua
More file actions
1236 lines (1097 loc) · 53.3 KB
/
A-10A.lua
File metadata and controls
1236 lines (1097 loc) · 53.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
-- A-10A
ExportScript.FoundFCModule = true
ExportScript.Version.A10A = "1.2.1"
-- auxiliary function
dofile(ExportScript.Config.ExportModulePath.."FC_AuxiliaryFuntions.lua")
-----------------------------------------
-- FLAMING CLIFFS AIRCRAFT / A-10A --
-- FC aircraft don't support GetDevice --
-----------------------------------------
function ExportScript.ProcessIkarusFCHighImportanceConfig()
local lFunctionTyp = "Ikarus" -- function type for shared function
local myData = LoGetSelfData()
if (myData) then
local lLatitude = myData.LatLongAlt.Lat -- LATITUDE
local lLongitude = myData.LatLongAlt.Long -- LONGITUDE
local lBasicAtmospherePressure = LoGetBasicAtmospherePressure() -- BAROMETRIC PRESSURE
local lAltBar = LoGetAltitudeAboveSeaLevel() -- ALTITUDE SEA LEVEL (Meter)
local lEngineRPMleft = LoGetEngineInfo().RPM.left -- ENG1 RPM %
local lEngineRPMright = LoGetEngineInfo().RPM.right -- ENG2 RPM %
local lEngineTempLeft = LoGetEngineInfo().Temperature.left -- ENG1 EGT �C
local lEngineTempRight = LoGetEngineInfo().Temperature.right -- ENG2 EGT �C
local lIAS = LoGetIndicatedAirSpeed() -- INDICATED AIRSPEED (Meter/Second)
local lAoA = LoGetAngleOfAttack() -- ANGLE OF ATTACK AoA (Radian)
local lEngineFuelConsumptionLeft = LoGetEngineInfo().FuelConsumption.left
local lEngineFuelConsumptionRight = LoGetEngineInfo().FuelConsumption.right
local lEngineHydraulicPressureLeft = LoGetEngineInfo().HydraulicPressure.left
local lEngineHydraulicPressureRight = LoGetEngineInfo().HydraulicPressure.right
--[[
local lAltRad = LoGetAltitudeAboveGroundLevel() -- ALTITUDE GROUND LEVEL (Meter)
local lTrueAirSpeed = LoGetTrueAirSpeed() -- TRUE AIRSPEED (Meter/Second)
local lPitch, lBank, lYaw = LoGetADIPitchBankYaw() -- PITCH, BANK, YAW (Radian)
local lHeading = myData.Heading -- HEADING (Radian)
local lVVI = LoGetVerticalVelocity() -- VERTICAL SPEED (Meter/Second)
local lMachNumber = LoGetMachNumber() -- MACH
local lGlide = LoGetGlideDeviation() -- VOR1 HORIZONTAL DEFLECTION (-1 +1)
local lSide = LoGetSideDeviation() -- VOR1 VERTICAL DEFLECTION (-1 +1)
local lSlipBallPosition = LoGetSlipBallPosition() -- SLIP BALL (-1 +1)
local lAccelerationUnits = LoGetAccelerationUnits().y -- G-LOAD
local lNavInfoPitch = LoGetNavigationInfo().Requirements.pitch -- AP REQUIRED PITCH (Radian)
local lNavInfoRoll = LoGetNavigationInfo().Requirements.roll -- AP REQUIRED BANK (Radian)
local lNavInfoSpeed = LoGetNavigationInfo().Requirements.speed -- AP SPEED (Meter/Second)
local lNavInfoAltitude = LoGetNavigationInfo().Requirements.altitude -- AP ALTITUDE (Meter)
local lNavInfoVerticalSpeed = LoGetNavigationInfo().Requirements.vertical_speed -- AP VERTICAL SPEED (Meter/Second)
local lControlPanel_HSI = LoGetControlPanel_HSI() -- HSI Data
local lHSI_RMI = LoGetControlPanel_HSI().RMI_raw -- VOR1 OBS (Radian)
local lHSI_ADF = LoGetControlPanel_HSI().ADF_raw -- ADF OBS (Radian)
local lHSI_Heading = LoGetControlPanel_HSI().Heading_raw -- Heading (Radian)
local lEngineFuelInternal = LoGetEngineInfo().fuel_internal -- TANK1 (INT) (KG)
local lEngineFuelExternal = LoGetEngineInfo().fuel_external -- TANK2 (EXT) (KG)
local lMechInfo = LoGetMechInfo() -- mechanical components, e.g. Flaps, Wheelbrakes,...
local lPayloadInfo = LoGetPayloadInfo() -- Paylod, e.g. bombs, guns, rockets, fuel tanks,...
]]
local lDistanceToWay = 999
local lRoute = LoGetRoute()
if (myData and lRoute) then -- if neither are nil
local myLoc = LoGeoCoordinatesToLoCoordinates(lLongitude, lLatitude)
--lDistanceToWay = math.sqrt((myLoc.x - lRoute.goto_point.world_point.x)^2 + (myLoc.y - lRoute.goto_point.world_point.y)^2)
lDistanceToWay = math.sqrt((myLoc.x - lRoute.goto_point.world_point.x)^2 + (myLoc.z - lRoute.goto_point.world_point.z)^2)
end
-- ADI
ExportScript.AF.FC_US_ADI() -- ID 1 to 10
-- HSI
ExportScript.AF.FC_US_HSI(lDistanceToWay) -- ID 11 to 23
-- VVI
ExportScript.AF.FC_US_VVI() -- ID 24
-- G-LOAD
ExportScript.AF.FC_US_GLOAD() -- ID 25 to 27
-- Clock
ExportScript.AF.FC_US_Clock() -- ID 28 to 30
-- Standby Compass
ExportScript.AF.FC_US_Compass() -- ID 31 to 33
-- Standby ADI
ExportScript.AF.FC_US_stbyADI() -- ID 34, 35
-- Barometrisic Altimeter
--local lAltCounter = {[0] = 0.0, [1] = 0.11, [2] = 0.22, [3] = 0.33, [4] = 0.44, [5] = 0.55, [6] = 0.66, [7] = 0.77, [8] = 0.88, [9] = 0.99}
local lAltCounter = {[0] = 0.0, [1] = 0.1, [2] = 0.2, [3] = 0.3, [4] = 0.4, [5] = 0.5, [6] = 0.6, [7] = 0.7, [8] = 0.8, [9] = 0.9}
--local lAltBarTmp = string.format("%03d", ((lAltBar * 3.28084) / 100)) -- meter to feeds
--ExportScript.Tools.WriteToLog("lAltBar 1: "..ExportScript.Tools.dump(lAltBar))
--lAltBar = lAltBar + (9.5 * (760 - lBasicAtmospherePressure)) -- 9.5 m per 1mmHg difference , eventuell minus der Differenz
-- bei 5000 feed in Ikarus 5100 feed
--ExportScript.Tools.WriteToLog("lAltBar 2: "..ExportScript.Tools.dump(lAltBar))
local lAltBarTmp = ((lAltBar * 3.28084) / 100) -- meter to feeds
lAltBar = lAltBar * 3.28084 -- meter to feeds
lBasicAtmospherePressure = lBasicAtmospherePressure * 3.937023 -- mmHg to inPa (0.03937023 * 100)
lBasicAtmospherePressure = string.format("%04d", lBasicAtmospherePressure)
--ExportScript.Tools.WriteToLog("lAltBar 3: "..ExportScript.Tools.dump(lAltBar))
lAltBar = lAltBar / 1000
lAltBar = lAltBar - ExportScript.Tools.round(lAltBar, 0, "floor")
local lAltCounter3 = 0
local lAltBarTmp2 = string.format("%03d", lAltBarTmp)
if lAltBarTmp > 10 then
lAltCounter3 = (lAltBarTmp - (ExportScript.Tools.round(lAltBarTmp / 10, 0, "floor") * 10)) * 0.1
else
lAltCounter3 = lAltBarTmp * 0.1
end
-- AltBar {0.0,1.0}
-- AltBar_1000 {0.0,1.0}
-- AltBar_100 {0.0,1.0}
-- AltBar_10 {0.0,1.0}
-- BasicAtmospherePressure_1 {0.0,1.0}
-- BasicAtmospherePressure_10 {0.0,1.0}
-- BasicAtmospherePressure_100 {0.0,1.0}
-- BasicAtmospherePressure_1000 {0.0,1.0}
ExportScript.Tools.SendData(36, lAltBar)
ExportScript.Tools.SendData(37, lAltCounter[tonumber(string.sub(lAltBarTmp2, 1, 1))])
ExportScript.Tools.SendData(38, lAltCounter[tonumber(string.sub(lAltBarTmp2, 2, 2))])
ExportScript.Tools.SendData(39, lAltCounter3)
ExportScript.Tools.SendData(40, lAltCounter[tonumber(string.sub(lBasicAtmospherePressure, 4, 4))])
ExportScript.Tools.SendData(41, lAltCounter[tonumber(string.sub(lBasicAtmospherePressure, 3, 3))])
ExportScript.Tools.SendData(42, lAltCounter[tonumber(string.sub(lBasicAtmospherePressure, 2, 2))])
ExportScript.Tools.SendData(43, lAltCounter[tonumber(string.sub(lBasicAtmospherePressure, 1, 1))])
-- Barometrisic Altimeter end
-- Air Speed Indicator (IAS)
lAltBar = LoGetAltitudeAboveSeaLevel() * 3.28084 -- ALTITUDE SEA LEVEL (Meter to Feeds)
lIAS = lIAS * 1.9438444924574 -- INDICATED AIRSPEED (M/S TO KNOTS)
local lIAStmp = lIAS
--[[
y_min = 0.0 -- minimaler Ausgabewert
y_max = 1.0 -- maximaler Ausgabewert
x_min = 0.0 -- minimaler Eingangswert
x_max = 550.0 -- maximaler Eingangswert
x = 250.0 -- aktueller Eingangswert
d_y = 1.0 -- Delta Ausgabewerte (y_max - y_min)
d_x = 550.0 -- Delta Eingangswerte (x_max - x_min)
m = 0.00181818181818181818181818181818 -- Steigung der linearen Funktion (d_y / d_x)
n = 0.000000000000000000000000000001 -- Schnittpunkt der Funktion mit y-Achse (y_max - m * x_max)
y = 0.45454545454545454545454545454645 -- Ergebnis (m * x + n)
]]
lIAS = 0.00181818181818181818181818181818 * lIAS + 0.000000000000000000000000000001
if lIAStmp > 100 then
lIAStmp = lIAStmp - (ExportScript.Tools.round((lIAStmp / 100), 0, "floor") * 100)
end
lIAStmp = lIAStmp / 100
--[[
local lAltBarTmp = ((lAltBar * 3.28084) / 100) -- meter to feeds
lBasicAtmospherePressure = string.format("%04d", lBasicAtmospherePressure)
local lAltCounter3 = 0
local lAltBarTmp2 = string.format("%03d", lAltBarTmp)
if lAltBarTmp > 10 then
lAltCounter3 = (lAltBarTmp - (ExportScript.Tools.round(lAltBarTmp / 10, 0, "floor") * 10)) * 0.1
else
lAltCounter3 = lAltBarTmp * 0.1
end]]
-- IAS {0.0,1.0}
-- IAS Decimals {0.0,1.0}
-- Barometric Altimeter in 1000 Feeds for calculate max Air Speed
-- Barometric Altimeter in 100 Feeds for calculate max Air Speed
-- Barometric Altimeter in 10 Feeds for calculate max Air Speed
ExportScript.Tools.SendData(44, string.format("%.4f", lIAS))
ExportScript.Tools.SendData(45, string.format("%.4f", lIAStmp))
--ExportScript.Tools.SendData(37, lAltCounter[tonumber(string.sub(lAltBarTmp2, 1, 1))])
--ExportScript.Tools.SendData(38, lAltCounter[tonumber(string.sub(lAltBarTmp2, 2, 2))])
--ExportScript.Tools.SendData(39, lAltCounter3)
-- Air Speed Indicator End
-- RPM Engine Left
ExportScript.AF.FC_TwoNeedlesGauge(lEngineRPMleft, 105, 10, 50, 51)
-- RPM Engine Right
ExportScript.AF.FC_TwoNeedlesGauge(lEngineRPMright, 105, 10, 52, 53)
-- Oil Pressure Left, no value but similar to Engine RPM
ExportScript.AF.FC_OneNeedleGauge(lEngineRPMleft, 110, 54)
-- Oil Pressure Right, no value but similar to Engine RPM
ExportScript.AF.FC_OneNeedleGauge(lEngineRPMright, 110, 55)
-- RPM FAN Left
--[[
y_min = 0.0 0.11 0.375 0.50 -- minimaler Ausgabewert
y_max = 0.11 0.375 0.50 1.0 -- maximaler Ausgabewert
x_min = 0.0 64.2 91.3 99.7 -- minimaler Eingangswert
x_max = 64.2 91.3 99.7 100.0 -- maximaler Eingangswert
x = 40.0 75.0 85.0 99.9 -- aktueller Eingangswert
d_y = 0.11 0.265 0.125 0.50 -- Delta Ausgabewerte (y_max - y_min)
d_x = 64.2 27.1 8.4 0.3 -- Delta Eingangswerte (x_max - x_min)
m = 0.001713 0.009779 0.014881 1.666667 -- Steigung der linearen Funktion (d_y / d_x)
n = 0.000254 -0.517823 -0.983636 -165.66667 -- Schnittpunkt der Funktion mit y-Achse (y_max - m * x_max)
y = 0.2 0.25795 0.37795 0.8725 -- Ergebnis (m * x + n)
]]
local lFanRPMleft = 0
if lEngineRPMleft > 99.7 then
lFanRPMleft = 1.666667 * lEngineRPMleft + -165.66667 -- > 81%
elseif lEngineRPMleft > 91.3 and lEngineRPMleft < 99.7 then
lFanRPMleft = 0.014881 * lEngineRPMleft + -0.983636 -- > 50%
elseif lEngineRPMleft > 64.2 and lEngineRPMleft < 91.3 then
lFanRPMleft = 0.009779 * lEngineRPMleft + -0.517823 -- > 23%
elseif lEngineRPMleft < 64.2 then
lFanRPMleft = 0.001713 * lEngineRPMleft + 0.000254 -- < 23%
end
ExportScript.AF.FC_OneNeedleGauge(lFanRPMleft, 1, 56)
-- RPM FAN Right
--[[
y_min = 0.0 0.11 0.375 0.50 -- minimaler Ausgabewert
y_max = 0.11 0.375 0.50 1.0 -- maximaler Ausgabewert
x_min = 0.0 64.2 91.3 99.7 -- minimaler Eingangswert
x_max = 64.2 91.3 99.7 100.0 -- maximaler Eingangswert
x = 40.0 75.0 85.0 99.9 -- aktueller Eingangswert
d_y = 0.11 0.265 0.125 0.50 -- Delta Ausgabewerte (y_max - y_min)
d_x = 64.2 27.1 8.4 0.3 -- Delta Eingangswerte (x_max - x_min)
m = 0.001713 0.009779 0.014881 1.666667 -- Steigung der linearen Funktion (d_y / d_x)
n = 0.000254 -0.517823 -0.983636 -165.66667 -- Schnittpunkt der Funktion mit y-Achse (y_max - m * x_max)
y = 0.2 0.25795 0.37795 0.8725 -- Ergebnis (m * x + n)
]]
local lFanRPMright = 0
if lEngineRPMright > 99.7 then
lFanRPMright = 1.666667 * lEngineRPMright + -165.66667 -- > 81%
elseif lEngineRPMright > 91.3 and lEngineRPMright < 99.7 then
lFanRPMright = 0.014881 * lEngineRPMright + -0.983636 -- > 50%
elseif lEngineRPMright > 64.2 and lEngineRPMright < 91.3 then
lFanRPMright = 0.009779 * lEngineRPMright + -0.517823 -- > 23%
elseif lEngineRPMright < 64.2 then
lFanRPMright = 0.001713 * lEngineRPMright + 0.000254 -- < 23%
end
ExportScript.AF.FC_OneNeedleGauge(lFanRPMright, 1, 57)
-- RPM APU, no value
-- Exaust Gas Temperature APU, no value
-- Exaust Gas Temperature Left
ExportScript.AF.FC_TwoNeedlesGauge(lEngineTempLeft, 1200, 100, 58, 59)
--ExportScript.AF.FC_A10A_ExaustGasTemp(lEngineTempLeft, 7)
-- Exaust Gas Temperature Right
ExportScript.AF.FC_TwoNeedlesGauge(lEngineTempRight, 1200, 100, 60, 61)
--ExportScript.AF.FC_A10A_ExaustGasTemp(lEngineTempRight, 8)
-- Fuel Flow Left
ExportScript.AF.FC_OneNeedleGauge((lEngineFuelConsumptionLeft * 2.2046223302272) * 3600, 5000, 62)
-- Fuel Flow Right
ExportScript.AF.FC_OneNeedleGauge((lEngineFuelConsumptionRight * 2.2046223302272) * 3600, 5000, 63)
-- Hydraulic Pressure Left (small gauges over fuel gauge)
ExportScript.AF.FC_OneNeedleGauge(lEngineHydraulicPressureLeft, 100, 64)
-- Hydraulic Pressure Right (small gauges over fuel gauge)
ExportScript.AF.FC_OneNeedleGauge(lEngineHydraulicPressureRight, 100, 65)
-- AOA
--ExportScript.AF.FC_US_AOA(16)
--ExportScript.Tools.WriteToLog('lAoA 1: '..ExportScript.Tools.dump(lAoA))
--local lAoATmp = 0.7728 * math.deg(lAoA) + 12.22
--ExportScript.Tools.WriteToLog('lAoA 2: '..ExportScript.Tools.dump(lAoATmp))
--[[
y_min = 0.0 -- minimaler Ausgabewert
y_max = 1.0 -- maximaler Ausgabewert
x_min = 0.0 -- minimaler Eingangswert
x_max = 30.0 -- maximaler Eingangswert
x = 12.6 -- aktueller Eingangswert
d_y = 1.0 -- Delta Ausgabewerte (y_max - y_min)
d_x = 30.0 -- Delta Eingangswerte (x_max - x_min)
m = 0.03333333333333333333333333333333 -- Steigung der linearen Funktion (d_y / d_x)
n = 0.0000000000000000000000000000001 -- Schnittpunkt der Funktion mit y-Achse (y_max - m * x_max)
y = 0.4200000000000000000000000000001 -- Ergebnis (m * x + n)
]]
--lAoATmp = 0.03333333333333333333333333333333 * lAoATmp + 0.0000000000000000000000000000001
if lAoA > -2.7 then -- positive AOA
--[[
y_min = 0.333 -- minimaler Ausgabewert
y_max = 1.0 -- maximaler Ausgabewert
x_min = -2.7 -- minimaler Eingangswert
x_max = 23.0 -- maximaler Eingangswert
x = 10.6 -- aktueller Eingangswert
d_y = 0.667 -- Delta Ausgabewerte (y_max - y_min)
d_x = 27.7 -- Delta Eingangswerte (x_max - x_min)
m = 0.02407942238267148014440433212996 -- Steigung der linearen Funktion (d_y / d_x)
n = 0,44617328519855595667870036101083 -- Schnittpunkt der Funktion mit y-Achse (y_max - m * x_max)
y = 0.615808 -- Ergebnis (m * x + n)
]]
lAoA = 0.02407942238267148014440433212996 * lAoA + 0.44617328519855595667870036101083
else
--[[
y_min = 0.0 -- minimaler Ausgabewert
y_max = 0.333 -- maximaler Ausgabewert
x_min = -2.7 -- minimaler Eingangswert
x_max = -15.3 -- maximaler Eingangswert
x = -3.6 -- aktueller Eingangswert
d_y = 0.333 -- Delta Ausgabewerte (y_max - y_min)
d_x = -12.6 -- Delta Eingangswerte (x_max - x_min)
m = -0.02642857142857142857142857142857 -- Steigung der linearen Funktion (d_y / d_x)
n = -0.07135714285714285714285714285714 -- Schnittpunkt der Funktion mit y-Achse (y_max - m * x_max)
y = 0.0238 -- Ergebnis 0.333 - (m * x + n)
]]
lAoA = 0.333 - (-0.02642857142857142857142857142857 * lAoA + -0.07135714285714285714285714285714)
end
ExportScript.Tools.SendData(66, string.format("%.4f", lAoA))
ExportScript.Tools.SendData(67, 0) --??ExportID fehlt noch
else
ExportScript.Tools.WriteToLog("Unknown FC Error, no LoGetSelfData.")
end
end
function ExportScript.ProcessDACConfigHighImportance()
local lFunctionTyp = "DAC" -- function type for shared function
-- your script
end
function ExportScript.ProcessIkarusFCLowImportanceConfig()
local lFunctionTyp = "Ikarus" -- function type for shared function
-- UHF Gauges, no value
ExportScript.Tools.SendData(68, "001.00")
-- Flaps Indicator
-- Gear Lamps
ExportScript.AF.MechanicalDevicesIndicator(lFunctionTyp)
-- Fuel Indicator
local lEngineFuelInternal = LoGetEngineInfo().fuel_internal -- TANK1 (INT) (KG)
local lEngineFuelExternal = LoGetEngineInfo().fuel_external -- TANK2 (EXT) (KG)
local lCounter = {[0] = 0.0, [1] = 0.1, [2] = 0.2, [3] = 0.3, [4] = 0.4, [5] = 0.5, [6] = 0.6, [7] = 0.7, [8] = 0.8, [9] = 0.9}
lEngineFuelInternal = lEngineFuelInternal * 2.2046223302272 -- kg to lbs
lEngineFuelExternal = lEngineFuelExternal * 2.2046223302272 -- kg to lbs
local lFuelNeedle = (lEngineFuelInternal / 2) / 6000 -- 6000 = scala
lEngineFuelInternal = lEngineFuelInternal / 100 -- um unf die ersten drei stellen zukommen
local lEngineFuelInternalTmp = string.format("%03d", lEngineFuelInternal)
local lFuelCounter3 = 0
if lEngineFuelInternal > 10 then
lFuelCounter3 = (lEngineFuelInternal - (ExportScript.Tools.round(lEngineFuelInternal / 10, 0, "floor") * 10)) * 0.1
else
lFuelCounter3 = lEngineFuelInternal * 0.1
end
ExportScript.Tools.SendData(300, string.format("%.2f", lCounter[tonumber(string.sub(lEngineFuelInternalTmp, 1, 1))]))
ExportScript.Tools.SendData(301, string.format("%.2f", lCounter[tonumber(string.sub(lEngineFuelInternalTmp, 2, 2))]))
ExportScript.Tools.SendData(302, string.format("%.2f", lFuelCounter3))
ExportScript.Tools.SendData(303, string.format("%.4f", lFuelNeedle))
ExportScript.Tools.SendData(304, string.format("%.4f", lFuelNeedle))
ExportScript.Tools.SendData(311, string.format("%d", lEngineFuelExternal))
-- Fuel Indicator end
-- Weapon Panel
ExportScript.AF.PayloadInfo = LoGetPayloadInfo()
--[[
ShellsCounter
Station1
Station2
...
Station11
Station Data:
0.0 = off
0.1 = E (Empty, yellow E)
0.2 = 1 (load, white one)
0.3 = RR (active, two green R and white 1 for load)
]]
--[[
Weapon Panel
|
---------------------------------------------------
| | | | | | | | | | |
1 2 3 4 5 6 7 8 9 10 11
1 3 5 7 9 11 10 8 6 4 2 -- Weapon Station ID
]]
ExportScript.AF.TmpWeaponPanelActive = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}
for lIndex = 1, 11, 1 do
ExportScript.AF.TmpWeaponPanelActive[lIndex] = (ExportScript.AF.PayloadInfo.Stations[lIndex].count > 0 and 0.2 or 0.1) -- get status, empty or load
end
if ExportScript.AF.PayloadInfo.CurrentStation > 0 then
ExportScript.AF.TmpWeaponPanelActive[ExportScript.AF.PayloadInfo.CurrentStation] = 0.3 -- currrent value
table.foreach(ExportScript.AF.PayloadInfo.Stations, ExportScript.AF.WeaponStatusPanel_selectCurrentPayloadStationIkarus_A10A) -- corresponding station
end
ExportScript.Tools.SendData(100, ExportScript.AF.PayloadInfo.Cannon.shells)
ExportScript.Tools.SendData(101, string.format("%0.1f", ExportScript.AF.TmpWeaponPanelActive[1])) -- Station 1
ExportScript.Tools.SendData(102, string.format("%0.1f", ExportScript.AF.TmpWeaponPanelActive[3])) -- Station 2
ExportScript.Tools.SendData(103, string.format("%0.1f", ExportScript.AF.TmpWeaponPanelActive[5])) -- Station 3
ExportScript.Tools.SendData(104, string.format("%0.1f", ExportScript.AF.TmpWeaponPanelActive[7])) -- Station 4
ExportScript.Tools.SendData(105, string.format("%0.1f", ExportScript.AF.TmpWeaponPanelActive[9])) -- Station 5
ExportScript.Tools.SendData(106, string.format("%0.1f", ExportScript.AF.TmpWeaponPanelActive[11])) -- Station 6
ExportScript.Tools.SendData(107, string.format("%0.1f", ExportScript.AF.TmpWeaponPanelActive[10])) -- Station 7
ExportScript.Tools.SendData(108, string.format("%0.1f", ExportScript.AF.TmpWeaponPanelActive[8])) -- Station 8
ExportScript.Tools.SendData(109, string.format("%0.1f", ExportScript.AF.TmpWeaponPanelActive[6])) -- Station 9
ExportScript.Tools.SendData(110, string.format("%0.1f", ExportScript.AF.TmpWeaponPanelActive[4])) -- Station 10
ExportScript.Tools.SendData(111, string.format("%0.1f", ExportScript.AF.TmpWeaponPanelActive[2])) -- Station 11
-- Wepaon Panel end
local lMCPState = LoGetMCPState() -- Warning Lights
if lMCPState ~= nil then
ExportScript.Tools.SendData(702, lMCPState.MasterWarning == true and 1 or 0 )
end
-- Missle launch / Scan Warning
ExportScript.AF.RWRStatusPanel(lFunctionTyp)
-- (x < 0 and 'negative' or 'non-negative')
--[[
local lPayloadInfo = LoGetPayloadInfo()
ExportScript.Tools.WriteToLog('lPayloadInfo: '..ExportScript.Tools.dump(lPayloadInfo))
local lSnares = LoGetSnares() -- Flare and Chaff
ExportScript.Tools.WriteToLog('lSnares: '..ExportScript.Tools.dump(lSnares))
local lSightingSystemInfo = LoGetSightingSystemInfo()
ExportScript.Tools.WriteToLog('lSightingSystemInfo: '..ExportScript.Tools.dump(lSightingSystemInfo))
local lTWSInfo = LoGetTWSInfo() -- SPO Informationen, z.B. Radarwarner F15C
ExportScript.Tools.WriteToLog('lTWSInfo: '..ExportScript.Tools.dump(lTWSInfo))
local lTargetInformation = LoGetTargetInformation() -- detalierte Radar Infos z.B. F15C
ExportScript.Tools.WriteToLog('lTargetInformation: '..ExportScript.Tools.dump(lTargetInformation))
local lLockedTargetInformation = LoGetLockedTargetInformation()
ExportScript.Tools.WriteToLog('lLockedTargetInformation: '..ExportScript.Tools.dump(lLockedTargetInformation))
local lF15_TWS_Contacs = LoGetF15_TWS_Contacts() -- the same information but only for F-15 in TWS mode
ExportScript.Tools.WriteToLog('lF15_TWS_Contacs: '..ExportScript.Tools.dump(lF15_TWS_Contacs))
local lMechInfo = LoGetMechInfo() -- mechanical components, e.g. Flaps, Wheelbrakes,...
ExportScript.Tools.WriteToLog('lMechInfo: '..ExportScript.Tools.dump(lMechInfo))
local lMCPState = LoGetMCPState() -- Warnlichter
ExportScript.Tools.WriteToLog('lMCPState: '..ExportScript.Tools.dump(lMCPState))
local lControlPanel_HSI = LoGetControlPanel_HSI()
ExportScript.Tools.WriteToLog('lControlPanel_HSI: '..ExportScript.Tools.dump(lControlPanel_HSI))
local lRadioBeaconsStatus = LoGetRadioBeaconsStatus()
ExportScript.Tools.WriteToLog('lRadioBeaconsStatus: '..ExportScript.Tools.dump(lRadioBeaconsStatus))
local lEngineInfo = LoGetEngineInfo()
ExportScript.Tools.WriteToLog('lEngineInfo: '..ExportScript.Tools.dump(lEngineInfo))
]]
-- Weapon Control System
-- local lNameByType = LoGetNameByType () -- args 4 (number : level1,level2,level3,level4), result string
-- values from LoGetTargetInformation().type
-- ExportScript.Tools.WriteToLog('lNameByType: '..ExportScript.Tools.dump(lNameByType))
ExportScript.AF.FlareChaff()
end
function ExportScript.ProcessDACConfigLowImportance()
local lFunctionTyp = "DAC" -- function type for shared function
ExportScript.AF.MechanicalDevicesIndicator(lFunctionTyp)
ExportScript.AF.RWRStatusPanel(lFunctionTyp)
ExportScript.AF.SightingSystem()
ExportScript.AF.FuelQuantityIndicator()
ExportScript.AF.StatusLamp()
ExportScript.AF.WeaponStatusPanel()
ExportScript.AF.AOAIndicator()
end
-----------------------------
-- Custom functions --
-----------------------------
function ExportScript.AF.SightingSystem()
local lSightingSystemInfo = LoGetSightingSystemInfo()
if lSightingSystemInfo == nil then
return
end
--ExportScript.Tools.WriteToLog('lSightingSystemInfo: '..ExportScript.Tools.dump(lSightingSystemInfo)9
--[[
[PRF] = {
[selection] = string: "ILV"
[current] = string: "MED"
}
[laser_on] = boolean: "false"
[scale] = {
[azimuth] = number: "0.52359873056412"
[distance] = number: "10000"
}
[radar_on] = boolean: "false"
[optical_system_on] = boolean: "false"
[LaunchAuthorized] = boolean: "false"
[ECM_on] = boolean: "false"
[Manufacturer] = string: "RUS"
[TDC] = {
[y] = number: "0"
[x] = number: "0"
}
[ScanZone] = {
[coverage_H] = {
[min] = number: "0"
[max] = number: "20000"
}
[size] = {
[azimuth] = number: "1.0471974611282"
[elevation] = number: "0.17453290522099"
}
[position] = {
[exceeding_manual] = number: "0"
[distance_manual] = number: "0"
[azimuth] = number: "0"
[elevation] = number: "0"
}
}
]]
ExportScript.Tools.SendDataDAC("600", lSightingSystemInfo.ECM_on == true and 1 or 0 )
ExportScript.Tools.SendDataDAC("601", lSightingSystemInfo.laser_on == true and 1 or 0 )
ExportScript.Tools.SendDataDAC("602", lSightingSystemInfo.optical_system_on == true and 1 or 0 )
ExportScript.Tools.SendDataDAC("603", lSightingSystemInfo.LaunchAuthorized == true and 1 or 0 )
--ExportScript.Tools.SendDataDAC("604", lSightingSystemInfo.radar_on == true and 1 or 0 )
end
function ExportScript.AF.FuelQuantityIndicator()
-- Fuel quantity shows the fuel remaining in all tanks
local lEngineInfo = LoGetEngineInfo()
if lEngineInfo == nil then
return
end
--ExportScript.Tools.WriteToLog('lEngineInfo: '..ExportScript.Tools.dump(lEngineInfo))
--[[
[fuel_external] = number: "0"
[Temperature] = {
[left] = number: "626.99444580078"
[right] = number: "626.99444580078"
}
[RPM] = {
[left] = number: "87.453765869141"
[right] = number: "87.453758239746"
}
[FuelConsumption] = {
[left] = number: "0.1500396137767"
[right] = number: "0.1500396137767"
}
[fuel_internal] = number: "3773.2749023438"
[EngineStart] = {
[left] = number: "0"
[right] = number: "0"
}
[HydraulicPressure] = {
[left] = number: "210"
[right] = number: "210"
}
lPayloadInfo.Stations[8].CLSID == E8D4652F-FD48-45B7-BA5B-2AE05BB5A9CF -- ext 800l Fuel Tank
]]
ExportScript.Tools.SendDataDAC("300", string.format("%d", ExportScript.Tools.round((((lEngineInfo.fuel_internal + lEngineInfo.fuel_external) * 2.2) / 100), 0, "ceil") * 100) ) -- total fuel in lbs
--ExportScript.Tools.SendDataDAC("301", string.format("%d", lEngineInfo.fuel_internal * 2.2) ) -- internal fuel in lbs
--ExportScript.Tools.SendDataDAC("302", string.format("%d", lEngineInfo.fuel_external * 2.2) ) -- external fuel in lbs
--[[
local lPayloadInfo = LoGetPayloadInfo()
if lPayloadInfo == nil then
return
end
ExportScript.Tools.SendDataDAC("303", ((lPayloadInfo.Stations[5].count > 0 and lPayloadInfo.Stations[5].CLSID == "Fuel_Tank_FT600") and 1 or 0) ) -- weapon presend > 0 (panel 5)
ExportScript.Tools.SendDataDAC("304", ((lPayloadInfo.Stations[6].count > 0 and lPayloadInfo.Stations[6].CLSID == "Fuel_Tank_FT600") and 1 or 0) ) -- weapon presend > 0 (panel 6)
ExportScript.Tools.SendDataDAC("305", ((lPayloadInfo.Stations[7].count > 0 and lPayloadInfo.Stations[7].CLSID == "Fuel_Tank_FT600") and 1 or 0) ) -- weapon presend > 0 (panel 7)
ExportScript.Tools.SendDataDAC("307", (lEngineInfo.fuel_internal < 600.0 and 1 or 0) ) -- Bingo Fuel
]]
end
function ExportScript.AF.StatusLamp()
local lMCPState = LoGetMCPState() -- Warning Lights
if lMCPState == nil then
return
end
--ExportScript.Tools.WriteToLog('lMCPState: '..ExportScript.Tools.dump(lMCPState))
--[[
[RightTailPlaneFailure] = boolean: "false"
[EOSFailure] = boolean: "false"
[ECMFailure] = boolean: "false"
[RightAileronFailure] = boolean: "false"
[MasterWarning] = boolean: "false"
[RightEngineFailure] = boolean: "false"
[CannonFailure] = boolean: "false"
[MLWSFailure] = boolean: "false"
[ACSFailure] = boolean: "false"
[RadarFailure] = boolean: "false"
[HelmetFailure] = boolean: "false"
[HUDFailure] = boolean: "false"
[LeftMainPumpFailure] = boolean: "false"
[RightWingPumpFailure] = boolean: "false"
[LeftWingPumpFailure] = boolean: "false"
[MFDFailure] = boolean: "false"
[RWSFailure] = boolean: "false"
[GearFailure] = boolean: "false"
[HydraulicsFailure] = boolean: "false"
[AutopilotFailure] = boolean: "true"
[FuelTankDamage] = boolean: "false"
[LeftAileronFailure] = boolean: "false"
[CanopyOpen] = boolean: "false"
[RightMainPumpFailure] = boolean: "false"
[StallSignalization] = boolean: "false"
[LeftEngineFailure] = boolean: "false"
[AutopilotOn] = boolean: "false"
[LeftTailPlaneFailure] = boolean: "false"
]]
ExportScript.Tools.SendDataDAC("700", lMCPState.LeftTailPlaneFailure == true and 1 or 0 )
ExportScript.Tools.SendDataDAC("701", lMCPState.RightTailPlaneFailure == true and 1 or 0 )
ExportScript.Tools.SendDataDAC("702", lMCPState.MasterWarning == true and 1 or 0 )
ExportScript.Tools.SendDataDAC("703", lMCPState.LeftEngineFailure == true and 1 or 0 )
ExportScript.Tools.SendDataDAC("704", lMCPState.RightEngineFailure == true and 1 or 0 )
ExportScript.Tools.SendDataDAC("705", lMCPState.LeftAileronFailure == true and 1 or 0 )
ExportScript.Tools.SendDataDAC("706", lMCPState.RightAileronFailure == true and 1 or 0 )
ExportScript.Tools.SendDataDAC("707", lMCPState.LeftMainPumpFailure == true and 1 or 0 )
ExportScript.Tools.SendDataDAC("708", lMCPState.RightMainPumpFailure == true and 1 or 0 )
ExportScript.Tools.SendDataDAC("709", lMCPState.LeftWingPumpFailure == true and 1 or 0 )
ExportScript.Tools.SendDataDAC("710", lMCPState.RightWingPumpFailure == true and 1 or 0 )
ExportScript.Tools.SendDataDAC("711", lMCPState.EOSFailure == true and 1 or 0 )
ExportScript.Tools.SendDataDAC("712", lMCPState.ECMFailure == true and 1 or 0 )
ExportScript.Tools.SendDataDAC("713", lMCPState.CannonFailure == true and 1 or 0 )
ExportScript.Tools.SendDataDAC("714", lMCPState.MLWSFailure == true and 1 or 0 )
ExportScript.Tools.SendDataDAC("715", lMCPState.ACSFailure == true and 1 or 0 )
ExportScript.Tools.SendDataDAC("716", lMCPState.RadarFailure == true and 1 or 0 )
ExportScript.Tools.SendDataDAC("717", lMCPState.HelmetFailure == true and 1 or 0 )
ExportScript.Tools.SendDataDAC("718", lMCPState.HUDFailure == true and 1 or 0 )
ExportScript.Tools.SendDataDAC("719", lMCPState.MFDFailure == true and 1 or 0 )
ExportScript.Tools.SendDataDAC("720", lMCPState.RWSFailure == true and 1 or 0 )
ExportScript.Tools.SendDataDAC("721", lMCPState.GearFailure == true and 1 or 0 )
ExportScript.Tools.SendDataDAC("722", lMCPState.HydraulicsFailure == true and 1 or 0 )
ExportScript.Tools.SendDataDAC("723", lMCPState.AutopilotFailure == true and 1 or 0 )
ExportScript.Tools.SendDataDAC("724", lMCPState.FuelTankDamage == true and 1 or 0 )
ExportScript.Tools.SendDataDAC("725", lMCPState.CanopyOpen == true and 1 or 0 )
ExportScript.Tools.SendDataDAC("726", lMCPState.StallSignalization == true and 1 or 0 )
ExportScript.Tools.SendDataDAC("727", lMCPState.AutopilotOn == true and 1 or 0 )
local lEngineInfo = LoGetEngineInfo()
if lEngineInfo ~= nil then
--ExportScript.Tools.WriteToLog('lEngineInfo: '..ExportScript.Tools.dump(lEngineInfo))
ExportScript.Tools.SendDataDAC("728", lEngineInfo.EngineStart.left ) -- lamp start left engine 1 (0|1)
ExportScript.Tools.SendDataDAC("729", lEngineInfo.EngineStart.right ) -- lamp start right engine 1 (0|1)
end
end
function ExportScript.AF.FlareChaff()
local lSnares = LoGetSnares() -- Flare and Chaff
if lSnares == nil then
return
end
--ExportScript.Tools.WriteToLog('lSnares: '..ExportScript.Tools.dump(lSnares))
--[chaff] = number: "30"
--[flare] = number: "30"
ExportScript.Tools.SendData("800", lSnares.chaff )
ExportScript.Tools.SendData("801", lSnares.flare )
end
function ExportScript.AF.MechanicalDevicesIndicator(FunctionTyp)
local lFunctionTyp = FunctionTyp or "Ikarus"
-- The mechanical devices indicator shows the position of the landing gear, flaps, leading edge flaps and airbrake
local lMechInfo = LoGetMechInfo() -- mechanical components, e.g. Flaps, Wheelbrakes,...
--ExportScript.Tools.WriteToLog("lMechInfo: "..ExportScript.Tools.dump(lMechInfo))
if lMechInfo == nil then
return
end
--[[
[hook] = {
[status] = number: "0"
[value] = number: "0"
}
[parachute] = {
[status] = number: "0"
[value] = number: "0"
}
[controlsurfaces] = {
[eleron] = {
[left] = number: "0"
[right] = number: "-0.21084336936474"
}
[elevator] = {
[left] = number: "-0"
[right] = number: "-0"
}
[rudder] = {
[left] = number: "0"
[right] = number: "0"
}
}
[airintake] = {
[status] = number: "0"
[value] = number: "0"
}
[canopy] = {
[status] = number: "0"
[value] = number: "0"
}
[refuelingboom] = {
[status] = number: "0"
[value] = number: "0"
}
[wing] = {
[status] = number: "0"
[value] = number: "0"
}
[noseflap] = {
[status] = number: "0"
[value] = number: "0"
}
[gear] = {
[value] = number: "0"
[nose] = {
[rod] = number: "0"
}
[main] = {
[left] = {
[rod] = number: "0"
}
[right] = {
[rod] = number: "0"
}
}
[status] = number: "0"
}
[speedbrakes] = {
[status] = number: "0"
[value] = number: "0"
}
[wheelbrakes] = {
[status] = number: "0"
[value] = number: "0"
}
[flaps] = {
[status] = number: "0"
[value] = number: "0"
}]]
local lGetTrueAirSpeed = LoGetTrueAirSpeed()
if lGetTrueAirSpeed == nil then
lGetTrueAirSpeed = 0
end
if ExportScript.Config.IkarusExport and lFunctionTyp == "Ikarus" then
ExportScript.Tools.SendData(501, (lMechInfo.gear.value > 0.85 and 1 or 0) ) -- nose gear
ExportScript.Tools.SendData(502, (lMechInfo.gear.value > 0.95 and 1 or 0) ) -- left gear
ExportScript.Tools.SendData(503, (lMechInfo.gear.value == 1 and 1 or 0) ) -- right gear
ExportScript.Tools.SendData(510, (lMechInfo.speedbrakes.value > 0.1 and 1 or 0) ) -- speedbreakes on > 0.1 (0 - 1)
local lFlapsValue = lMechInfo.flaps.value
lFlapsValue = lFlapsValue / 1.6
lFlapsValue = (lFlapsValue > 1.0 and 1.0 or lFlapsValue) -- the result is limited to 1.0
ExportScript.Tools.SendData(530, string.format("%.4f", lFlapsValue))
end
if ExportScript.Config.DACExport and lFunctionTyp == "DAC" then
ExportScript.Tools.SendDataDAC("501", (lMechInfo.gear.value > 0.85 and 1 or 0) ) -- nose gear
ExportScript.Tools.SendDataDAC("502", (lMechInfo.gear.value > 0.95 and 1 or 0) ) -- left gear
ExportScript.Tools.SendDataDAC("503", (lMechInfo.gear.value == 1 and 1 or 0) ) -- right gear
--ExportScript.Tools.SendDataDAC("510", lMechInfo.speedbrakes.status ) -- speedbreakes on 1 (0|1)
ExportScript.Tools.SendDataDAC("510", (lMechInfo.speedbrakes.value > 0.1 and 1 or 0) ) -- speedbreakes on > 0.1 (0 - 1)
--ExportScript.Tools.SendDataDAC("530", lMechInfo.flaps.status ) -- flap switch off 0, 1. position 1, 2. position 2 (0|1|2)
--ExportScript.Tools.SendDataDAC("531", lMechInfo.flaps.value ) -- flap 1. position > 0.25, 2. position > 0.93 (0 - 1)
ExportScript.Tools.SendDataDAC("531", (lMechInfo.flaps.value > 0.25 and 1 or 0) ) -- flap 1. position
ExportScript.Tools.SendDataDAC("532", (lMechInfo.flaps.value > 0.93 and 1 or 0) ) -- flap 2. position
ExportScript.Tools.SendDataDAC("533", ((lMechInfo.flaps.value > 0.93 and lGetTrueAirSpeed > 340) and 1 or 0) ) -- Speed Warning for Flaps, same light as gear warning light, but blinking light
end
end
function ExportScript.AF.RWRStatusPanel(FunctionTyp)
local lFunctionTyp = FunctionTyp or "Ikarus"
-- RWR Status Panel only
local lTWSInfo = LoGetTWSInfo()
if lTWSInfo == nil then
return
end
--ExportScript.Tools.WriteToLog('lTWSInfo: '..ExportScript.Tools.dump(lTWSInfo))
--[[
[Emitters] = {
[1] = {
[Type] = {
[level3] = number: "105"
[level1] = number: "2"
[level4] = number: "46"
[level2] = number: "16"
}
[Azimuth] = number: "1.8300691843033"
[Power] = number: "0.92326503992081"
[ID] = number: "16777472"
[Priority] = number: "230.92445373535"
[SignalType] = string: "lock"
}
[2] = {
[Type] = {
[level3] = number: "101"
[level1] = number: "2"
[level4] = number: "39"
[level2] = number: "16"
}
[Azimuth] = number: "2.6759564876556"
[Power] = number: "0.90609884262085"
[ID] = number: "16777728"
[Priority] = number: "140.90609741211"
[SignalType] = string: "scan"
}
}
[Mode] = number: "0"
]]
if ExportScript.AF.EventNumberRWRStatusPanel == nil then
ExportScript.AF.EventNumberRWRStatusPanel = 0
end
if(ExportScript.AF.EventNumberRWRStatusPanel < ExportScript.AF.EventNumber) then
ExportScript.AF.EventNumberRWRStatusPanel = ExportScript.AF.EventNumber
local lPrimaryThreatTmp = 0
local lPriorityTmp = 0
ExportScript.AF.ScanTmp = 0
ExportScript.AF.MissileTmp = 0
if(#lTWSInfo.Emitters > 0) then
for EmitterIndex = 1, #lTWSInfo.Emitters, 1 do
if(lTWSInfo.Emitters[EmitterIndex].Priority > lPriorityTmp) then
lPrimaryThreatTmp = EmitterIndex
end
if(lTWSInfo.Emitters[EmitterIndex].SignalType == "scan") then
ExportScript.AF.ScanTmp = 1
elseif(lTWSInfo.Emitters[EmitterIndex].SignalType == "missile_radio_guided") then
ExportScript.AF.MissileTmp = 1
end
end
else
lPrimaryThreatTmp = 0
lPriorityTmp = 0
end
end
if ExportScript.Config.DACExport and lFunctionTyp == "DAC" then
ExportScript.Tools.SendDataDAC("440", ExportScript.AF.MissileTmp)
ExportScript.Tools.SendDataDAC("444", ExportScript.AF.ScanTmp)
end
if ExportScript.Config.IkarusExport and lFunctionTyp == "Ikarus" then
ExportScript.Tools.SendData(440, ExportScript.AF.MissileTmp)
ExportScript.Tools.SendData(444, ExportScript.AF.ScanTmp)
end
end
function ExportScript.AF.AOAIndicator()
-- AOA Indicator only
local lAoA = LoGetAngleOfAttack()
if lAoA == nil then
return
end
local lMechInfo = LoGetMechInfo() -- mechanical components, e.g. Gear
if lMechInfo == nil then
return
end
if lMechInfo.gear.status == 1 then
local lAOAUnits = (lAoA * 57.3) * 0.7728 + 12.22
--ExportScript.Tools.WriteToLog('lAoA: '..ExportScript.Tools.dump(lAoA))
--ExportScript.Tools.WriteToLog('lAOAUnits: '..ExportScript.Tools.dump(lAOAUnits))
ExportScript.Tools.SendDataDAC("900", (lAOAUnits > 21.0 and 1 or 0) )
ExportScript.Tools.SendDataDAC("901", ((lAOAUnits > 18.0 and lAOAUnits < 22.0) and 1 or 0) )
ExportScript.Tools.SendDataDAC("902", (lAOAUnits < 19.0 and 1 or 0) )
else -- AOA Index Lamps off
ExportScript.Tools.SendDataDAC("900", 0 )
ExportScript.Tools.SendDataDAC("901", 0 )
ExportScript.Tools.SendDataDAC("902", 0 )
end
end
function ExportScript.AF.WeaponStatusPanel()
-- The weapon status panel, quantity and readiness of the currently selected weapon and the remaining gun ammunition are indicated.
ExportScript.AF.PayloadInfo = LoGetPayloadInfo()
if ExportScript.AF.PayloadInfo == nil then
return
end
--ExportScript.Tools.WriteToLog('ExportScript.AF.PayloadInfo: '..ExportScript.Tools.dump(ExportScript.AF.PayloadInfo))
--[[ exsample
[Stations] = {
[1] = {
[CLSID] = string: "{6D21ECEA-F85B-4E8D-9D51-31DC9B8AA4EF}"
[container] = boolean: "false"
[count] = number: "1"
[weapon] = {
[level3] = number: "45"
[level1] = number: "4"
[level4] = number: "25"
[level2] = number: "15"
}
}
[2] = {
[wstype] = {
[level3] = number: "32"
[level1] = number: "4"
[level4] = number: "117"
[level2] = number: "7"
}
[count] = number: "7"
[CLSID] = string: "{69926055-0DA8-4530-9F2F-C86B157EA9F6}"
[adapter] = {
[level3] = number: "0"
[level1] = number: "0"
[level4] = number: "0"
[level2] = number: "0"
}
[container] = boolean: "true"
[weapon] = {
[level3] = number: "33"
[level1] = number: "4"
[level4] = number: "147"
[level2] = number: "7"
}
}
[3] = {
[wstype] = {
[level3] = number: "32"
[level1] = number: "4"
[level4] = number: "135"
[level2] = number: "4"
}
[count] = number: "2"
[CLSID] = string: "LAU_88_AGM_65H_2_L"
[adapter] = {
[level3] = number: "47"
[level1] = number: "4"
[level4] = number: "4"
[level2] = number: "15"
}
[container] = boolean: "true"
[weapon] = {
[level3] = number: "8"
[level1] = number: "4"
[level4] = number: "138"
[level2] = number: "4"
}
}
[4] = {
[wstype] = {
[level3] = number: "32"
[level1] = number: "4"
[level4] = number: "114"
[level2] = number: "5"
}
[count] = number: "3"
[CLSID] = string: "BRU-42_3*BDU-33"
[adapter] = {
[level3] = number: "0"
[level1] = number: "0"
[level4] = number: "0"
[level2] = number: "0"
}
[container] = boolean: "true"
[weapon] = {
[level3] = number: "9"
[level1] = number: "4"