December 31, 200916 yr (Here's an example of a gauge with a timer. <!-- Landing light gauge for Hawker Fury --><Gauge Name="landing_light1" Version="1.0"><Image Name="landing_light_background.bmp"/></P> <P><Comment>This gauge models a pyrotechnic landing flare.This is "one-shot" so once it's been turned on it burns for a linited time (60 sec)and cannot be used again.</P> <P>(L:STATUS1, number) is status: 0 = unburnt, 1 = burning, 2 = burnt(L:START TIME1, seconds) time flare ignited </Comment></P> <P><Update Frequency="1"/></P> <P><Element> <Select> <Value> <!-- If the light's on and it's been on for more than 60 sec change the status, and turn the light off --> (L:STATUS1, number) 1 == (P:ABSOLUTE TIME, seconds) (L:START TIME1, seconds) - 60 > && if{ 2 (>L:STATUS1, number) (>K:LANDING_LIGHTS_OFF) } </Value> </Select></Element></P> <P><Mouse> <Tooltip>Landing Flare 1</Tooltip> <Area Left="15" Top="25" Width="45" Height="45"> <Visible>(L:STATUS1, number) 0 == </Visible> <Cursor Type="Hand"/> <Click> <!-- Change status, save the current time, and turn the light on --> 1 (>L:STATUS1, number) (P:ABSOLUTE TIME, seconds) (>L:START TIME1, seconds) (>K:LANDING_LIGHTS_ON) </Click> </Area></Mouse></Gauge> Gerry Howard
December 31, 200916 yr Author Thanks, for your quick reaction and possible solution. Question is though, how can i make the timer so it will act as in the elements and switches?Ed
December 31, 200916 yr Author MGH and others,With the help of the forum i've come to the following count-down timer. When (L:ALIGN-INS,enum) 1 == the timer starts to count down from 100 to 0 but does not stop at 0 (goes below 0) and does not activate the (L:ALIGNMENT FINISHED,bool) when coutdown timer reaches 0<Element>......<String>%((L:INS-Time-Down, number) (L: SHORT ALIGN,seconds) (P:LOCAL TIME, seconds) - abs 1 > d if{ (P:LOCAL TIME, seconds) (>L:SHORT ALIGN,seconds) } (L:INS-Time-Down, number) r - 60 3 (L:ALIGN-INS,enum) case (>L:INS-Time-Down, number) (L:INS-Time-Down, number) 6 / int)%/%!d!%((L:INS-Time-Down, number) 6 % int)%!d!%<Click>(L:ALIGN-INS,enum) ++ d 3 != * d (>L:AVCS-INS,enum) 1 == if{ 60 (>L:INS-Time-Down,number) (P:LOCAL TIME, seconds) } (P:LOCAL TIME,seconds) 1 % 5 < if{(L:ALIGNMENT FINISHED,bool)</Click>Please help me to make this code work correctly.Greets Ed
January 1, 201016 yr Commercial Member Not sure as to the extent of your XML knowledge but here's a Navigational System Logic (IRU) I put together: (L:PWR,bool) 0 == (A:GPS GROUND SPEED,knots) 0 == and if{ (A:PLANE LATITUDE,degrees) (>L:FMC-IRU-POS-LAT-LAST,degrees) (A:PLANE LONGITUDE,degrees) (>L:FMC-IRU-POS-LON-LAST,degrees) (A:PLANE LATITUDE,degrees) (>L:FMC-IRU-INITIAL-POS-LAT,degrees) (A:PLANE LONGITUDE,degrees) (>L:FMC-IRU-INITIAL-POS-LON,degrees) 0 (>L:FMC-IRU-POS,degrees) 0 (>L:FMC-IRU-POS-SET,bool) 0 (>L:FMC-IRU-ALIGNED,bool) 0 (>L:FMC-IRU-ALIGN,number) } (L:FMC-SET-IRU-POS-UNIT-1,number) 78 == (L:FMC-SET-IRU-POS-UNIT-1,number) 83 == || (L:FMC-SET-IRU-POS-UNIT-2,number) 48 > (L:FMC-SET-IRU-POS-UNIT-2,number) 57 < (L:FMC-SET-IRU-POS-UNIT-8,number) 69 == (L:FMC-SET-IRU-POS-UNIT-8,number) 87 == || (L:FMC-SET-IRU-POS-UNIT-9,number) 48 == (L:FMC-SET-IRU-POS-UNIT-9,number) 49 == || (L:FMC-SET-IRU-POS-UNIT-6,number) 46 == (L:FMC-SET-IRU-POS-UNIT-14,number) 46 == and and and and and and if{ 1 (>L:FMC-IRU-POS-SET,bool) } els{ 0 (>L:FMC-IRU-POS-SET,bool) } (L:IRU-1,bool) 1 == (L:IRU-2,bool) 1 == (L:IRU-3,bool) 1 == (L:IRU-4,bool) 1 == and and and if{ 1 (>L:FMC-IRU-SET,bool) } els{ 0 (>L:FMC-IRU-SET,bool) } [color="#FF0000"](L:FMC-IRU-POS-SET,bool) 1 == (L:FMC-IRU-SET,bool) 1 == and if{ (L:FMC-IRU-ALIGN,number) 10 < if{ (L:FMC-IRU-ALIGN,number) 0.0015 + (>L:FMC-IRU-ALIGN,number) } } els{ (L:FMC-IRU-ALIGN,number) 0.0 > if{ (L:FMC-IRU-ALIGN,number) 0.75 - (>L:FMC-IRU-ALIGN,number) } }[/color] (L:FMC-IRU-ALIGN,number) 7 < (A:GPS GROUND SPEED,knots) 1 > and if{ (L:FMC-IRU-ALIGN,number) 0.1 > if{ (L:FMC-IRU-ALIGN,number) 0.75 - (>L:FMC-IRU-ALIGN,number) } } (L:FMC-IRU-ALIGN,number) 8 > if{ 1 (>L:FMC-IRU-ALIGNED,bool) } els{ 0 (>L:FMC-IRU-ALIGNED,bool) } (L:FMC-IRU-ALIGNED,bool) 1 == if{ (A:PLANE LATITUDE,degrees) (L:FMC-IRU-POS-LAT-LAST,degrees) - (>L:FMC-IRU-POS-LAT-CHANGE,degrees) (A:PLANE LONGITUDE,degrees) (L:FMC-IRU-POS-LON-LAST,degrees) - (>L:FMC-IRU-POS-LON-CHANGE,degrees) (L:FMC-IRU-INITIAL-POS-LAT,degrees) (L:FMC-IRU-POS-LAT-CHANGE,degrees) + (>L:FMC-IRU-POS-LAT-CURRENT,degrees) (L:FMC-IRU-INITIAL-POS-LON,degrees) (L:FMC-IRU-POS-LON-CHANGE,degrees) + (>L:FMC-IRU-POS-LON-CURRENT,degrees) } I doubt you would need to use everything there, in your particular case I would just pay attention to the Variables with Align in them.All that is wrapped in Update clause. The bit in red is something I would pay particular attention to because it's essentially what you're asking for. :( It controls the speed at which the IRU aligns.Now that you have a mechanism for simulating Alignment you can work out making it look like it's supposed.Good Luck! :( Engjell BerishaGood Day! Good Day, Engjell Berisha
January 1, 201016 yr Author Engjell,First, best wishes for 2010! Thanks for your reply! My knowledge of XML is not very good but i'll give it a try. If i can't get it fixed i'll get back at you.Thanks a lot!Ed
January 1, 201016 yr Author Engjell,I'am sorry that i have to get back at you, my knowledge of XML is not good enough (still a beginner). I can't get it fixed.Here's the code: <Element> <Position X="15" Y="-1"/> <Text X="105" Y="20" Bright="Yes" Length="9" Font="arial black" Bold="Yes" Color="yellowgreen" Adjust="right" VerticalAdjust="center"> <String>%INS %((>L:FMC-IRU-ALIGN,number) 6 / ceil 10 / 9.9 min )%!3.1f!</String> </Text> </Element> <Element> <Position X="125" Y="-1"/> <Text X="65" Y="20" Bright="Yes" Length="5" Font="arial black" Bold="Yes" Color="yellowgreen" Adjust="left" VerticalAdjust="center"> <String>% / %(100 (>L:FMC-IRU-ALIGN,number) (L:LONG ALIGN,bool) if{ 6.517 } els{ 4.719 }/ ceil - 6 max )%!2d!</String> </Text> </Element><!-- ********* INS ALIGNMENT **********--><Area Left="263" Right="280" Top="104" Bottom="118"> <Cursor Type="Hand"/><Click>(L:INS-ALIGN,enum) 1 == if{ 1 (>L:FMC-IRU-SET,bool) } els{ 0 (>L:FMC-IRU-SET,bool) } (L:FMC-IRU-SET,bool) 1 == if{ (L:FMC-IRU-ALIGN,number) 10 < if{ (L:FMC-IRU-ALIGN,number) 0.0015 + (>L:FMC-IRU-ALIGN,number) } } els{ (L:FMC-IRU-ALIGN,number) 0.0 > if{ (L:FMC-IRU-ALIGN,number) 0.75 - (>L:FMC-IRU-ALIGN,number) } } (L:FMC-IRU-ALIGN,number) 7 < (A:GPS GROUND SPEED,knots) 1 > and if{ (L:FMC-IRU-ALIGN,number) 0.1 > if{ (L:FMC-IRU-ALIGN,number) 0.75 - (>L:FMC-IRU-ALIGN,number) } (L:FMC-IRU-ALIGN,number) 8 > if{ 1 (>L:ALIGN-FINISHED,bool) } els{ 0 (>L:ALIGN-FINISHED,bool) } (L:ALIGN-INS,enum) 2 == if{ 1 (>L:ALIGN-FINISHED,bool)} </Click></Area> As you see i've tried to use your code but both counters still gives 0.0 / 0 and do not change. During alignment the 0.0 value should count up with a max ceil of 9.9 The / 0 should count down from 100 with a ceil of 6. When alignment reached the values it should activate the (L:ALIGN-FINISHED,bool)Engjell,Are you, with your knowledge of XML, willing to try coding this for me? Wife and kids are scraping me from my computer!i've created a switch (L:ALIGN-FINISHED,bool) and put it in the main panel. The strangest thing is that if i push this button it will freeze the align finished bool and displays alt/hdg/kts which is good. I also put this in the click statement but doesn't work? How can this be possible?
January 2, 201016 yr Commercial Member Okay Ed, here's what I've come up with - I realized after reading you post that your XML knowledge isn't in accordance with what I posted - No Offense. <Gauge Name="INS" Author="Engjell Berisha"> <Image Name="INS.bmp" ImageSizes="300,711"/> <Update Hidden="Yes" Frequency="10"/> <!--========================INS-COMPUTATIONAL-DATA========================--><Update Hidden="Yes" Frequency="6" > <!--========================INS-LOGIC========================--><!--========================INS-LOGIC========================--><!--========================INS-LOGIC========================--> (L:INS-POS-SET,bool) 1 == if{ (L:INS-ALIGNMENT,number) 10 < if{ (L:INS-ALIGNMENT,number) 0.0015 + (>L:INS-ALIGNMENT,number) } } els{ (L:INS-ALIGNMENT,number) 0.0 > if{ (L:INS-ALIGNMENT,number) 0.75 - (>L:INS-ALIGNMENT,number) } } (L:INS-ALIGNMENT,number) 7 < (A:GPS GROUND SPEED,knots) 1 > and if{ (L:INS-ALIGNMENT,number) 0.1 > if{ (L:INS-ALIGNMENT,number) 0.75 - (>L:INS-ALIGNMENT,number) } } (L:INS-ALIGNMENT,number) 8 > if{ 1 (>L:INS-ALIGNED,bool) } els{ 0 (>L:INS-ALIGNED,bool) } </Update> <Element> <Position X="25" Y="25"/> <Text X="50" Y="10" Bright="Yes" FontSize="10" Length="10" Font="Verdana" Color="#aeff00" Adjust="Left" VerticalAdjust="Center" Multiline="No" Bold="Yes"> <String>%((L:INS-POS-SET,bool))%!s!</String> </Text> </Element> <Element> <Position X="25" Y="35"/> <Text X="50" Y="10" Bright="Yes" FontSize="10" Length="10" Font="Verdana" Color="#aeff00" Adjust="Left" VerticalAdjust="Center" Multiline="No" Bold="Yes"> <String>%((L:INS-ALIGNMENT,number))%!s!</String> </Text> </Element> <Element> <Position X="25" Y="45"/> <Text X="50" Y="10" Bright="Yes" FontSize="10" Length="10" Font="Verdana" Color="#aeff00" Adjust="Left" VerticalAdjust="Center" Multiline="No" Bold="Yes"> <String>%((L:INS-ALIGNED,bool))%!s!</String> </Text> </Element><Area Left="263" Right="280" Top="104" Bottom="118"><Cursor Type="Hand"/><Click>(L:INS-POS-SET,bool) ! (>L:INS-POS-SET,bool)</Click></Area></Gauge> Understand that you can't - or you really shouldn't evaluate variables with <STRING> code or even in <Click> code, particularly for what you were trying to do here. There is particular code that is best for evaluating variables and making advanced computations. Understand that if you put evaluating text in a click code it will only be evaluated when you click not constantly. The <Update> clause is best for this, it will update at a speed of your choosing, no that you can only place it as I did, you shouldn't place it inside elements or strings only under the master <Gauge> clause. What I did above is essentially the backwards rendition of what you wanted, but it's easy enough to reverse the computations to make it work the way you want it to.I've exerted the following bit of code as it's probably the most important: (L:INS-POS-SET,bool) 1 == if{ (L:INS-ALIGNMENT,number) 10 < if{ (L:INS-ALIGNMENT,number) 0.0015 + (>L:INS-ALIGNMENT,number) } } els{ (L:INS-ALIGNMENT,number) 0.0 > if{ (L:INS-ALIGNMENT,number) 0.75 - (>L:INS-ALIGNMENT,number) } }Now when you click the variable (L:INS-POS-SET,bool) will toggle between 0 and 1, when you click and it goes to 1 that will initiate the above code. What the first statement says the "if{" statement says that if (L:INS-POS-SET,bool) equals 1 then (L:INS-ALIGNMENT,number) should approach ten. The next statment within that after the red 10, "if{" says that if (L:INS-ALIGNMENT,number) is approaching 10 - or any number we put there - then it should do so at the rate of - the blue number - every second. And then the els{ code reverses what we said, so that if (L:INS-POS-SET,bool) doesn't equal 1 then the alignment number should go to the number in red at the speeed in blue.Now to make it the way you want it all we have to do is reverse things: (L:INS-POS-SET,bool) 1 == if{ (L:INS-ALIGNMENT,number) 0.0 > if{ (L:INS-ALIGNMENT,number) 0.075 - (>L:INS-ALIGNMENT,number) } } els{ (L:INS-ALIGNMENT,number) 100 < if{ (L:INS-ALIGNMENT,number) 0.075 + (>L:INS-ALIGNMENT,number) } } In the final gauge that would look like this: <Gauge Name="INS" Author="Engjell Berisha"> <Image Name="INS.bmp" ImageSizes="300,711"/> <Update Hidden="Yes" Frequency="10"/> <!--========================INS-COMPUTATIONAL-DATA========================--><Update Hidden="Yes" Frequency="6" > <!--========================INS-LOGIC========================--><!--========================INS-LOGIC========================--><!--========================INS-LOGIC========================--> (L:INS-POS-SET,bool) 1 == if{ (L:INS-ALIGNMENT,number)[color="#FF0000"] 0.0 > [/color]if{ (L:INS-ALIGNMENT,number)[color="#0000FF"] 0.075 - [/color](>L:INS-ALIGNMENT,number) } } els{ (L:INS-ALIGNMENT,number)[color="#FF0000"] 100 < [/color]if{ (L:INS-ALIGNMENT,number)[color="#0000FF"] 0.075 + [/color](>L:INS-ALIGNMENT,number) } } [i][b] (L:INS-ALIGNMENT,number) 10 > (A:GPS GROUND SPEED,knots) 1 > and if{ (L:INS-ALIGNMENT,number) 100 < if{ (L:INS-ALIGNMENT,number) 0.75 + (>L:INS-ALIGNMENT,number) } } (L:INS-ALIGNMENT,number) 4 < if{ 1 (>L:INS-ALIGNED,bool) } els{ 0 (>L:INS-ALIGNED,bool) } [/b][/i]</Update> <Element> <Position X="25" Y="25"/> <Text X="50" Y="10" Bright="Yes" FontSize="10" Length="10" Font="Verdana" Color="#aeff00" Adjust="Left" VerticalAdjust="Center" Multiline="No" Bold="Yes"> <String>%((L:INS-POS-SET,bool))%!s!</String> </Text> </Element> <Element> <Position X="25" Y="35"/> <Text X="50" Y="10" Bright="Yes" FontSize="10" Length="10" Font="Verdana" Color="#aeff00" Adjust="Left" VerticalAdjust="Center" Multiline="No" Bold="Yes"> <String>%((L:INS-ALIGNMENT,number))%!s!</String> </Text> </Element> <Element> <Position X="25" Y="45"/> <Text X="50" Y="10" Bright="Yes" FontSize="10" Length="10" Font="Verdana" Color="#aeff00" Adjust="Left" VerticalAdjust="Center" Multiline="No" Bold="Yes"> <String>%((L:INS-ALIGNED,bool))%!s!</String> </Text> </Element><Area Left="263" Right="280" Top="104" Bottom="118"><Cursor Type="Hand"/><Click>(L:INS-POS-SET,bool) ! (>L:INS-POS-SET,bool)</Click></Area></Gauge> Note that I've also had to change the definition of the INS being aligned, now any time the alignment number is 4 or less the INS will be aligned instead of the previous 8 > the same for the disrupter code that kills alignment if you start to move.I've not had the chance to test this in the sim, as I too am very busy at the moment but it should work as advertised. I included in the gauge string text with each of the variables just so that you can see that they are working as they ought to be and when you don't need them anymore just remove them.Hope that helps.Engjell BerishaGood Day! Good Day, Engjell Berisha
January 3, 201016 yr Author Engjell,Sorry that i get back so late, after you send your code so quickly. I do understand the 1 and 0's which take place after being pushed, only i do not no how to conver it to the code i want. No offence either.The code you send works and looks great. There appears to be only one remark.The timer starts counting up to 100 and nothing happens, pushing the INS-POS-SET,bool button afterwards the counter starts counting down from 100 to 0. At 4 it activates the INS-FINISHED,bool and ends the alignment. I also got the count-up timer to work at the same time.I'm now trying to set the counter to 100 and start counting down instead of counting up first (from 100 back to ) but am not to fruitfull. If you have any suggestions i'll be glad.I'm very glad that you are willing to help me in the way you do. Thank you very much for that!Greetings Ed, Member Virtual and Real Royal Netherlands Air Force (VRNLAF)
January 4, 201016 yr Author Engjell,Both counters are working at the same time (one up and one down). Thank you very very much for your help and code to get the job done! I know now at what stage in programming I am (very beginner) and can't always follow why certain things do not happen even though you think it should. I'am glad that there still are people willing to help and have patience with those that do not have a clou, like me.I do have one question:is it possible during flight to mark lat/lon and time, and display it somewhere in a gauge. I was thinking of using s0 and l0.... is this a correct way of thinking?Many thanks for helping me,Greetings Ed,
January 7, 201016 yr Commercial Member Hey Ed, I'm glad everything work out for you - it seems you understood what I was trying to say/do either way.I'm not sure what you're asking for your other question, if you're asking if it's possible to record the lat/lon at the press of a button and then show that recorded position on your gauge, this is indeed possible but might be a little tricky - I'll have to do some thinking to figure this one out. :( If you're asking if you can display the current LAT/LON of the aircraft on this is also possible and very easy. :( Engjell BerishaGood Day! Good Day, Engjell Berisha
January 7, 201016 yr Author Engjell,I would like to record the LAT/LON and Time after pushing the ENTER button on the Keyboard (for instance to record the position of a target for later usage). The MARK page consists of 4 pages: MARK-1, MARK-2, MARK-3 and MARK-4 page is to clear all MARKS. I've tried to use a part of your code (i thought i had to use <update> for this as well, since LAT/LON and Time constantly changes while in flight) probably i guesed wrong.Anyway thanks for your interest.Ed
Create an account or sign in to comment