Fixes / improved icing nasal
This commit is contained in:
parent
0c00b474a4
commit
cc6e842a07
5 changed files with 95 additions and 103 deletions
|
@ -54,37 +54,40 @@
|
|||
<iceable>
|
||||
<name>Windshield</name>
|
||||
<ice-inches>0.0</ice-inches>
|
||||
<salvage-control>/controls/deice/windowprobeheat</salvage-control>
|
||||
<salvage-control>/controls/ice-protection/windowprobeheat-output</salvage-control>
|
||||
<sensitivity type="double">0.5</sensitivity>
|
||||
<output-property>/environment/aircraft-effects/frost-inch</output-property>
|
||||
</iceable>
|
||||
<iceable>
|
||||
<name>Fuselage</name>
|
||||
<ice-inches>0.0</ice-inches>
|
||||
<!-- salvage control: de-icing truck -->
|
||||
<sensitivity type="double">0.3</sensitivity>
|
||||
<!-- salvage control: de-icing truck -->
|
||||
<salvage-control>services/deicing_truck/deicing/position-norm</salvage-control>
|
||||
<output-property>/fdm/jsbsim/ice/fuselage</output-property>
|
||||
</iceable>
|
||||
<iceable>
|
||||
<name>Pitot tube</name>
|
||||
<ice-inches>0.0</ice-inches>
|
||||
<sensitivity type="double">1</sensitivity>
|
||||
<salvage-control>/controls/deice/windowprobeheat</salvage-control>
|
||||
<output-property>/systems/pitot/icing</output-property>
|
||||
<sensitivity type="double">0.99</sensitivity>
|
||||
<salvage-control>/controls/ice-protection/windowprobeheat-output</salvage-control>
|
||||
<output-property>/systems/pitot[0]/icing</output-property>
|
||||
</iceable>
|
||||
<iceable>
|
||||
<name>Pitot tube</name>
|
||||
<ice-inches>0.0</ice-inches>
|
||||
<sensitivity type="double">0.99</sensitivity>
|
||||
<salvage-control>/controls/ice-protection/windowprobeheat-output</salvage-control>
|
||||
<output-property>/systems/pitot[1]/icing</output-property>
|
||||
</iceable>
|
||||
<iceable>
|
||||
<name>Pitot tube</name>
|
||||
<ice-inches>0.0</ice-inches>
|
||||
<sensitivity type="double">0.98</sensitivity>
|
||||
<salvage-control>/controls/ice-protection/windowprobeheat-output</salvage-control>
|
||||
<output-property>/systems/pitot[2]/icing</output-property>
|
||||
</iceable>
|
||||
</icing>
|
||||
<flame>
|
||||
<red-high type="double">1.0</red-high>
|
||||
<red-low type="double">0.95</red-low>
|
||||
<red-base type="double">1.0</red-base>
|
||||
<green-high type="double">0.741</green-high>
|
||||
<green-low type="double">0.32</green-low>
|
||||
<green-base type="double">0.741</green-base>
|
||||
<blue-high type="double">0.10</blue-high>
|
||||
<blue-low type="double">0.02</blue-low>
|
||||
<blue-base type="double">0.09</blue-base>
|
||||
</flame>
|
||||
</model>
|
||||
|
||||
<previews>
|
||||
|
@ -776,6 +779,16 @@
|
|||
<yellow-elec type="bool">0</yellow-elec>
|
||||
</switches>
|
||||
</hydraulic>
|
||||
<ice-protection>
|
||||
<leng type="bool">0</leng>
|
||||
<reng type="bool">0</reng>
|
||||
<wing type="bool">0</wing>
|
||||
<lengfault type="bool">0</lengfault>
|
||||
<rengfault type="bool">0</rengfault>
|
||||
<wingfault type="bool">0</wingfault>
|
||||
<windowprobeheat type="bool">0</windowprobeheat>
|
||||
<windowprobeheat-output type="bool">0</windowprobeheat-output>
|
||||
</ice-protection>
|
||||
<lighting>
|
||||
<DU>
|
||||
<du1 type="double">1</du1>
|
||||
|
@ -886,7 +899,6 @@
|
|||
<no-smoking-sign type="double">0.5</no-smoking-sign>
|
||||
<seatbelt-sign type="double">0.0</seatbelt-sign>
|
||||
<annun-test>0</annun-test>
|
||||
<windowprobeheat type="double">0.5</windowprobeheat>
|
||||
<qnh-knb>100000</qnh-knb>
|
||||
<strobe type="double">0.0</strobe>
|
||||
<beacon type="bool">0</beacon>
|
||||
|
@ -933,7 +945,7 @@
|
|||
<n1 type="double">0</n1>
|
||||
<n-actual type="double">0</n-actual>
|
||||
<running type="bool">0</running>
|
||||
<servicable type="bool">1</servicable>
|
||||
<serviceable type="bool">1</serviceable>
|
||||
</engine>
|
||||
</engines>
|
||||
|
||||
|
@ -1298,20 +1310,27 @@
|
|||
<ditchingpb type="double">14.7</ditchingpb>
|
||||
</pressurization>
|
||||
|
||||
<pitot n="0">
|
||||
<icing type="double">0</icing>
|
||||
<serviceable type="bool">1</serviceable>
|
||||
</pitot>
|
||||
|
||||
<pitot n="1">
|
||||
<serviceable>1</serviceable>
|
||||
<icing type="double">0</icing>
|
||||
<serviceable type="bool">1</serviceable>
|
||||
</pitot>
|
||||
|
||||
<pitot n="2">
|
||||
<serviceable>1</serviceable>
|
||||
<icing type="double">0</icing>
|
||||
<serviceable type="bool">1</serviceable>
|
||||
</pitot>
|
||||
|
||||
<static n="1">
|
||||
<serviceable>1</serviceable>
|
||||
<serviceable type="bool">1</serviceable>
|
||||
</static>
|
||||
|
||||
<static n="2">
|
||||
<serviceable>1</serviceable>
|
||||
<serviceable type="bool">1</serviceable>
|
||||
</static>
|
||||
|
||||
<navigation>
|
||||
|
|
|
@ -5512,7 +5512,7 @@
|
|||
</condition>
|
||||
<command>property-cycle</command>
|
||||
<property>controls/ice-protection/windowprobeheat</property>
|
||||
<value>0.5</value>
|
||||
<value>0</value>
|
||||
<value>1</value>
|
||||
</binding>
|
||||
<binding>
|
||||
|
|
|
@ -37,20 +37,19 @@ var Iceable = {
|
|||
### Icing parameters computation.
|
||||
# Environmental parameters of the icing model.
|
||||
var environment = {
|
||||
dewpoint: props.globals.getNode("environment/dewpoint-degc"),
|
||||
temperature: props.globals.getNode("environment/temperature-degc"),
|
||||
visibility: props.globals.getNode("environment/effective-visibility-m"),
|
||||
visibLclWx: props.globals.getNode("environment/visibility-m"),
|
||||
dewpoint: props.globals.getNode("/environment/dewpoint-degc"),
|
||||
temperature: props.globals.getNode("/environment/temperature-degc"),
|
||||
visibility: props.globals.getNode("/environment/effective-visibility-m"),
|
||||
visibLclWx: props.globals.getNode("/environment/visibility-m"),
|
||||
};
|
||||
|
||||
var effects = {
|
||||
frost_inch: props.globals.getNode("environment/aircraft-effects/frost-inch", 1),
|
||||
frost_norm: props.globals.getNode("environment/aircraft-effects/frost-level"),
|
||||
frost_inch: props.globals.getNode("/environment/aircraft-effects/frost-inch", 1),
|
||||
frost_norm: props.globals.getNode("/environment/aircraft-effects/frost-level"),
|
||||
};
|
||||
|
||||
|
||||
# Icing factor computation.
|
||||
var maxSpread = 0;
|
||||
|
||||
var severity_factor_table = [
|
||||
-0.00000166,
|
||||
|
@ -63,20 +62,21 @@ var severity_factor_table = [
|
|||
|
||||
var melt_factor = -0.00005;
|
||||
|
||||
var temperature = 0;
|
||||
var spread = 0;
|
||||
var icingCond = 0;
|
||||
var severity = 0;
|
||||
|
||||
var icing_factor = func() {
|
||||
var temperature = environment.temperature.getValue();
|
||||
var dewpoint = environment.dewpoint.getValue();
|
||||
var visibility = environment.visibility.getValue();
|
||||
var visibLclWx = environment.visibLclWx.getValue();
|
||||
temperature = environment.temperature.getValue();
|
||||
|
||||
# Do we create ice?
|
||||
var spread = temperature - dewpoint;
|
||||
spread = temperature - environment.dewpoint.getValue();
|
||||
# freezing fog or low temp and below dp or in advanced wx cloud
|
||||
var icingCond = ((spread < maxSpread or visibility < 1000 or visibLclWx < 5000)
|
||||
icingCond = ((spread < 0.1 or environment.visibility.getValue() < 1000 or environment.visibLclWx.getValue() < 5000)
|
||||
and temperature < 0);
|
||||
|
||||
# todo: turn this into a table or something
|
||||
var severity = 0;
|
||||
severity = 0;
|
||||
if (icingCond) {
|
||||
if (temperature >= -2) {
|
||||
severity = 1;
|
||||
|
@ -96,7 +96,6 @@ var icing_factor = func() {
|
|||
|
||||
|
||||
var speed = 0;
|
||||
var pause = 0;
|
||||
var windowprobe = 0;
|
||||
var wingBtn = 0;
|
||||
var wingFault = 0;
|
||||
|
@ -117,18 +116,10 @@ var stateR = 0;
|
|||
|
||||
var iceables = [];
|
||||
|
||||
var icingInit = func {
|
||||
setprop("/controls/ice-protection/windowprobeheat", 0);
|
||||
setprop("/controls/ice-protection/wingfault", 0);
|
||||
setprop("/controls/ice-protection/wing", 0);
|
||||
setprop("/controls/ice-protection/leng", 0);
|
||||
setprop("/controls/ice-protection/lengfault", 0);
|
||||
setprop("/controls/ice-protection/reng", 0);
|
||||
setprop("/controls/ice-protection/rengfault", 0);
|
||||
setprop("/controls/deice/windowprobeheat", 0);
|
||||
setprop("/systems/pitot/icing", 0.0);
|
||||
setprop("/systems/pitot/failed", 1);
|
||||
var PitotIcing = [props.globals.getNode("/systems/pitot[0]/icing"),props.globals.getNode("/systems/pitot[1]/icing"),props.globals.getNode("/systems/pitot[2]/icing")];
|
||||
var PitotServicable = [props.globals.getNode("/systems/pitot[0]/serviceable", 1),props.globals.getNode("/systems/pitot[1]/serviceable", 1),props.globals.getNode("/systems/pitot[2]/serviceable"), 1];
|
||||
|
||||
var icingInit = func {
|
||||
iceables = props.globals.getNode("sim/model/icing", 1).getChildren("iceable");
|
||||
forindex(var i; iceables) {
|
||||
iceables[i] = Iceable.new(iceables[i]);
|
||||
|
@ -138,20 +129,6 @@ var icingInit = func {
|
|||
}
|
||||
|
||||
var icingModel = func {
|
||||
speed = getprop("velocities/airspeed-kt");
|
||||
pause = getprop("/sim/freeze/master");
|
||||
windowprobe = getprop("/controls/deice/windowprobeheat");
|
||||
wingBtn = getprop("/controls/ice-protection/wing");
|
||||
wingFault = getprop("/controls/ice-protection/wingfault");
|
||||
wowl = getprop("gear/gear[1]/wow");
|
||||
wowr = getprop("gear/gear[2]/wow");
|
||||
PitotIcing = getprop("/systems/pitot/icing");
|
||||
PitotFailed = getprop("/systems/pitot/failed");
|
||||
lengBtn = getprop("/controls/ice-protection/leng");
|
||||
lengFault = getprop("/controls/ice-protection/lengfault");
|
||||
rengBtn = getprop("/controls/ice-protection/reng");
|
||||
rengFault = getprop("/controls/ice-protection/rengfault");
|
||||
|
||||
var factor = icing_factor();
|
||||
foreach(iceable; iceables) {
|
||||
iceable.update(factor, melt_factor);
|
||||
|
@ -159,49 +136,19 @@ var icingModel = func {
|
|||
|
||||
effects.frost_norm.setDoubleValue(effects.frost_inch.getValue() * 50);
|
||||
|
||||
if (PitotIcing > 0.03) {
|
||||
if (!PitotFailed) {
|
||||
setprop("/systems/pitot/failed", 1);
|
||||
}
|
||||
} else if (PitotIcing < 0.03) {
|
||||
if (PitotFailed) {
|
||||
setprop("/systems/pitot/failed", 0);
|
||||
for (var i = 0; i <= 2; i = i + 1) {
|
||||
if (PitotIcing[i].getValue() > 0.03) {
|
||||
if (PitotServicable[i].getBoolValue()) {
|
||||
PitotServicable[i].setBoolValue(0);
|
||||
}
|
||||
} else {
|
||||
if (!PitotServicable[i].getBoolValue()) {
|
||||
PitotServicable[i].setBoolValue(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# if ((getprop("/systems/electrical/bus/dc-1") == 0 or getprop("/systems/electrical/bus/dc-2") == 0) and getprop("fdm/jsbsim/position/wow") == 0) {
|
||||
# setprop("/controls/ice-protection/leng", 1);
|
||||
# setprop("/controls/ice-protection/reng", 1);
|
||||
# }
|
||||
|
||||
#if (getprop("/systems/electrical/bus/dc-ess-shed") == 0) {
|
||||
# setprop("/controls/ice-protection/wing", 0);
|
||||
#}
|
||||
}
|
||||
|
||||
##################
|
||||
# Probe Anti-Ice #
|
||||
##################
|
||||
|
||||
setlistener("/controls/ice-protection/windowprobeheat", func {
|
||||
windowprb = getprop("/controls/ice-protection/windowprobeheat");
|
||||
if (windowprb == 0.5) { # if in auto
|
||||
wowl = getprop("gear/gear[1]/wow");
|
||||
wowr = getprop("gear/gear[2]/wow");
|
||||
stateL = getprop("engines/engine[0]/state");
|
||||
stateR = getprop("engines/engine[1]/state");
|
||||
if (!wowl or !wowr) {
|
||||
setprop("/controls/deice/windowprobeheat", 1);
|
||||
} else if (stateL == 3 or stateR == 3) {
|
||||
setprop("/controls/deice/windowprobeheat", 1);
|
||||
}
|
||||
} else if (windowprb == 1) { # if in ON
|
||||
setprop("/controls/deice/windowprobeheat", 1);
|
||||
} else {
|
||||
setprop("/controls/deice/windowprobeheat", 0);
|
||||
}
|
||||
});
|
||||
|
||||
###################
|
||||
# Update Function #
|
||||
###################
|
||||
|
|
|
@ -138,6 +138,7 @@ var Position = {
|
|||
|
||||
var Sim = {
|
||||
aero: props.globals.getNode("/sim/aero"),
|
||||
pause: props.globals.getNode("/sim/freeze/master"),
|
||||
Replay: {
|
||||
replayActive: props.globals.getNode("/sim/replay/replay-state"),
|
||||
},
|
||||
|
|
|
@ -1297,6 +1297,31 @@
|
|||
/systems/pneumatics/valves/engine-ice-2 ne /controls/ice-protection/reng
|
||||
</test>
|
||||
</switch>
|
||||
|
||||
<switch name="/controls/ice-protection/windowprobeheat-output">
|
||||
<default value="0"/>
|
||||
<test logic="OR" value="1">
|
||||
/controls/ice-protection/windowprobeheat eq 1
|
||||
<test logic="OR">
|
||||
/systems/electrical/bus/ac-ess ge 110
|
||||
/systems/electrical/bus/ac-1 ge 110
|
||||
/systems/electrical/bus/ac-2 ge 110
|
||||
</test>
|
||||
</test>
|
||||
<test logic="AND" value="1">
|
||||
/controls/ice-protection/windowprobeheat eq 0
|
||||
/gear/gear[1]/wow eq 1
|
||||
<test logic="OR">
|
||||
/engines/engine[0]/state eq 3
|
||||
/engines/engine[1]/state eq 3
|
||||
</test>
|
||||
<test logic="OR">
|
||||
/systems/electrical/bus/ac-ess ge 110
|
||||
/systems/electrical/bus/ac-1 ge 110
|
||||
/systems/electrical/bus/ac-2 ge 110
|
||||
</test>
|
||||
</test>
|
||||
</switch>
|
||||
</channel>
|
||||
|
||||
</system>
|
||||
|
|
Loading…
Add table
Reference in a new issue