'##############
'Door Script
'##############

'Controls Doors

'(c) 2007-2009 Rüdiger Hülsmann
'(c) 2007-2009 Marcel Kuhnt

'Script Version: 1.1
'Omsi release: 1.0

'Needs:
'- elec

'Revision History:
'- Marcel Kuhnt		13.06.2009	Batterietrennschalter => elec_busbar_main
'- Marcel Kuhnt		21.06.2009	AI-Unterstützung hinzugefügt	
'- Rüdiger Hülsmann	24.10.2009	Ansteuerung des Kinderwagenwunsches modifiziert
'- Rüdiger Hülsmann	19.12.2009	Timer für Ausstiegstür jetzt Timegap-basiert, Bugfix: Tür schließt jetzt nur bei elec_busbar=1
'- RÜdiger Hülsmann	22.09.2010	Door light trigger value set to 0.1
'- RÜdiger Hülsmann	07.11.2010	Door speed based on reservoir pressure, air-operated doors made an option
'- Marcel Kuhnt		08.11.2010	AI procedure closing doors debugged
'- Rüdiger Hülsmann	21.11.2010	Front doors only operable when busbar on
'- Rüdiger Hülsmann	23.12.2010	External front door operation included, option: doors only operable with actual stop brake
'- Rüdiger Hülsmann	31.12.2010	Electric door function debugged
'- Rüdiger Hülsmann	05.01.2011	20h-switch
'- Rüdiger Hülsmann	07.01.2011	Backdoor manual switch sound debugged, 20h switch depending on bus type
'- Rüdiger Hülsmann	19.01.2011	Electric door support
'- Rüdiger Hülsmann	19.01.2011	Electric door support
'- Morozov Maxim	----------	Removed automatical back door. Added ramp animation... etc...
'- Alexey Vasiliev	09.03.2012	Added more doors for Citaro "Private Edition"
'- Ñåðãåé Wizard	14.11.2013	Added automatical back doors. Rework dooraft for citaro 3door
'--------------------------------------------------------------------------------

{trigger:cp_door_01_nothahn}
	(L.L.door_01_nothahn_sw) ! (S.L.door_01_nothahn_sw)

	(L.L.door_01_nothahn_sw)
	{if}
		(T.L.ev_nothahn01_auf)
	{else}
		(T.L.ev_nothahn01_zu)
	{endif}
{end}

{trigger:cp_door_23_nothahn}
	(L.L.door_23_nothahn_sw) ! (S.L.door_23_nothahn_sw)

	(L.L.door_23_nothahn_sw)
	{if}
		(T.L.ev_nothahn23_auf)
	{else}
		(T.L.ev_nothahn23_zu)
	{endif}
{end}

{trigger:door0_drag}
	(L.S.mouse_x) -400 / (L.L.doorDragAcc_0) + 1 min 0 max (S.L.doorDragAcc_0)
{end}

{trigger:door1_drag}
	(L.S.mouse_x) -400 / (L.L.doorDragAcc_1) + 1 min 0 max (S.L.doorDragAcc_1)
{end}

{trigger:door2_drag}
	(L.S.mouse_x) -400 / (L.L.doorDragAcc_2) + 1 min 0 max (S.L.doorDragAcc_2)
{end}

{trigger:door3_drag}
	(L.S.mouse_x) -400 / (L.L.doorDragAcc_3) + 1 min 0 max (S.L.doorDragAcc_3)
{end}

{trigger:door_all}
	(L.L.Door_Error_Count) 1 + (S.L.Door_Error_Count)
	1 (S.L.door_all)
	(T.L.ev_VDV_toggle_on)
{end}

{trigger:door_all_off}
	0 (S.L.door_all)
	0 (S.L.door_all_lock)
	(T.L.ev_VDV_toggle_off)
{end}

{trigger:CG_active}
	(L.L.CG_active) ! (S.L.CG_active) (S.L.door_20h_sw)
	(L.L.CG_active) !
	{if}
	(T.L.ev_VDV_on)
	{else}
	(T.L.ev_VDV_off)
	{endif}
{end}

{trigger:bus_doorfront0}
	(L.L.Door_Error_Count) 1 + (S.L.Door_Error_Count)
	0 (S.L.door0_tilted)
	1 (S.L.door_20h_sw)
		(L.L.tuersperre) 0 =
		{if}
		(M.L.trg_bus_doorfront0)
		(M.L.trg_bus_doorfront1)
		{endif}
		
		(L.L.tuersperre) 0 > 
		{if}
		(M.L.trg_bus_doorfront0)
		{endif}
		
		(L.L.tuersperre) 0 <
		{if}
		(M.L.trg_bus_doorfront1)
		{endif}
	1 (S.L.cockpit_tuertaster1)
	(T.L.ev_tuertaster_ein)
{end}

{trigger:bus_doorfront0_off}
	0 (S.L.cockpit_tuertaster1)
	(T.L.ev_tuertaster_aus)
{end}

{trigger:bus_doorfront1}
	(L.L.Door_Error_Count) 1 + (S.L.Door_Error_Count)
	0 (S.L.door0_tilted)
	1 (S.L.door_20h_sw)
	(M.L.trg_bus_doorback23)
	1 (S.L.cockpit_tuertaster2)
	(T.L.ev_tuertaster_ein)
{end}

{trigger:bus_doorfront1_off}
	0 (S.L.cockpit_tuertaster2)
	(T.L.ev_tuertaster_aus)
{end}

{trigger:CG_1}
	1 (S.L.PAX_Entry0_Req)
{end}

{trigger:CG_2}
	1 (S.L.PAX_Entry2_Req)
{end}

{trigger:bus_dooraft}
  	(L.L.bremse_halte_sw) ! (S.L.bremse_halte_sw)
   
	(L.L.bremse_halte_sw)
	{if}
		(T.L.ev_VDV_on)
	{else}
		(T.L.ev_VDV_off)
	{endif}	
{end}

{trigger:bus_20h-switch}
	(L.L.door_20h_sw) ! (S.L.door_20h_sw)

	(L.L.door_20h_sw)
	{if}
		(T.L.ev_haltebremse_sw_an)
	{else}
		(T.L.ev_haltebremse_sw_aus)
	{endif}
{end}

{trigger:cp_tuersperre}	
	(L.L.tuersperre_sw) 1 + (S.L.tuersperre_sw)
	(L.L.tuersperre_sw) 1.5 >
	{if}
		-0.5 (S.L.tuersperre_sw)
	{endif}

	(T.L.ev_kippschalter_aus)
{end}

