This repository has been archived on 2021-09-26. You can view files and clone it, but cannot push or open issues or pull requests.
IDG-A32X/Nasal/pneumatics.nas

107 lines
3.8 KiB
Text
Raw Normal View History

# A320 Pneumatics System
# Jonathan Redpath (legoboyvdlp) and Joshua Davidson (it0uchpods)
2017-04-24 12:46:44 +00:00
#############
# Init Vars #
#############
2017-04-24 12:46:44 +00:00
# 7th stage of HP compressor is where the bleed is normally extracted at 44 PSI +- 4 but at low N2 10th stage is selected to provide 36 +- 4 psi
var pneumatics_init = func {
setprop("/systems/pneumatic/tempspsi/eng1/bleedvalvepsi", 0);
setprop("/systems/pneumatic/tempspsi/eng1/bleedvalvetemp", 0);
setprop("/systems/pneumatic/tempspsi/eng2/bleedvalvepsi", 0);
setprop("/systems/pneumatic/tempspsi/eng2/bleedvalvetemp", 0);
setprop("/systems/pneumatic/tempspsi/eng1/downstreamfavtemp", 0);
setprop("/systems/pneumatic/tempspsi/eng2/downstreamfavtemp", 0);
setprop("/systems/pneumatic/valves/xbleed", 0);
setprop("/systems/pneumatic/valves/eng1/bleedvalvepos", 0);
setprop("/systems/pneumatic/valves/eng1/OPRESSvalve", 0);
setprop("/systems/pneumatic/valves/eng1/bleedengsrc", "7");
setprop("/systems/pneumatic/valves/eng1/fav", 0);
setprop("/systems/pneumatic/valves/eng2/fav", 0);
setprop("/systems/pneumatic/valves/eng2/bleedvalvepos", 0);
setprop("/systems/pneumatic/valves/eng2/OPRESSvalve", 0);
setprop("/systems/pneumatic/valves/eng2/bleedengsrc", "7");
setprop("/systems/pneumatic/valves/eng2/fav", 0);
setprop("/systems/pneumatic/valves/apubleed", 0);
setprop("/systems/pneumatic/valves/eng1/startvalve", 0);
setprop("/systems/pneumatic/valves/eng2/startvalve", 0);
setprop("/controls/bleed/ground", 0);
setprop("/controls/bleed/OHP/pack1", 0);
setprop("/controls/bleed/OHP/pack2", 0);
setprop("/controls/bleed/OHP/bleed1", 0);
setprop("/controls/bleed/OHP/bleed2", 0);
setprop("/controls/bleed/OHP/xbleed", 0);
setprop("/controls/bleed/OHP/bleedapu", 0);
setprop("/controls/bleed/OHP/ramair", 0);
pneu_timer.start();
2017-04-24 12:46:44 +00:00
}
#######################
# Main Pneumatic Loop #
#######################
2017-04-24 12:46:44 +00:00
var master_pneu = func {
var bleed1 = getprop("/controls/bleed/OHP/bleed1");
var bleed2 = getprop("/controls/bleed/OHP/bleed2");
var apubleedsw = getprop("/controls/bleed/OHP/bleedapu");
var apubleed = getprop("/systems/pneumatic/valves/apubleed");
var opress1 = getprop("/systems/pneumatic/valves/eng1/OPRESSvalve");
2017-04-24 12:46:44 +00:00
var bleedohp1 = getprop("/controls/bleed/OHP/bleed1");
var eng1valveopen = getprop("/systems/pneumatic/valves/eng1/startvalve");
var opress2 = getprop("/systems/pneumatic/valves/eng2/OPRESSvalve");
var bleedohp2 = getprop("/controls/bleed/OHP/bleed2");
var eng2valveopen = getprop("/systems/pneumatic/valves/eng2/startvalve");
if (bleed1) {
setprop("/systems/pneumatic/valves/eng1/bleedvalvepos", 1);
} else {
setprop("/systems/pneumatic/valves/eng1/bleedvalvepos", 0);
2017-04-24 12:46:44 +00:00
}
if (bleed2) {
setprop("/systems/pneumatic/valves/eng2/bleedvalvepos", 1);
} else {
setprop("/systems/pneumatic/valves/eng2/bleedvalvepos", 0);
2017-04-24 12:46:44 +00:00
}
if (opress1 or apubleed or !bleedohp1 or eng1valveopen) {
setprop("/systems/pneumatic/valves/eng1/bleedvalvepos", 0);
}
if (opress2 or apubleed or !bleedohp2 or eng2valveopen) {
setprop("/systems/pneumatic/valves/eng2/bleedvalvepos", 0);
}
if (apubleedsw) {
apubleedtimer.start();
} else {
apubleedtimer.stop();
setprop("/systems/pneumatic/valves/xbleed", 0);
setprop("/systems/pneumatic/valves/apubleed", 0);
}
2017-04-24 12:46:44 +00:00
}
var apubleedtimer = maketimer(0.5, func {
var APU = getprop("/systems/apu/rpm");
if (APU > 94.9) {
apubleedtimer.stop();
setprop("/systems/pneumatic/valves/xbleed", 1);
setprop("/systems/pneumatic/valves/eng1/bleedvalvepos", 0);
setprop("/systems/pneumatic/valves/eng2/bleedvalvepos", 0);
setprop("/controls/bleed/OHP/bleed1", 0);
setprop("/controls/bleed/OHP/bleed2", 0);
setprop("/systems/pneumatic/valves/apubleed", 1);
}
2017-04-24 12:46:44 +00:00
});
###################
# Update Function #
###################
var update_pneumatic = func {
master_pneu();
2017-04-24 12:46:44 +00:00
}
var pneu_timer = maketimer(0.5, update_pneumatic);