1
0
Fork 0

Merge branch 'dev' into effects

This commit is contained in:
legoboyvdlp R 2020-03-17 15:25:29 +00:00
commit ed0d191ab7
61 changed files with 446 additions and 380 deletions

View file

@ -160,7 +160,7 @@ xsi:noNamespaceSchemaLocation="http://jsbsim.sourceforge.net/JSBSim.xsd">
</tank>
</propulsion>
<system file="glass-effect1"/>
<system file="glass-effect"/>
<system file="a320-fcs"/>
<system file="a320-fuel"/>
<system file="a320-fwc"/>

View file

@ -159,7 +159,7 @@ xsi:noNamespaceSchemaLocation="http://jsbsim.sourceforge.net/JSBSim.xsd">
</tank>
</propulsion>
<system file="glass-effect1"/>
<system file="glass-effect"/>
<system file="a320-fcs"/>
<system file="a320-adr"/>
<system file="a320-fuel"/>

View file

@ -159,7 +159,7 @@ xsi:noNamespaceSchemaLocation="http://jsbsim.sourceforge.net/JSBSim.xsd">
</tank>
</propulsion>
<system file="glass-effect1"/>
<system file="glass-effect"/>
<system file="a320-fcs"/>
<system file="a320-fuel"/>
<system file="a320-fwc"/>

View file

@ -45,7 +45,7 @@
<ice-inches>0.0</ice-inches>
<salvage-control>/controls/deice/windowprobeheat</salvage-control>
<sensitivity type="double">0.5</sensitivity>
<!-- not relevant for fdm, ignore output-property -->
<output-property>/environment/aircraft-effects/frost-level</output-property>
</iceable>
<iceable>
<name>Fuselage</name>
@ -1676,6 +1676,33 @@
<script>libraries.resetView();</script>
</binding>
</key>
<key n="105">
<name>i</name>
<desc>Change view to lights</desc>
<repeatable type="bool">true</repeatable>
<binding>
<command>nasal</command>
<script>libraries.lightsView();</script>
</binding>
</key>
<key n="111">
<name>o</name>
<desc>Change view to overhead</desc>
<repeatable type="bool">true</repeatable>
<binding>
<command>nasal</command>
<script>libraries.overheadView();</script>
</binding>
</key>
<key n="117">
<name>u</name>
<desc>Change view to pedestal</desc>
<repeatable type="bool">true</repeatable>
<binding>
<command>nasal</command>
<script>libraries.pedestalView();</script>
</binding>
</key>
<key n="120">
<name>x</name>
<desc>Decrease field of view</desc>
@ -1685,6 +1712,15 @@
<script>libraries.fovZoom(-1);</script>
</binding>
</key>
<key n="121">
<name>y</name>
<desc>Change view to autopilot</desc>
<repeatable type="bool">true</repeatable>
<binding>
<command>nasal</command>
<script>libraries.autopilotView();</script>
</binding>
</key>
<key n="127">
<name>DEL</name>
<desc>Simple Engage/Disengage reversers</desc>
@ -1800,6 +1836,12 @@
<value>0</value>
<value>1</value>
</binding>
<binding>
<command>property-cycle</command>
<property>sim/rendering/als-secondary-lights/use-searchlight</property>
<value>0</value>
<value>1</value>
</binding>
</key>
</keyboard>
</input>
@ -1926,6 +1968,9 @@
<file>Aircraft/A320-family/gui/dialogs/refuel.nas</file>
<file>Aircraft/A320-family/gui/dialogs/rmp.nas</file>
</Dialogs>
<save>
<file>Aircraft/A320-family/Nasal/Systems/save.nas</file>
</save>
</nasal>
</PropertyList>

View file

@ -159,7 +159,7 @@ xsi:noNamespaceSchemaLocation="http://jsbsim.sourceforge.net/JSBSim.xsd">
</tank>
</propulsion>
<system file="glass-effect1"/>
<system file="glass-effect"/>
<system file="a320-fcs"/>
<system file="a320-fuel"/>
<system file="a320-fwc"/>

View file

@ -159,7 +159,7 @@ xsi:noNamespaceSchemaLocation="http://jsbsim.sourceforge.net/JSBSim.xsd">
</tank>
</propulsion>
<system file="glass-effect1"/>
<system file="glass-effect"/>
<system file="a320-fcs"/>
<system file="a320-fuel"/>
<system file="a320-fwc"/>