{trigger:int_haltewunsch}
	1 (S.L.haltewunsch)
{end}

{trigger:door_haltewunsch}
	1 (S.L.haltewunsch) (S.L.door_haltewunsch_knopfdruck)
{end}

{trigger:door_haltewunsch_off}
	0 (S.L.door_haltewunsch_knopfdruck)
{end}

{trigger:cp_schalter_kinderwagen}
	(L.L.door_handsteuerung) ! (S.L.door_handsteuerung)
	{if}
		0 (S.L.door_kinderwagenwunsch) (S.L.zufall_kinderwagenwunsch)
		(T.L.ev_kippschalter_ein)
	{else}
		(T.L.ev_kippschalter_aus)
	{endif}
		
{end}

{trigger:cp_schalter_kinderwagen2}
	(L.L.door_handsteuerung2) ! (S.L.door_handsteuerung2)
	{if}
		0 (S.L.door_kinderwagenwunsch) (S.L.zufall_kinderwagenwunsch)
		(T.L.ev_kippschalter_ein)
	{else}
		(T.L.ev_kippschalter_aus)
	{endif}
		
{end}

{trigger:door_kinderwagenwunsch}
	1 (S.L.door_kinderwagenwunsch)
{end}


{macro:Door_Init}
	1000 random 500 / 1 - (C.L.door_acc_var) * (C.L.fdoor_acc) + (S.L.doorAcc_0)
	1000 random 500 / 1 - (C.L.door_acc_var) * (C.L.fdoor_acc) + (S.L.doorAcc_1)
	1000 random 500 / 1 - (C.L.door_acc_var) * (C.L.bdoor_acc) + (S.L.doorAcc_2)
	1000 random 500 / 1 - (C.L.door_acc_var) * (C.L.bdoor_acc) + (S.L.doorAcc_3)	
	1000 random 500 / 1 - (C.L.door_acc_var) * (C.L.bdoor_acc) + (S.L.doorAcc_4)
	1000 random 500 / 1 - (C.L.door_acc_var) * (C.L.bdoor_acc) + (S.L.doorAcc_5)

	1000 random 500 / 1 - (C.L.door_maxspeed_var) * (C.L.fdoor_maxspeed) + (S.L.doorMaxSpeed_0_norm)
	1000 random 500 / 1 - (C.L.door_maxspeed_var) * (C.L.fdoor_maxspeed) + (S.L.doorMaxSpeed_1_norm)
	1000 random 500 / 1 - (C.L.door_maxspeed_var) * (C.L.bdoor_maxspeed) + (S.L.doorMaxSpeed_2_norm)
	1000 random 500 / 1 - (C.L.door_maxspeed_var) * (C.L.bdoor_maxspeed) + (S.L.doorMaxSpeed_3_norm)	
	1000 random 500 / 1 - (C.L.door_maxspeed_var) * (C.L.bdoor_maxspeed) + (S.L.doorMaxSpeed_4_norm)
	1000 random 500 / 1 - (C.L.door_maxspeed_var) * (C.L.bdoor_maxspeed) + (S.L.doorMaxSpeed_5_norm)
	
	(C.L.door_refl) (S.L.doorRefl_0)
	(C.L.door_refl) (S.L.doorRefl_1)
	(C.L.door_refl) (S.L.doorRefl_2)
	(C.L.door_refl) (S.L.doorRefl_3)
	(C.L.door_refl) (S.L.doorRefl_4)
	(C.L.door_refl) (S.L.doorRefl_5)
	
	(C.L.tuerverzoegerung) (S.L.doortimer0) (S.L.doortimer1) (S.L.doortimer23)
	0.5 (S.L.tuersperre_sw)
	0 (S.L.tuersperre)
{end}

{macro:Door_Frame}
	(M.L.Door0_Calc)
	(M.L.Door1_Calc)
	(M.L.DoorAftCalc)
	(M.L.Door2_Calc)
	(M.L.Door3_Calc)

	(L.L.door_0) 0.9 > (S.L.PAX_Entry0_Open) (S.L.PAX_Exit0_Open)
	(L.L.door_1) 0.9 > (S.L.PAX_Entry1_Open) (S.L.PAX_Exit1_Open)
	(L.L.door_2) 0.9 > (S.L.PAX_Entry2_Open) (S.L.PAX_Exit2_Open)
	(L.L.door_3) 0.9 > (S.L.PAX_Entry3_Open) (S.L.PAX_Exit3_Open)
	
	(L.L.door_0) (F.L.door0_xposition) (S.L.door0_positionx)
	(L.L.door_0) (F.L.door0_yposition) (S.L.door0_positiony)
 	(L.L.door_2) (F.L.door2_xposition) (S.L.door2_positionx)
	(L.L.door_2) (F.L.door2_yposition) (S.L.door2_positiony)
	(L.L.door_0) (F.L.door0_buegeleisen) (S.L.door0_buegeleisen_pos)
	(L.L.door_1) (F.L.door1_buegeleisen) (S.L.door1_buegeleisen_pos)
	(L.L.door_2) (F.L.door2_buegeleisen) (S.L.door2_buegeleisen_pos)
	(L.L.door_3) (F.L.door3_buegeleisen) (S.L.door3_buegeleisen_pos)
	
	(L.L.PAX_Exit0_Req) 0 >
	(L.L.PAX_Exit1_Req) 0 > ||
	{if}
		1 (S.L.exit1_lichtschranke)
	{else}
		0 (S.L.exit1_lichtschranke)
	{endif}

	(L.L.PAX_Exit2_Req) 0 >
	(L.L.PAX_Exit3_Req) 0 > ||
	{if}
		1 (S.L.exit2_lichtschranke)
	{else}
		0 (S.L.exit2_lichtschranke)
	{endif}
	
	(L.L.PAX_Exit4_Req) 0 >
	(L.L.PAX_Exit5_Req) 0 > ||
	{if}
		1 (S.L.exit3_lichtschranke)
	{else}
		0 (S.L.exit3_lichtschranke)
	{endif}
			
	(L.L.bremse_halte_sw)
	{if}
	1 (S.L.door_20h_sw)
	{endif}
		
	(L.L.door_20h_sw) (L.L.door_0) ! && (L.L.door_1) ! && (L.L.door_2) ! && 
	(L.L.door_3) ! &&
	(L.L.kneel_allowed) ! && (L.L.Throttle) 0 > && (L.L.CG_active) ! &&
	{if}
	0 (S.L.door_20h_sw)
	{endif}
	
	(L.L.door_all) (L.L.Velocity) (C.L.Door_Bremse_Halte_MaxKMH) < &&
	{if}
		(L.L.door_all_lock) !
		{if}
		1 (S.L.door_all_lock)
		(M.L.door_all)
		{endif}
	{endif}
	
	(L.L.door_kinderwagenwunsch)
	(L.L.door_2) &&
	{if}
	0 (S.L.door_kinderwagenwunsch) (S.L.zufall_kinderwagenwunsch)
	{endif}
	
