Sign in to follow this  
taguilo

L:Var to control a string

Recommended Posts

After a few months out due to work commitment and other commitments, I am getting back in to gauge programming, so I thought I would finish my 757 lower EICAS off, but am having a few little problems, hopefully some one will be able to help me out here. I am using (A:eng1/eng2 hydraulic pressure, psi) in a string for the HYD pressure for right and left, now what i need to do is sort out one for the center hydraulic pressure, I am using (L: Center hydraulic quantity, Percent) in a string and a switch (L:Center Hydraulic Switch 1, enum) to turn it on and off, but my switch does nothing, this is the code I have at the moment: (L:Center Hydraulic Switch 1, enum) if{ 1 (L:Center hydraulic pressure, psi) 2970 } %((L:Center hydraulic pressure, psi))%!04d!The Switch Code(L:Center Hydraulic Switch 1, enum)Center Hydraulic Switch 1(L:Center Hydraulic Switch 1, enum) ! (>L:Center Hydraulic Switch 1, enum)When I turn the swith on I would like the hydraulic pressure to go to 2970, and when the switch is off go to 0000. I am using the A Variable for the Left and Right Hydraulic pressure, is there any way I can keep them to 0000 untill a switch is turned on, as at the moment when I start the engine the pressure rises.Russell

Share this post


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

(L:Center Hydraulic Switch 1, enum) ! (>L:Center Hydraulic Switch 1, enum)Try using a boolean:(L:Center Hydraulic Switch 1, bool) ! (>L:Center Hydraulic Switch 1, bool)Replace all instances of enum for your switch var. XML will allocate all L:variables double precision regardless of their "defined" type, but certain ops still won't work unless the type is correct. i.e. I don't think you can 'switch' an enum in that way. Besides, you only have 2 values for (L:Center Hydraulic Switch 1), so bool is the best choice.--Jon

Share this post


Link to post
Share on other sites

I have 2-value enum-based switches that work just fine. I use enum instead of bool when I think I might want to add another possibility or "layer" for the switch later on.The below works for me:(L:Slope Switch, enum)(L:Slope Switch, enum) ! (>L:Slope Switch, enum)Slope indicator

Share this post


Link to post
Share on other sites

Hi,Try in a :(L:Center Hydraulic Switch 1, enum) 0 == if{ 1 (>L:Center Hydraulic Switch 1, enum) 2970 (>L:Center hydraulic pressure, psi) }els{ 0 (>L:Center Hydraulic Switch 1, enum) 0 (>L:Center hydraulic pressure, psi) } Or in a :(L:Center Hydraulic Switch 1, enum) 1 == if{ (L:Center hydraulic pressure, psi) 10 + 2970 min (>L:Center hydraulic pressure, psi) }els{ (L:Center hydraulic pressure, psi) 10 - 0 max (>L:Center hydraulic pressure, psi) } Hope it helps,Jan"Beatus ille qui procul negotiis..."

Share this post


Link to post
Share on other sites

Ah ok, I see. Well as I said, "I don't think" you can use them that way, probably because I never found a need to try it. But I do see something at the top of your code that looks wrong:(L:Center Hydraulic Switch 1, enum) if{ 1 (L:Center hydraulic pressure, psi) 2970 } I don't see what that is supposed to do. The following will do as Jan has suggested, and slowly add a rise or fall depending on the position of the switch (assuming the actual SWITCH is working. Test the switch value to make sure, but it looks right from here.(L:Center hydraulic pressure, psi) s0 ++ 2970 min l0 -- 0 max (L:Center Hydraulic Switch 1, enum) 1 == ? (>L:Center hydraulic pressure, psi) Note that I use 1 == for the switch value test instead of just ? because again, (in my mind at least) it's not proper to test an enum as though it were a boolean. So if you did want the ability to have multiple choices for the switch at some time, this would still work.To add a faster rise/fall just modify ++ and -- with somevalue + or somevalue - --Jon

Share this post


Link to post
Share on other sites

Thanks for the replies, I shall try the posted code later, regarding clicks is it possible to get a switch to switch one screen on and another off again, Example the 757 EICAS screen, from Engine screen to Status Screen.This is the code I have so far and it turns the Engine Eicas Screen on and off, but if the Status Screen is showing the two merge together and visa versa.(L:Engine EICAS Switch, bool)(L:Engine EICAS Switch, bool) ! (>L:Engine EICAS Switch, bool) (>L:Status Eicas Switch, bool) 0

