Sign in to follow this  
Guest Ron Freimuth

XML Documentation ! 'goto'; strings, etc.

Recommended Posts

I don't know how I missed it, but the "Panels SDK.doc" March 2002, has several pages of XML Gauge info near the end. It gives a list of the math operators. There are also a dozen string operators. "To put a string on the stack enclose it in single quotes: 'My String' ". I assume that could be copied as (>L:A_String,string). I also found there is a 'goto'. 'g1, g2, ...'. Which branch to :1, :2, .. :n . So, one should be able to synthesize loops for FS2K2 XML gauges. BTW, you can store s1, to s49. 'sp1' stores stack top in variable 1 and pops the stack. 'c' clears the stack. 'p' pops the top element off the stack. 'div' does an integer divide. '%' gives the remainder. All in all, quite similar to an H-P RPN calculator. I guess this stuff wasn't in any of the FS2K2 XML gauges so people weren't aware of them. At least I wasn't. Ron

Share this post


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

Dang Ron!!! You're starting to talk like an old programmer! :-)Milton

Share this post


Link to post
Share on other sites

I did not miss it. I've been trying to use it. But not all of it works. Curiously, they seem to have L variables acting like global variables and G variables acting like local variables. I have yet to get a variable to be saved through one cycle. I tried making cowl drag and a touchdown data grabber. Neither worked. I have made several xml gauges that read parameters and display them digitally. That is very handy for special flight test gauges.The SDK is not perfect. Some parameter names do not seem to work although guessing units is often difficult.I am hoping MS will offer an improved SDK with perhaps some more xml capability built into FS9.

Share this post


Link to post
Share on other sites

>I did not miss it. I've been trying to use it. But not all of>it works. Curiously, they seem to have L variables acting like>global variables and G variables acting like local variables. Right. 'E:' and some other variables were also mentioned, but I have never heard of them being used. I think the E: "Time variables" were changed to P: variables. ** Strings and 'goto' did NOT work for me. **>I have yet to get a variable to be saved through one cycle. I know L: variables are saved unless changed, since I Initialize some constants only on the first iteration. Further, I have a COUNT that iterates on every cycle. I display it at a corner of my Test Displays. I got some ideas from a complex, 'all XML gauges' AC package I'm associated with. I think there is a trick with: code code code. Most of my calculations are in Gauge Base.XML, all the Display is done by Jet Display.XML. I also ripped off Arnie's sunangle.xml and have it in another XML file. All L: variables see one another, as advertised. > I tried making cowl drag and a touchdown data grabber. Neither>worked. I have made several xml gauges that read parameters>and display them digitally. That is very handy for special>flight test gauges. That's all I've been working on: test gauges. At times it takes me days before I get values back that disappeared after a bit of editing. This 'XML/RPN' is VERY FRAGILE. I tested an EPR/EGT algorithm in my test gauge. I have to add Mach variation, then I'll give the algorithms to a C programmer to put in his C gauge. The Displayed EGT and EPR are exactly what my SS shows.>The SDK is not perfect. Some parameter names do not seem to>work although guessing units is often difficult. I COULD NOT get 'goto' 'g1', etc. to work. Nor could I get a 'string' on the stack. I wasted a couple of hours last night trying to do it. Nor does my preliminary Fuel Tank Temp work. But, I'm sure that's some syntax error. Typical MSFS 'documentation' and software. Buggy and often doesn't work. However, the 'c', clear stack fixed my problems with my test gauges messing up Autopilot switching. MS is an expert on buffer overflows, etc. They add 'programming versatility' for WORM writers. I learned 8087 ASM stack programming years ago, also have used HP calculators since 1972. I had stack overflow problems until MS came out with a CodeView that displayed the 8087 stack. Partly fixed with the 'c' equivalent. RPN isn't much of a problem for me. Except a day after I write some tricky RPN operations it gets hard to understand what I did. ;) >I am hoping MS will offer an improved SDK with perhaps some>more xml capability built into FS9. I mentioned here what I'd figured out from the GPS 500 coding. Much more powerful. However, I have not tried to use any of the new structures so far. Not good for test gauges which I want to work in FS2K2 also. That FS9 gauge has a bit of debug code commented out at the end of the gauge. Seems one could set a BOOL to define whether multiple debug blocks were active or not. Or, even switch debug code on/off with mouse hot spots. One can display L: variables in a 'debug' gauge/window and delete the 'debug' gauge when it is no longer needed. Ron

Share this post


Link to post
Share on other sites

>Dang Ron!!! You're starting to talk like an old programmer! >:-)>Milton I hadn't programmed much for ten years. But now see lots of ways to enhance flight models, etc. with XML gauges. For example, I think I can make your AC520 drop stall speed from 60 mph to 40 mph when the engines are at full power. Since the spoilers aren't otherwise needed, I could use 'spoiler lift' to increase CL when there is a good prop blast over the wings. But, that will have to wait until I get more important stuff done.Ron

Share this post


Link to post
Share on other sites