'	(L.L.bremse_halte_sw) (S.L.door_20h_sw)
	
	(L.L.door_0) (L.L.door_1) || (L.L.door_2) || (L.L.door_3) ||
	(L.L.CG_active) &&
	{if}
	1 (S.L.CG_opened)
	{endif}
	
	(L.L.door_0) (L.L.door_1) || (L.L.door_2) || (L.L.door_3) ||
	(L.L.CG_active) 0 = && (L.L.CG_opened) 1 = &&
	{if}
	0 (S.L.CG_opened) (S.L.door_20h_sw)
	(M.L.door_all)
	0 (S.L.PAX_Exit0_state) (S.L.PAX_Exit2_state)
	{endif}
	
	(L.L.PAX_Exit0_Req) (L.L.PAX_Exit1_Req) ||
	{if}
	1 (S.L.PAX_Exit0_state)
	{endif}
	
	(L.L.PAX_Exit2_Req) (L.L.PAX_Exit3_Req) ||
	{if}
	1 (S.L.PAX_Exit2_state)
	{endif}
	
	(L.L.PAX_Exit4_Req) (L.L.PAX_Exit5_Req) ||
	{if}
	1 (S.L.PAX_Exit4_state)
	{endif}
	
	(L.L.door_0) (L.L.door_1) || (L.L.door_2) || (L.L.door_3) ||
		{if}
		0 (S.L.PAX_Exit0_state) (S.L.PAX_Exit2_state)
		{endif}
	
	(L.L.PAX_Entry0_Req) (L.L.PAX_Entry1_Req) ||
	(L.L.PAX_Exit0_Req) || (L.L.PAX_Exit1_Req) ||
	(L.L.PAX_Exit0_state) ||
	(L.L.CG_active) && 
	{if}
	0 (S.L.PAX_Exit0_state) 
	1 (S.L.CG_opened)
		(L.L.door_1) !
		(L.L.tuersperre) 0 = &&
		{if}
		(M.L.trg_bus_doorfront0)
		(M.L.trg_bus_doorfront1)
		{endif}
		
		(L.L.door_0) !
		(L.L.tuersperre) 0 > &&
		{if}
		(M.L.trg_bus_doorfront0)
		{endif}
		
		(L.L.door_1) !
		(L.L.tuersperre) 0 < &&
		{if}
		(M.L.trg_bus_doorfront1)
		{endif}
	{endif}
		
	(L.L.PAX_Entry2_Req) (L.L.PAX_Entry3_Req) ||
	(L.L.PAX_Exit2_Req) || (L.L.PAX_Exit3_Req) ||
	(L.L.PAX_Exit2_state) ||
	(L.L.CG_active) && 
	(L.L.door_3) ! &&
	{if}
	0 (S.L.PAX_Exit2_state) 
	1 (S.L.CG_opened)
	(M.L.trg_bus_doorback23)
	{endif}
	

	(L.L.bus_dooraft_sw)
	(L.L.velocity) 0.1 < &&
	{if}
		1 (S.L.bremse_halte)
	{endif}

'	Türsteuerung:

'	Türsperre setzen:

	(L.L.door_0) 0 =
	(L.L.door_1) 0 = &&
	{if}
		(L.L.tuersperre_sw) -0.5 =
		{if}
			-1 (S.L.tuersperre)
		{endif}
		(L.L.tuersperre_sw) 0.5 =
		{if}
			0 (S.L.tuersperre)
		{endif}
		(L.L.tuersperre_sw) 1.5 =
		{if}
			1 (S.L.tuersperre)
		{endif}
	{endif}

'	"Dauerfeuer"-Haltewunsch über Kinderwagenschalter (macht genau dasselbe wie der "trigger:int_haltewunsch"):
	(L.L.door_haltewunsch_knopfdruck)
	{if}
		1 (S.L.haltewunsch)
	{endif}

'	Setzen der Haltestellenbremse erst bei Stillstand des Busses:
	(L.L.bremse_halte_sw) (L.L.door_20h_sw) ||
	(L.L.bremse_halte) ! (L.L.Velocity) (C.L.Door_Bremse_Halte_MaxKMH) < && &&
	{if}
		(L.L.elec_busbar_main)
		{if}
			(T.L.ev_haltebremse_an)		
			1 (S.L.bremse_halte)
		{endif}
	{endif}

'	(M.L.DoorAft_Open)

'	Türfreigabekriterium

	(L.L.bremse_halte_sw) (L.L.bremse_halte) && (S.L.door_freigabe)

'	Haltewunschlampe:
	(L.L.haltewunsch) (L.L.door_2) 0.2 < (L.L.door_5) 0.2 < (L.L.elec_busbar_main) && && &&
	{if}
		1 (S.L.haltewunschlampe)
	{else}
		0 (S.L.haltewunschlampe) (S.L.haltewunsch)
	{endif}

'	Abfall des Kinderwagenwunsch-Relais bei fehlender Stromversorgung:

	(L.L.elec_busbar_main) 0 = 
	{if}
		0 (S.L.door_kinderwagenwunsch) (S.L.zufall_kinderwagenwunsch)
	{endif}

'	Zufälliges zusätzliches Aufleuchten des Kinderwagenwunsches bei Haltewunsch:

	(L.L.haltewunsch) 1 =
	(L.L.zufall_kinderwagenwunsch) 0 = &&
	(L.S.Time) 72000 < (L.S.Time) 28800 > && &&
	{if}
		10 random (S.L.zufall_kinderwagenwunsch)
		(L.L.zufall_kinderwagenwunsch) 9 >=
		{if}
			1 (S.L.door_kinderwagenwunsch)
		{endif}
	{endif}

'	Beleuchtung der Einstiege

