- Messages
- 28
- Country

I'm trying to make a simple FLCH gauge. I know the basics of gauge coding at this point, and mathematically, what I have come up with makes total sense. But when I run the gauge in the sim, it doesn't continue to reiterate the gauge operation (see <update> section). The concept is as follows:
1) Click the gauge button (FLCH). Instantaneous airspeed and vertical speed are sent to the autopilot panel. FD follows suit to match VS.
2) The math: Current IAS is subtracted from the now preselected IAS, and then the result is divided by the preselected IAS. The result, a percentage essentially, is multiplied against the now preselected VS. This results in a+/- correction, which is then added to the preselected VS, whose result should then be sent to the AP panel. But the gauge stops working after step one. Nothing happens after that. VS stays pegged at whatever the gauge was switched on at. What's going on?
Thank you for your help!
The code:
<?xml version="1.0" encoding="UTF-8"?>
<SimBase.Document Type="AceXML" version="1,0" id="FLCH_Button">
<Descr>FLCH Button</Descr>
<Filename>FLCH_Button.xml</Filename>
<SimGauge.Gauge id="FLCH_Button" ArtDirectory="Gauges">
<FloatPosition>0.000,0.000</FloatPosition>
<Size>80,40</Size>
<Image id="flch_button.bmp" Name="flch_button.bmp">
<Transparent>True</Transparent>
</Image>
<MouseArea>
<FloatPosition>0.000,0.000</FloatPosition>
<Size>80,40</Size>
<CursorType>Hand</CursorType>
<MouseClick>
<Script>
(L:FLCH_Active, bool) ! (>L:FLCH_Active, bool)
(L:FLCH_Active, bool) if{
(A:AIRSPEED INDICATED, knots) (>L:CurrentAirspeed, number)
(A:AIRSPEED INDICATED, knots) (>K:AP_SPD_VAR_SET)
(A:VERTICAL SPEED, feet per minute) (>K:AP_VS_VAR_SET_ENGLISH)
(A:AUTOPILOT AIRSPEED HOLD VAR, knots) (>L:TargetAirspeed, number)
(A:AUTOPILOT VERTICAL HOLD VAR, feet per minute) (>L:VerticalSpeed, number)
(
}
els{
0 (>L:FLCH_Active, bool)
}
</Script>
</MouseClick>
</MouseArea>
<Update>
(L:FLCH_Active, bool) if{
(A:AIRSPEED INDICATED, knots) (>L:CurrentAirspeed, number)
(A:AUTOPILOT AIRSPEED HOLD VAR, knots) (>L:TargetAirspeed, number)
(L:TargetAirspeed, number) (L:CurrentAirspeed, number) - (>L:SpeedDifference, number)
(L:SpeedDifference, number) (L:TargetAirspeed, number) / (>L:SpeedErrorPercentage, number)
(L:SpeedErrorPercentage, number) (L:VerticalSpeed, number) * (>L:VSAdjustment, number)
(L:VerticalSpeed, number) (L:VSAdjustment, number) + (>L:NewVS, number)
(L:NewVS, number) (>K:AP_VS_VAR_SET_ENGLISH)
}
</Update>
</SimGauge.Gauge>
</SimBase.Document>
1) Click the gauge button (FLCH). Instantaneous airspeed and vertical speed are sent to the autopilot panel. FD follows suit to match VS.
2) The math: Current IAS is subtracted from the now preselected IAS, and then the result is divided by the preselected IAS. The result, a percentage essentially, is multiplied against the now preselected VS. This results in a+/- correction, which is then added to the preselected VS, whose result should then be sent to the AP panel. But the gauge stops working after step one. Nothing happens after that. VS stays pegged at whatever the gauge was switched on at. What's going on?
Thank you for your help!
The code:
<?xml version="1.0" encoding="UTF-8"?>
<SimBase.Document Type="AceXML" version="1,0" id="FLCH_Button">
<Descr>FLCH Button</Descr>
<Filename>FLCH_Button.xml</Filename>
<SimGauge.Gauge id="FLCH_Button" ArtDirectory="Gauges">
<FloatPosition>0.000,0.000</FloatPosition>
<Size>80,40</Size>
<Image id="flch_button.bmp" Name="flch_button.bmp">
<Transparent>True</Transparent>
</Image>
<MouseArea>
<FloatPosition>0.000,0.000</FloatPosition>
<Size>80,40</Size>
<CursorType>Hand</CursorType>
<MouseClick>
<Script>
(L:FLCH_Active, bool) ! (>L:FLCH_Active, bool)
(L:FLCH_Active, bool) if{
(A:AIRSPEED INDICATED, knots) (>L:CurrentAirspeed, number)
(A:AIRSPEED INDICATED, knots) (>K:AP_SPD_VAR_SET)
(A:VERTICAL SPEED, feet per minute) (>K:AP_VS_VAR_SET_ENGLISH)
(A:AUTOPILOT AIRSPEED HOLD VAR, knots) (>L:TargetAirspeed, number)
(A:AUTOPILOT VERTICAL HOLD VAR, feet per minute) (>L:VerticalSpeed, number)
(
}
els{
0 (>L:FLCH_Active, bool)
}
</Script>
</MouseClick>
</MouseArea>
<Update>
(L:FLCH_Active, bool) if{
(A:AIRSPEED INDICATED, knots) (>L:CurrentAirspeed, number)
(A:AUTOPILOT AIRSPEED HOLD VAR, knots) (>L:TargetAirspeed, number)
(L:TargetAirspeed, number) (L:CurrentAirspeed, number) - (>L:SpeedDifference, number)
(L:SpeedDifference, number) (L:TargetAirspeed, number) / (>L:SpeedErrorPercentage, number)
(L:SpeedErrorPercentage, number) (L:VerticalSpeed, number) * (>L:VSAdjustment, number)
(L:VerticalSpeed, number) (L:VSAdjustment, number) + (>L:NewVS, number)
(L:NewVS, number) (>K:AP_VS_VAR_SET_ENGLISH)
}
</Update>
</SimGauge.Gauge>
</SimBase.Document>



