Jump to content
Sign in to follow this  
rcbarend

Automatic sequences

Recommended Posts

Guest Pencil pusher

I have read and been able to create xml gauges by following the many recommended Tutorials - many thanks to the authors - but apart from the 'autoflaps' program of Glen Copeland which does not suit my needs, I have been unable to create sucessfully an auto sequence. I have a few others that I would like to create, so a lead would be very helpful. Sequence is: on the approach, a/c airborne, flaps down, gear down, throttle set at 40%, elevator & pitch trim settings set. What I would like then is on touchdown to retract the flaps and shut down the engine. Because I would like to have a take off auto sequence as well, I think that (A:Sim on ground) cannot be used. I have tried (A:Radio height) which seems to be OK as I have a Rad alt of 4 ft at T/O, and a Rad alt of 2 ft at touchdown. So far all my attempts have failed either because the Flaps_up command is read and blocks all other flap sequence, or the RAad Alt height is not read. I do not want a mouse click or a visible button or gauge.This is for FS2004. Any ideas please? I am getting hairless!

Share this post


Link to post
Share on other sites

What about this:check the airspeed and as soon as you are above - let's say 10 knots - L:FLYING,bool is set to 1.the code could look like this:(A:Airspeed select indicated or true,knots) 10 > (L:FLYING,bool) ! && if{ (YOUR TAKE OFF SEQUENCE) 1 (>L:FLYING,bool) }Now, when it comes to land the bird, you'll somewhen will be slower than 10 knots (or any other speed that meets your requirements), which probably happens somewhen after touch down (the better time to shut down the engines rather than at the moment of touch down, I think...). So for this use something like:(A:Airspeed select indicated or true,knots) 10 < (L:FLYING,bool) && if{ (YOUR TOUCH DOWN SEQUENCE) 0 (>L:FLYING,bool) }This kind of code triggers one time events only and starts with a 0-value variable (L:FLYING,bool), sets it to 1 at take off and sets it back to 0 after touch down. You may even use diffferent variables for take off and touch down and also think about triggering macros with your sequences to keep the code simplier.Hope this helps,Herbert

Share this post


Link to post
Share on other sites
Guest Pencil pusher

Thanks Herbert, food for thought I will try tomorrow and keep you posted. Don't know enough about macros yet - thats very much on the drag curve!

Share this post


Link to post
Share on other sites
Guest Pencil pusher

Herbert,I tried this following your advice, but on opening the flight the flaps are already down and cannot be changed by direct command or when either of the sequence (Climb or Descend) are invoked. I have kept the sequence simple to start with... Where have I gone wrong please?P.P.

Share this post


Link to post
Share on other sites

Ooops, there are several mistakes in your code...Maybe you should get a bit more familiar with the XML syntax first.Never the less, the attached code works - put it in your gauge. I reduced the codes to the flaps only, add whatever you need - after the flaps_up / flaps_down event. Pay attention to where spaces have to be!Just one more thing to mention: it will be better to use a higher speed to trigger the events for take off than the spped you use for landing.Herbert

Share this post


Link to post
Share on other sites
Guest Pencil pusher

Herbert, Thank you very, very much. I initially transposed your answer into my original and it didn't work, so I copied & pasted yours and it worked a dream - trouble is I don't now know where the mistake was!!! I am very aware that spaces are important in various places, but I am not aware (as you noticed) of the rules of syntax - any monographs that you are aware of - or is empirical as is the method I am using. I must also revise my boolean algebra, but its such a long time ago. You having given me this lead, I shall go away for a bit before sending the next questions I have on a three position spring centre off switch...... I have one at present, but it needs double clickking, and its not quite so simple as it sounds - at least I don't think so!Thanks again,Keith P :-)

Share this post


Link to post
Share on other sites

Keith,No it ain't simple but also not that difficult...First of all, I'd strongly recommend to use an XML editor. Things are much clearer then. My first choice still is Peter Reynold's PXE ver. 1.1, a freeware you can get here: http://www.iol.ie/~pxe/pxev11.exeThe XML syntax requires spaces allmost between every single expression or operator, exept the { and } (see my example).Such a three-way switch isn't difficult, but first you have to decide how it should work. Does it have to switch back automaticly to the center position or do you want to remain in either top, center or bottom position? Does it refer to variables provided by the sim which decide about its position (which is the usually mode for on/off switches), or will you use an internal variable to control the position?You see, questions over questions...A good source for most things to create are the FS stock XML gauges. You'll find examples and answers to most of your questions there.Herbert