(L.L.elec_busbar_main)
{if}
	(L.L.vdv_error_door_active) !
	{if}
		(L.L.door_0) 0 > (L.L.door_1) 0 > ||
		{if}
			1 (S.L.door_light_1)
			0 (S.L.light_timer1)
			(L.L.lights_stand) 1 =
			{if}
				1 (S.L.door_spotlight_1)
			{else}
				0 (S.L.door_spotlight_1)
			{endif}
		{else}
			(L.L.light_timer1) (L.S.timegap) + 2 min (S.L.light_timer1)
			2 =
			{if}
				0 (S.L.door_spotlight_1)
			{endif}
			0 (S.L.door_light_1)
		{endif}
		(L.L.door_2) 0 > (L.L.door_3) 0 > ||
		{if}
			1 (S.L.door_light_2)
			0 (S.L.light_timer2)
			(L.L.lights_stand) 1 =
			{if}
				1 (S.L.door_spotlight_2)
			{else}
				0 (S.L.door_spotlight_2)
			{endif}
		{else}
			(L.L.light_timer2) (L.S.timegap) + 2 min (S.L.light_timer2)
			2 =
			{if}
				0 (S.L.door_spotlight_2)
			{endif}
			0 (S.L.door_light_2)
		{endif}
	{else}
		(L.L.Tuerfehler_blinkgeber) (L.S.Timegap) + 1 min (S.L.Tuerfehler_blinkgeber)
		0.5 <
		{if}
			1 (S.L.door_light_1)
			1 (S.L.door_light_2)
			1 (S.L.door_light_3)
		{else}
			0 (S.L.door_light_1)
			0 (S.L.door_light_2)
			0 (S.L.door_light_3)
		{endif}
		(L.L.Tuerfehler_blinkgeber) 1 =
		{if}
			0 (S.L.Tuerfehler_blinkgeber)
		{endif}
	{endif}
{else}
	0 (S.L.door_light_1) (S.L.door_light_2) (S.L.door_light_3)
{endif}

'	Druckabhängige Türgeschwindigkeit
	
	(C.L.door_druckluft)
	{if}
		(L.L.doorMaxSpeed_0_norm) (L.L.bremse_p_Tank04) 100000 - 850000 / (S.L.doorMaxSpeed_0)
		(L.L.doorMaxSpeed_1_norm) (L.L.bremse_p_Tank04) 100000 - 850000 / (S.L.doorMaxSpeed_1)
		(L.L.doorMaxSpeed_2_norm) (L.L.bremse_p_Tank04) 100000 - 850000 / (S.L.doorMaxSpeed_2)
		(L.L.doorMaxSpeed_3_norm) (L.L.bremse_p_Tank04) 100000 - 850000 / (S.L.doorMaxSpeed_3)		
		(L.L.doorMaxSpeed_4_norm) (L.L.bremse_p_Tank04) 100000 - 850000 / (S.L.doorMaxSpeed_4)
		(L.L.doorMaxSpeed_5_norm) (L.L.bremse_p_Tank04) 100000 - 850000 / (S.L.doorMaxSpeed_5)
	{endif}
'----------------------
'	AI-Ablauf:

(L.L.AI_Scheduled_AtStation) s0
1 =
{if}
'Wenn Türen geöffnet werden sollen:
	(L.L.Velocity) (C.L.Door_Bremse_Halte_MaxKMH) <
	{if}
	1 (S.L.CG_active)
'Nur, wenn v < maxkmh, sonst warten
'Taster jeweils nur betätigen, falls noch nicht an
		(L.L.bremse_halte_sw) !
		{if}
			(M.L.trg_bus_dooraft)
		{endif}
		(L.L.doorTarget_0) ! (L.L.door_AI_timer) 0.3 > &&
		{if}
			(M.L.trg_bus_doorfront0)
		{endif}
		(L.L.doorTarget_1) ! (L.L.door_AI_timer) 0.6 > &&
		{if}
			(M.L.trg_bus_doorfront1)
		{endif}
		(L.L.doorTarget_23) ! (L.L.door_AI_timer) 0.6 > (L.L.haltewunsch) && &&
		{if}
			(M.L.trg_bus_doorback23)
		{endif}
	{else}
		0 (S.L.door_AI_timer)
	{endif}
	(L.L.door_AI_timer) (L.S.Timegap) + (S.L.door_AI_timer)
{else}
l0 -1 =
{if}
0 (S.L.CG_active)
'Wenn Türen geschlossen werden sollen:
'Taster jeweils nur betätigen, falls noch nicht aus:
	(L.L.doorTarget_1)
	{if}
		(M.L.trg_bus_doorfront1)
		0 (S.L.door_AI_timer)
	{endif}
	(L.L.doorTarget_0) (L.L.door_AI_timer) 0.3 > &&
	{if}
		(M.L.trg_bus_doorfront0)
	{endif}
	(L.L.doorTarget_23) (L.L.door_AI_timer) 0.3 > &&
	{if}
		(M.L.trg_bus_doorback23)
	{endif}
'Haltestellenbremse erst wegnehmen, wenn alle Türen zu. Dann auch erst den Bus AI-mäßig freigeben:
	(L.L.door_0) 0.1 <
	(L.L.door_1) 0.1 < &&
	(L.L.door_2) 0.1 < &&	
	{if}
		(L.L.bremse_halte_sw) (L.L.door_AI_timer) 0.3 > &&
		{if}
			(M.L.trg_bus_dooraft)
		{endif}
		(L.L.bremse_halte_sw) !
		{if}
			0 (S.L.AI_Scheduled_AtStation)
		{endif}
	{else}
'Sollte eine der Türen auf sein und die Haltestellenbremse aus, dann sofort diese einlegen
		(L.L.bremse_halte_sw) !
		{if}
			(M.L.trg_bus_dooraft)
		{endif}
		(L.L.doorTarget_0) !
		(L.L.doorTarget_1) ! &&
		(L.L.doorTarget_23) ! &&
		{if}
			0 (S.L.door_AI_timer)
		{endif}
	{endif}
	(L.L.door_AI_timer) (L.S.Timegap) + (S.L.door_AI_timer)
{endif}
{endif}


{end}


