Jump to content

Archived

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

autogyro

XML coding for the Carenado Hawker 850XP

Recommended Posts

Hi all,

 

Upon request I've put up this thread as both a compendium and learning centre for XML coding for the Hawker 850XP.

 

Given that most systems are coded in SPB or XML format, it is not outside the realm of possibility to correct a lot of flaws or bugs with the Hawker. All it takes is some XML coding knowledge and patience.

 

Just remember that these are copyright to Carenado so I'm not sure how happy they will be with editing and distributing files. You may wish to seek permission from them to distribute any files. Any bug corrections can also be suggested to them via Carenado's support helpdesk.

 

I am hoping this thread will serve as a link or copy/paste of the xml tweaks we've created thus far as well as discussions on what errors are noted and how we can fix them.

 

Set up

 

1. Before we begin, ensure you're running the SP1 version of the Hawker. If you would like to contribute or make your own modifications, download spb2xml:

 

http://flyawaysimulation.com/downloads/files/1655/fsx-spb2xml-utility/

 

2. The next step is to unpack your .cab files:

 

Browse to your Prepar3d v2\gauges or FSX\gauges folders.

 

Within this folder, are the relevant .cab (cabinet) files for your Hawker. These include CARPROLINE21.CAB, EFIS850XP.CAB, GAUGE850XP.CAB and FMS6000.CAB

 

Extract each .CAB file into a folder of the same name. This will fill these folders with, typically, .xml/.spb files and .bmp files.

 

For the .spb files, convert them to .xml files following the instructions from spb2xml.

 

3. within your Prepar3d v2\SimObjects\Airplanes\Carenado H25B_H850XP\panel or FSX\SimObjects\Airplanes\Carenado H25B_H850XP\panel folder, duplicate the folders (keep them empty) of the .cab files you have extracted. You should thus end up with 4 folders named CARPROLINE21, EFIS850XP, GAUGE850XP and FMS6000.

 

4. Copy all the XML files from the gauge\.... folder into the same panel\.... folder, where .... is the name of the above 4 .cab files.

 

What this does, is allow FSX or P3D to seek out the XML file from the panel folder first, provided the name of the xml gauge and folder naming is kept the same. You will modify the xml files within these panel\.... folders.

 

XML Coding

 

So now that you have the files, what do you do?

 

Have a read of https://msdn.microsoft.com/en-au/library/cc526953.aspx before you begin. It sets out how FSX/P3D uses the gauges, what sort of simulation variables are used, and how they interact, and how to get them to do certain things.

 

The rest, really, is up to you, and I, but especially Bert :P to fix these bugs.

 

 

Example

 

Let's run through a simple example.

 

Fixing the AUX fuel transfer switch

 

The AUX Fuel transfer switch in the Carenado Hawker 850XP is a bit broken. In fact, fuel modelling in FSX/P3D is a bit broken. There is no straightforward way to actually transfer fuel between tanks. This thus makes the AUX Fuel transfer switch in the plane work differently to what it would do in real life. I am not a Hawker pilot but as far as I know the AUX Fuel transfer switch actually does transfer fuel from the ventral (central) tank to the wing tanks. The Hawker 850XP only uses fuel from the wing tanks. In the game, the Hawker will switch from using wing tanks to the ventral tank when the AUX Fuel transfer switch is turned on.

 

The end result is sort of the same, in that you use up the ventral fuel tanks before the wing tanks, with one major caveat - if you run out of fuel on the ventral tank, your engines stop. This is not correct, nor something you want to happen. So, the fix would be to code, outside of the game, using C++ and SimConnect, a way to actually transfer fuel from the ventral tank to the wing tanks. But wait, I thought we were just adjusting XML files? So we'll have to ######ise a solution. Let's instead, have the AUX fuel transfer switch auto-switch when it's empty, so that we won't accidentally lose the engines if we forget to switch the AUX fuel switch off.

 

This is can be done via the Gauge_Update_Dig.xml file, within the GAUGE850XP folder (in your ...\panel folder).

 

Carenado uses the Gauge update xml files to set variables that need to be updated, or where the game needs to poll for values over time. There are actually a few files that have the <update> </update> section in them, so any of these would work. But the base gauge_update_xml file is my recommended location.

 

Using Notepad++, scroll to line 942, or maybe it's 943. This should be the blank line before the following code:

(A:AIRSPEED SELECT INDICATED OR TRUE, knots) (L:AIRSPEED_VS_850XP,knots) / 100 * 100 - 0 max 50 min (>L:NEEDLE_VDIVVS_850XP,number)

At this blank line, insert the following code:

<!-- Toggle AUX Transfer lever off when under 2% of fuel -->

(A:FUEL TANK CENTER QUANTITY, gallons) 4 <
if{ 
	(L:ASD_LEVER_FUEL_CENTER_850XP, number) 0 != if{ 0 (>L:ASD_LEVER_FUEL_CENTER_850XP, number) }
}

Now what does this mean?

 

The comment is to let you know the next section is relating to the AUX fuel switch.

 

(A:FUEL TANK CENTER QUANTITY, gallons) is a aircraft variable within FSX/P3D that is the value of the current quantity of fuel, within the center tank, displayed in gallons.

 

4 < is to set a criteria that the variable is less than 4 (less than 4 gallons). I believe the xml coding doesn't really allow you to use < or > symbols, so you use < and > instead. The syntax is in reverse polish notation, which is explained at the FSX XML SDK tutorial I linked above.

 

if{
    (L:ASD_LEVER_FUEL_CENTER_850XP, number) 0 != if{ 0 (>L:ASD_LEVER_FUEL_CENTER_850XP, number) }
}

 

