Bugfix - Brakes overheat on replay #115
This commit is contained in:
parent
f7fe9af157
commit
a257b23750
3 changed files with 106 additions and 114 deletions
|
@ -7125,12 +7125,12 @@
|
||||||
<name>chrono2_1</name>
|
<name>chrono2_1</name>
|
||||||
<offsets>
|
<offsets>
|
||||||
<x-m>-0.547</x-m>
|
<x-m>-0.547</x-m>
|
||||||
<y-m>0.151</y-m>
|
<y-m>0.167</y-m>
|
||||||
<z-m>0.196</z-m>
|
<z-m>0.196</z-m>
|
||||||
<heading-deg>90</heading-deg>
|
<heading-deg>90</heading-deg>
|
||||||
<roll-deg>72.81</roll-deg>
|
<roll-deg>72.81</roll-deg>
|
||||||
</offsets>
|
</offsets>
|
||||||
<alignment>center-center</alignment>
|
<alignment>right-center</alignment>
|
||||||
<axis-alignment>xy-plane</axis-alignment>
|
<axis-alignment>xy-plane</axis-alignment>
|
||||||
<type type="string">text-value</type>
|
<type type="string">text-value</type>
|
||||||
<format type="string">%s</format>
|
<format type="string">%s</format>
|
||||||
|
@ -7187,7 +7187,7 @@
|
||||||
<name>UTC_1</name>
|
<name>UTC_1</name>
|
||||||
<offsets>
|
<offsets>
|
||||||
<x-m>-0.547</x-m>
|
<x-m>-0.547</x-m>
|
||||||
<y-m>0.144</y-m>
|
<y-m>0.146</y-m>
|
||||||
<z-m>0.196</z-m>
|
<z-m>0.196</z-m>
|
||||||
<heading-deg>90</heading-deg>
|
<heading-deg>90</heading-deg>
|
||||||
<roll-deg>72.81</roll-deg>
|
<roll-deg>72.81</roll-deg>
|
||||||
|
@ -7218,7 +7218,7 @@
|
||||||
<name>UTC_2</name>
|
<name>UTC_2</name>
|
||||||
<offsets>
|
<offsets>
|
||||||
<x-m>-0.547</x-m>
|
<x-m>-0.547</x-m>
|
||||||
<y-m>0.158</y-m>
|
<y-m>0.160</y-m>
|
||||||
<z-m>0.196</z-m>
|
<z-m>0.196</z-m>
|
||||||
<heading-deg>90</heading-deg>
|
<heading-deg>90</heading-deg>
|
||||||
<roll-deg>72.81</roll-deg>
|
<roll-deg>72.81</roll-deg>
|
||||||
|
|
|
@ -107,68 +107,59 @@ var BrakeSystem =
|
||||||
var L_thrust_lb = getprop("engines/engine[0]/thrust_lb");
|
var L_thrust_lb = getprop("engines/engine[0]/thrust_lb");
|
||||||
var R_thrust_lb = getprop("engines/engine[1]/thrust_lb");
|
var R_thrust_lb = getprop("engines/engine[1]/thrust_lb");
|
||||||
|
|
||||||
if (dt<1.0)
|
if (getprop("sim/freeze/replay-state")==0 and dt<1.0) {
|
||||||
{
|
|
||||||
var OnGround = getprop("gear/gear[1]/wow");
|
var OnGround = getprop("gear/gear[1]/wow");
|
||||||
#cooling effect: adjust cooling factor by a value proportional to the environment temp (m.CoolingFactor + environment temp-degc * 0.00001)
|
#cooling effect: adjust cooling factor by a value proportional to the environment temp (m.CoolingFactor + environment temp-degc * 0.00001)
|
||||||
var LCoolingRatio = me.CoolingFactor+(tatdegc*0.000001);
|
var LCoolingRatio = me.CoolingFactor+(tatdegc*0.000001);
|
||||||
var RCoolingRatio = me.CoolingFactor+(tatdegc*0.000001);
|
var RCoolingRatio = me.CoolingFactor+(tatdegc*0.000001);
|
||||||
if (getprop("controls/gear/brake-fans"))
|
if (getprop("controls/gear/brake-fans")) {
|
||||||
{
|
|
||||||
#increase CoolingRatio if Brake Fans are active
|
#increase CoolingRatio if Brake Fans are active
|
||||||
LCoolingRatio = LCoolingRatio * 3;
|
LCoolingRatio = LCoolingRatio * 3;
|
||||||
RCoolingRatio = RCoolingRatio * 3;
|
RCoolingRatio = RCoolingRatio * 3;
|
||||||
}
|
};
|
||||||
if (getprop("gear/gear[1]/position-norm"))
|
if (getprop("gear/gear[1]/position-norm")) {
|
||||||
{
|
|
||||||
#increase CoolingRatio if gear down according to airspeed
|
#increase CoolingRatio if gear down according to airspeed
|
||||||
LCoolingRatio = LCoolingRatio * getprop("velocities/airspeed-kt");
|
LCoolingRatio = LCoolingRatio * getprop("velocities/airspeed-kt");
|
||||||
} else {
|
} else {
|
||||||
#Reduced CoolingRatio if gear up
|
#Reduced CoolingRatio if gear up
|
||||||
LCoolingRatio = LCoolingRatio * 0.1;
|
LCoolingRatio = LCoolingRatio * 0.1;
|
||||||
}
|
};
|
||||||
if (getprop("gear/gear[2]/position-norm"))
|
if (getprop("gear/gear[2]/position-norm")) {
|
||||||
{
|
|
||||||
#increase CoolingRatio if gear down according to airspeed
|
#increase CoolingRatio if gear down according to airspeed
|
||||||
RCoolingRatio = RCoolingRatio * getprop("velocities/airspeed-kt");
|
RCoolingRatio = RCoolingRatio * getprop("velocities/airspeed-kt");
|
||||||
} else {
|
} else {
|
||||||
#Reduced CoolingRatio if gear up
|
#Reduced CoolingRatio if gear up
|
||||||
RCoolingRatio = RCoolingRatio * 0.1;
|
RCoolingRatio = RCoolingRatio * 0.1;
|
||||||
}
|
};
|
||||||
if (LBrakeLevel>0)
|
if (LBrakeLevel>0) {
|
||||||
{
|
|
||||||
#Reduced CoolingRatio if Brakes used
|
#Reduced CoolingRatio if Brakes used
|
||||||
LCoolingRatio = LCoolingRatio * 0.1 * LBrakeLevel;
|
LCoolingRatio = LCoolingRatio * 0.1 * LBrakeLevel;
|
||||||
}
|
};
|
||||||
if (RBrakeLevel>0)
|
if (RBrakeLevel>0) {
|
||||||
{
|
|
||||||
#Reduced CoolingRatio if Brakes used
|
#Reduced CoolingRatio if Brakes used
|
||||||
RCoolingRatio = RCoolingRatio * 0.1 * RBrakeLevel;
|
RCoolingRatio = RCoolingRatio * 0.1 * RBrakeLevel;
|
||||||
}
|
};
|
||||||
|
|
||||||
var LnCoolFactor = math.ln(1-LCoolingRatio);
|
var LnCoolFactor = math.ln(1-LCoolingRatio);
|
||||||
var RnCoolFactor = math.ln(1-RCoolingRatio);
|
var RnCoolFactor = math.ln(1-RCoolingRatio);
|
||||||
|
|
||||||
L_thrust_lb = math.abs(getprop("engines/engine[0]/thrust_lb"));
|
L_thrust_lb = math.abs(getprop("engines/engine[0]/thrust_lb"));
|
||||||
if (L_thrust_lb < 1)
|
if (L_thrust_lb < 1) {
|
||||||
{
|
|
||||||
L_thrust_lb = 1
|
L_thrust_lb = 1
|
||||||
}
|
};
|
||||||
#Disabling thrust computation on Brakes temperature
|
#Disabling thrust computation on Brakes temperature
|
||||||
#L_Thrust = math.pow((math.log10(L_thrust_lb)),10)*0.0000000002;
|
#L_Thrust = math.pow((math.log10(L_thrust_lb)),10)*0.0000000002;
|
||||||
L_Thrust = 0;
|
L_Thrust = 0;
|
||||||
|
|
||||||
R_thrust_lb = math.abs(getprop("engines/engine[1]/thrust_lb"));
|
R_thrust_lb = math.abs(getprop("engines/engine[1]/thrust_lb"));
|
||||||
if (R_thrust_lb < 1)
|
if (R_thrust_lb < 1) {
|
||||||
{
|
|
||||||
R_thrust_lb = 1
|
R_thrust_lb = 1
|
||||||
}
|
};
|
||||||
#Disabling thrust computation on Brakes temperature
|
#Disabling thrust computation on Brakes temperature
|
||||||
#R_Thrust = math.pow((math.log10(R_thrust_lb)),10)*0.0000000002;
|
#R_Thrust = math.pow((math.log10(R_thrust_lb)),10)*0.0000000002;
|
||||||
R_Thrust = 0;
|
R_Thrust = 0;
|
||||||
|
|
||||||
if (OnGround)
|
if (OnGround) {
|
||||||
{
|
|
||||||
var V1 = getprop("velocities/groundspeed-kt");
|
var V1 = getprop("velocities/groundspeed-kt");
|
||||||
var Mass = getprop("fdm/jsbsim/inertia/weight-lbs")*(me.ScalingDivisor);
|
var Mass = getprop("fdm/jsbsim/inertia/weight-lbs")*(me.ScalingDivisor);
|
||||||
|
|
||||||
|
@ -176,26 +167,21 @@ var BrakeSystem =
|
||||||
# dE= 1/2 * m * V1^2 - 1/2 * m * V2^2)
|
# dE= 1/2 * m * V1^2 - 1/2 * m * V2^2)
|
||||||
var V2_L = V1 - me.BrakeDecel * dt * LBrakeLevel;
|
var V2_L = V1 - me.BrakeDecel * dt * LBrakeLevel;
|
||||||
var V2_R = V1 - me.BrakeDecel * dt * RBrakeLevel;
|
var V2_R = V1 - me.BrakeDecel * dt * RBrakeLevel;
|
||||||
|
|
||||||
LThermalEnergy += (Mass * getprop("gear/gear[1]/compression-norm") * (math.pow(V1, 2) - math.pow(V2_L, 2)) / 2);
|
LThermalEnergy += (Mass * getprop("gear/gear[1]/compression-norm") * (math.pow(V1, 2) - math.pow(V2_L, 2)) / 2);
|
||||||
if (getprop("services/chocks/left"))
|
if (getprop("services/chocks/left")) {
|
||||||
{
|
if (!getprop("controls/gear/brake-parking")) {
|
||||||
if (!getprop("controls/gear/brake-parking"))
|
|
||||||
{
|
|
||||||
# cooling effect: reduce thermal energy by (LnCoolFactor) * dt
|
# cooling effect: reduce thermal energy by (LnCoolFactor) * dt
|
||||||
LThermalEnergy = LThermalEnergy * math.exp(LnCoolFactor * dt);
|
LThermalEnergy = LThermalEnergy * math.exp(LnCoolFactor * dt);
|
||||||
} else {
|
} else {
|
||||||
#LThermalEnergy += L_Thrust;
|
#LThermalEnergy += L_Thrust;
|
||||||
# cooling effect: reduce thermal energy by (LnCoolFactor) * dt
|
# cooling effect: reduce thermal energy by (LnCoolFactor) * dt
|
||||||
LThermalEnergy = (LThermalEnergy * math.exp(LnCoolFactor * dt)) + (L_Thrust * dt);
|
LThermalEnergy = (LThermalEnergy * math.exp(LnCoolFactor * dt)) + (L_Thrust * dt);
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
if (!getprop("controls/gear/brake-parking"))
|
if (!getprop("controls/gear/brake-parking")) {
|
||||||
{
|
if (LBrakeLevel>0) {
|
||||||
if (LBrakeLevel>0)
|
if (V2_L>0) {
|
||||||
{
|
|
||||||
if (V2_L>0)
|
|
||||||
{
|
|
||||||
#LThermalEnergy += (Mass * (math.pow(V1, 2) - math.pow(V2_L, 2)) / 2) + L_thrust;
|
#LThermalEnergy += (Mass * (math.pow(V1, 2) - math.pow(V2_L, 2)) / 2) + L_thrust;
|
||||||
# cooling effect: reduce thermal energy by (LnCoolFactor) * dt
|
# cooling effect: reduce thermal energy by (LnCoolFactor) * dt
|
||||||
LThermalEnergy = LThermalEnergy * math.exp(LnCoolFactor * dt);
|
LThermalEnergy = LThermalEnergy * math.exp(LnCoolFactor * dt);
|
||||||
|
@ -203,37 +189,32 @@ var BrakeSystem =
|
||||||
#LThermalEnergy += math.abs(L_Thrust);
|
#LThermalEnergy += math.abs(L_Thrust);
|
||||||
# cooling effect: reduce thermal energy by (LnCoolFactor) * dt
|
# cooling effect: reduce thermal energy by (LnCoolFactor) * dt
|
||||||
LThermalEnergy = (LThermalEnergy * math.exp(LnCoolFactor * dt)) + (L_Thrust * dt);
|
LThermalEnergy = (LThermalEnergy * math.exp(LnCoolFactor * dt)) + (L_Thrust * dt);
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
# cooling effect: reduce thermal energy by (LnCoolFactor) * dt
|
# cooling effect: reduce thermal energy by (LnCoolFactor) * dt
|
||||||
LThermalEnergy = LThermalEnergy * math.exp(LnCoolFactor * dt);
|
LThermalEnergy = LThermalEnergy * math.exp(LnCoolFactor * dt);
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
#LThermalEnergy += math.abs(L_Thrust);
|
#LThermalEnergy += math.abs(L_Thrust);
|
||||||
# cooling effect: reduce thermal energy by (LnCoolFactor) * dt
|
# cooling effect: reduce thermal energy by (LnCoolFactor) * dt
|
||||||
LThermalEnergy = (LThermalEnergy * math.exp(LnCoolFactor * dt)) + (L_Thrust * dt);
|
LThermalEnergy = (LThermalEnergy * math.exp(LnCoolFactor * dt)) + (L_Thrust * dt);
|
||||||
}
|
};
|
||||||
}
|
};
|
||||||
|
|
||||||
RThermalEnergy += (Mass * getprop("gear/gear[2]/compression-norm") * (math.pow(V1, 2) - math.pow(V2_R, 2)) / 2);
|
RThermalEnergy += (Mass * getprop("gear/gear[2]/compression-norm") * (math.pow(V1, 2) - math.pow(V2_R, 2)) / 2);
|
||||||
if (getprop("services/chocks/right"))
|
if (getprop("services/chocks/right")) {
|
||||||
{
|
if (!getprop("controls/gear/brake-parking")) {
|
||||||
if (!getprop("controls/gear/brake-parking"))
|
|
||||||
{
|
|
||||||
# cooling effect: reduce thermal energy by (RnCoolFactor) * dt
|
# cooling effect: reduce thermal energy by (RnCoolFactor) * dt
|
||||||
RThermalEnergy = RThermalEnergy * math.exp(RnCoolFactor * dt);
|
RThermalEnergy = RThermalEnergy * math.exp(RnCoolFactor * dt);
|
||||||
} else {
|
} else {
|
||||||
#RThermalEnergy += math.abs(R_Thrust);
|
#RThermalEnergy += math.abs(R_Thrust);
|
||||||
# cooling effect: reduce thermal energy by (RnCoolFactor) * dt
|
# cooling effect: reduce thermal energy by (RnCoolFactor) * dt
|
||||||
RThermalEnergy = (RThermalEnergy * math.exp(RnCoolFactor * dt)) + (R_Thrust * dt);
|
RThermalEnergy = (RThermalEnergy * math.exp(RnCoolFactor * dt)) + (R_Thrust * dt);
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
if (!getprop("controls/gear/brake-parking"))
|
if (!getprop("controls/gear/brake-parking")) {
|
||||||
{
|
if (RBrakeLevel>0) {
|
||||||
if (RBrakeLevel>0)
|
if (V2_R>0) {
|
||||||
{
|
|
||||||
if (V2_R>0)
|
|
||||||
{
|
|
||||||
#RThermalEnergy += (Mass * (math.pow(V1, 2) - math.pow(V2_R, 2)) / 2) + R_thrust;
|
#RThermalEnergy += (Mass * (math.pow(V1, 2) - math.pow(V2_R, 2)) / 2) + R_thrust;
|
||||||
# cooling effect: reduce thermal energy by (RnCoolFactor) * dt
|
# cooling effect: reduce thermal energy by (RnCoolFactor) * dt
|
||||||
RThermalEnergy = RThermalEnergy * math.exp(RnCoolFactor * dt);
|
RThermalEnergy = RThermalEnergy * math.exp(RnCoolFactor * dt);
|
||||||
|
@ -241,36 +222,34 @@ var BrakeSystem =
|
||||||
#RThermalEnergy += math.abs(R_Thrust);
|
#RThermalEnergy += math.abs(R_Thrust);
|
||||||
# cooling effect: reduce thermal energy by (RnCoolFactor) * dt
|
# cooling effect: reduce thermal energy by (RnCoolFactor) * dt
|
||||||
RThermalEnergy = (RThermalEnergy * math.exp(RnCoolFactor * dt)) + (R_Thrust * dt);
|
RThermalEnergy = (RThermalEnergy * math.exp(RnCoolFactor * dt)) + (R_Thrust * dt);
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
# cooling effect: reduce thermal energy by (RnCoolFactor) * dt
|
# cooling effect: reduce thermal energy by (RnCoolFactor) * dt
|
||||||
RThermalEnergy = RThermalEnergy * math.exp(RnCoolFactor * dt);
|
RThermalEnergy = RThermalEnergy * math.exp(RnCoolFactor * dt);
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
#RThermalEnergy += math.abs(R_Thrust);
|
#RThermalEnergy += math.abs(R_Thrust);
|
||||||
# cooling effect: reduce thermal energy by (RnCoolFactor) * dt
|
# cooling effect: reduce thermal energy by (RnCoolFactor) * dt
|
||||||
RThermalEnergy = (RThermalEnergy * math.exp(RnCoolFactor * dt)) + (R_Thrust * dt);
|
RThermalEnergy = (RThermalEnergy * math.exp(RnCoolFactor * dt)) + (R_Thrust * dt);
|
||||||
}
|
};
|
||||||
}
|
};
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
LThermalEnergy = LThermalEnergy * math.exp(LnCoolFactor * dt);
|
LThermalEnergy = LThermalEnergy * math.exp(LnCoolFactor * dt);
|
||||||
RThermalEnergy = RThermalEnergy * math.exp(RnCoolFactor * dt);
|
RThermalEnergy = RThermalEnergy * math.exp(RnCoolFactor * dt);
|
||||||
}
|
};
|
||||||
|
if (LThermalEnergy < 0) {
|
||||||
if (LThermalEnergy < 0) {
|
|
||||||
LThermalEnergy = 0
|
LThermalEnergy = 0
|
||||||
}
|
};
|
||||||
if (LThermalEnergy > 3) {
|
if (LThermalEnergy > 3) {
|
||||||
LThermalEnergy = 3
|
LThermalEnergy = 3
|
||||||
}
|
};
|
||||||
if (RThermalEnergy < 0) {
|
if (RThermalEnergy < 0) {
|
||||||
RThermalEnergy = 0
|
RThermalEnergy = 0
|
||||||
}
|
};
|
||||||
if (RThermalEnergy > 3) {
|
if (RThermalEnergy > 3) {
|
||||||
RThermalEnergy = 3
|
RThermalEnergy = 3
|
||||||
}
|
};
|
||||||
|
|
||||||
setprop("gear/gear[1]/L-Thrust",L_Thrust);
|
setprop("gear/gear[1]/L-Thrust",L_Thrust);
|
||||||
setprop("gear/gear[2]/R-Thrust",R_Thrust);
|
setprop("gear/gear[2]/R-Thrust",R_Thrust);
|
||||||
setprop("gear/gear[1]/Lbrake-thermal-energy",LThermalEnergy);
|
setprop("gear/gear[1]/Lbrake-thermal-energy",LThermalEnergy);
|
||||||
|
@ -281,21 +260,19 @@ var BrakeSystem =
|
||||||
setprop("gear/gear[1]/L2brake-temp-degc",tatdegc+getprop("gear/gear[1]/L2error-temp-degc")+(LThermalEnergy * (300-tatdegc-getprop("gear/gear[1]/L2error-temp-degc"))));
|
setprop("gear/gear[1]/L2brake-temp-degc",tatdegc+getprop("gear/gear[1]/L2error-temp-degc")+(LThermalEnergy * (300-tatdegc-getprop("gear/gear[1]/L2error-temp-degc"))));
|
||||||
setprop("gear/gear[2]/R3brake-temp-degc",tatdegc+getprop("gear/gear[2]/R3error-temp-degc")+(RThermalEnergy * (300-tatdegc-getprop("gear/gear[2]/R3error-temp-degc"))));
|
setprop("gear/gear[2]/R3brake-temp-degc",tatdegc+getprop("gear/gear[2]/R3error-temp-degc")+(RThermalEnergy * (300-tatdegc-getprop("gear/gear[2]/R3error-temp-degc"))));
|
||||||
setprop("gear/gear[2]/R4brake-temp-degc",tatdegc+getprop("gear/gear[2]/R4error-temp-degc")+(RThermalEnergy * (300-tatdegc-getprop("gear/gear[2]/R4error-temp-degc"))));
|
setprop("gear/gear[2]/R4brake-temp-degc",tatdegc+getprop("gear/gear[2]/R4error-temp-degc")+(RThermalEnergy * (300-tatdegc-getprop("gear/gear[2]/R4error-temp-degc"))));
|
||||||
|
|
||||||
if ((LThermalEnergy>1)and(!me.LSmokeActive))
|
if ((LThermalEnergy>1)and(!me.LSmokeActive)) {
|
||||||
{
|
|
||||||
# start smoke processing
|
# start smoke processing
|
||||||
me.LSmokeActive = 1;
|
me.LSmokeActive = 1;
|
||||||
settimer(func { BrakeSys.Lsmoke(); },0);
|
settimer(func { BrakeSys.Lsmoke(); },0);
|
||||||
}
|
};
|
||||||
if ((RThermalEnergy>1)and(!me.RSmokeActive))
|
if ((RThermalEnergy>1)and(!me.RSmokeActive)) {
|
||||||
{
|
|
||||||
# start smoke processing
|
# start smoke processing
|
||||||
me.RSmokeActive = 1;
|
me.RSmokeActive = 1;
|
||||||
settimer(func { BrakeSys.Rsmoke(); },0);
|
settimer(func { BrakeSys.Rsmoke(); },0);
|
||||||
}
|
};
|
||||||
}
|
};
|
||||||
|
|
||||||
me.LastSimTime = CurrentTime;
|
me.LastSimTime = CurrentTime;
|
||||||
# 5 updates per second are good enough
|
# 5 updates per second are good enough
|
||||||
settimer(func { BrakeSys.update(); },0.2);
|
settimer(func { BrakeSys.update(); },0.2);
|
||||||
|
@ -304,85 +281,84 @@ var BrakeSystem =
|
||||||
# smoke processing
|
# smoke processing
|
||||||
Lsmoke : func()
|
Lsmoke : func()
|
||||||
{
|
{
|
||||||
if ((me.LSmokeActive)and(getprop("gear/gear[1]/Lbrake-thermal-energy")>1))
|
if ((me.LSmokeActive)and(getprop("gear/gear[1]/Lbrake-thermal-energy")>1)) {
|
||||||
{
|
|
||||||
# make density of smoke effect depend on energy level
|
# make density of smoke effect depend on energy level
|
||||||
var LSmokeDelay=0;
|
var LSmokeDelay=0;
|
||||||
var LThermalEnergy = getprop("gear/gear[1]/Lbrake-thermal-energy");
|
var LThermalEnergy = getprop("gear/gear[1]/Lbrake-thermal-energy");
|
||||||
if (LThermalEnergy < 1.5)
|
if (LThermalEnergy < 1.5) {
|
||||||
LSmokeDelay=(1.5-LThermalEnergy);
|
LSmokeDelay=(1.5-LThermalEnergy);
|
||||||
|
};
|
||||||
|
|
||||||
# No smoke when gear retracted
|
# No smoke when gear retracted
|
||||||
var LSmokeValue = (getprop("gear/gear[1]/position-norm")>0.5);
|
var LSmokeValue = (getprop("gear/gear[1]/position-norm")>0.5);
|
||||||
# toggle smoke to interpolate different densities
|
# toggle smoke to interpolate different densities
|
||||||
if (LSmokeDelay>0.05)
|
if (LSmokeDelay>0.05) {
|
||||||
{
|
|
||||||
me.LSmokeToggle = !me.LSmokeToggle;
|
me.LSmokeToggle = !me.LSmokeToggle;
|
||||||
if (!me.LSmokeToggle)
|
if (!me.LSmokeToggle)
|
||||||
LSmokeValue = 0;
|
LSmokeValue = 0;
|
||||||
else
|
else
|
||||||
LSmokeDelay = 0;
|
LSmokeDelay = 0;
|
||||||
}
|
};
|
||||||
setprop("gear/gear[1]/Lbrake-smoke",LSmokeValue);
|
setprop("gear/gear[1]/Lbrake-smoke",LSmokeValue);
|
||||||
settimer(func { BrakeSys.Lsmoke(); },LSmokeDelay);
|
settimer(func { BrakeSys.Lsmoke(); },LSmokeDelay);
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
# stop smoke processing
|
# stop smoke processing
|
||||||
setprop("gear/gear[1]/Lbrake-smoke",0);
|
setprop("gear/gear[1]/Lbrake-smoke",0);
|
||||||
setprop("sim/animation/fire-services",0);
|
setprop("sim/animation/fire-services",0);
|
||||||
me.LSmokeActive = 0;
|
me.LSmokeActive = 0;
|
||||||
}
|
};
|
||||||
if (getprop("gear/gear[1]/Lbrake-thermal-energy") > 1.5)
|
if (getprop("gear/gear[1]/Lbrake-thermal-energy") > 1.5) {
|
||||||
setprop("sim/animation/fire-services",1);
|
setprop("sim/animation/fire-services",1);
|
||||||
else
|
} else {
|
||||||
setprop("sim/animation/fire-services",0);
|
setprop("sim/animation/fire-services",0);
|
||||||
|
};
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
# smoke processing
|
# smoke processing
|
||||||
Rsmoke : func()
|
Rsmoke : func()
|
||||||
{
|
{
|
||||||
if ((me.RSmokeActive)and(getprop("gear/gear[2]/Rbrake-thermal-energy")>1))
|
if ((me.RSmokeActive)and(getprop("gear/gear[2]/Rbrake-thermal-energy")>1)) {
|
||||||
{
|
|
||||||
# make density of smoke effect depend on energy level
|
# make density of smoke effect depend on energy level
|
||||||
var RSmokeDelay=0;
|
var RSmokeDelay=0;
|
||||||
var RThermalEnergy = getprop("gear/gear[2]/Rbrake-thermal-energy");
|
var RThermalEnergy = getprop("gear/gear[2]/Rbrake-thermal-energy");
|
||||||
if (RThermalEnergy < 1.5)
|
if (RThermalEnergy < 1.5) {
|
||||||
RSmokeDelay=(1.5-RThermalEnergy);
|
RSmokeDelay=(1.5-RThermalEnergy);
|
||||||
|
};
|
||||||
|
|
||||||
# No smoke when gear retracted
|
# No smoke when gear retracted
|
||||||
var RSmokeValue = (getprop("gear/gear[2]/position-norm")>0.5);
|
var RSmokeValue = (getprop("gear/gear[2]/position-norm")>0.5);
|
||||||
# toggle smoke to interpolate different densities
|
# toggle smoke to interpolate different densities
|
||||||
if (RSmokeDelay>0.05)
|
if (RSmokeDelay>0.05) {
|
||||||
{
|
|
||||||
me.RSmokeToggle = !me.RSmokeToggle;
|
me.RSmokeToggle = !me.RSmokeToggle;
|
||||||
if (!me.RSmokeToggle)
|
if (!me.RSmokeToggle)
|
||||||
RSmokeValue = 0;
|
RSmokeValue = 0;
|
||||||
else
|
else
|
||||||
RSmokeDelay = 0;
|
RSmokeDelay = 0;
|
||||||
}
|
};
|
||||||
setprop("gear/gear[2]/Rbrake-smoke",RSmokeValue);
|
setprop("gear/gear[2]/Rbrake-smoke",RSmokeValue);
|
||||||
settimer(func { BrakeSys.Rsmoke(); },RSmokeDelay);
|
settimer(func { BrakeSys.Rsmoke(); },RSmokeDelay);
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
# stop smoke processing
|
# stop smoke processing
|
||||||
setprop("gear/gear[2]/Rbrake-smoke",0);
|
setprop("gear/gear[2]/Rbrake-smoke",0);
|
||||||
me.RSmokeActive = 0;
|
me.RSmokeActive = 0;
|
||||||
}
|
};
|
||||||
if (getprop("gear/gear[2]/Rbrake-thermal-energy") > 1.5)
|
if (getprop("gear/gear[2]/Rbrake-thermal-energy") > 1.5) {
|
||||||
setprop("sim/animation/fire-services",1);
|
setprop("sim/animation/fire-services",1);
|
||||||
else
|
} else {
|
||||||
setprop("sim/animation/fire-services",0);
|
setprop("sim/animation/fire-services",0);
|
||||||
|
};
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
var BrakeSys = BrakeSystem.new();
|
var BrakeSys = BrakeSystem.new();
|
||||||
|
|
||||||
setlistener("sim/signals/fdm-initialized",
|
setlistener("sim/signals/fdm-initialized",
|
||||||
# executed on _every_ FDM reset (but not installing new listeners)
|
# executed on _every_ FDM reset (but not installing new listeners)
|
||||||
func(idle) { BrakeSys.reset(); },
|
func(idle) { BrakeSys.reset(); },
|
||||||
0,0);
|
0,0);
|
||||||
|
|
||||||
settimer(func()
|
settimer(func()
|
||||||
{
|
{
|
||||||
BrakeSys.update();
|
BrakeSys.update();
|
||||||
}, 5);
|
}, 5);
|
||||||
|
|
|
@ -134,7 +134,23 @@
|
||||||
<type>float</type>
|
<type>float</type>
|
||||||
<property>/fdm/jsbsim/hydraulics/spoiler-r5/final-deg</property>
|
<property>/fdm/jsbsim/hydraulics/spoiler-r5/final-deg</property>
|
||||||
</signal>
|
</signal>
|
||||||
|
<signal>
|
||||||
|
<type>float</type>
|
||||||
|
<property>/gear/gear[1]/L1brake-temp-degc</property>
|
||||||
|
</signal>
|
||||||
|
<signal>
|
||||||
|
<type>float</type>
|
||||||
|
<property>/gear/gear[1]/L2brake-temp-degc</property>
|
||||||
|
</signal>
|
||||||
|
<signal>
|
||||||
|
<type>float</type>
|
||||||
|
<property>/gear/gear[2]/R3brake-temp-degc</property>
|
||||||
|
</signal>
|
||||||
|
<signal>
|
||||||
|
<type>float</type>
|
||||||
|
<property>/gear/gear[2]/R4brake-temp-degc</property>
|
||||||
|
</signal>
|
||||||
</signals>
|
</signals>
|
||||||
</config>
|
</config>
|
||||||
|
|
||||||
</PropertyList>
|
</PropertyList>
|
||||||
|
|
Loading…
Reference in a new issue