Share this post


Link to post
Share on other sites

Hi,First of all, I think you have a misconcept on how to assign a value to a var. The proper sintax is "value (>L:Var,unit)" and it seems you are doing the opposite = ** (>L:Status Eicas Switch, bool) 0 ** ??Now, regarding the code you posted first, won't work. It need a before, like this: put a value here (optative .. etc must come here )So, a basic example:(L:Center Hydraulic Switch 1, bool) if{ 2970 } els{ 0 }(>L:Center hydraulic pressure, psi)and then, in another ,%((L:Center hydraulic pressure, psi))%!04d!Also I'd suggest to use bool as unit because those center hydraulic switches (there are two btw), have only on/off position.I think there is no way of totally disabling hydraulic pressure when engines are on other than to custom code the hydraulics. (via lVars like your "Center" example, combined with flight controls handling events)Tom

Share this post


Link to post
Share on other sites

My code for the engine eicas center hydraulic pressure using Jan code for the Value, not tested, correct ???(L:Center Hydraulic Switch 1, enum) 1 == if{ (L:Center hydraulic pressure, psi) 10 + 2970 min (>L:Center hydraulic pressure, psi)}els{ (L:Center hydraulic pressure, psi) 10 - 0 max (>L:Center hydraulic pressure, psi) } %((L:Center hydraulic pressure, psi))%!04d!

Share this post


Link to post
Share on other sites

