May 19, 200521 yr Hi,Maybe this is familiar to many of you, but I think it's worth to clarify the concept:Local (L:type) vars may accept units like FS's own vars (A:type) and even more, they support conversions as well!For instance, you may assign (A:XXXX, feet) to (L:MyVar, feet)Or you can assign 15 (>L:MyVar, celsius) or 30 (>L:MyVar, degrees)Then if you read those Lvars using COMPATIBLE units, FS will make the conversion automatically. So you will get proper values for(L:MyVar, meters), (L:MyVar, farenheit) or (L:MyVar, radians)There is no need to be limited by "number", "bool", "enum", etc.NOTE: Only tested in FS2004, and for the most common units like those stated, but I guess should work for the rest.Hope this helps,Tom
May 19, 200521 yr Hi Tom,Allthough I wasn't aware of this (probably because I've never needed it), it's good to know.So thanks for posting it.As a sidenote, conversions in FS2004 are NOT always as trivial as you would expect.Example:(A:FUEL TANK LEFT MAIN QUANTITY,gallon)Now if you read(A:FUEL TANK LEFT MAIN QUANTITY,pounds)you would expect FS2004 to use a conversion factor gallon-to-pounds.(that is: I would :-) )But it doesn't ...Instead of the expected gallon-to-pounds conversion of appr. 6.7, FS uses a factor of 8.4. (beats me where that comes from, it's not even the same as the difference between Liquid Gallon and Imperial Gallon)Cheers, Rob
May 19, 200521 yr Rob,I think FS considers water as the fluid to use in gallons to pounds conversion, which has a gravity of 1. Jet fuel has a lower gravity value, therefore the difference.Cheers,Tom
May 19, 200521 yr Hi Tom,Yes, I can explain WHY there is a difference (although I would have expected FS to handle that for me, given the type of parameter which appies to FUEL, not WATER in the tanks :-)), but NOT the difference between factor 6.7 and 8.4 ... I just can't figure out where the 8.4 comes from :-)But again, it was just an example of non-trivial conversion.. nothing more...Cheers, Rob
May 20, 200521 yr Moderator >Hi Tom,>>Yes, I can explain WHY there is a difference (although I would>have expected FS to handle that for me, given the type of>parameter which appies to FUEL, not WATER in the tanks :-)),>but NOT the difference between factor 6.7 and 8.4 ... I just>can't figure out where the 8.4 comes from :-)That becomes even more curious when you consider that the calculation in the Fuel Menu uses the correct 6.7 lb/gal factor... ??? Fr. Bill AOPA Member: 07141481 AARP Member: 3209010556 Avsim Board of Directors | Avsim Forums Moderator
May 20, 200521 yr "..I just can't figure out where the 8.4 comes from" 1 US water gallon = 8.4 * Water Density(1.0000) = 8.4 pounds (the value you get)1 US Jet Fuel gallon = 8.4 * JF Density(aprox 0.8029) = 6.74 pounds I agree FS should take JFuel on account instead of water. It seems that uses only direct conversions ie formulas with standard constants only.Tom
May 20, 200521 yr Yes, that explains it...But I'll still stick to my original point: It's not what I would expect when using these conversion functions :-)Cheers, Rob
May 22, 200521 yr >Local (L:type) vars may accept units like FS's own vars>(A:type) and even more, they support conversions as well!>>For instance, you may assign (A:XXXX, feet) to (L:MyVar,>feet)>Or you can assign 15 (>L:MyVar, celsius) or 30 (>L:MyVar,>degrees) You don't need to use the same units in the L: Parmaeters above. I use 'float' for FP values, letting the unit in the A: variable do the conversion. Though, if A: is bool or enum then L: should be the same. While I think using 'enum' in the L: variable will simply change a FP value to an integer value.>NOTE: Only tested in FS2004, and for the most common units>like those stated, but I guess should work for the rest.>Tom Sure, works in FS2K2 also.Ron
May 22, 200521 yr > You don't need to use the same units in the L: Parmaeters>above. I use 'float' for FP values, letting the unit in the>A: variable do the conversion.Hi Ron,Yes you do if you need to read an L:Var with different units, because automatic conversion between L:Var units only works when they are COMPATIBLE. Using your example,if you assign (A:XXX,knots) to (L:MyVar,float), you will get proper values for (L:MyVar,knots) BUT NOT for (L:MyVar,kilometers/hour). Instead, if you assign (A:XXX,knots) to (L:MyVar,knots), you will have right values for (L:MyVar,knots) AND (L:MyVar,kilometers/hour).Best regards,Tom
May 22, 200521 yr >> You don't need to use the same units in the L: Parmaeters>>above. I use 'float' for FP values, letting the unit in the>>A: variable do the conversion.>>Hi Ron,>>Yes you do if you need to read an L:Var with different units,>because automatic conversion between L:Var units only works>when they are COMPATIBLE. ...........>Tom Ah. I never expected automatic conversion to work with 'floats', if I wanted to convert them I used my own conversion factors. L: Parameters set once in an initialization block. However, I'll keep your comment in mind. Ron
Create an account or sign in to comment