Starting with X-Plane 11.30, it is possible to equip high-flying aircraft with an oxygen system rather than or in addition to the pressurized cabin, to allow realistic black-out behavior also with unpressurized aircraft.

Crew oxygen system

The crew oxygen system employs an oxygen bottle or canister in which gaseous oxygen is stored under high pressure. These systems are found in high-flying GA-aircraft like a Cirrus SR22 or a Cessna Caravan. They supply oxygen to ports into which either a mask is plugged in directly, or via a pulse demand regulator. Typically, 1 to 8 people are plugged into such a system, each consuming 60-150 liters of oxygen per hour, depending on altitude.
In airliners, typically the cockpit is equipped with such a system, where flight crew and observer stations all have masks hooked up to demand regulators. Note that this system is typically NOT connected to the passenger oxygen masks in the cabin.

Passenger oxygen system

The passenger oxygen system in airliners usually uses chemical oxygenators (using potassium superoxyde) that are usually directly connected to a mask or several masks. These masks rest in little compartments above the passengers. The compartments are latched closed, and all that the passenger oxygen system activation typically does is electrically unlatch the compartment doors (which doesn’t start the chemical reaction yet). When the oxygen compartment doors are open, the passengers will pull the oxygen mask to their face, which pulls a lanyard connected to the firing pin of the chemical oxygen generator. This initiates the flow of oxygen to the passenger’s oxygen mask. The reservoir bags on the passenger oxygen masks begins to fill with oxygen. The chemical oxygen generator supplies approximately 13-22 minutes of oxygen to each mask. When activated, the oxygen generator surface temperature may reach 260C, which is why you don’t want to reach up into the compartment once you have pulled the mask out.

Crew oxygen system simulation in X-Plane

To equip an aircraft with a crew oxygen system, go to the second equipment tab of Plane Maker, and enter the crew oxygen bottle capacity in liter. Note that this refers to the volume of compressed oxygen in a typical 1800psi bottle. For reference, a popular Mountain High Oxygen system in a Cirrus SR22 has a capacity of 415 liter, and that will supply three people for about one hour and ten minutes at 18.000 feet.

To use the oxygen system in your panel or plugin, you can then use the following datarefs:

sim/cockpit2/oxygen/actuators/o2_valve_on - this turns on the valve that allows oxygen to flow from the bottle through the pressure reducer to the ports.
sim/cockpit2/oxygen/actuators/num_plugged_in_o2 - this is how many people have masks plugged into those ports and are using them
sim/cockpit2/oxygen/actuators/demand_flow_setting - this is how the oxygen flow to the masks is regulated.
0: Off - no flow
1: Unregulated - the masks are plugged in directly, there is no pulse demand regulator
2: N - the pulse demand regulator is in N mode
3: D5 - the pulse demand regulator is in D5 mode
4: D10 - the pulse demand regulator is in D10 mode
5: F1 - the pulse demand regulator is in F1 mode
6: F2 - the pulse demand regulator is in F2 mode
7: F3 - the pulse demand regulator is in F3 mode
8: F4 - the pulse demand regulator is in F4 mode

These settings will have great influence on how fast you are going to deplete your oxygen reserve. For example, unregulated mode will blast you with oxygen regardless of your pressure altitude, whereas a demand regulator will give you less oxygen at lower pressure altitudes. For more information on the simulated pulse demand regulator, see the documentation of the real O2D2-G2 from Mountain High Oxygen:

To see the result of your oxygen consumption, you can use the following datarefs:

sim/cockpit2/oxygen/indicators/o2_bottle_pressure_psi - the pressure of the bottle, which is an indirect indication of how much is left in there (note that it's not completely linear with the remaining volume).
sim/cockpit2/oxygen/indicators/o2_bottle_rem_liter - this is cheating, and telling you the actual volume. Note that not all of that is useable, since the flow rate will drop when the pressure gets too low. For reference, a 415 liter system should be considered to have about 370 useable liter before you see a decrease in flow rate.
sim/cockpit2/oxygen/indicators/pilot_felt_altitude_ft - This is how good your mask user feels. The lower the altitude, the better. Hypoxia symptoms (X-Plane blackout) will begin at 12.500ft and be obvious at 15.000ft. 

Finally, if you want complete control over oxygen and pilot health, you can set the override


which will allow you to set all these datarefs from your plugin and thus also completely control the blackout.

Passenger Oxygen System in X-Plane

The passenger oxygen has been implemented since X-Plane 9.30 as a failure and annunciator dataref, exposed in the simulator as the “Passenger O2 on” failure.

X-Plane 11.30 adds the following functionality: When your aircraft type is airliner, your aircraft does have a pressurized cabin (max differential pressure is greater than 0) and the cabin altitude climbs above 13,000ft, the masks are auto-deployed. Aircraft designers can check the


dataref for modelling dropped masks. If you model this in 3d, avoid using


for that purpose, otherwise you will show dropped masks when a light test is in progress!

X-Plane 11.30 adds these two new datarefs

sim/cockpit2/oxygen/indicators/pass_oxygenator_working - tells you whether the chemical oxygenator is actually still supplying oxygen
sim/cockpit2/oxygen/indicators/pass_oxygenator_min_rem - tells you how many minutes are left until they stop working

X-Plane 11.30 does not actually use these datarefs for anything yet, as it does not award points or a score. Plugin authors however can take advantage of these in combination with the cabin altitude dataref, to score passenger health for virtual airline or career system plugins.