Sign in to follow this  
Guest Itchycoo

Engine fire and oil leak via SimConnect

Recommended Posts

Hi,I'd like to turn on the engine fire and oil leak, which is available in missions and in failures. I looked for it in the SDK and found these things: "ENG ON FIRE" and "GENERAL ENG OIL LEAKED PERCENT". ENG ON FIRE does not work. (Maybe it belongs to the engine startup procedure?) The oil leak raises an exception when I write.Is it possible to turn these on and off?Thanks,Endre

Share this post


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

When setting the ENG ON FIRE boolean, did you include the index for which engine it is supposed to be effecting? It should be the same for the Oil Leak var.For example, ENG ON FIRE:0 for engine 1.The oil variable takes a precentage, I wonder if that has anything to do with it. What exception was it throwing?Also, would you mind posting the relevant bit of code so we can see if we can replicate the issue?Thanks,

Share this post


Link to post
Share on other sites

Ok, so the ENG ON FIRE thing didn't work for me either.I'll be posting about it on my blog later to try to get some help figuring it out.I was looking at old documentation I think for the oil thing. It's a read only variable according to the SDK docs.

Share this post


Link to post
Share on other sites

Yes, I included the index for both vars:enum DEFINITIONS{ EngineFire, OilLeak,};[structLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi, Pack = 1)]struct EngineFire{ public bool ENG1_ON_FIRE; public bool ENG2_ON_FIRE; public bool ENG3_ON_FIRE; public bool ENG4_ON_FIRE;}[structLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi, Pack = 1)]struct OilLeak{ public float OIL_LEAK1; public float OIL_LEAK2; public float OIL_LEAK3; public float OIL_LEAK4;}//Engine firessimconnect.AddToDataDefinition(DEFINITIONS.EngineFire, "ENG ON FIRE:0", null, SIMCONNECT_DATATYPE.INT32, 0.0f, SimConnect.SIMCONNECT_UNUSED);simconnect.AddToDataDefinition(DEFINITIONS.EngineFire, "ENG ON FIRE:1", null, SIMCONNECT_DATATYPE.INT32, 0.0f, SimConnect.SIMCONNECT_UNUSED);simconnect.AddToDataDefinition(DEFINITIONS.EngineFire, "ENG ON FIRE:2", null, SIMCONNECT_DATATYPE.INT32, 0.0f, SimConnect.SIMCONNECT_UNUSED);simconnect.AddToDataDefinition(DEFINITIONS.EngineFire, "ENG ON FIRE:3", null, SIMCONNECT_DATATYPE.INT32, 0.0f, SimConnect.SIMCONNECT_UNUSED);//Fuel leakssimconnect.AddToDataDefinition(DEFINITIONS.OilLeak, "GENERAL ENG OIL LEAKED PERCENT:0", null, SIMCONNECT_DATATYPE.FLOAT32, 0.0f, SimConnect.SIMCONNECT_UNUSED);simconnect.AddToDataDefinition(DEFINITIONS.OilLeak, "GENERAL ENG OIL LEAKED PERCENT:1", null, SIMCONNECT_DATATYPE.FLOAT32, 0.0f, SimConnect.SIMCONNECT_UNUSED);simconnect.AddToDataDefinition(DEFINITIONS.OilLeak, "GENERAL ENG OIL LEAKED PERCENT:2", null, SIMCONNECT_DATATYPE.FLOAT32, 0.0f, SimConnect.SIMCONNECT_UNUSED);simconnect.AddToDataDefinition(DEFINITIONS.OilLeak, "GENERAL ENG OIL LEAKED PERCENT:3", null, SIMCONNECT_DATATYPE.FLOAT32, 0.0f, SimConnect.SIMCONNECT_UNUSED);//1st engine fireEngineFire EnginesOnFire = new EngineFire();EnginesOnFire.ENG1_ON_FIRE = true;EnginesOnFire.ENG2_ON_FIRE = false;EnginesOnFire.ENG3_ON_FIRE = false;EnginesOnFire.ENG4_ON_FIRE = false;simconnect.SetDataOnSimObject(DEFINITIONS.EngineFire, SimConnect.SIMCONNECT_OBJECT_ID_USER, SIMCONNECT_DATA_SET_FLAG.DEFAULT, EnginesOnFire);//1st engine oil leakOilLeak EngOilLeak = new OilLeak();EngOilLeak.OIL_LEAK1 = 50.0f;EngOilLeak.OIL_LEAK2 = 0.0f;EngOilLeak.OIL_LEAK3 = 0.0f;EngOilLeak.OIL_LEAK4 = 0.0f;simconnect.SetDataOnSimObject(DEFINITIONS.OilLeak, SimConnect.SIMCONNECT_OBJECT_ID_USER, SIMCONNECT_DATA_SET_FLAG.DEFAULT, EngOilLeak);The engine fire doesn't work, as you wrote in your second post. I know, the oil leak is read only. (Exception code is 20.) That's why I asked, there is an other way to turn these on/off. :-)