{macro:door_all}
	(L.L.door_0) (L.L.door_1) || (L.L.door_2) || (L.L.door_3) ||
	{if}
		(L.L.door_0) {if} (M.L.trg_bus_doorfront0) {endif}
		(L.L.door_1) {if} (M.L.trg_bus_doorfront1) {endif}
		(L.L.door_2) (L.L.door_3) || {if} (M.L.trg_bus_doorback23) {endif}
	{else}
		1 (S.L.door_20h_sw)
		(L.L.tuersperre) 0 <= {if} (M.L.trg_bus_doorfront1) {endif}
		(L.L.tuersperre) 0 >= {if} (M.L.trg_bus_doorfront0) {endif}
		(M.L.trg_bus_doorback23)
	{endif}
	
{end}



{macro:Door0_Calc}
(L.L.door_01_nothahn_sw) !
{if}
	(C.L.electric_doors)
	{if}
		(L.L.doorTarget_0)
		{if}
			(L.L.door_0) (F.L.door_0_opn_speed) (S.L.doorMaxSpeed_0)
		{else}
			(L.L.door_0) (F.L.door_0_cls_speed) (S.L.doorMaxSpeed_0)
		{endif}

		(C.L.fdoor_acc) (S.L.doorAcc_0)

		(L.L.doorTarget_0) ! (L.L.doorSpeed_0) s0 abs 0.05 > (L.L.door_0) 0 > || && 
		{if}
			(L.L.doortimer0) (L.S.Timegap) + (C.L.tuerverzoegerung) min (S.L.doortimer0)
		    (C.L.tuerverzoegerung) =
		    {if}
			l0 /-/ (L.L.doorMaxSpeed_0) <
			{if}
				(L.L.doorSpeed_0) (L.L.doorAcc_0) (L.S.Timegap) * - (S.L.doorSpeed_0)
			{else}
				(L.L.doorSpeed_0) (L.L.doorAcc_0) (L.S.Timegap) * + (S.L.doorSpeed_0)
			{endif}
			(L.L.door_0) (L.L.doorSpeed_0) (L.S.Timegap) * + (S.L.door_0)
			{endif}
		{else}
			(L.L.doorSpeed_0) abs 0.05 > (L.L.door_0) 1 < || (L.L.doorTarget_0) &&
			{if}
				l0 (L.L.doorMaxSpeed_0) <
				{if}
					(L.L.doorSpeed_0) (L.L.doorAcc_0) (L.S.Timegap) * + (S.L.doorSpeed_0) 
				{else}
					(L.L.doorSpeed_0) (L.L.doorAcc_0) (L.S.Timegap) * - (S.L.doorSpeed_0) 
				{endif}
				(L.L.door_0) (L.L.doorSpeed_0) (L.S.Timegap) * + (S.L.door_0)
				0 (S.L.doortimer0)
				0 (S.L.trigger_antirepeat0)
			{else}
				0 (S.L.doorSpeed_0)
			{endif}
		{endif}
		(L.L.doortimer0) (C.L.tuerverzoegerung) =
		(L.L.doortimer0) 0 > &&
		{if}
			(L.L.trigger_antirepeat0) 1 + (S.L.trigger_antirepeat0)
			(L.L.trigger_antirepeat0) 1 =
				{if}
				(T.L.ev_doortriggerclose_0)
				{endif}
		{endif}
	{else}
		(L.L.doorTarget_0) ! (L.L.doorSpeed_0) s0 abs 0.05 > (L.L.door_0) 0 > || && 
		{if}
			(L.L.doortimer0) (L.S.Timegap) + (C.L.tuerverzoegerung) min (S.L.doortimer0)
		    (C.L.tuerverzoegerung) =
		    {if}
			l0 /-/ (L.L.doorMaxSpeed_0) <
			{if}
				(L.L.doorSpeed_0) (L.L.doorAcc_0) (L.S.Timegap) * - (S.L.doorSpeed_0)
			{endif}
			(L.L.door_0) (L.L.doorSpeed_0) (L.S.Timegap) * + (S.L.door_0)
			{endif}
		{else}
			(L.L.doorSpeed_0) abs 0.05 > (L.L.door_0) 1 < || (L.L.doorTarget_0) &&
			{if}
				l0 (L.L.doorMaxSpeed_0) <
				{if}
					(L.L.doorSpeed_0) (L.L.doorAcc_0) (L.S.Timegap) * + (S.L.doorSpeed_0) 
				{endif}
				(L.L.door_0) (L.L.doorSpeed_0) (L.S.Timegap) * + (S.L.door_0)
				0 (S.L.doortimer0)
				0 (S.L.trigger_antirepeat0)
			{else}
				0 (S.L.doorSpeed_0)
			{endif}
		{endif}
		(L.L.doortimer0) (C.L.tuerverzoegerung) =
		(L.L.doortimer0) 0 > &&
		{if}
			(L.L.trigger_antirepeat0) 1 + (S.L.trigger_antirepeat0)
			(L.L.trigger_antirepeat0) 1 =
				{if}
				(T.L.ev_doortriggerclose_0)
				{endif}
		{endif}
	{endif}

	(L.L.door_0) 1 >
	{if}
		(T.L.ev_doorhitopen_0)
		1 (S.L.door_0)
		(L.L.doorSpeed_0) /-/ (L.L.doorRefl_0) * (S.L.doorSpeed_0)
	{else}
		(L.L.door_0) 0 <
		{if}
			(T.L.ev_doorhitclose_0)
			0 (S.L.door_0)
			(L.L.doorSpeed_0) /-/ (L.L.doorRefl_0) * (S.L.doorSpeed_0)
		{endif}
	{endif}
	(L.L.door_0) (S.L.doorDragAcc_0)
{else}
	(L.L.doorDragAcc_0) (S.L.door_0)
{endif}
{end}

