Jump to content
The simFlight Network Forums

Starting an engine fire with FSUIPC


Recommended Posts

Tim Gregson from MS has confirmed that the "ENG ON FIRE:index" SimVar is read and write so I was wondering if I can write to the FSUIPC 3366 offset to set an engine ablaze ?

Yes, of course, but only with FSX. It doesn't work before FSX SP1. And it doesn't work for the APU, only engines 1 - 4. Why don'ty you simply try it, either via FSInterrogate, or by adding an FSUIPC control using Offset Byte Set or Setbits.

Regards

Pete

Link to comment
Share on other sites

Hi Pete,

OK, I gave it a try, I'm trying to kill an engine fire in the below code:

FSUIPC_Read(ENGINE_FIRE, 1, &engine_fire, &dwResult);

if ( kill_fire == 1 && ( engine_fire & 1 )){
	engine_fire ^= 1;
	kill_fire = 0;
	FSUIPC_Write(ENGINE_FIRE, 1, &engine_fire, &dwResult);
	FSUIPC_Process(&dwResult);
}

(kill_fire is a local variable to indicate when the fire extinguisher handle is pulled)

I can read offset 3366 and bit 0 and 1 give the correct value for burning engines or not. If engine 1 is on fire and I set the respective bit to "0" however that doesn't do anything to the fire burning. The bit is correctly set to "0" but the engine is still burning. Guess this is an FSX related related issue rather than FSUIPC related.

Björn

Link to comment
Share on other sites

Hi Pete,

OK, I gave it a try, I'm trying to kill an engine fire in the below code:

FSUIPC_Read(ENGINE_FIRE, 1, &engine_fire, &dwResult);

if ( kill_fire == 1 && ( engine_fire & 1 )){
	engine_fire ^= 1;
	kill_fire = 0;
	FSUIPC_Write(ENGINE_FIRE, 1, &engine_fire, &dwResult);
	FSUIPC_Process(&dwResult);
}

I assume "ENGINE_FIRE" is 0x3366?

You are testing for "engine_fire & 1" before you've actually read the value -- the _Read only queus the read, you need a Process to fire it off.

I can read offset 3366 and bit 0 and 1 give the correct value for burning engines or not. If engine 1 is on fire and I set the respective bit to "0" however that doesn't do anything to the fire burning.

It works fine here -- the fire extinguishes in a few seconds, not immediately.

Please please please use the tools provided to check these things. There are IPC read and write logging facilities in FSUIPC's logging tab to help you work out what you have wrong, and there is a program called FSInterrogate which is very easy to use to verify operation of offsets. I shouldn't need to debug folks code for them, really.

Regards

Pete

Link to comment
Share on other sites

Thx Pete,

Sorry about the incomplete code, I just wanted to give you a general idea of what I was doing, wasn't trying to be complete.

Here's what I found out:

Using the code (via offset 3366) will start a fire but it wil not stop the fire if you read the "ENGINE2_ON_FIRE" c-variable, nor the "ENG ON FIRE:x" XML variable, it will stop the fire if you check offset 3366 again. Also if you look at the failures dialog, the failure can be turned on and off again through code...

Must be something internal to FSX.

Björn

Link to comment
Share on other sites

Using the code (via offset 3366) will start a fire but it wil not stop the fire if you read the "ENGINE2_ON_FIRE" c-variable, nor the "ENG ON FIRE:x" XML variable, it will stop the fire if you check offset 3366 again.

sorry, I don't really understand how stopping a fire is achieved by reading anything. It's writing 0 to the appropriate bit which does it. I tested by actually doing it whilst watching the fire in the external 3D view. This is how I know it takes a few seconds for the fire to go out and the smoke to disperse.

Maybe I'm misunderstanding something about what you are saying?

Regards

Pete

Link to comment
Share on other sites

Hi Pete,

Tried the FSinterogator approach and still doesn't work, in fact the same thing happens as through the code that I sent.

