Jump to content

Randomly enable the built-in IXEG failures - LUA script


Tom Stian

Recommended Posts

Hello

I made this LUA-script for randomly enable the built-in IXEG failures.

The script enables the built-in IXEG failures + engine fire, engine failure and oil pumps.
Have your QRH ready.

Available failures by IXEG.
FFNZVSs.png

 

The script activates when your GroundSpeed is higher then 40 knots.

Settings: (edit the IXEG_Failures.lua)

-- Here you set if the failures should be default enabled or disabled when your starting up X-Plane.
-- Set true to enable failures, false to disable. Default is true. true and false have to be written with lowercase letters.

EnableFailures_WizVar = true

-- Mean time between failures (MTBF) is the predicted elapsed time between inherent failures of a system during operation.
-- Default is MTBF_hours = 20.0. See further down for of a example of MTBF set to 10 hours.

MTBF_hours = 20.0

-- Max simultaneous failures pr session
-- Default is Max_Failures = 2  -- The highest numbers of failures is 27 -- setting above this can crash x-plane

Max_Failures = 2

-- Set the level of failures you want. 
-- 1 = Minor failures, 2 = Minor and Major failures, 3 Minor, Major and Critical failures.

FailureSeverity = 3

 

"ADVANCED OPTIONS"

-- Set 'ImminentFailure' to 1 to enable the imminent failure option. When this option is enabled you can trigger a imminent failure with setting the SERVICE INTERPHONE to ON position on the overhead panel.
-- The SERVICE INTERPHONE will switch back to OFF when a failure is triggered.
-- The 'ImminentFailureMTBF' (in minutes) is the MTBF used when you enable the 'ImminentFailure' and set the SERVICE INTERPHONE to on.

-- Default is 0. 
ImminentFailure = 0
-- Default is 5 (in minutes)
ImminentFailureMTBF = 5

The Service Interphone switch

WxwlbJA.png


How to enable or disable failures (for the session) with FlywithLua menu.

1zpNYpY.png

 

MTBF:
This graph shows a example how often you can expect a failure when you set the MTBF to 10 hours.

2NZQelW.png

 

 

Requirement:
- You need FlyWithLua installed - 
XP10: http://forums.x-plane.org/index.php?/files/file/17468-flywithlua-for-xp9-and-xp10/
XP11: http://forums.x-plane.org/index.php?/files/file/35579-flywithlua-for-x-plane-11-and-10-windows-linux-mac-os-x-version/
- Tested on X-Plane 11 with Windows 10.

Installation:
- Simply place the script in [X-Plane]\Resources\plugins\FlyWithLua\Scripts

Logging:
Every failure is logged. You can find the logfile in your X-Plane root folder. The logfile is called IXEG_Failures.log

 

Here is a sample of the logfile.

I08Cwxh.png

 

Known bugs/limitations:
- None. But please report if you find one :)

 

Changelog:

0.113
- Added failures for landing gear.

0.112
- Added option 'Imminent Failure'.
- Changed default MTBF from 10 to 20 hours.


You can download the script here:

http://forums.x-pilot.com/files/file/1054-randomly-enables-failures-for-ixeg-733/

 

Edited by Tom Stian
New version v0.113
  • Upvote 8
Link to comment
Share on other sites

Nice. Will test it in a shared cockpit.

29 minutes ago, Tom Stian said:

Hello

I made a simple LUA-script for randomly enable the IXEG failures.
Im not a programmer. Last experience with programming was Turbo Pascal v7.0 for "some" years ago. So the script aint pretty or perfect ;)

The scripts enable the IXEG failures + engine fire and engine flameout. Have your QRH ready.

The scripts only activates when your GroundSpeed is more then 40kts.

Settings:
- Its two settings you can change.

-- Max simultaneous failures pr session (Set to 0 to disable)
Max_Failures = 2

-- FailurePercent/factor is (not percent atm) (1-100) chance of failure. Higher number = higher chance of failure.
FailurePercent = 10 
Try out different values here. Not sure if 10 is often enough really. 

Requirement:
- You need FlyWithLua installed - http://forums.x-plane.org/index.php?/files/file/17468-flywithlua-for-xp9-and-xp10/