{macro:Door1_Calc}
(L.L.door_01_nothahn_sw) !
{if}
	(C.L.electric_doors)
	{if}
		(L.L.doorTarget_1)
		{if}
			(L.L.door_1) (F.L.door_1_opn_speed) (S.L.doorMaxSpeed_1)
		{else}
			(L.L.door_1) (F.L.door_1_cls_speed) (S.L.doorMaxSpeed_1)
		{endif}

		(C.L.fdoor_acc) (S.L.doorAcc_1)

		(L.L.doorTarget_1) ! (L.L.doorSpeed_1) s0 abs 0.05 > (L.L.door_1) 0 > || && 
		{if}
			(L.L.doortimer1) (L.S.Timegap) + (C.L.tuerverzoegerung) min (S.L.doortimer1)
		    (C.L.tuerverzoegerung) =
		    {if}
			l0 /-/ (L.L.doorMaxSpeed_1) <
			{if}
				(L.L.doorSpeed_1) (L.L.doorAcc_1) (L.S.Timegap) * - (S.L.doorSpeed_1)
			{else}
				(L.L.doorSpeed_1) (L.L.doorAcc_1) (L.S.Timegap) * + (S.L.doorSpeed_1)
			{endif}
			(L.L.door_1) (L.L.doorSpeed_1) (L.S.Timegap) * + (S.L.door_1)
			{endif}
		{else}
			(L.L.doorSpeed_1) abs 0.05 > (L.L.door_1) 1 < || (L.L.doorTarget_1) &&
			{if}
				l0 (L.L.doorMaxSpeed_1) <
				{if}
					(L.L.doorSpeed_1) (L.L.doorAcc_1) (L.S.Timegap) * + (S.L.doorSpeed_1) 
				{else}
					(L.L.doorSpeed_1) (L.L.doorAcc_1) (L.S.Timegap) * - (S.L.doorSpeed_1) 
				{endif}
				(L.L.door_1) (L.L.doorSpeed_1) (L.S.Timegap) * + (S.L.door_1)
				0 (S.L.doortimer1)
				0 (S.L.trigger_antirepeat1)
			{else}
				0 (S.L.doorSpeed_1)
			{endif}
		{endif}
		(L.L.doortimer1) (C.L.tuerverzoegerung) =
		(L.L.doortimer1) 0 > &&
		{if}
			(L.L.trigger_antirepeat1) 1 + (S.L.trigger_antirepeat1)
			(L.L.trigger_antirepeat1) 1 =
				{if}
				(T.L.ev_doortriggerclose_1)
				{endif}
		{endif}
	{else}
		(L.L.doorTarget_1) ! (L.L.doorSpeed_1) s0 abs 0.05 > (L.L.door_1) 0 > || && 
		{if}
			(L.L.doortimer1) (L.S.Timegap) + (C.L.tuerverzoegerung) min (S.L.doortimer1)
		    (C.L.tuerverzoegerung) =
		    {if}
			l0 /-/ (L.L.doorMaxSpeed_1) <
			{if}
				(L.L.doorSpeed_1) (L.L.doorAcc_1) (L.S.Timegap) * - (S.L.doorSpeed_1)
			{endif}
			(L.L.door_1) (L.L.doorSpeed_1) (L.S.Timegap) * + (S.L.door_1)
			{endif}
		{else}
			(L.L.doorSpeed_1) abs 0.05 > (L.L.door_1) 1 < || (L.L.doorTarget_1) &&
			{if}
				l0 (L.L.doorMaxSpeed_1) <
				{if}
					(L.L.doorSpeed_1) (L.L.doorAcc_1) (L.S.Timegap) * + (S.L.doorSpeed_1) 
				{endif}
				(L.L.door_1) (L.L.doorSpeed_1) (L.S.Timegap) * + (S.L.door_1)
				0 (S.L.doortimer1)
				0 (S.L.trigger_antirepeat1)
			{else}
				0 (S.L.doorSpeed_1)
			{endif}
		{endif}
		(L.L.doortimer1) (C.L.tuerverzoegerung) =
		(L.L.doortimer1) 0 > &&
		{if}
			(L.L.trigger_antirepeat1) 1 + (S.L.trigger_antirepeat1)
			(L.L.trigger_antirepeat1) 1 =
				{if}
				(T.L.ev_doortriggerclose_1)
				{endif}
		{endif}
	{endif}

	(L.L.door_1) 1 >
	{if}
		(T.L.ev_doorhitopen_1)
		1 (S.L.door_1)
		(L.L.doorSpeed_1) /-/ (L.L.doorRefl_1) * (S.L.doorSpeed_1)
	{else}
		(L.L.door_1) 0 <
		{if}
			(T.L.ev_doorhitclose_1)
			0 (S.L.door_1)
			(L.L.doorSpeed_1) /-/ (L.L.doorRefl_1) * (S.L.doorSpeed_1)
		{endif}
	{endif}
	(L.L.door_1) (S.L.doorDragAcc_1)
{else}
	(L.L.doorDragAcc_1) (S.L.door_1)
{endif}
{end}


{macro:DoorAftCalc}
	(L.L.bremse_halte_sw) !
	(L.L.door_20h_sw) ! &&
	(L.L.door_0) 0 = &&
	(L.L.door_1) 0 = &&
	(L.L.door_3) 0 = &&
	(L.L.light_timer2) 1 > &&
	(L.L.light_timer3) 1 > &&
	(L.L.elec_busbar_main) ! ||
	(L.L.bremse_halte) &&
	(L.L.throttle) 0.1 > &&
      	(L.L.kneel_timer) 0 = &&
	{if}
		0 (S.L.bremse_halte) (S.L.kneel_locked)
		0 (S.L.doorAftLastOpen) (S.L.doorAftLastOpen1)
		(T.L.ev_haltebremse_aus)
	{endif}


{end}

'--------------------------------------------------------------------------------


'--------------------------------------------------------------------------------

{macro:DoorAft_Open}

(L.L.exit1_lichtschranke)
(L.L.door_handsteuerung) ||
(L.L.haltewunsch) ||
{if}
      (L.L.doorTarget_23) !
      (L.L.bremse_halte_sw) &&
      (L.L.velocity) 0.1 < &&
      {if}
	(T.L.ev_doortriggeropen_2)
         1 (S.L.doorTarget_23)
         1 (S.L.bremse_halte)
         (C.L.door_druckluft)
         {if}
         (L.L.bremse_p_Tank04) 100000 - 0.96 * 100000 + (S.L.bremse_p_Tank04)
         {endif}
      {endif}
      0 (S.L.doorAftLastOpen)      
{endif}

(L.L.elec_busbar_main)
	{if}
		(L.L.bremse_halte)
		{if}
			(L.L.doorAftLastOpen) (L.S.Timegap) + (S.L.doorAftLastOpen)
			(L.L.doorAftLastOpen1) (L.S.Timegap) + (S.L.doorAftLastOpen1)
		{endif}

		(L.L.doorTarget_23)
		(L.L.doorAftLastOpen) (C.L.doorAftOpenTime) > &&
		(L.L.door_handsteuerung) 0 = &&
		{if}
		  (C.L.tuerverzoegerung) 0 >
		    {if}
			(T.L.ev_doorwarn)
			0 (S.L.doorTarget_23)
			(C.L.door_druckluft)
			{if}
			(L.L.bremse_p_Tank04) 100000 - 0.96 * 100000 + (S.L.bremse_p_Tank04)
			{endif}
		    {else}
			(T.L.ev_doortriggerclose_2)
			0 (S.L.doorTarget_23)
			(C.L.door_druckluft)
			{if}
			(L.L.bremse_p_Tank04) 100000 - 0.96 * 100000 + (S.L.bremse_p_Tank04)
			{endif}
		    {endif}
		{endif}
	{endif}
{end}