Share this post


Link to post
Share on other sites

If I may, I'd also suggest that you make ample use of the "space requirement" to format your XML script to use indents and linespaces to make the "logic" more clear.Consider the format below as a possible 'prototype' for emulation. In the (re)formatted example below, note that the conditions for each "if" statement are on seperate lines, and the '&&' on a seperate line makes it very clear that it is using the "union" of the evaluation of the two conditions for the final result.Also the 'action' to be accomplished is very clear from the way it is formatted between the two curly braces { } of the 'if' statement. (A:AIRSPEED INDICATED,knots) 50 > (L:Flying,bool) ! && if{ (>K:FLAPS_DOWN) 1 (>L:Flying,bool) } (A:AIRSPEED INDICATED,knots) 40 < (L:Flying,bool) && if{ (>K:FLAPS_UP) 0 (>L:Flying,bool) }


Fr. Bill    

AOPA Member: 07141481 AARP Member: 3209010556


     Avsim Board of Directors | Avsim Forums Moderator

Share this post


Link to post
Share on other sites
Guest Pencil pusher

Herbert, & Bill, Thanks very much for both of your inputs. Firstly Bill - I have read and learnt a great deal from your tutorials, many thanks, as yet though I cannot see the advantage of your layout, but it might come, as I know spacing is very important. The other thing I have difficulty with is knowing where to place the operand(if thats what you call it?) or the SET value, e.g. K:AXIS_ELEVATOR_SET, and what spaces to use. Trial and error at the moment, but appering to work.Herbert, thanks again for your help and the attachment is what I have developed today for my take-off & touchdown sequence which works very well - it now lacks the automatic short duration up elevator 1 second after Flaps down. I can get it to insert up elevator, but it inhibits modification by joystick until 190 kts, so am brick wall hitting again.(If you realise what I am doing - its trying to replicate a Jindivik which can no loger have wind beneath its wings... ever heard of it?) Still a long way to go on the fine detail but I can fly it almost as the real thing did until Oct 2004 - see you tube!My three position spring centre off is for sending aileron commands (ideally they are turn commands where the onboard autopilot demands 10

Share this post


Link to post
Share on other sites

Bill,you are right - as usual. The code snipet im my .txt was a clipboard copy of the code taken from the final xml gauge - but opened using notepad. Opening that code using an xml editor will make things clear.BTW, thanks for your mail answer concerning the WEP - (that was me, too). Things are working now. Maybe I had an old version...Keith,I don't think, that this forum is the right place to give an online step-by-step tutorial of how to make a special gauges.I'd strongly recommend to read through several tutorials and to have a look at existing stock xml gauges. If after that there still are questions to answer - you'll be more than welcome!Anyways, I'll have a look at your latest attachment - maybe you'll get it back as working code.Best,Herbert

Share this post


Link to post
Share on other sites
Guest Pencil pusher

Herbert, Yes I think that this series has done more than enough for the time being, but like many others my research into what I want to do with this sequence or switch has not returned anything similar to be able to use. I have however created all my other gauges from this research (or plagairism - I hope not!). BTW I do have XML Viewer, & XML Designer v1.0b1, I have just downloaded Peter's XML Editor & will now give that a try; but I find the clearest for me at the moment is just to double click on the .xml file and it comes up in IE7, heavy type for the code,and light brown for the headings. If something is left out or there is a white space too many or not, it tells you, and more often than not points to the place also, which the others do not. If the xml file is within a .cab, one does not need to extract it either! Not sure if I downloaded this from somewhere or whether its standard! I did do a check on XML Designer this morning and it said OK when a final bracket was missing, so that ones got to go!RegardsKeith :=)

Share this post


Link to post
Share on other sites

Keith,I must say, you're confusing me... you say you allready made several other XML gauges, you use an XML editor and still you don't know the basics of the XML syntax?Well, I'm not the one to judge this here.As for that mentioned elevator up-/down-feature:That's indee a bit tricky, as now time comes into the game.Working with time controlled events is possible, but not that easy to explain - and to keep code simple, I'd let do that by using macros. But that would start a new thread, I'm afraid...But here is an idea, which should also work:As you will have to move the elevator down and then up again within a certain time, you might use the time the flaps need to get extended.So check when the flaps are starting to extend with something like(A:TRAILING EDGE FLAPS LEFT PERCENT,percent) s0 l0 5 > l0 50 < && if{ (>K:ELEVATOR_UP) }This will move the elevator as long as the flaps are > 5% and < 50%. To move the elevators down again use this:(A:TRAILING EDGE FLAPS LEFT PERCENT,percent) s1 l1 50 > l1 95 < && if{ (>K:ELEVATOR_DOWN) }But those commands above aren't one time events, so they will happen as long as the condition meets. You could controll this by the gauge update frequency, but probably it would be better to use something like(A:ELEVATOR POSITION,percent) X.X - 163,83 * (>K:ELEVATOR_SET)By using an appropriate value for X.X (start with 0.1) you can controll how fast the elevator position will change per update cycle. You may also try different values for the start points when this movements begin / end (the obove flaps positions 5 / 50 / 95 %).OK, these are the quick ideas of I would try to do these things. I'm sure it can be done, but will probably need a lot of try and error and a lot of time to find the fittings values.Good luck!Herbert

Share this post


Link to post
Share on other sites

>Bill,>you are right - as usual. The code snipet im my .txt was a>clipboard copy of the code taken from the final xml gauge ->but opened using notepad. Opening that code using an xml>editor will make things clear.I rarely -if ever- use an XML specific editor. I find it much simpler to use notepad.exe or wordpad.exe instead. Occasionally, if my MSVC++ IDE happens to be open, I'll make use of its built-in text editor......even though MSVC++ IDE also has an XML Editor available as well! ;)>BTW, thanks for your mail answer concerning the WEP - (that>was me, too). Things are working now. Maybe I had an old>version...I'm glad the source C code was helpful.


Fr. Bill    

AOPA Member: 07141481 AARP Member: 3209010556


     Avsim Board of Directors | Avsim Forums Moderator

Share this post


Link to post
Share on other sites

>The other thing I have difficulty with is>knowing where to place the operand(if thats what you call it?)>or the SET value, e.g. K:AXIS_ELEVATOR_SET, and what spaces to>use. Trial and error at the moment, but appering to work.Understand that this is not a "technically correct description," but is instead at the very least a clear way of visualizing the syntax...Consider the following snippet:200 (>K:AXIS_ELEVATOR_SET)It helps to think about the syntax this way...(put the value) 200 (into the command string) K:AXIS_ELEVATOR_SET


Fr. Bill    

AOPA Member: 07141481 AARP Member: 3209010556


     Avsim Board of Directors | Avsim Forums Moderator

Share this post


Link to post
Share on other sites
Guest Pencil pusher

Bill, Thanks, that simple phrase helps a lot - I have yet to try to put to paper my english expansion of the 'symbology' or shorthand of 'software-eeze', maybe I should do so urgently!Herbert, again thanks for the idea, I shall give it a try and let you know how I get on. I have just been experimenting (that was part of my trade by the way, but usually empirically) with utilising the different Key Elevator & elevator trim commands (Axis or not axis) to see if that gets me out of the 'lockout' syndrome, and by invoking a separate code program for the elevator movement - partial success, can get the elevator to go up, & a/c lifts off, but my second value to return it to neutral doesn't load, and I have no control of the elevator through the joystick until >190 kts, although the lear_45 controls indicator says I have!!!! Trying ! == &gt & &lt combinations as well, don't know what I'm doing half the time, but hopefully learning very slowly - thats the problem when ones brain (& body ) is very close to 70!I though somehow that I was opening a can of worms here - it tends to be my nature to light a fuse and then wait for the result! Devils advocate I think is what its known by, that was also my trade in design airworthiness matters!So you think that I should know syntax by now - I get so confused as to where to place certain pieces - I know they work for the guages I have produced so far, mainly following the design of others, but then you come up with a different sequence that works where I have failed before. I shall persevere for as long as I am able - keeps the brain active!Again many thanks to you both for your assistance, and any future thoughts most welcome.RegardsKeith :=)

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...