Installation:
- Simply place the script in [X-Plane]\Resources\plugins\FlyWithLua\Scripts

Known bugs/limitations:
- Same failure can be triggered twice.
- The routine for trigger the failures is not that god (yet?) My goal was to have a percentage chance of failure pr 10 hour of flying. But dident manage to make a good enough routine for that. So its very simplified now.

You can download the script here:

IXEG_failures.lua

 

Link to comment
Share on other sites

2 minutes ago, birdy.dma said:

Flight of 1 hour and some minutes, FailurePercent set on 40, Nothing happen (version 0.103).

Thanks for trying the script. You could just be luck(unlucky) that a failure dident trigger.

One additional condition that needs to be meet are PLANE_ICAO == "B733"  

You can check that out if you select Plugins->FlyWithLua Macros-> Enter a line of code

On the red line just enter PLANE_ICAO . You dont need to hit enter. It should show your current PLANE_ICAO.

For next version, I will have a short message that says if the script are loaded/enabled.

But will look into it to see if I did miss something.

Thanks again for your time.

 

Link to comment
Share on other sites

It's my pleasure, No time wasted!

My install of FlyWithLua was not correct. I have to redo the test.

Claude.

10 hours ago, Tom Stian said:

Thanks for trying the script. You could just be luck(unlucky) that a failure dident trigger.

One additional condition that needs to be meet are PLANE_ICAO == "B733"  

You can check that out if you select Plugins->FlyWithLua Macros-> Enter a line of code

On the red line just enter PLANE_ICAO . You dont need to hit enter. It should show your current PLANE_ICAO.

For next version, I will have a short message that says if the script are loaded/enabled.

But will look into it to see if I did miss something.

Thanks again for your time.

 

 

Link to comment
Share on other sites

On 10.8.2016 at 11:44 PM, birdy.dma said:

Flight of 1 hour and some minutes, FailurePercent set on 40, Nothing happen (version 0.103).

Did some longer testing now.

Yesterday I had a failure after about 10 hours.

And today I got one after 47 minutes. 

This is with setting FailurePercent set to 10.

  • Upvote 1
Link to comment
Share on other sites

  • 3 weeks later...

I have no idea if anyone is using this script. :)

But have made a minor update with som tweaks. 

I have for sure made my flights a bit more interesting.
For some days ago I did leave X-Plane for 10 min during a flight. When I came back I found the plane spinning around due to a engine fire.
The flight ended here ;)

mJeJHuF.png

 

Link to comment
Share on other sites

  • 8 months later...

I cannot download this file. "The page you are trying to access is not available for your account.". Can you please post the file to another board or another location where I can download it from please? I would be very interested in using it. Thank you in advance.

Edit: or perhaps you (or anyone who has version 1.05) could mail it to me? dv20@teletronic.at Thanks

Edited by greuff
mail
Link to comment
Share on other sites

1 hour ago, greuff said:

I cannot download this file. "The page you are trying to access is not available for your account.". Can you please post the file to another board or another location where I can download it from please? I would be very interested in using it. Thank you in advance.

Edit: or perhaps you (or anyone who has version 1.05) could mail it to me? dv20@teletronic.at Thanks

Hello.

I have uploaded it to the file library.

Maybe you have better luck downloading from there

 

 

Link to comment
Share on other sites

Hi all 

A new version is available.

0.108
- Added failures for Oil Pump

0.107
- Changed the logging system. Every failure will be logged in [X-Plane]\IXEG_Failures.log
- Fixed the slow leak failure for system B.
- Engine flameout failure is changed with engine failure.
- Removed smoke in cockpit failure

Edited by Tom Stian
0.108 is now up
  • Upvote 1
Link to comment
Share on other sites

A new semi "major" update is available ;)

0.109
- You can now only get one type of hydraulic leak pr system. Example: You cannot get a fast leak and then a slow leak on system A.
- You can now only get one type of failure pr engine. Failures available is engine fire or engine failure.
- Bug fix: The same failure will not be triggered twice.
 

  • Upvote 2
Link to comment
Share on other sites

  • 3 weeks later...