'--------------------------------------------------------------------------------

{macro:Door2_Calc}
(L.L.door_23_nothahn_sw) !
{if}
	(C.L.electric_doors)
	{if}
		(L.L.doorTarget_23)
		{if}
			(L.L.door_2) (F.L.door_2_opn_speed) (S.L.doorMaxSpeed_2)
		{else}
			(L.L.door_2) (F.L.door_2_cls_speed) (S.L.doorMaxSpeed_2)
		{endif}

		(C.L.bdoor_acc) (S.L.doorAcc_2)

		(L.L.doorTarget_23) ! (L.L.doorSpeed_2) s0 abs 0.05 > (L.L.door_2) 0 > || && 
		{if}
		    (L.L.doortimer23) (L.S.Timegap) + (C.L.tuerverzoegerung) min (S.L.doortimer23)
		    (C.L.tuerverzoegerung) =
		    {if}
			l0 /-/ (L.L.doorMaxSpeed_2) <
			{if}
				(L.L.doorSpeed_2) (L.L.doorAcc_2) (L.S.Timegap) * - (S.L.doorSpeed_2)
			{else}
				(L.L.doorSpeed_2) (L.L.doorAcc_2) (L.S.Timegap) * + (S.L.doorSpeed_2)
			{endif}
			(L.L.door_2) (L.L.doorSpeed_2) (L.S.Timegap) * + (S.L.door_2)
		    {endif}
		{else}
			(L.L.doorSpeed_2) abs 0.05 > (L.L.door_2) 1 < || (L.L.doorTarget_23) &&
			{if}
				l0 (L.L.doorMaxSpeed_2) <
				{if}
					(L.L.doorSpeed_2) (L.L.doorAcc_2) (L.S.Timegap) * + (S.L.doorSpeed_2) 
				{else}
					(L.L.doorSpeed_2) (L.L.doorAcc_2) (L.S.Timegap) * - (S.L.doorSpeed_2) 
				{endif}
				(L.L.door_2) (L.L.doorSpeed_2) (L.S.Timegap) * + (S.L.door_2)
				0 (S.L.doortimer23)
				0 (S.L.trigger_antirepeat23)
			{else}
				0 (S.L.doorSpeed_2)
			{endif}
		{endif}
		(L.L.doortimer23) (C.L.tuerverzoegerung) =
		(L.L.doortimer23) 0 > &&
		{if}
			(L.L.trigger_antirepeat23) 1 + (S.L.trigger_antirepeat23)
			(L.L.trigger_antirepeat23) 1 =
				{if}
				(T.L.ev_doortriggerclose_2)
				{endif}
		{endif}
	{else}
		(L.L.doorTarget_23) ! (L.L.doorSpeed_2) s0 abs 0.05 > (L.L.door_2) 0 > || && 
		{if}
		    (L.L.doortimer23) (L.S.Timegap) + (C.L.tuerverzoegerung) min (S.L.doortimer23)
		    (C.L.tuerverzoegerung) =
		    {if}
			l0 /-/ (L.L.doorMaxSpeed_2) <
			{if}
				(L.L.doorSpeed_2) (L.L.doorAcc_2) (L.S.Timegap) * - (S.L.doorSpeed_2)
			{endif}
			(L.L.door_2) (L.L.doorSpeed_2) (L.S.Timegap) * + (S.L.door_2)
		    {endif}
		{else}
			(L.L.doorSpeed_2) abs 0.05 > (L.L.door_2) 1 < || (L.L.doorTarget_23) &&
			{if}
				l0 (L.L.doorMaxSpeed_2) <
				{if}
					(L.L.doorSpeed_2) (L.L.doorAcc_2) (L.S.Timegap) * + (S.L.doorSpeed_2) 
				{endif}
				(L.L.door_2) (L.L.doorSpeed_2) (L.S.Timegap) * + (S.L.door_2)
				0 (S.L.doortimer23)
				0 (S.L.trigger_antirepeat23)
			{else}
				0 (S.L.doorSpeed_2)
			{endif}
		{endif}
		(L.L.doortimer23) (C.L.tuerverzoegerung) =
		(L.L.doortimer23) 0 > &&
		{if}
			(L.L.trigger_antirepeat23) 1 + (S.L.trigger_antirepeat23)
			(L.L.trigger_antirepeat23) 1 =
				{if}
				(T.L.ev_doortriggerclose_2)
				{endif}
		{endif}
	{endif}

	(L.L.door_2) 1 >
	{if}
		(T.L.ev_doorhitopen_2)
		1 (S.L.door_2)
		(L.L.doorSpeed_2) /-/ (L.L.doorRefl_2) * (S.L.doorSpeed_2)
	{else}
		(L.L.door_2) 0 <
		{if}
			(T.L.ev_doorhitclose_2)
			0 (S.L.door_2)
			(L.L.doorSpeed_2) /-/ (L.L.doorRefl_2) * (S.L.doorSpeed_2)
		{endif}
	{endif}
	(L.L.door_2) (S.L.doorDragAcc_2)
{else}
	(L.L.doorDragAcc_2) (S.L.door_2)
{endif}
{end}

