Demo entry 6324684

Engine 1 Fail

   

Submitted by anonymous on Nov 20, 2016 at 22:49
Language: C#. Code size: 2.6 kB.

% Engine 1 Fails
Engine_1failure=true
Hydraulic_A_electric_fail=true
If(Engine_1_failure):
	export_energy_Hydraulic_A_engine_pump = false
if(!export_energy_Hydraulic_A_engine_pump):
if(Hydraulic_A_electric_fail):
	Hydraulic_A_fail= true 
if(Hydraulic_A_fail):
	
	% Aileron Energy Supply
	Export_hydraulic_energy_Ailerons = false
	
	% Spoiler Power Supply
	Export_hydraulic_energy_Spoiler_1 = false
	Export_hydraulic_energy_Spoiler_2 = false
	Export_hydraulic_energy_Spoiler_3 =true
	Export_hydraulic_energy_Spoiler_4 = false
	Export_hydraulic_energy_Spoiler_5 = true
	Export_hydraulic_energy_Spoiler_6 = false
	Export_hydraulic_energy_Spoiler_7 = false
	Export_hydraulic_energy_Spoiler_8 = false
	Export_hydraulic_energy_Spoiler_9 = false
	Export_hydraulic_energy_Spoiler_10 = true
	Export_hydraulic_energy_Spoiler_11 = false
	Export_hydraulic_energy_Spoiler_12 = false

% Calculate sum of Spoiler function	
Spoiler_function=0
For i=1:12
	if (Export_hydraulic_energy_Spoiler_i = true)
		Func = 1
	Else
		Func = 0
spoiler_function = spoiler_function + func
end

% Return Spoiler Function
if(spoiler_function>=4)
	spoiler_control = true
else
	spoiler_control = false

	% Elevator Power Supply
	Export_hydraulic_energy_L_Elevator_A = false
	Export_hydraulic_energy_L_Elevator_B = true
	Export_hydraulic_energy_R_Elevator_A = false
	Export_hydraulic_energy_R_Elevator_B = true
	
	% Calculate elevator function
	if(Export_hydraulic_energy_L_Elevator ||
	Export_hydraulic_energy_L_Elevator):
		L_elevator_func = true		
	if(Export_hydraulic_energy_R_Elevator ||
	Export_hydraulic_energy_R_Elevator):
		R_elevator_func = true
	
	% Output elevator control
	if(L_elevator_func && L_elevator_func)	
		elevator_control = true
	else
		elevator control = false	
	
	% Leading Edge Power Supply
	Export_hydraulic_energy_LE_PTU_A = false
	Export_hydraulic_energy_LE_PTU_B = true
	
	% Calculate Leading Edge Function
	if(Export_hydraulic_energy_LE_PTU_A ||
	Export_hydraulic_energy_LE_PTU_B)
		LE_control = true
	else
		LE_control = false	
	
	% Rudder Power Supply
	Export_hydraulic_energy_Rudder_PCU_A = false
	Export_hydraulic_energy_Rudder_PCU_B = true
	
	% Calcaulate rudder function
	if(Export_hydraulic_energy_Rudder_PCU_A ||
	Export_hydraulic_energy_Rudder_PCU_B)
		rudder_control = true
	else
		rudder_control = false
	
	% Stabilizer Power Supply
	Export_hydraulic_energy_Stabilizer = true
	
	if(Export_hydraulic_energy_Stabilizer)
		stabilizer_control = true
	else
		stabilizer_control = false

This snippet took 0.01 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).