A little story from my last flight.

Had a interesting flight yesterday between LSZH (Zurich) and ESSA (Arlanda) during a VATSIM event, when a failure was triggered.

Its fun to (try) troubleshooting and find out what has happend without looking at the logfile or the failures menu.

 

(All picture is taken on ground just to illustrate)

il6qKoR.png

I had about 400-500nm left on my flight to ESSA when I got this master caution.
I obvious have some issues with flight controls and the hydraulics. So my next step is to look at the overhead panel.

 

sqd2tyj.png

The first I notice is that both hydraulic pumps for SYSTEM B is indicating LOW PRESSURE. And I noticed the indicators for the flight controls, but my main concern was the hydraulics.

 

lz1Hbn8.png

So I checked the pressure and quantity for SYSTEM B and confirming that I have a total loss of that hydraulic system.

 

So I was thinking, what to do, what to do. I had no problems flying the aircraft with the autopilot. And everything else worked fine.

My next step was to check if the QRH was covering this issue. And it did. Luckly for me.

 

9J8mm63.png

 

 

First two steps is to set SYSTEM B FLIGHT CONTROL SWITCH to STBY RUD and set both hydraulic pumps for SYSTEM B to off.

wPN2OGH.png

 

1MYzK3G.png

 

So far so good. Still flying. And I made a decision to continue my flight to my destination as planed, it was after all a nice VATSIM event with alot of traffic. ;)

I started planing my next steps.
What system have I lost ? How do I handle that ?

The QRH says this.
Systems that are handled by SYSTEM B is.

  • Outboard flight spoilers.
  • Autopilot B. - No issue for me, flying on Autopilot A.
  • Yaw damper.
  • Alternate nose wheel steering. No issue SYSTEM A is covering Nose wheel steering.
  • Normal brakes.  SYSTEM A have to handle the brakes, and that means that Autobrake is INOP. Manual braking only.

 

SYSTEM B is also covering flaps, so alternate flaps have to be used. 
The QRH says I should plan for a FLAP 15 landing. Not sure why, but could be performance issues with a go around or if I lose of a engine, since I cant retract the flaps with the alternate system.

Active runway for landing at ESSA this night was 01R (2500 meters). I did ask ATC for 01L (3300 meters) for landing, but it was denied (shame on you ATC) ;)

So 01R it is. Winds calm.

VREF with FLAPS 15 was 144knots + 15. So my approach speed would be 159kts.

The QRH says that alternate flaps extension from flaps 0 to flaps 15 takes 2 minutes. So had to plan this and make sure I was able to set flaps 15 in time. 

On the approach.
At < 230kts I enabled the alternate flaps.
Set the flap lever to desired flap position and extend flaps on maneuvering speed schedule using the alternate flaps position switch.

poPKYhW.png

 

Landing checklist:
1MiOedN.png

 

I was able to set the flaps in time and the landing went fine.

You can learn so much from the failures IXEG have made availble for us. And a 2 hour "boring" flight from A to B can be pretty busy when you need to start troubleshooting and flying the aircraft at the same time. :)

Pretty sure I was doing a lot of mistakes, but it was great fun :)

 

From the logfile.

HaMPYP4.png

The flight on vatsim:
https://vataware.com/flight/5926fe4253523315c9000008

 

  • Upvote 8
Link to comment
Share on other sites

Nice post!

And I want to add I was hearing someone declaring PAN-PAN-PAN in Swedish airspace as while crossing it, I guess that was you, I did compare date and time. :)  I was thinking at that time: "Heck I am glad I did not decide to arrive to ESSA", it was quite busy I did hear. My travel was instead to EFHK from ENGM.

Glad it worked out for ya

Link to comment
Share on other sites

Hi Tom,

excellent post and all your observations were spot on!

The reason for flaps 15 is the ability to fly a missed approach with flaps 15 without having to use the alternate system (electric engine) to retract the flaps during the go-around.