In the "normal" situation offset 3366 returns 0x00, I then set it to value "1" (with FSINterogator) and FSInterogator will return "0x0D" (13), engine 1 is now on fire and the Failures dialog shows that engine 1 fire is in a failed state. Fine... Setting 3366 back to "0" also works fine, and the failures dialog will show engine 1 fire is off. Great ! Except that the XML and the C variables that I mentionned in my previous posts are still showing that the fire is burning.

Note that in the piece of code that I sent:

engine_fire ^= 1; ==> switches engine_fire bit 0 from 1 to 0
   FSUIPC_Write(ENGINE_FIRE, 1, &engine_fire, &dwResult);
   FSUIPC_Process(&dwResult);

I don't understand why it works in your setting and not in mine.

Anyway, I will try the same thing tonight on the standard FSX aircraft and see what happens there... probably something else in my panel which is not working as it should...

Kind regards and thanks for the help,

Björn

Link to comment
Share on other sites

In the "normal" situation offset 3366 returns 0x00, I then set it to value "1" (with FSINterogator) and FSInterogator will return "0x0D" (13), engine 1 is now on fire and the Failures dialog shows that engine 1 fire is in a failed state.

But 13 means engines 3 and 4 are also on fire! Please enable IPC read and write Logging in FSUIPC and show me that in the Log.

Fine... Setting 3366 back to "0" also works fine, and the failures dialog will show engine 1 fire is off. Great ! Except that the XML and the C variables that I mentionned in my previous posts are still showing that the fire is burning.

Sorry, I know nothing at all about XML and C variables. I observe that the fire is extinguished from outside the aircraft. Do you? Isn't that what matters?

I don't understand why it works in your setting and not in mine.

Have you even looked to see if the fire is put out? Why are you trusting in some XML variables only? Maybe those go wrong here too, I don't know.

Anyway, I will try the same thing tonight on the standard FSX aircraft and see what happens there... probably something else in my panel which is not working as it should...

I have no panel in my cockpit -- I use a PMDG 737NG mofel with no Gauges whatsoever, as I have a hardware cockpit using Project Magenta. It works fine with that. I'll do a test for you here on my dev PC using the default 737.

[LATER]

Yes, it works on the default 737. When I write 1 to 3366, the Engine 1 fire starts, and 3366 reads back 1, not 13. I really don't know how you are getting 13.

When I write 0, it reads back 0 immediately (but I think that is merely because FSUIPC is providing the current value it has, which is the one you wrote), and the fire visibly extinguishes in about 10-15 seconds. It does not extinguish immediately -- maybe you are not waiting long enough?

I will change FSUIPC for this variable so that it doesn't copy the written value to the read-back value, as it does with most -- I have to make such exceptions here and there, but in general it is better (for toggling purposes) to readback the written value, so that is what my code does except for flagged exceptions.

Testing that change now ...

[LATER STILL]

Okay. Some observations:

(1) If you are using the FSInterrogate "Quick Data Window" facility to test reads and writes, please note that there is a bug in it where Hex values are decoded wrongly when writing. It may be that "0x01" is being written as 13, which is why you are seeing it. I have told Pelle about this and, when he has time, he will be fixing it. Meanwhile, either use the Interrogation facility and its single read/write options (which have separate entries for each data size and hex / decimal) or change the data type in the Quick Data window to "decimal", which seems to work okay.

(2) The readback you get from FSUIPC is indeed only what you writer. Download 4.283 from here:

http://fsuipc.simflight.com/beta/FSUIPC4283.zip

and you will then see that after writing the 0 to extinguish the fire, it continues to read back 1 until the fire does actualy extinguish.

(3) I believe, then, that you weill find that your XML / C variables behave in the same way. That the fire does extinguish, but it takes 10-15 seconds.

Regards

Pete

Link to comment
Share on other sites

Thx Pete,

Yes I got it working now ! There was a problem wit the aircraft.cfg file probably as it was pointing to a defective effects file it seams. Strangely enough this caused the fires not to go out . Not sure why that is ! I removed the reference to the effects file and the problem was solved.

The FSInterogator returning 0x0D when the number one engine is on fire, is correct, that's also what I get back from offset 3366 in FSUIPC.

Thanks for the help Pete, really much appreciated !

Björn

Link to comment
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
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use. Guidelines Privacy Policy We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.