{macro:Door3_Calc}
(L.L.door_23_nothahn_sw) !
{if}
	(C.L.electric_doors)
	{if}
		(L.L.doorTarget_23)
		{if}
			(L.L.door_3) (F.L.door_3_opn_speed) (S.L.doorMaxSpeed_3)
		{else}
			(L.L.door_3) (F.L.door_3_cls_speed) (S.L.doorMaxSpeed_3)
		{endif}

		(C.L.bdoor_acc) (S.L.doorAcc_3)

		(L.L.doorTarget_23) ! (L.L.doorSpeed_3) s0 abs 0.05 > (L.L.door_3) 0 > || && 
		{if}
		    (L.L.doortimer23) (C.L.tuerverzoegerung) =
		    {if}
			l0 /-/ (L.L.doorMaxSpeed_3) <
			{if}
				(L.L.doorSpeed_3) (L.L.doorAcc_3) (L.S.Timegap) * - (S.L.doorSpeed_3)
			{else}
				(L.L.doorSpeed_3) (L.L.doorAcc_3) (L.S.Timegap) * + (S.L.doorSpeed_3)
			{endif}
			(L.L.door_3) (L.L.doorSpeed_3) (L.S.Timegap) * + (S.L.door_3)
		    {endif}
		{else}
			(L.L.doorSpeed_3) abs 0.05 > (L.L.door_3) 1 < || (L.L.doorTarget_23) &&
			{if}
				l0 (L.L.doorMaxSpeed_3) <
				{if}
					(L.L.doorSpeed_3) (L.L.doorAcc_3) (L.S.Timegap) * + (S.L.doorSpeed_3) 
				{else}
					(L.L.doorSpeed_3) (L.L.doorAcc_3) (L.S.Timegap) * - (S.L.doorSpeed_3) 
				{endif}
				(L.L.door_3) (L.L.doorSpeed_3) (L.S.Timegap) * + (S.L.door_3)
			{else}
				0 (S.L.doorSpeed_3)
			{endif}
		{endif}
	{else}
		(L.L.doorTarget_23) ! (L.L.doorSpeed_3) s0 abs 0.05 > (L.L.door_3) 0 > || && 
		{if}
		    (L.L.doortimer23) (C.L.tuerverzoegerung) =
		    {if}
			l0 /-/ (L.L.doorMaxSpeed_3) <
			{if}
				(L.L.doorSpeed_3) (L.L.doorAcc_3) (L.S.Timegap) * - (S.L.doorSpeed_3)
			{endif}
			(L.L.door_3) (L.L.doorSpeed_3) (L.S.Timegap) * + (S.L.door_3)
		    {endif}
		{else}
			(L.L.doorSpeed_3) abs 0.05 > (L.L.door_3) 1 < || (L.L.doorTarget_23) &&
			{if}
				l0 (L.L.doorMaxSpeed_3) <
				{if}
					(L.L.doorSpeed_3) (L.L.doorAcc_3) (L.S.Timegap) * + (S.L.doorSpeed_3) 
				{endif}
				(L.L.door_3) (L.L.doorSpeed_3) (L.S.Timegap) * + (S.L.door_3)
			{else}
				0 (S.L.doorSpeed_3)
			{endif}
		{endif}
	{endif}

	(L.L.door_3) 1 >
	{if}
		(T.L.ev_doorhitopen_2)
		1 (S.L.door_3)
		(L.L.doorSpeed_3) /-/ (L.L.doorRefl_3) * (S.L.doorSpeed_3)
	{else}
		(L.L.door_3) 0 <
		{if}
			(T.L.ev_doorhitclose_2)
			0 (S.L.door_3)
			(L.L.doorSpeed_3) /-/ (L.L.doorRefl_3) * (S.L.doorSpeed_3)
		{endif}
	{endif}
	(L.L.door_3) (S.L.doorDragAcc_3)
{else}
	(L.L.doorDragAcc_3) (S.L.door_3)
{endif}
{end}

{macro:trg_bus_doorfront0}
	(L.L.doorTarget_0) (L.L.Velocity) (C.L.Door_Bremse_Halte_MaxKMH) < ||
	(L.L.elec_busbar_main) &&
	(L.L.vdv_error_door_active) ! &&
	{if}
	(L.L.doorTarget_0) ! (S.L.doorTarget_0) 
	{if}
		(T.L.ev_doortriggeropen_0)
	{else}
		(C.L.tuerverzoegerung) 0 >
		{if}
			(L.L.tuersperre) 0 >
			{if}
			(T.L.ev_doorwarn1)
			{endif}
		{else}
			(T.L.ev_doortriggerclose_0)
		{endif}
	{endif}
		(C.L.door_druckluft)
		{if}
		(L.L.bremse_p_Tank04) 100000 - 0.98 * 100000 + (S.L.bremse_p_Tank04)
		{endif}
	{endif}
{end}

{macro:trg_bus_doorfront1}
	(L.L.doorTarget_1) (L.L.Velocity) (C.L.Door_Bremse_Halte_MaxKMH) < ||
	(L.L.elec_busbar_main) &&
	(L.L.vdv_error_door_active) ! &&
	{if}
	(L.L.doorTarget_1) ! (S.L.doorTarget_1) 
	{if}
		(T.L.ev_doortriggeropen_0)
	{else}
		(C.L.tuerverzoegerung) 0 >
		{if}
			(T.L.ev_doorwarn1)
		{else}
			(T.L.ev_doortriggerclose_0)
		{endif}
		
	{endif}	
		(C.L.door_druckluft)
		{if}
		(L.L.bremse_p_Tank04) 100000 - 0.98 * 100000 + (S.L.bremse_p_Tank04)
		{endif}
	{endif}
{end}

{macro:trg_bus_doorback23}
	(L.L.doorTarget_23) (L.L.Velocity) (C.L.Door_Bremse_Halte_MaxKMH) < ||
	(L.L.pandus_2_mode) ! &&
	(L.L.elec_busbar_main) &&
	(L.L.vdv_error_door_active) ! &&
	{if}
	(L.L.doorTarget_23) ! (S.L.doorTarget_23) 
	{if}
		(T.L.ev_doortriggeropen_2)
	{else}
		(C.L.tuerverzoegerung) 0 >
		{if}
			(T.L.ev_doorwarn2)
		{else}
			(T.L.ev_doortriggerclose_2)
		{endif}
	{endif}	
		(C.L.door_druckluft)
		{if}
		(L.L.bremse_p_Tank04) 100000 - 0.96 * 100000 + (S.L.bremse_p_Tank04)
		{endif}
	{endif}
{end}

{macro:trg_bus_20h-switch}
	(L.L.door_20h_sw) ! (S.L.door_20h_sw)
	
	(L.L.door_20h_sw)
	{if}
		(T.L.ev_haltebremse_sw_an)
	{else}
		(T.L.ev_haltebremse_sw_aus)
	{endif}	
{end}

{macro:trg_bus_dooraft}
	(L.L.bremse_halte_sw) ! (S.L.bremse_halte_sw)
	
	(L.L.bremse_halte_sw)
	{if}
		(T.L.ev_haltebremse_sw_an)
	{else}
		(T.L.ev_haltebremse_sw_aus)
	{endif}	
{end}