Share this post


Link to post
Share on other sites

Sorry to dig up an old topic but I am trying to implement a similar feature in a little application I am creating. I am fairly new to FSX programming and my goal is to create a little app that monitors how I am treating the engines and triggers failures if I become to rough. I am making good progress and have been able to trigger engine fires without any problems however I can't see anyway of triggering oil leaks or oil system failures. Whilst both of these are easily set via FSX failures it seems you can't trigger them via SimConnect? I was just wondering if others had found an event/simvar which I could use to simulate oil related failures?

Share this post


Link to post
Share on other sites

>Yes, I included the index for both vars:>enum DEFINITIONSIn my tests both the Engine Fire and Oil Leaked Sim Vars are writeable without error. The Engine Fire ones most certainly do start an engine fire when set -- I have used this, via FSUIPC4, in my cockpit, whilst testing my fire subpanel (the logic of which is dealt with via pmSystems). The fire and smoke become visible on the user aircraft. (I've not tried causing one on an AI aircraft though).The oil leak percentage can be written. I haven't checked whether it stays, or gets overwritten soon after -- it is easy enough to check, though, via FSUIPC4 using FSInterrogate.I'm not sure what you are doing wrong, but you may find it useful to experiment with FSUIPC4 and FSInterrogate. If you do this with SimConnect logging enabled you can see exactly what FSUIPC4 is doing. You don't need to buy it.RegardsPete

Share this post


Link to post
Share on other sites

Hi Pete,Thanks for the reply. This maybe a stupid question but in order to use FSUPIC via my application is there an SDK I can download and install? I have checked on your website but the SDK there seems to relate to FS2004 and below, I couldn't find anything for FSX.

Share this post


Link to post
Share on other sites

>This maybe a stupid question but in>order to use FSUPIC via my application is there an SDK I can>download and install? I have checked on your website but the>SDK there seems to relate to FS2004 and below, I couldn't find>anything for FSX.My Support Forum carries all sorts of pre-released and interim updates, including additional files relating to the SDK. Please check the Announcements there. The main release SDK is still applicable to FSX (the whole point of FSUIPC has always been FS-version-independent development), but the FSX offsets list does provide extras applicable to FSX only.Incidentally, I've just tried setting the oil quantity to lower values via FSUIPC4 (using FSInterrogate). FSUIPC4 implements this by increasing the "Leaked" value. This works fine, and indeed the oil leakage value in SimConnect reflects the change correctly.However, in the default 737 at least this does not appear to have any effect on either the oil pressure or oil temperature. Maybe this system is only modelled on some aircraft. I haven't tried any others, yet.RegardsPete

Share this post


Link to post
Share on other sites

Thank you Pete! I'll check your forums and go from there. I have also noticed some strange issues with the engine behaviour when I have forced certain variables up or down - generally the engine behaved as normal as it would not in real life. It's for this reason I have decided to embark on FSX programming to try and model realistic engine behaviour (I am mostly targeting GA aircraft).I really appreciate your help.Maccas

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