• Which the release of FS2020 we see an explosition of activity on the forun and of course we are very happy to see this. But having all questions about FS2020 in one forum becomes a bit messy. So therefore we would like to ask you all to use the following guidelines when posting your questions:

    • Tag FS2020 specific questions with the MSFS2020 tag.
    • Questions about making 3D assets can be posted in the 3D asset design forum. Either post them in the subforum of the modelling tool you use or in the general forum if they are general.
    • Questions about aircraft design can be posted in the Aircraft design forum
    • Questions about airport design can be posted in the FS2020 airport design forum. Once airport development tools have been updated for FS2020 you can post tool speciifc questions in the subforums of those tools as well of course.
    • Questions about terrain design can be posted in the FS2020 terrain design forum.
    • Questions about SimConnect can be posted in the SimConnect forum.

    Any other question that is not specific to an aspect of development or tool can be posted in the General chat forum.

    By following these guidelines we make sure that the forums remain easy to read for everybody and also that the right people can find your post to answer it.

FSX SimConnect to induce failures

Messages
639
Country
panama
I am trying to generate/induce system failures (such as engine failures) using managed code (C#) with the SimConnect library.

However, in looking at the documentation I found that all the "failure" System Variables are NOT settable.

So, how can I induce a failure using SimConnect? am I missing something?
 
hmmmm... not sure what you're asking here. If some failure vars are not settable, then they are not settable. Looking at the docs, the engine failure vars are NOT settable. That means the engine failure is produced internally, in the FS engine, and is not available to SimConnect. What exactly are you trying to do?
 
I was looking at other vars somehow, BUT there is a bunch of SimVars prefixed "PARTIAL PANEL" followed by the name of a gauge such as AIRSPEED, VARIOMETER, etc that are settable. However, I have not managed to get them to fail when I set it to the Fail value or even the Blank value. They just keep working as if nothing had happened.
 
Its best to copy the sim variables into a custom variable and then you can control whether or now that variable will display the value.
 
How can I do with managed code? I don't see any example or mention of a custom variable. Note I am NOT building a gauge, I want to put an existent standard gauge in a failure state.

Simulation Variable Description Units Settable Multiplayer
----------------------------------------------------------------------------------------------------
PARTIAL PANEL ADF Gauge fail flag (0 = ok, 1 = fail, 2 = blank) Enum Y -
PARTIAL PANEL AIRSPEED Gauge fail flag (0 = ok, 1 = fail, 2 = blank) Enum Y -
PARTIAL PANEL ALTIMETER Gauge fail flag (0 = ok, 1 = fail, 2 = blank) Enum Y -
PARTIAL PANEL ATTITUDE Gauge fail flag (0 = ok, 1 = fail, 2 = blank) Enum Y -
PARTIAL PANEL COMM Gauge fail flag (0 = ok, 1 = fail, 2 = blank) Enum Y -
PARTIAL PANEL COMPASS Gauge fail flag (0 = ok, 1 = fail, 2 = blank) Enum Y -
PARTIAL PANEL ELECTRICAL Gauge fail flag (0 = ok, 1 = fail, 2 = blank) Enum Y -
PARTIAL PANEL AVIONICS Gauge fail flag (0 = ok, 1 = fail, 2 = blank) Enum N -
PARTIAL PANEL ENGINE Gauge fail flag (0 = ok, 1 = fail, 2 = blank) Enum Y -
PARTIAL PANEL FUEL INDICATOR Gauge fail flag (0 = ok, 1 = fail, 2 = blank) Enum N
PARTIAL PANEL HEADING Gauge fail flag (0 = ok, 1 = fail, 2 = blank) Enum Y -
PARTIAL PANEL VERTICAL VELOCITY Gauge fail flag (0 = ok, 1 = fail, 2 = blank) Enum Y -
PARTIAL PANEL TRANSPONDER Gauge fail flag (0 = ok, 1 = fail, 2 = blank) Enum Y -
PARTIAL PANEL NAV Gauge fail flag (0 = ok, 1 = fail, 2 = blank) Enum Y -
PARTIAL PANEL PITOT Gauge fail flag (0 = ok, 1 = fail, 2 = blank) Enum Y -
PARTIAL PANEL TURN COORDINATOR Gauge fail flag (0 = ok, 1 = fail, 2 = blank) Enum N -
PARTIAL PANEL VACUUM Gauge fail flag (0 = ok, 1 = fail, 2 = blank) Enum Y

Events (Aircraft Failures)
Event ID String Name Description Multiplayer
KEY_TOGGLE_VACUUM_FAILURE TOGGLE_VACUUM_FAILURE Toggle vacuum system failure Shared Cockpit
KEY_TOGGLE_ELECTRICAL_FAILURE TOGGLE_ELECTRICAL_FAILURE Toggle electrical system failure Shared Cockpit
KEY_TOGGLE_PITOT_BLOCKAGE TOGGLE_PITOT_BLOCKAGE Toggles blocked pitot tube Shared Cockpit
KEY_TOGGLE_STATIC_PORT_BLOCKAGE TOGGLE_STATIC_PORT_BLOCKAGE Toggles blocked static port Shared Cockpit
KEY_TOGGLE_HYDRAULIC_FAILURE TOGGLE_HYDRAULIC_FAILURE Toggles hydraulic system failure Shared Cockpit
KEY_TOGGLE_TOTAL_BRAKE_FAILURE TOGGLE_TOTAL_BRAKE_FAILURE Toggles brake failure (both) Shared Cockpit
KEY_TOGGLE_LEFT_BRAKE_FAILURE TOGGLE_LEFT_BRAKE_FAILURE Toggles left brake failure Shared Cockpit
KEY_TOGGLE_RIGHT_BRAKE_FAILURE TOGGLE_RIGHT_BRAKE_FAILURE Toggles right brake failure Shared Cockpit
KEY_TOGGLE_ENGINE1_FAILURE TOGGLE_ENGINE1_FAILURE Toggle engine 1 failure Shared Cockpit
KEY_TOGGLE_ENGINE2_FAILURE TOGGLE_ENGINE2_FAILURE Toggle engine 2 failure Shared Cockpit
KEY_TOGGLE_ENGINE3_FAILURE TOGGLE_ENGINE3_FAILURE Toggle engine 3 failure Shared Cockpit
KEY_TOGGLE_ENGINE4_FAILURE TOGGLE_ENGINE4_FAILURE Toggle engine 4 failure Shared Cockpit
 
Map those events to simconnect using their XML strings (ie no KEY_ prefix or as seen in the SDK docs) and then call SimConnect_TransmitClientEvent I think...
 
The failure events I have chosen to use do work fine with the TransmitClientEvent() method. The problem is with the SimVars which offer a greater variety of gauge/system failures (messy implementation from ACES) and that is what doesn't seem to work.
 
Hmm...the only type of variables I have tried to set are FLOAT64. I am not sure how it would work for non double types....Doug Dawson might be of more help.
 
True but DD might be able to speak some simconnect for handling non FLOAT64 types in general....:D
 
I have used Int32 without problems, if you get it wrong SimConnect will throw you an exception with code "Invalid data type".

The problem is with the ill documented SDK and that some things are marked writable when apparently they are not.

It is Pete Dowson BTW but he doesn't speak C#.
 
No there is a Doug Dawson and a Pete Dawson....PD normally hangs out in the FSUIPC forum (he made it) and DD hangs out here helping noobs and has made a lot of modules to make things easier for noobs.
 
You have two options to create failures.. You either use the provided events like TOGGLE_ENGINE1_FAILURE.

You have to keep in mind that these are yes/no situation. If yes the affected system will be 100% failed. If you want to create a more gradual failure situation then you will have to make use of the variables for the selected system and change them as you wish.

For example, you want to fail the flaps. There is no toggle_flap_failure event. So you have to create one by using the TRAILING EDGE FLAPS LEFT PERCENT and TRAILING EDGE FLAPS RIGHT PERCENT variables, so you will have create the logic that will make them malfunction.

In this example if you use TOGGLE_HYDRAULIC_FAILURE to generate a flap failure, you will affect all hydraulic powered systems as well.
 
Back
Top