X-Plane historically had only one windshield for the 2d cockpit, on which effects for icing, rain or wipers were displayed. With the advent of more sophisticated 3d effects, it has become necessary to simulate more than one glass surface for looking out.

Index conventions

X-Plane 12 has four distinct window surfaces. They are numbered as follows:

  1. Pilot front windshield
  2. Copilot front windshield
  3. Pilot side window
  4. Copilot side window

Even numbers refer to the left side (0 being even) and odd numbers to the right side.

Ice and defrost

Depending on temperature and weather conditions around the airplane, ice can form on the windows. The amount of ice is tracked as a ratio from 0..1 and available as an array dataref, index as per above
sim/flightmodel/failures/window_ice_per_window float[4]
The pilot can turn on electric heating for each window (a real airplane might not have heat for every window, in which case there simply wouldn’t be switches for some of the dataref indices).
sim/cockpit2/ice/ice_window_heat_on_window int[4]
controls the electric switches, which will then consume the amps set in Plane Maker for
De-ice: window heat, De-ice: window heat copilot, De-ice: l side window heat and De-ice: r side window heat respectively.
The heating elements can be failed by their respective bus, or the failure datarefs
sim/operation/failures/rel_ice_window_heat
sim/operation/failures/rel_ice_window_heat_cop
sim/operation/failures/rel_ice_window_heat_l_side
sim/operation/failures/rel_ice_window_heat_r_side

Wipers

X-Plane has two wiper speed controllers, acting on the left (even numbered) wipers and right (odd numbered wipers).
sim/cockpit2/switches/wiper_speed_switch int[2] y enum 0=park, 1=25%speed,2=50%speed,3=100%speed
Wiper speed 0 is aliased to the old wiper_speed dataref for backward compatibility for the pilot windshield.

Four wipers can be defined in Plane Maker and assigned min and max deflection angles. If your aircraft has less than four wipers, simply assign the unnecessary wipers so that angle 1 == angle 2, in which case no movement will be generated.

At runtime,
sim/flightmodel2/misc/wiper_angle_deg float[4] n degrees
tells you the deflection of each wiper and this dataref will be used to wipe the 3d rain off the windshield in the 3d cockpit as well.

Rain repellent

Some business jets don’t have wipers, and instead rely on airflow alone to run the water off of specially coated windshields.

On the ground, a blower is used to generate an airflow over the windshield, to run off water when airspeed is insufficient to do so. In X-Plane, you can turn on two blowers for left and right side with the dataref
sim/cockpit2/switches/rain_repellent_switch int[2] y boolean
This will use electric power to generate the airflow.

Meta

Topic:

  • Aircraft Development

Article type:

  • Tech Note

Version:

  • X-Plane 12