Working code after a little tweaking of Jans Code. Thanks Jan(L:Center Hydraulic Switch 1, enum) 1 == if{ (L:Center hydraulic pressure, psi) 10 + 2970 min (>L:Center hydraulic pressure, psi) } els { (L:Center Hydraulic Switch 1, enum) 0 == if{ (L:Center hydraulic pressure, psi) 10 - 0 max (>L:Center hydraulic pressure, psi) }%((L:Center hydraulic pressure, psi))%!04d!I need two switches to be set to on before the hydraulic pressure goes up. I came up with this, (L:Center Hydraulic Switch 1, enum) 1 ==(L:Center Hydraulic Switch 2, enum) 1 == if{ (L:Center hydraulic pressure, psi) 10 + 2970 min (>L:Center hydraulic pressure, psi) } els { (L:Center Hydraulic Switch 1, enum) 1 == (L:Center Hydraulic Switch 2, enum) 0 == if{ (L:Center hydraulic pressure, psi) 10 - 0 max (>L:Center hydraulic pressure, psi) }but it does not work, how do you link two Variable to make one Varible work.

Share this post


Link to post
Share on other sites

Try (L:Center Hydraulic Switch 1, enum) 1 == (L:Center Hydraulic Switch 2, enum) 1 == && if{ (L:Center hydraulic pressure, psi) 10 + 2970 min (>L:Center hydraulic pressure, psi) } els { (L:Center Hydraulic Switch 1, enum) 1 == (L:Center Hydraulic Switch 2, enum) 0 == if{ (L:Center hydraulic pressure, psi) 10 - 0 max (>L:Center hydraulic pressure, psi) } and watch the spaces

Share this post


Link to post
Share on other sites

For what it's worth, try looking at what I did with the hydraulic system in the J35J. I basically made a new hydraulic system independent of the FS9 hyd. Somewhat amateurish maybe, but feel free to nick what you like. All XML, which is as open source as it gets... ;o)/Thomas

Share this post


Link to post
Share on other sites

"I need two switches to be set to on before the hydraulic pressure goes up"Nope. Either of the two CENTER HYD ELEC PUMPs being ON will give hydraulic pressure to the center system.You may just compare (L:Center Hydraulic Switch 1, enum) 1 == (L:Center Hydraulic Switch 2, enum) 1 == or if{ raise pressure } els{ drop pressure }Tom

Share this post


Link to post
Share on other sites

>"I need two switches to be set to on before the hydraulic>pressure goes up">>Nope. Either of the two CENTER HYD ELEC PUMPs being ON will>give hydraulic pressure to the center system.Yes, If only one hydraulic switch is on, then the Hydraulic pressure will be lower than with two switches on.I will try all the code supplied, Thomas is your J35J in the avsim library ????

Share this post


Link to post
Share on other sites

"Yes, If only one hydraulic switch is on, then the Hydraulic pressure will be lower than with two switches on."Err..not exactly :-). Hydraulic readings show for each system the highest pressure delivered by any of the pumps in service. Only if the added pump is stronger than the current in use, you'll see a raise in pressure, probably very slight. Tom

Share this post


Link to post
Share on other sites

Correct Tom, from what I have read about the Hydraulic system of the 757 and 767 the pressure goes up slightly when 2 pumps are on. So would like to be able to do that in my hydraulic system. Trouble is I can not link the two switches together to be able to do this, I also need the switches to work together when switched off, as you rightly pointed one pump on will give hydraulic pressure. At the moment one switch is overiding the other so when I turn switch 1 off, the hydraulic pressure is lost but switch 2 is still on, so I need to link the L:Var switch 1 and 2 so that when switch 1 is turned off switch 2 still holds the current pressure and vise versa. My problem is I can not work out how to get the two varibles to work together, also both switches need to be turn off for hydraulic pressure to go to zero. I am going to hunt the forum to see if I can find a post on linking varible together, but if any one can help me with this I would be very greatfull.

Share this post


Link to post
Share on other sites

You might try this:(L:Center Hydraulic Switch 1, enum) 1 == (L:Center Hydraulic Switch 2, enum) 1 == orif{ (L:Center hydraulic pressure, psi) 10 + 2970 min (>L:Center hydraulic pressure, psi) } els { (L:Center hydraulic pressure, psi) 10 - 0 max (>L:Center hydraulic pressure, psi) }After you make it work, you could try this little more complex that will add a bit of pressure when both switches are on, as per your desire :-)(L:Center Hydraulic Switch 1, enum) 1 == s0(L:Center Hydraulic Switch 2, enum) 1 == s1 or if{ (L:Center hydraulic pressure, psi) 10 + 2970 15 l0 l1 * * + min (>L:Center hydraulic pressure, psi) } els { (L:Center hydraulic pressure, psi) 10 - 0 max (>L:Center hydraulic pressure, psi) }TomPD: Be sure to check the proper spacing within the syntax.

Share this post


Link to post
Share on other sites

Hi, 15 l0 l1 * * + is a good one!I add also some N2, Hz and Bleedair to give more "oscillation".Jan"Beatus ille qui procul negotiis..."

Share this post


Link to post
Share on other sites

Jan,Actually oscillation occurs mostly by the use of flight controls (30-60 psi fluctuations). The redudancy in pumps make each system pretty stable, especially when both are working.Tom

Share this post


Link to post
Share on other sites

Thanks for all the help, I manged to get it work how I want it to. The pressures are taken from the level D 767 panel, and work simliar to that panel, the only thing I have not modelled yet is the rotary switch.Here is the working valueAnd once again Thanks for all the help.Cheers(L:Center Hydraulic Switch 1, enum) 1 == if{ (L:Center Hydraulic Switch 2, enum) 0 == if{ (L:Center hydraulic pressure, psi) 10 + 2970 min (>L:Center hydraulic pressure, psi) } } els { (L:Center Hydraulic Switch 1, enum) 0 == if{ (L:Center Hydraulic Switch 2, enum) 1 == if{ (L:Center hydraulic pressure, psi) 10 + 2970 min (>L:Center hydraulic pressure, psi) } } els { (L:Center Hydraulic Switch 1, enum) 1 == if{ (L:Center Hydraulic Switch 2, enum) 1 == if{ (L:Center hydraulic pressure, psi) 10 + 3170 min (>L:Center hydraulic pressure, psi) } } els { (L:Center Hydraulic Switch 1, enum) 0 == if{ (L:Center Hydraulic Switch 2, enum) 0 == if{ (L:Center hydraulic pressure, psi) 10 - 0 max (>L:Center hydraulic pressure, psi) } }

Share this post


Link to post
Share on other sites

"I manged to get it work how I want it to"Good. Most important is to use the code you feel more comfortable with. :-)"the only thing I have not modelled yet is the rotary switch." There ain't no rotary switchs for hydraulics in the 757.Proper documentation is of a great help in the development of a complex project. :-)Tom

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