Archived

This topic is now archived and is closed to further replies.

taguilo

Trying to change brake effectiveness with decreasing pressure

Recommended Posts

Hi,next problem.....I have thought up a cunning system where it would be possible to decrease brake effectiveness as hydraulic pressure decreases.So in case of a hydraulic failure and the remaining pressure is 1500 psi, with the pedals fully depressed i would have manipulated the brake event so that it is at only 50% of what it normally would be.I tried to use K:AXIS_LEFT_BRAKE_SET (and ..RIGHT..) but it seems that i have a problem in getting an intermediate setting.Here's the relevant bit of my code:(L:Brake_System_Press, number) 3000 / (A:BRAKE RIGHT POSITION, percent) 1.16 * 100 / * 32766 * 16383 - -16383 max 16383 min (>L:Brake_press_pct_2, number)(L:Brake_Press_pct_1, number) (>K:AXIS_LEFT_BRAKE_SET) (L:Brake_Press_pct_2, number) (>K:AXIS_RIGHT_BRAKE_SET) If i skip the >K...SET bit and remark it out, and i read the values of the variable L:Brake_Press_pct_2, number, it works great! The variable nicely follows the hydraulic pressure compared to pedal position.The problem is that i am unable to push that value into the axis_brake_set event. So when i put back the >K...SET bit of code, it will only go to no brakes or full brakes and that only when the pressure is 3000 psi.Does anyone have any ideas on how to implement this in a better way?grtWillem

Share this post


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

Sorry 'bout the smiley thing... They are a plague to the programmer seeking help desperately and thus forgetting the check box :-).Here's the code again:(L:Brake_System_Press, number) 3000 / (A:BRAKE RIGHT POSITION, percent) 1.16 * 100 / * 32766 * 16383 - -16383 max 16383 min (>L:Brake_press_pct_2, number)(L:Brake_Press_pct_1, number) (>K:AXIS_LEFT_BRAKE_SET) (L:Brake_Press_pct_2, number) (>K:AXIS_RIGHT_BRAKE_SET) The code which produces L:Brake_Press_pct_1, number i left out in this snippet but in the gauge it is in place and works, except for the fact that i am unable to control the K:AXIS_LEFT_BRAKE_SET, with it.It seems like FS can't handle the fact that the K:event is given a soft value by some code instead of directly from the input device.Hope someone can tell me that this is not so, and that i left a comma out somewhere, after which magically my code works....Btw this is for FS9.grtWillem

Share this post


Link to post
Share on other sites

Willen,AXIS_LEFT_BRAKE_SET and AXIS_RIGHT_BRAKE_SET are controller related events, which means they are executed as long as you press the brake pedals.So, if you want to restrain the max values at a given pedal position, just try by capturing the event like this: (A:BRAKE LEFT POSITION, percent) YourLControlVar > if{ LBrakePressNumber (>K:AXIS_LEFT_BRAKE_SET) }...same for right brakeTom

Share this post


Link to post
Share on other sites

Tom,Thanks for your reply!I will try this, as it seems to possible to have proportional control over the brakes, which is exactly what i need!Let you know how it turns out!grtWillem.

Share this post


Link to post
Share on other sites

Tom,i'm afraid it won't work.It seems FS gets caught into a loop and freezes.I tried numerous approaches, i even went to bare basics as can be seen below. Pressing the brake pedal freezes the sim on me.Changing (>K:AXIS_LEFT_BRAKE_SET) by an L:variable and reading its value shows that the principle works, as it changes upon pressing the pedal (and the sim does not freeze). 1600 (>K:AXIS_LEFT_BRAKE_SET)I have included an if{...} els{...} statement to make the L:Variable change its value depending on pedal position and that works also.I also tried to link the (>K:AXIS_LEFT_BRAKE_SET) to the rudder axis, to gain some more insight. (A:RUDDER DEFLECTION PCT, percent) 100 * (>K:AXIS_LEFT_BRAKE_SET)This changes the A:Brake left position, percent (that i read out using the blackbox) depending on rudder pedal input, so it is possible to control the K:AXIS_LEFT_BRAKE_SET by a variable as long as it is not triggered by its own axis.Am i doing something wrong here, or do i have to abandon my idea?grtWillem

Share this post


Link to post
Share on other sites

Willem,It's pretty obvious that calling the same event will lead to a freezing loop. My mistake, sorry.However, you could make two other tests:1-Try whether BRAKE_LEFT and BRAKE_RIGHT events are executed while the pedals are moved. If so then : (A:BRAKE LEFT POSITION, percent) YourLControlVar > if{ LBrakePressNumber (>K:AXIS_LEFT_BRAKE_SET) }Same for right brakes.2-Even if this freezes the sim, you could try (A:BRAKE LEFT POSITION, percent) YourLControlVar > (L:FreezeOff,bool) ! and if{ LBrakePressNumber (>K:AXIS_LEFT_BRAKE_SET) 1 (>L:FreezeOff,bool) } els{ 0 (>L:FreezeOff,bool) }Tom

Share this post


Link to post
Share on other sites

Hey Tom,i actually did already try the first option and it did not work.There was no code related response whatsoever (no freezing either).On the second one, i will try that of course but i did a similar thing by checking if the brakesystem press was higher than 500 psi. Even when it was lower than 500 psi it froze the sim for some odd reason.But i will try, your code has a "freezing protection " built in by the looks of it, so it is worth checking it.It will be for tomorrow or the day after i'm afraid.Thanks a lot for your help on this one!grtWillem.

Share this post


Link to post
Share on other sites

Tom,Just to let you know that i'm still working on it and your energy was not wasted by someone who fails to have the decency to follow up on your suggestions... lol.My time has been very limited lately, so i only had a quick try yesterday.Your second suggestion does have some effect. At least it does not crash the sim, and the brake position seems to be controllable which is more than i had before all this. It is still very jumpy, so i need to do some more serious work on this.If i understand your code correctly you have prevented fs from running into a loop by toggling the L:FreezeOff, bool so that the statement skips a cycle ?I'll do some more testing'n'tweaking and let you know the result!Thanks!!grtWillem

Share this post


Link to post
Share on other sites

Hmm, i've been at it all night yesterday and got a bleedin' headache in return...I just cannot get it to work properly, probably because altering K:AXIS_XXX_BRAKE_SET also alters the reading of A:brake left position, percent (or whatever the tags are called, not at my FS computer now). This causes some looping action and gives an erratic brake behaviour.I tried to store the brake pedal position in an L:Var (only once when the pedals are depressed, and resetting when pedals are released). But no joy either.So i now have come to the conclusion that it's time to move on and settle for second best, which is a brake failure when the brake system press drops below a certain value.The system now works like this: brake system is fed via hydraulic system 2. If sys 2 fails, the brake system pressure starts to decrease slowly (system internal leakages). Also when using the brakes there is a (more significant) pressure drop, so only a limited amount of braking actions is available.This i got working in ten minutes so i am still a happy camper.Anyway thanks for your help!While this excersise did not give the desired result i still have learnt a lot from the trial and error and your input.Thanks!!grtWillem

Share this post


Link to post
Share on other sites

Willem,The problem to get a decent control of brake pressure is the lack of a _SET event, which is present in the others that are related to axis movements -throttle, rudder, aileron, etc. As the only event able to capture is the AXIS, a loop is almost unavoidable unless placing a lot of tricky code; even that doesn't ensure a proper behavior as you could test by yourself.So, if setting a BRAKE FAILURE works fine, these are good news to me for the moment I'd need to code a braking system :-)Regards,Tom

Share this post


Link to post
Share on other sites