Jump to content
Sign in to follow this  
taguilo

L:Var to control a string

Recommended Posts

Guest A320 Co-Pilot

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

(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
Guest jprintz

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
Guest A320 Co-Pilot

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
Guest A320 Co-Pilot

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
Guest A320 Co-Pilot

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


Paul EGLD

Share this post


Link to post
Share on other sites
Guest bookmark

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
Guest A320 Co-Pilot

>"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
Guest A320 Co-Pilot

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

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  

  • Tom Allensworth,
    Founder of AVSIM Online


  • Flight Simulation's Premier Resource!

    AVSIM is a free service to the flight simulation community. AVSIM is staffed completely by volunteers and all funds donated to AVSIM go directly back to supporting the community. Your donation here helps to pay our bandwidth costs, emergency funding, and other general costs that crop up from time to time. Thank you for your support!

    Click here for more information and to see all donations year to date.
×
×
  • Create New...