Sign in to follow this  
Guest

Fuel gauging problem, xml.

Recommended Posts

HiI'm 85% sure (LOL) a version of this code snippet worked earlier tonight, but no way can I get it to respond to all input again :( It's a fuel gauge for a C421B with a 3-position switch. For 1 (down) and 2 (up) positions it should read mains and aux respectively, and for 0 (springloaded to middle) it should read which ever tank is selected on the tank selectors. It looks somewhat advanced, but I've added comments so I'm able to keep better track. This code snippet only prepares an index value to be used in the tag, using a case function to determine what to output in the gauge. Here goes:(A:Fuel tank selector 1,enum) 0 (*Off*) == if{ 0 (>L:LFuelIndex,enum) quit } els{ (A:Fuel tank selector 1,enum) 9 (*LMain*) == (L:tank gauging,enum) 1 (*main*) == || if{ 1 (>L:LFuelIndex,enum) quit } els{ (A:Fuel tank selector 1,enum) 4 (*LAux*) == (L:tank gauging,enum) 2 (*aux*) == || if{ 2 (>L:LFuelIndex,enum) quit } els{ (A:Fuel tank selector 1,enum) 10 (*RMain crossfeed*) == if{ 3 (>L:LFuelIndex,enum) } } } }I've also tried without the quit commands, or dividing it into els statements, but to no success. It works for everything, except when the tank selectors are in the main tanks (external tank, due to the old Microsoft crossfeed bug on normal main tanks).I'm monitoring the output of the index value, and it works fine in respect to whichever tank is selected, but the combination main tank selected with switch to aux (which should cause a change), doesn't seem to work.I'm out of ideas here. Anyone?Edit: The code within the rotate function of the needle goes:(A:FUEL TANK EXTERNAL2 QUANTITY,gallon) (A:FUEL TANK LEFT AUX QUANTITY,gallon) (A:FUEL TANK EXTERNAL1 QUANTITY,gallon) 0.0 4 (L:LFuelIndex,enum) case

Share this post


Link to post
Share on other sites
Help AVSIM continue to serve you!
Please donate today!

Ho, never mind. I solved it by putting all within the value tag, no indexing or case function used at all. For those interrested, it went like this - rather scary looking, but it works:(L:tank gauging,enum) 0 == (A:Fuel tank selector 1,enum) 9 (*main*) == && if{ (A:FUEL TANK EXTERNAL1 QUANTITY,gallon) quit } els{ (L:tank gauging,enum) 0 == (A:Fuel tank selector 1,enum) 4 (*aux*) == && if{ (A:FUEL TANK LEFT AUX QUANTITY,gallon) quit } els{ (L:tank gauging,enum) 1 == if{ (A:FUEL TANK EXTERNAL1 QUANTITY,gallon) quit } els{ (L:tank gauging,enum) 2 == if{ (A:FUEL TANK LEFT AUX QUANTITY,gallon) quit } els{ (L:tank gauging,enum) 0 == (A:Fuel tank selector 1,enum) 10 (*cf*) == && if{ (A:FUEL TANK EXTERNAL2 QUANTITY,gallon) quit } els{ (L:tank gauging,enum) 0 == (A:Fuel tank selector 1,enum) 0 (*off*) == && if{ 0.0 quit } } } } } }

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this