Sign in to follow this  
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.

 

Share this post


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

THANK YOU autogyro... wow !

 

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

 

aero

Share this post


Link to post
Share on other sites

That moment when customers are fixing problems themselves hahahha

 

Good job finding these!

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

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.

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.

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.

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

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.

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:
 

Share this post


Link to post
Share on other sites

Bert,

too bad you're not in the sim business. I am pretty sure you would release amazing models.

But I think I know why: you would not charge for them, you would end up giving them for free, wouldn't you? :-)

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:

 

 

Good pick up, thanks Bert. I didn't get a chance to change it before the post editing is locked unfortunately.

Share this post


Link to post
Share on other sites
<!-- Toggle AUX Transfer lever off when under 2% of fuel -->

 

That's a sharp eye, Bert. I've edited the OP to fix the error.

Share this post


Link to post
Share on other sites

Being a bit of a beginner/learner in the dark arts of computational endeavours, I thought that there may be others who find themselves at my level of knowledge who may appreciate the following:

 

The spb2xml utility comes with some instructions requiring some command line syntax via the START menu cmd.exe which opens the DOS command prompt.

 

I tried copying the spb2xml.exe into the folder where the .spb files are located, and simply dragging an spb onto the spb2xml.exe icon in Windows Explorer works. You may have to hit F5 to refresh the view if the xml files don't show up straight away.

Share this post


Link to post
Share on other sites

The SAT, TAT and ISA displays on the PFD & MFD do not display correctly. The TAT should show the temperature due to ram rise, the SAT should show the ambient air temperature, and the ISA field should show the deviation from ISA, not the ISA temperature itself.

Here are some proposed fixes:

To display TAT correctly on the PFD:

in HS25B_pfd.XML do a search for "tat value label" which should take you to line 7992.

Change the variable

A:AMBIENT TEMPERATURE    to       A:TOTAL AIR TEMPERATURE

To display SAT and ISA correctly on the MFD:

In HS25B_mfd_pilot.XML do a search for "SAT value label" which should take you to about line 7240.

Change the variable A:STANDARD ATM TEMPERATURE    to     A:AMBIENT TEMPERATURE

I also edited the ISA section as follows just to tidy it up. Do a search for "ISA value label" which should be on about line 5828.

In the section at line 5850, remove the first, second and 4th lines

%((A:AMBIENT...
%{if}
%{end}

leaving just line 3, and towards the end of that string, change  %!+02d!  to  %!+d!

so it should now look like this:

<GaugeString>%((A:AMBIENT TEMPERATURE, Celsius) 15 (A:INDICATED ALTITUDE, feet) 1000 / 2 * - - near)%!+d! oC</GaugeString>

 

All the fields should now display the correct values.

Share this post


Link to post
Share on other sites

Not sure what that complex code is for ISA deviation;

<GaugeString>%((A:AMBIENT TEMPERATURE, Celsius) (A:STANDARD ATM TEMPERATURE, Celsius)-)%!+2d! oC</GaugeString>

Share this post


Link to post
Share on other sites

I thought I'd tried using STANDARD ATM TEMPERATURE and when it didn't work, I thought the text must have been wrong. Looking at your version, I think it would have been a missing minus sign...

 

Thanks for that.

 

The next thing is to make the UTC readout on the bottom of the PFD actually read out zulu time instead of jumping an hour each time it hits a new time zone!

 

In the HS25B_pfd.xml look for utc_value_label and change the <GaugeString> value that starts on line 7956 to read:

 

<GaugeString>%((P:Zulu time,hours) flr 24 %)%!02d!:%((P:Zulu time,minutes) flr 60 %)%!02d!</GaugeString>

 

The original text is spread over about 9 lines and gets replaced by this one line.

Share this post


Link to post
Share on other sites

That is a nice improvement...  Bit by bit we'll get this plane fixed.. B)

 

BTW, no underscores in "utc value label" in my copy..

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