Basically means, that if the previous statement (fuel center tank is less than 4 gallons) is true, then do the following. The following being, if the aux fuel switch is not off (or set to 0, notated as 0 !=) then switch it off.

 

L:... are local variables, and 0 (>L:...) is to set a local variable to, in this case, 0 (or off as far as the Carenado modelling goes).

 

So the end result, is that, when your center tank has less than 4 gallons, when that is true, then check if the aux fuel switch lever is on, and if that is also true, then switch it off.

 

Simple! No, not really. But you'll get the hang of it.

 

Further below I'll list any other coding changes members of AVSIM have noted in various other threads so people don't need to look far and wide for coding changes.

 


Shuai Li

 

MqMT51D.png

Share this post


Link to post
Share on other sites

THANK YOU autogyro... wow !

 

Have to go out at no will be back to study this later....

 

aero


                        mustang_banner_newstar2777.png

 


 
 
 
 

Share this post


Link to post
Share on other sites

That moment when customers are fixing problems themselves hahahha

 

Good job finding these!


Keven Menard 
Technical Director, //42
.

Share this post


Link to post
Share on other sites

I have been looking for a fix for this fuel system..... It is screwed up by default because if you have the AUX TRSFR pump on and were feeding from the ventral tank - When the ventral tank goes dry it starts feeding from the wing tanks BUT the fuel quantity in the wing tanks displayed on the Proline screen does not start decreasing until you switch the AUX TRSFR pump off. This is problematic because the Proline screen will not reflect the correct fuel onboard. The FMS does read the correct fuel but is is lump sum of both tanks.

 

Also noticed the FMS fuel used figures for the engine start as a negative number.... (This has been screwed up on every Carenado Release to date - I don know why they cant figure that one out)

 

Thanks for your hardwork Gyro... I think we will all be able to get the aircraft to a state that is acceptable to us - It is a long way off now and I am not banking on Carenado fixing alot.....

Share this post


Link to post
Share on other sites

Interesting post  but I will be interested in the final fixed files if you provide them - thank you


Rich Sennett

               

Share this post


Link to post
Share on other sites

Please... don't be providing the physical files. That is a copyright violation. Only Carenado can distribute those files unless someone can prove they have permission to do so as well.


Ed Wilson

Mindstar Aviation
My Playland - I69

Share this post


Link to post
Share on other sites

Ed is quite correct. What Shuai Li is sharing is perfectly acceptable, as it is simply providing a means for another owner to break, er, I mean fix his/her own avionics. :Whistle:

 

Sharing the entire 'fixed' files however is a no-no, and I'll shut it down quickly.


Fr. Bill    

AOPA Member: 07141481 AARP Member: 3209010556

Interests: Gauge Programming - 3d Modeling for Milviz

Share this post


Link to post
Share on other sites

Interesting post  but I will be interested in the final fixed files if you provide them - thank you

 

Please put up here the content of the fixed files! The whole long scrolls of them 

 

Thank you,

Dirk 

Share this post


Link to post
Share on other sites

Please put up here the content of the fixed files! The whole long scrolls of them 

 

Thank you,

Dirk

It's not going to happen. Read the entire thread. Copyright infringement isn't something AVSIM has ever allowed. It's not about to change.


Ed Wilson

Mindstar Aviation
My Playland - I69

Share this post


Link to post
Share on other sites

Hey I have an idea Carenado should fix - at least some feedback from Them on future fixes


Rich Sennett

               

Share this post


Link to post
Share on other sites

Hey I have an idea Carenado should fix - at least some feedback from Them on future fixes

 

WHUT?

 

10 char

Share this post


Link to post
Share on other sites

WHUT?

 

10 char

I think what Richard is asking is for Carenado to be a bit more transparent about their future plans as to what we can expect to get fixed and when we can expect it as right now a service pack is released out of the blue and not everything we flag as wrong or bugged is fixed.

 

I don't intend to correct everything myself with the Hawker but if anyone else posts a xml tweak for it I'll go to the effort of compiling them in this thread as sometimes they get lost in other threads.

 

For example we also have the popup shortcut for dump spoilers as well as the FLC fix from Bert in a couple of threads that people might not know about.


Shuai Li

 

MqMT51D.png

Share this post


Link to post
Share on other sites

I could not agree more.... I am still waiting for the service pack on this.....but I am not holding my breath....

 

I have to say the service packs on the last few releases have taken a while to publish and have been underwhelming....

 

Fingers crossed...

Share this post


Link to post
Share on other sites

Ed is quite correct. What Shuai Li is sharing is perfectly acceptable, as it is simply providing a means for another owner to break, er, I mean fix his/her own avionics. :Whistle:

 

 

Bring fixes on, put them all up here in quoted text format, if no problem, including those tips dealing with AP logic that WarpD's generously shared somehwere in the neighbouring thread, I copy pasted them all right away.

 

Thanks!

Dirk.

Share this post


Link to post
Share on other sites

Just in case someone wants to try the quoted code above, make a simple change, or it will not work:

 

<!-- Toggle AUX Transfer lever off when under 2% of fuel --!>
 

should be

 

<!-- Toggle AUX Transfer lever off when under 2% of fuel -->

 

:mellow:
 


Bert

Share this post


Link to post
Share on other sites

  • 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.
  • Donation Goals

    AVSIM's 2020 Fundraising Goal

    Donate to our annual general fundraising goal. This donation keeps our doors open and providing you service 24 x 7 x 365. Your donation here helps to pay our bandwidth costs, emergency funding, and other general costs that crop up from time to time. We reset this goal every new year for the following year's goal.


    34%
    $8,650.00 of $25,000.00 Donate Now
×
×
  • Create New...