'##############
'Wiper Script
'##############

'Controls Wiper

'(c) 20.03.2009 Marcel Kuhnt

'Script Version: 1.0
'Omsi release: 1.0

'Needs:
'- rain
'- dirt

'Revision History:
'- Marcel Kuhnt		20.03.2009	Last Change		
'- Marcel Kuhnt		13.06.2009	Added Switch-Vars	
'- Marcel Kuhnt		13.06.2009	Added Wiper/Washer Function
'- Marcel Kuhnt		21.06.2009	Added AI-Activation
'- Rüdiger Hülsmann	14.05.2010	Added wiperpos_2xspeed for sinusdial movement during half a period

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

{macro:wiper2_init}
	0 (S.L.wiperrun)
{end}

{macro:wiper2_frame}

'-------------------------------------------
'AI-Einfluss auf den Scheibenwischer:
'Nur wenn Motor an sein soll:
	(L.L.AI) (L.L.AI_Engine) 1 = &&
	{if}
'Wenn der Intervallwischer nicht ausreicht, dann Dauermodus:
		(C.L.wiper_intervall) (L.L.PrecipRate) * (C.L.rain_wiper_eff) >
		{if}
			0 (S.L.wiper_intervall_sw)
			1 (S.L.wiper_einaus_sw)
		{else}
'Sonst (falls es regnet) den Intervallmodus:
		(L.L.PrecipRate) 0 >
		{if}
			1 (S.L.wiper_intervall_sw)
			0 (S.L.wiper_einaus_sw)
		{else}
			0 (S.L.wiper_intervall_sw)
			0 (S.L.wiper_einaus_sw)
		{endif}
		{endif}
	{endif}

	(L.L.elec_busbar_main)
	{if}	
		(L.L.wiperrunning1) 1 =
		{if}
			(L.L.wiperrun) (L.S.Timegap) (L.L.wiper_speed1) * + (S.L.wiperrun)
		{endif}
	
		(L.L.wiperrun) 2 pi * >
		{if}
			(L.L.wiper_einaus_sw) (L.L.wiper_wascher_sw) || (S.L.wiperrunning1)
			0 (S.L.wiperrun) (S.L.wiperrunning1)
		{endif}
	
		(L.L.wiperrunning1) ! (L.L.wiper_einaus_sw) (L.L.wiper_wascher_sw) || &&
		{if}
			1 (S.L.wiperrunning1)
			(T.L.wiper_start1)
			(L.L.Rain_Window_Wiped_Wetness) 0 =
			{if}
				(T.L.wiper_start_dry1)
			{endif}
		{endif}

		(L.L.wiper_wascher_sw)
		{if}
			(L.L.wiper_wash) !
			{if}
				(T.L.wiper_wash_start)
			{endif}
			1 (S.L.wiper_wash)
			(L.L.wiper_wash_texpos) 3 (L.S.Timegap) * - (S.L.wiper_wash_texpos)
		{else}
			0 (S.L.wiper_wash)
		{endif}



	{endif}


	{else}
		0 (S.L.wiperrunning1)
	{endif}






	(L.L.wiperrun) 1.5 pi * + sin 1 + 2 / (S.L.wiperpos1) (S.L.Rain_Wiper_Pos) (S.L.Dirt_Wiper_Pos)

	(L.L.wiperrun) 2 * 1.5 pi * + sin 1 + 2 / (S.L.wiperpos1_2xspeed)


'	Wischer schnell

	(L.L.wiper_schnell_sw) (L.L.wiper_einaus_sw) &&
	{if}
		3.55 (S.L.wiper_speed1)
	{else}
		2.0 (S.L.wiper_speed1)
	{endif}




	
	(L.L.wiper_intervall_sw) !
	{if}
		0 (S.L.wiper_intervall_on)
	{endif}

	(L.L.wiper_intervall_on)
	{if}
		(L.S.getTime) (L.L.wiper_intervall_starttime) - (S.L.wiper_intervall_time)
	{else}
		0 (S.L.wiper_intervall_time)
	{endif}








	
{end}