View file

@ -96,6 +96,7 @@ setprop("systems/acconfig/options/weight-kgs", 0);
setprop("systems/acconfig/options/adirs-skip", 0);
setprop("systems/acconfig/options/welcome-skip", 0);
setprop("systems/acconfig/options/no-rendering-warn", 0);
setprop("systems/acconfig/options/save-state", 0);
setprop("systems/acconfig/options/pfd-rate", 1);
setprop("systems/acconfig/options/nd-rate", 1);
setprop("systems/acconfig/options/uecam-rate", 1);
@ -187,9 +188,17 @@ setlistener("/sim/signals/fdm-initialized", func {
}
setprop("systems/acconfig/options/revision", current_revision);
writeSettings();
if (getprop("options/system/save-state") == 1)
{
save.restore(save.default, getprop("/sim/fg-home") ~ "/Export/" ~ getprop("/sim/aircraft") ~ "-save.xml");
}
spinning.stop();
});
setlistener("/sim/signals/exit", func {
save.save(save.default, getprop("/sim/fg-home") ~ "/Export/" ~ getprop("/sim/aircraft") ~ "-save.xml");
});
var renderingSettings = {
check: func() {
var rembrandt = getprop("sim/rendering/rembrandt/enabled");
@ -223,6 +232,7 @@ var readSettings = func {
io.read_properties(getprop("sim/fg-home") ~ "/Export/A320-family-config.xml", "/systems/acconfig/options");
setprop("options/system/keyboard-mode", getprop("systems/acconfig/options/keyboard-mode"));
setprop("options/system/weight-kgs", getprop("systems/acconfig/options/weight-kgs"));
setprop("options/system/save-state", getprop("systems/acconfig/options/save-state"));
setprop("controls/adirs/skip", getprop("systems/acconfig/options/adirs-skip"));
setprop("sim/model/autopush/route/show", getprop("systems/acconfig/options/autopush/show-route"));
setprop("sim/model/autopush/route/show-wingtip", getprop("systems/acconfig/options/autopush/show-wingtip"));
@ -232,6 +242,7 @@ var readSettings = func {
var writeSettings = func {
setprop("systems/acconfig/options/keyboard-mode", getprop("options/system/keyboard-mode"));
setprop("systems/acconfig/options/weight-kgs", getprop("options/system/weight-kgs"));
setprop("systems/acconfig/options/save-state", getprop("options/system/save-state"));
setprop("systems/acconfig/options/adirs-skip", getprop("controls/adirs/skip"));
setprop("systems/acconfig/options/autopush/show-route", getprop("sim/model/autopush/route/show"));
setprop("systems/acconfig/options/autopush/show-wingtip", getprop("sim/model/autopush/route/show-wingtip"));

View file

@ -426,6 +426,27 @@
</binding>
<live>true</live>
</checkbox>
<checkbox>
<!-- TODO there might be a better way to formulate this. -->
<label>Save states between sessions</label>
<halign>left</halign>
<property>/systems/acconfig/options/save-state</property>
<binding>
<command>property-toggle</command>
<property>/options/system/save-state</property>
</binding>
<binding>
<command>dialog-apply</command>
</binding>
<binding>
<command>nasal</command>
<script>
acconfig.writeSettings();
</script>
</binding>
<live>true</live>
</checkbox>
<group>
<layout>hbox</layout>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 42 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 55 KiB

View file

@ -14,7 +14,7 @@
<effect>
<inherits-from>Effects/glass</inherits-from>
<object-name>Windshield</object-name>
<object-name>Windsheild</object-name>
<object-name>Windows</object-name>
<object-name>glass</object-name>
<object-name>glass1</object-name>

View file

@ -14,7 +14,7 @@
<effect>
<inherits-from>Effects/glass</inherits-from>
<object-name>Windshield</object-name>
<object-name>Windsheild</object-name>
<object-name>Windows</object-name>
<object-name>glass</object-name>
<object-name>glass1</object-name>

View file

@ -14,7 +14,7 @@
<effect>
<inherits-from>Effects/glass</inherits-from>
<object-name>Windshield</object-name>
<object-name>Windsheild</object-name>
<object-name>Windows</object-name>
<object-name>glass</object-name>
<object-name>glass1</object-name>

View file

@ -1,101 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="50"
height="50"
id="svg3076"
version="1.1"
inkscape:version="0.48.2 r9819"
sodipodi:docname="airbus-vor.svg">
<metadata
id="metadata3092">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
</cc:Work>
</rdf:RDF>
</metadata>
<defs
id="defs3090" />
<sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="1248"
inkscape:window-height="703"
id="namedview3088"
showgrid="false"
inkscape:zoom="1.6619718"
inkscape:cx="-33.09322"
inkscape:cy="71"
inkscape:window-x="0"
inkscape:window-y="0"
inkscape:window-maximized="0"
inkscape:current-layer="svg3076" />
<!-- Created with SVG-edit - http://svg-edit.googlecode.com/ -->
<g
id="g3078"
inkscape:groupmode="layer"
transform="matrix(0.34013605,0,0,0.33783784,0.84746249,0.78240397)">
<title
id="title3080">Layer 1</title>
<g
id="svg_7">
<line
id="svg_3"
y2="71"
x2="142"
y1="71"
x1="112"
style="fill:none;stroke:#b00064;stroke-width:5" />
<circle
id="svg_2"
r="39.115215"
cy="71.5"
cx="71"
sodipodi:cx="71"
sodipodi:cy="71.5"
sodipodi:rx="39.115215"
sodipodi:ry="39.115215"
style="fill:none;stroke:#b00064;stroke-width:5"
d="m 110.11522,71.5 c 0,21.602737 -17.512483,39.11522 -39.11522,39.11522 -21.602737,0 -39.115215,-17.512483 -39.115215,-39.11522 0,-21.602737 17.512478,-39.115215 39.115215,-39.115215 21.602737,0 39.11522,17.512478 39.11522,39.115215 z" />
<line
id="svg_4"
y2="71"
x2="30"
y1="71"
x1="0"
style="fill:none;stroke:#b00064;stroke-width:5" />
<line
transform="matrix(0,1,-1,0,198,58)"
id="svg_5"
y2="128"
x2="85"
y1="128"
x1="55"
style="fill:none;stroke:#b00064;stroke-width:5" />
<line
id="svg_6"
transform="matrix(0,1,-1,0,85,-55)"
y2="15"
x2="85"
y1="15"
x1="55"
style="fill:none;stroke:#b00064;stroke-width:5" />
</g>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.5 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 629 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 44 KiB

View file

@ -1261,9 +1261,6 @@ var canvas_PFD_1 = {
}
tgt_flap = 200;
if (ind_spd >= 210) {
tgt_flap = 215;
}
me.flaptrgt = tgt_flap - 30 - me.ASI;
me.SPDflaptrgtdiff = tgt_flap - ind_spd;
@ -1881,9 +1878,6 @@ var canvas_PFD_2 = {
}
tgt_flap = 200;
if (ind_spd >= 210) {
tgt_flap = 215;
}
me.flaptrgt = tgt_flap - 30 - me.ASI;
me.SPDflaptrgtdiff = tgt_flap - ind_spd;

View file

@ -112,7 +112,7 @@
<object-name>ACTUTATOR</object-name>
<object-name>Main Tires</object-name>
<object-name>Compression lower scissor</object-name>
<property>gear/gear[1]/compression-ft</property>
<property>gear/gear[1]/compression-norm</property>
<factor>0.305</factor>
<axis>
<x1-m>0</x1-m>

View file

@ -112,7 +112,7 @@
<object-name>ACTUTATOR</object-name>
<object-name>Main Tires</object-name>
<object-name>Compression lower scissor</object-name>
<property>gear/gear[2]/compression-ft</property>
<property>gear/gear[2]/compression-norm</property>
<factor>0.305</factor>
<axis>
<x1-m>0</x1-m>

View file

@ -112,7 +112,7 @@
<object-name>AXLE</object-name>
<object-name>Nose Tires</object-name>
<object-name>Compression lower scissor</object-name>
<property>gear/gear[0]/compression-ft</property>
<property>gear/gear[0]/compression-norm</property>
<factor>0.305</factor>
<axis>
<x1-m>-0.366</x1-m>

View file

@ -731,9 +731,125 @@ var resetView = func() {
}
interpolate("sim/current-view/field-of-view", 63, 0.66);
interpolate("sim/current-view/heading-offset-deg", hd_t,0.66);
interpolate("sim/current-view/pitch-offset-deg", -14.6,0.66);
interpolate("sim/current-view/heading-offset-deg", hd_t, 0.66);
interpolate("sim/current-view/pitch-offset-deg", -14.6, 0.66);
interpolate("sim/current-view/roll-offset-deg", 0, 0.66);
interpolate("sim/current-view/x-offset-m", -0.45, 0.66);
interpolate("sim/current-view/y-offset-m", 2.34, 0.66);
interpolate("sim/current-view/z-offset-m", -13.75, 0.66);
if (_shakeFlag) {
setprop("sim/rendering/headshake/enabled", 1);
}
}
}
var autopilotView = func() {
if (getprop("sim/current-view/view-number") == 0) {
if (getprop("sim/rendering/headshake/enabled")) {
var _shakeFlag = 1;
setprop("sim/rendering/headshake/enabled", 0);
} else {
var _shakeFlag = 0;
}
var hd = getprop("sim/current-view/heading-offset-deg");
var hd_t = 341.7;
if (hd < 180) {
hd_t = hd_t - 360;
}
interpolate("sim/current-view/field-of-view", 63, 0.66);
interpolate("sim/current-view/heading-offset-deg", hd_t, 0.66);
interpolate("sim/current-view/pitch-offset-deg", -16.4, 0.66);
interpolate("sim/current-view/roll-offset-deg", 0, 0.66);
interpolate("sim/current-view/x-offset-m", -0.45, 0.66);
interpolate("sim/current-view/y-offset-m", 2.34, 0.66);
interpolate("sim/current-view/z-offset-m", -13.75, 0.66);
if (_shakeFlag) {
setprop("sim/rendering/headshake/enabled", 1);
}
}
}
var overheadView = func() {
if (getprop("sim/current-view/view-number") == 0) {
if (getprop("sim/rendering/headshake/enabled")) {
var _shakeFlag = 1;
setprop("sim/rendering/headshake/enabled", 0);
} else {
var _shakeFlag = 0;
}
var hd = getprop("sim/current-view/heading-offset-deg");
var hd_t = 348;
if (hd < 180) {
hd_t = hd_t - 360;
}
interpolate("sim/current-view/field-of-view", 105.8, 0.66);
interpolate("sim/current-view/heading-offset-deg", hd_t, 0.66);
interpolate("sim/current-view/pitch-offset-deg", 65.25, 0.66);
interpolate("sim/current-view/roll-offset-deg", 0,0.66);
interpolate("sim/current-view/x-offset-m", -0.12, 0.66);
interpolate("sim/current-view/y-offset-m", 2.34, 0.66);
interpolate("sim/current-view/z-offset-m", -13.75, 0.66);
if (_shakeFlag) {
setprop("sim/rendering/headshake/enabled", 1);
}
}
}
var pedestalView = func() {
if (getprop("sim/current-view/view-number") == 0) {
if (getprop("sim/rendering/headshake/enabled")) {
var _shakeFlag = 1;
setprop("sim/rendering/headshake/enabled", 0);
} else {
var _shakeFlag = 0;
}
var hd = getprop("sim/current-view/heading-offset-deg");
var hd_t = 315;
if (hd < 180) {
hd_t = hd_t - 360;
}
interpolate("sim/current-view/field-of-view", 63, 0.66);
interpolate("sim/current-view/heading-offset-deg", hd_t, 0.66);
interpolate("sim/current-view/pitch-offset-deg", -46.3, 0.66);
interpolate("sim/current-view/roll-offset-deg", 0, 0.66);
interpolate("sim/current-view/x-offset-m", -0.45, 0.66);
interpolate("sim/current-view/y-offset-m", 2.34, 0.66);
interpolate("sim/current-view/z-offset-m", -13.75, 0.66);
if (_shakeFlag) {
setprop("sim/rendering/headshake/enabled", 1);
}
}
}
var lightsView = func() {
if (getprop("sim/current-view/view-number") == 0) {
if (getprop("sim/rendering/headshake/enabled")) {
var _shakeFlag = 1;
setprop("sim/rendering/headshake/enabled", 0);
} else {
var _shakeFlag = 0;
}
var hd = getprop("sim/current-view/heading-offset-deg");
var hd_t = 329;
if (hd < 180) {
hd_t = hd_t - 360;
}
interpolate("sim/current-view/field-of-view", 63, 0.66);
interpolate("sim/current-view/heading-offset-deg", hd_t, 0.66);
interpolate("sim/current-view/pitch-offset-deg", 17.533, 0.66);
interpolate("sim/current-view/roll-offset-deg", 0, 0.66);
interpolate("sim/current-view/x-offset-m", -0.45, 0.66);
interpolate("sim/current-view/y-offset-m", 2.34, 0.66);
interpolate("sim/current-view/z-offset-m", -13.75, 0.66);

View file

@ -3,17 +3,100 @@
# Copyright (c) 2019 Joshua Davidson (Octal450)
var dewpoint = 0;
var temperature = 0;
var speed = 0;
var visibility = 0;
var visibLclWx = 0;
var severity = 0;
var factor = 0;
### Ice sensitive components definition.
var Iceable = {
new: func(node) {
var m = { parents: [Iceable] };
m.ice_inches = node.getNode("ice-inches", 1);
m.sensitivity = node.getNode("sensitivity", 1);
var deice_prop = node.getValue("salvage-control");
m.deice = deice_prop ? props.globals.getNode(deice_prop, 1) : nil;
var output_prop = node.getValue("output-property");
m.output = output_prop ? props.globals.getNode(output_prop, 1): nil;
return m;
},
update: func(factor, melt) {
var icing = me.ice_inches.getValue();
if(me.deice != nil and me.deice.getBoolValue()) {
icing += melt;
} else {
icing += factor * me.sensitivity.getValue();
}
if(icing < 0) icing = 0;
me.ice_inches.setValue(icing);
if(me.output != nil) me.output.setValue(icing);
},
};
### 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"),
};
var effects = {
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 icingCond = 0;
var severity_factor_table = [
-0.00000166,
0.00000277,
0.00000277,
0.00000554,
0.00001108,
0.00002216,
];
var melt_factor = -0.00005;
var icing_factor = func() {
var temperature = environment.temperature.getValue();
var dewpoint = environment.dewpoint.getValue();
var visibility = environment.visibility.getValue();
var visibLclWx = environment.visibLclWx.getValue();
# Do we create ice?
var spread = temperature - dewpoint;
# freezing fog or low temp and below dp or in advanced wx cloud
var icingCond = ((spread < maxSpread or visibility < 1000 or visibLclWx < 5000)
and temperature < 0);
# todo: turn this into a table or something
var severity = 0;
if (icingCond) {
if (temperature >= -2) {
severity = 1;
} else if (temperature >= -12) {
severity = 3;
} else if (temperature >= -30) {
severity = 5;
} else if (temperature >= -40) {
severity = 3;
} else if (temperature >= -99) {
severity = 1;
}
}
return severity_factor_table[severity];
}
var speed = 0;
var pause = 0;
var melt = 0;
var windowprobe = 0;
var wingBtn = 0;
var wingFault = 0;
@ -31,40 +114,13 @@ var lengAnti = 0;
var rengAnti = 0;
var WingHasBeenTurnedOff = 0;
var GroundModeFinished = 0;
var icing1 = 0;
var sensitive1 = 0;
var v = 0;
var a = 0;
var icing2 = 0;
var sensitive2 = 0;
var u = 0;
var b = 0;
var icing3 = 0;
var sensitive3 = 0;
var t = 0;
var c = 0;
var icing4 = 0;
var sensitive4 = 0;
var s = 0;
var d = 0;
var icing5 = 0;
var sensitive5 = 0;
var r = 0;
var icing6 = 0;
var sensitive6 = 0;
var q = 0;
var e = 0;
var spread = 0;
var windowprb = 0;
var stateL = 0;
var stateR = 0;
var iceables = [];
var icingInit = func {
setprop("systems/icing/severity", "0"); # maximum severity: we will make it random
setprop("systems/icing/factor", 0.0); # the factor is how many inches we add per second
setprop("systems/icing/max-spread-degc", 0.0);
setprop("systems/icing/melt-w-heat-factor", -0.00005000);
setprop("systems/icing/icingcond", 0);
setprop("controls/switches/windowprobeheat", 0);
setprop("controls/switches/wing", 0);
setprop("controls/switches/wingfault", 0);
@ -80,21 +136,18 @@ var icingInit = func {
setprop("systems/pitot/failed", 1);
setprop("controls/deice/WingHasBeenTurnedOff", 0);
setprop("controls/deice/GroundModeFinished", 0);
iceables = props.globals.getNode("sim/model/icing", 1).getChildren("iceable");
forindex(var i; iceables) {
iceables[i] = Iceable.new(iceables[i]);
}
icing_timer.start();
}
var icingModel = func {
dewpoint = getprop("environment/dewpoint-degc");
temperature = getprop("environment/temperature-degc");
speed = getprop("velocities/airspeed-kt");
visibility = getprop("environment/effective-visibility-m");
visibLclWx = getprop("environment/visibility-m");
severity = getprop("systems/icing/severity");
factor = getprop("systems/icing/factor");
maxSpread = getprop("systems/icing/max-spread-degc");
icingCond = getprop("systems/icing/icingcond");
pause = getprop("sim/freeze/master");
melt = getprop("systems/icing/melt-w-heat-factor");
windowprobe = getprop("controls/deice/windowprobeheat");
wingBtn = getprop("controls/switches/wing");
wingFault = getprop("controls/switches/wingfault");
@ -112,104 +165,19 @@ var icingModel = func {
rengAnti = getprop("controls/deice/rengine");
WingHasBeenTurnedOff = getprop("controls/deice/WingHasBeenTurnedOff");
GroundModeFinished = getprop("controls/deice/GroundModeFinished");
if (temperature >= 0 or !icingCond) {
setprop("systems/icing/severity", "0");
} else if (temperature < 0 and temperature >= -2 and icingCond) {
setprop("systems/icing/severity", "1");
} else if (temperature < -2 and temperature >= -12 and icingCond) {
setprop("systems/icing/severity", "3");
} else if (temperature < -12 and temperature >= -30 and icingCond) {
setprop("systems/icing/severity", "5");
} else if (temperature < -30 and temperature >= -40 and icingCond) {
setprop("systems/icing/severity", "3");
} else if (temperature < -40 and temperature >= -99 and icingCond) {
setprop("systems/icing/severity", "1");
}
icing1 = getprop("sim/model/icing/iceable[0]/ice-inches");
sensitive1 = getprop("sim/model/icing/iceable[0]/sensitivity");
v = icing1 + (factor * sensitive1);
a = icing1 + melt;
if (icing1 < 0.0 and !pause) {
setprop("sim/model/icing/iceable[0]/ice-inches", 0.0);
} else if (wingAnti) {
setprop("sim/model/icing/iceable[0]/ice-inches", a);
} else if (!pause and !wingAnti) {
setprop("sim/model/icing/iceable[0]/ice-inches", v);
}
icing2 = getprop("sim/model/icing/iceable[1]/ice-inches");
sensitive2 = getprop("sim/model/icing/iceable[1]/sensitivity");
u = icing2 + (factor * sensitive2);
b = icing2 + melt;
if (icing2 < 0.0 and !pause) {
setprop("sim/model/icing/iceable[1]/ice-inches", 0.0);
} else if (lengAnti) {
setprop("sim/model/icing/iceable[1]/ice-inches", b);
} else if (!pause and !lengAnti) {
setprop("sim/model/icing/iceable[1]/ice-inches", u);
}
icing3 = getprop("sim/model/icing/iceable[2]/ice-inches");
sensitive3 = getprop("sim/model/icing/iceable[2]/sensitivity");
t = icing3 + (factor * sensitive3);
c = icing3 + melt;
if (icing3 < 0.0 and !pause) {
setprop("sim/model/icing/iceable[2]/ice-inches", 0.0);
} else if (rengAnti) {
setprop("sim/model/icing/iceable[2]/ice-inches", c);
} else if (!pause and !rengAnti) {
setprop("sim/model/icing/iceable[2]/ice-inches", t);
}
icing4 = getprop("sim/model/icing/iceable[3]/ice-inches");
sensitive4 = getprop("sim/model/icing/iceable[3]/sensitivity");
s = icing4 + (factor * sensitive4);
d = icing4 + melt;
if (icing4 < 0.0 and !pause) {
setprop("sim/model/icing/iceable[3]/ice-inches", 0.0);
} else if (windowprobe) {
setprop("sim/model/icing/iceable[3]/ice-inches", d);
} else if (!pause and !windowprobe) {
setprop("sim/model/icing/iceable[3]/ice-inches", s);
}
icing5 = getprop("sim/model/icing/iceable[4]/ice-inches");
sensitive5 = getprop("sim/model/icing/iceable[4]/sensitivity");
r = icing5 + (factor * sensitive5);
if (icing5 < 0.0 and !pause) {
setprop("sim/model/icing/iceable[4]/ice-inches", 0.0);
} else if (!pause) {
setprop("sim/model/icing/iceable[4]/ice-inches", r);
}
icing6 = getprop("sim/model/icing/iceable[5]/ice-inches");
sensitive6 = getprop("sim/model/icing/iceable[5]/sensitivity");
q = icing6 + (factor * sensitive6);
e = icing6 + melt;
if (icing6 < 0.0 and !pause) {
setprop("sim/model/icing/iceable[5]/ice-inches", 0.0);
} else if (windowprobe) {
setprop("sim/model/icing/iceable[5]/ice-inches", e);
} else if (!pause and !windowprobe) {
setprop("sim/model/icing/iceable[5]/ice-inches", q);
}
# Do we create ice?
spread = temperature - dewpoint;
# freezing fog or low temp and below dp or in advanced wx cloud
if ((spread < maxSpread and temperature < 0) or (temperature < 0 and visibility < 1000) or (visibLclWx < 5000 and temperature < 0)) {
setprop("systems/icing/icingcond", 1);
} else {
setprop("systems/icing/icingcond", 0);
var factor = icing_factor();
foreach(iceable; iceables) {
iceable.update(factor, melt_factor);
}
effects.frost_norm.setDoubleValue(effects.frost_inch.getValue() * 50);
if (WingHasBeenTurnedOff and !wowl and !wowr and GroundModeFinished) {
setprop("controls/deice/wing", 1);
setprop("controls/switches/WingHasBeenTurnedOff", 0);
}
# If we have low pressure we have a fault
if (PSI < 10) {
setprop("controls/switches/wingfault", 1);
@ -232,7 +200,7 @@ var icingModel = func {
setprop("systems/pitot/failed", 0);
}
}
# 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/switches/leng", 1);
# setprop("controls/switches/reng", 1);
@ -364,3 +332,4 @@ var update_Icing = func {
}
var icing_timer = maketimer(0.2, update_Icing);
icing_timer.simulatedTime = 1;

74
Nasal/Systems/save.nas Normal file
View file

@ -0,0 +1,74 @@
# Copyright (C) 2020 Merspieler, merspieler _at_ airmail.cc
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 3 of the
# License, or (at your option) any later version.
#
# This program 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 this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
# Save and restore properties between sessions
# To add more properties to autosave, just add them here.
var default = [
# CONSUMABLES
# Fuel
"/consumables/fuel/tank[0]/level-lbs",
"/consumables/fuel/tank[1]/level-lbs",
"/consumables/fuel/tank[2]/level-lbs",
"/consumables/fuel/tank[3]/level-lbs",
"/consumables/fuel/tank[4]/level-lbs",
# CONTROLS
# rmp
"/controls/radio/rmp[0]/on",
"/controls/radio/rmp[1]/on",
"/controls/radio/rmp[2]/on",
# efis
"/instrumentation/efis[0]/inputs/range-nm",
"/instrumentation/efis[0]/nd/display-mode",
"/instrumentation/efis[0]/input/lh-vor-adf",
"/instrumentation/efis[0]/input/rh-vor-adf",
"/instrumentation/efis[1]/inputs/range-nm",
"/instrumentation/efis[1]/nd/display-mode",
"/instrumentation/efis[1]/input/lh-vor-adf",
"/instrumentation/efis[1]/input/rh-vor-adf",
# parking brake
"/controls/gear/brake-parking"
];
var save = func (saved_props, file) {
print("Saving state...");
for (var i = 0; i < size(saved_props); i += 1)
{
setprop("/save" ~ saved_props[i], getprop(saved_props[i]));
}
var saveNode = props.globals.getNode("/save", 0);
io.write_properties(file, saveNode);
print("State saved");
}
var restore = func (saved_props, file) {
print("Loading saved state...");
var readNode = props.globals.initNode("/save", );
io.read_properties(file, readNode);
for (var i = 0; i < size(saved_props); i += 1)
{
var val = getprop("/save" ~ saved_props[i]);
if (val != nil)
{
setprop(saved_props[i], val);
}
}
print("Saved state loaded");
}

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

56
Systems/glass-effect.xml Normal file
View file

@ -0,0 +1,56 @@
<?xml version="1.0"?>
<!-- Copyright (c) 2019 Joshua Davidson (Octal450) -->
<system name="glass-effect">
<channel name="rain">
<fcs_function name="glass-effects/splashx">
<function>
<table>
<independentVar>velocities/u-aero-fps</independentVar>
<tableData>
0 0.01
7 0.01
8 -0.01
25 -0.5
50 -1.2
120 -2
</tableData>
</table>
</function>
<output>/environment/aircraft-effects/splash-vector-x</output>
</fcs_function>
<fcs_function name="glass-effects/splashy">
<function>
<table>
<independentVar>velocities/v-aero-fps</independentVar>
<tableData>
-25 -0.1
-8 0
8 0
25 0.1
</tableData>
</table>
</function>
<output>/environment/aircraft-effects/splash-vector-y</output>
</fcs_function>
<fcs_function name="glass-effects/splashz">
<function>
<table>
<independentVar>velocities/u-aero-fps</independentVar>
<tableData>
0 1.2
7 1.2
8 0.9
25 0.9
50 -0.2
120 -0.5
</tableData>
</table>
</function>
<output>/environment/aircraft-effects/splash-vector-z</output>
</fcs_function>
</channel>
</system>

View file

@ -1,58 +0,0 @@
<?xml version="1.0"?>
<!-- Copyright (c) 2019 Joshua Davidson (Octal450) -->
<system name="glass-effect1">
<channel name="rain">
<fcs_function name="glass-effects/airspeed-clamped-sqrt">
<function>
<sqrt>
<quotient>
<min>
<property>/velocities/airspeed-kt</property>
<value>40</value>
</min>
<value>40</value>
</quotient>
</sqrt>
</function>
</fcs_function>
<fcs_function name="glass-effects/splashx">
<function>
<difference>
<value>-0.1</value>
<product>
<value>2.0</value>
<property>/fdm/jsbsim/glass-effects/airspeed-clamped-sqrt</property>
</product>
</difference>
</function>
<output>/environment/aircraft-effects/splash-vector-x</output>
</fcs_function>
<fcs_function name="glass-effects/splashy">
<function>
<value>0.0</value>
</function>
<output>/environment/aircraft-effects/splash-vector-y</output>
</fcs_function>
<fcs_function name="glass-effects/splashz">
<function>
<difference>
<value>1.0</value>
<product>
<value>1.35</value>
<property>/fdm/jsbsim/glass-effects/airspeed-clamped-sqrt</property>
</product>
</difference>
</function>
<output>/environment/aircraft-effects/splash-vector-z</output>
</fcs_function>
</channel>
</system>

View file

@ -1,40 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Copyright (c) 2019 Joshua Davidson (Octal450) -->
<PropertyList>
<filter>
<name>splashX</name>
<type>gain</type>
<input>
<property>/fdm/jsbsim/glass-effects/splashx</property>
</input>
<output>
<property>/environment/aircraft-effects/splash-vector-x</property>
</output>
</filter>
<filter>
<name>splashY</name>
<type>gain</type>
<input>
<value>0.0</value>
</input>
<output>
<property>/environment/aircraft-effects/splash-vector-y</property>
</output>
</filter>
<filter>
<name>splashZ</name>
<type>gain</type>
<input>
<property>/fdm/jsbsim/glass-effects/splashz</property>
</input>
<output>
<property>/environment/aircraft-effects/splash-vector-z</property>
</output>
</filter>
</PropertyList>

View file

@ -608,27 +608,6 @@
<output>/systems/pressurization/targetvs</output>
</filter>
<filter>
<name>Icing Severity</name>
<type>gain</type>
<gain>1.0</gain>
<update-interval-secs type="double">0.1</update-interval-secs>
<input>
<expression>
<table>
<property>/systems/icing/severity</property>
<entry><ind>0</ind><dep>-0.00000166</dep></entry>
<entry><ind>1</ind><dep> 0.00000277</dep></entry>
<entry><ind>2</ind><dep> 0.00000277</dep></entry>
<entry><ind>3</ind><dep> 0.00000554</dep></entry>
<entry><ind>4</ind><dep> 0.00001108</dep></entry>
<entry><ind>5</ind><dep> 0.00002216</dep></entry>
</table>
</expression>
</input>
<output>/systems/icing/factor</output>
</filter>
<filter>
<name>TAS</name>
<type>gain</type>