Also interesting may be the fact that you had 10% of quantity remaining in the B system - this is due to the intricate "standpipe" design of the hydraulic supply lines in the hydraulic reservoir. If you have a rupture in the engine-driven-pump circuit (most likely due to engine failures), this highest standpipe will only drain so much fluid overboard, with enough remaining for the electrically driven pump. Should there be a rupture in that system (as in your case), the fluid will drain to the lower standpipe - with enough remaining (ca. 10%) to supply the automatic slat system via the PTU, should the need arise (stall while at flaps 1-5).

In a real airliner you would probably divert to the nearest suitable airfield with declaring emergency, after all you are out of redundancy (the standby hydraulic system doesn´t really count) - but in a simulator it is acceptable to continue, of course ;).

But you can see that even loosing half of the hydraulics is pretty much a "non event", piloting wise. You land with flaps 15 and are limited to CAT1 - legally. Plus there is a startle if it happens while you are on autopilot B, which will disconnect with the warble.

Technically you could still do an autoland with a single autopilot and the flaps extended via the alternate system to 30 or 40. This would fall under the "emergency authority" of the Captain, and would only be done in very dire circumstances (inability to reach an alternate airfield with CATII or III weather prevalent).

Cheers, Jan

 

  • Upvote 5
Link to comment
Share on other sites

@Tom Stian

Nice script - You're the guy who brings us Online-Pilots into big trouble with the ATC :wub: And that's what I really like :-)

So, from the software engineer's point of view, I have some small suggestions for your script. You're declaring a bunch of global variables in your script (Max_Failures, FailFactor, Cycles,... etc). That may cause problems with other LUA scripts. So it's either a good way to declare these vars locally in a function or prefix them with something like IXEG_Failuers_Cycles [...] to make sure that no other script will accidently produce sideeffects. Especially "Cycles" is a var that'll be used quiet often.

2nd:

By adding these 2 lines behind line 16, you can Enable/Disable the script via the Macros-Menu.

add_macro( "IXEG Failures DISABLE", "Max_Failures = 0" )
add_macro( "IXEG Failures ENABLE", "Max_Failures = 2" )

Cheers and happy checklist running

  • Upvote 1
Link to comment
Share on other sites

9 minutes ago, Cosmopilot said:

@Tom Stian

Nice script - You're the guy who brings us Online-Pilots into big trouble with the ATC :wub: And that's what I really like :-)

So, from the software engineer's point of view, I have some small suggestions for your script. You're declaring a bunch of global variables in your script (Max_Failures, FailFactor, Cycles,... etc). That may cause problems with other LUA scripts. So it's either a good way to declare these vars locally in a function or prefix them with something like IXEG_Failuers_Cycles [...] to make sure that no other script will accidently produce sideeffects. Especially "Cycles" is a var that'll be used quiet often.

Sorry for making trouble for you when flying online ;)

You are right about the variables.
In my next version of my vSpeed callout script I have allready changed all variables to local. And made the datarefs unique. Since they are always global.

I will do the same job with this script.

 

14 minutes ago, Cosmopilot said:

2nd:

By adding these 2 lines behind line 16, you can Enable/Disable the script via the Macros-Menu.


add_macro( "IXEG Failures DISABLE", "Max_Failures = 0" )
add_macro( "IXEG Failures ENABLE", "Max_Failures = 2" )

 

That was a good idea. Will make that available in the next version.

Thanks for the feedback. And safe flying ;)

 

  • Upvote 1
Link to comment
Share on other sites

Well, I was lucky (or maxbe not),

IXEG Failure triggered: --------------------------
IXEG Failure triggered: Time: 14:55:23 - 31 May 2017
IXEG Failure triggered: Failure happend after: 12 minutes
IXEG Failure triggered: Failed System: EDP B FAST LEAK
IXEG Failure triggered: Failures left: 1
IXEG Failure triggered: --------------------------
IXEG Failure triggered: --------------------------
IXEG Failure triggered: --------------------------
IXEG Failure triggered: Time: 15:46:27 - 31 May 2017
IXEG Failure triggered: Failure happend after: 63 minutes
IXEG Failure triggered: Failed System: ELECTRIC HYD PUMP B
IXEG Failure triggered: Failures left: 0
IXEG Failure triggered: --------------------------
IXEG Failure triggered: --------------------------

:huh:

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...