Ah, do real programmers today use goto statements? I thought that was a bad four letter word in a structured program language? Yep, we used it in fortran and basic just like you did a long time ago as an enginner. Recalling Pascal, don't thinkk it was available?Jesting only, as not many of us are programmers by education or experience in the real world of today.maybe the word is CASE?Regards,BobS

Share this post


Link to post
Share on other sites

>Ah, do real programmers today use goto statements? I thought>that was a bad four letter word in a structured program>language? Yep, we used it in fortran and basic just like you>did a long time ago as an enginner. Recalling Pascal, don't>thinkk it was available? Fortunately I leared TurboPascal 15 years ago; it sure helped me understand good programming structures. I used to do Fortran quite a bit, however I synthesized Repeat .. Until Loops by putting those statments in as comments and structuring the loop with the required GOTO.>Jesting only, as not many of us are programmers by education>or experience in the real world of today.>Regards,>BobS I came up with this neat looking XML loop in a test file to check the 'g0' goto. After a lot of time fooling around I decided the goto doesn't work. ;( 0 :0 ++ d 100 >= (** True if 100 >= ST **) if{ p g0 } (** pop T/F comparison, goto 0 if appropriate **) The intial value was always incremented by 1 from its initial value, it never looped to label :0. I copied stack top to an L: variable and displayed it, tried different 'g ' goto's, loop structures, set different initial loop variables and finally decided 'screwed again'. Ron

Share this post


Link to post
Share on other sites

The DC3 radio gauge shows an example of the goto commands. Haven't dwelved into it yet though.As for the spoiler, I used this in FS2002 to generate "special drag", which I/we felt FS2002 didn't handle at all or handled poorly. I'm not saying our were sooo much better, but at least the extra drag was felt. It can be used to drive drag created from cowlflaps (no momentum though) etc.The code went something like:(A:INCIDENCE BETA,radians) (L:DragEffect,enum) * abs 16384 * (>K:SPOILERS_SET) The (L:DragEffect,enum) is a userdefined variable set in another gauge. I guess you're able to spot what it is supposed to do :) Keep in mind that using SPOILERS_SET on a continous basis (any axix_SET), seem to render the SELECT function inoperative (select engine1 etc) from the keyboard. If put into a limiter, things works nicely again.

Share this post


Link to post
Share on other sites

>The DC3 radio gauge shows an example of the goto commands.>Haven't dwelved into it yet though. I had looked at that XML file before. It is almost FS2K2 compatable. I don't think one can use the ":1" to designate Com1 frequency in FS2K2. "(A:Com active frequency:1,Megahertz) flr " But, that can easily be changed for FS2K2. Offhand, the rest appeared to be FS2K2 compatable. Assuming the " ... } g0 } statements branch to the ":0" labels. There are a bunch of similar code blocks that all use 'g0' and have the ":0" label further down. So, the goto's and labels must be local to the tags. I tried my 'loop' in FS2K2, but could have run it in FS9. Guess I need to fool around some more and see if it was fixed in FS9, or I didn't use it right in my code block. I couldn't even get it to jump around a couple of lines of code. The GPS 500 XML coding is almost completely different. With the {macro}'s, etc.>As for the spoiler, I used this in FS2002 to generate "special>drag", which I/we felt FS2002 didn't handle at all or handled>poorly. .... Disgusting that we have to add special coding to fix problems in the flight model code. One AIR file parameter increased sideslip drag in FS2K, but it was lost in FS2K2. >The code went something like:>(A:INCIDENCE BETA,radians) (L:DragEffect,enum) * abs 16384 *>(>K:SPOILERS_SET) >The (L:DragEffect,enum) is a userdefined variable set in>another gauge. I guess you're able to spot what it is supposed>to do :) Add 'drag due to sideslip'. A good idea. I checked the effect of REC 1101 "Side Force due to Sideslip" and it appeared to add a drag that varied with sin^2 (beta). Some thought told me sin^2 makes sense. That can be approximated as beta^2. So, you might try adding 'sqr' (* squares st * ) between your A: and L: variables. Multiply by something like 5 after the squaring. An 11.4 deg sideslip is 0.2 radians, but if it is squared, the value drops to 0.2 the value you would get. Max sideslip angle is around +/- 15 degrees. I used to do full slips (sometimes with full flaps), in a PA-28 to get it down fast when landing. Doesn't work near as well in FS. > Keep in mind that using SPOILERS_SET on a continous>basis (any axix_SET), seem to render the SELECT function>inoperative (select engine1 etc) from the keyboard. If put>into a limiter, things works nicely again. I suspect that depends on how it is done. ;) Incidently, one can add many sources of drag before setting the "spoiler" deflection. But, you can't use a realistic spoiler for drag, since a spoiler reduces lift a lot. A speed brake has little lift, so various drags can be combined. If the MS FS people were responsive they could add more spoilers to the flight model. They could set to change Lift, Drag, and Pitching moment independently. As it is, it seems ever time the Airheads touch the FD code MS bought they mess it up. Ron

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