node -1 0 start_eu eventlauncher -20.0 15.0 0.0 1000 n 0 start_01 none end 

//----------------------------------------------------
node -1 0 memcell_start01 memcell 1.0 1.0 0.0 start 1 0 none endmemcell

event zwrotnicowo_start_przestaw01 multiple 2.0 none
	zwrotnicowo_zwr02-
	zwrotnicowo_zwr17- 
	zwrotnicowo_zwr19- 
	zwrotnicowo_zwr20- 
endevent

					//wyjedz z zeberka
event start_01 multiple 0.0 memcell_start01
	zwrotnicowo_sem_G_Ms2 
	zwrotnicowo_zwr08+ 
	zwrotnicowo_zwr05+ 
	zwrotnicowo_zwr04+ 
	zwrotnicowo_zwr03+ 
	zwrotnicowo_zwr18+
	zwrotnicowo_zwr21+ 
	zwrotnicowo_start_przestaw01
condition memcompare start 1 0 endevent

					//bocznica
event zwrotnicowo_wyc_sklad multiple 40.0 memcell_start01
	zwrotnicowo_sem_G_S1
	zwrotnicowo_sem_b_Tm5_Ms2
	zwrotnicowo_sem_Tm8_Ms2
	zwrotnicowo_zwr03-
	zwrotnicowo_zwr06-
condition memcompare start 1 0 endevent

					//z peronu na mijanke
event zwrotnicowo_mijanka1 multiple 30.0 memcell_start01
	zwrotnicowo_sem_Tm8_Ms1
	zwrotnicowo_sem_b_Tm5_Ms1
	zwrotnicowo_sem_E_Ms2
	zwrotnicowo_zwr09-
condition memcompare start 1 0 endevent

					//z mijanki na peron 1
event zwrotnicowo_mijanka2 multiple 30.0 memcell_start01
	zwrotnicowo_sem_Tm11_Ms2
	zwrotnicowo_sem_L_Ms2
	zwrotnicowo_sem_E_S1
	zwrotnicowo_zwr09+
	zwrotnicowo_zwr06+
condition memcompare start 1 0 endevent

event start_mem_2 updatevalues 0.0 memcell_start01 start 2 0 endevent

					//z drugiej mijanki na peron 2
event zwrotnicowo_mijanka3 multiple 30.0 memcell_start01
	zwrotnicowo_sem_Tm11_Ms1
	zwrotnicowo_sem_L_S1
	zwrotnicowo_sem_Tm8_Ms2
	zwrotnicowo_zwr06-
	start_mem_2
condition memcompare start 1 0 endevent
		
					//wjazd na stacje 2 - koniec manewrow
event zwrotnicowo_mijanka_koniec multiple 0.0 memcell_start01
	zwrotnicowo_sem_Tm8_Ms1
	zwrotnicowo_cala_naprzod
condition memcompare start 2 0 endevent

					//wyjazd ze stacji
event zwrotnicowo_cala_naprzod multiple 180.0 memcell_start01
	zwrotnicowo_sem_K_S2
	zwrotnicowo_zwr01+
	zwrotnicowo_zwr02+
	zwrotnicowo_za_pozno
condition memcompare start 2 0 endevent

event zwrotnicowo_za_pozno multiple 900.0 memcell_start01
	zwrotnicowo_sem_K_S1
condition memcompare start 2 0 endevent

//----------------------------------------------------
event trasa01 multiple 0.0 memcell_start01
	trasa_zwr-man_W_S1
condition memcompare start 2 0 endevent

event trasa02 multiple 30.0 memcell_start01
	trasa_zwr-man_W_S5
	trasa_zwr-man_A_S1
	trasa_zwr_man02+
	trasa_zwr_man01+
condition memcompare start 2 0 endevent

event trasa03 multiple 90.0 memcell_start01
	trasa_zwr-man_W_S1
	trasa_zwr-man_A_S2
condition memcompare start 2 0 endevent

event trasa04 multiple 0.0 memcell_start01
	trasa_zwr-man_A_S1
condition memcompare start 2 0 endevent

//----------------------------------------------------
event trasa10 multiple 0.0 memcell_start01
	manewrowo_sem_W_S13
	manewrowo_zwr01+
	manewrowo_zwr03-
condition memcompare start 2 0 endevent

event start_mem_3 updatevalues 0.0 memcell_start01 start 3 0 endevent

event trasa11 multiple 0.0 memcell_start01
	manewrowo_sem_W_S1
	trasa12
	start_mem_3
condition memcompare start 2 0 endevent

event trasa12 multiple 60.0 memcell_start01
	manewrowo_sem_E_Ms2
condition memcompare start 3 0 endevent

event trasa13 multiple 30.0 memcell_start01
	manewrowo_sem_E_S1
	manewrowo_sem_Tm1_Ms2
	manewrowo_zwr04+
	manewrowo_zwr03+
	manewrowo_zwr08+
	manewrowo_sem_N_Ms2
condition memcompare start 3 0 endevent


//------------------------------------------------------------------------------

event start_mem_4 updatevalues 0.0 memcell_start01 start 1 1 endevent

node -1 0 start_eu_2 eventlauncher -24000.0 0.0 7440.0 1000 v 0 start_02 none end 

event start_02 multiple 0.0 none
	start_mem_4
	trasa13
endevent

	//ustaw zwrotnice w manewrowie
event trasa13 multiple 5.0 memcell_start01
	manewrowo_zwr11+
	manewrowo_zwr12+
	manewrowo_zwr13-
	manewrowo_zwr14-
	manewrowo_sem_H_S2
condition memcompare start 1 1 endevent

	//podaj S1 po wyjezdzie z stacji
event trasa12 multiple 60.0 memcell_start01
	manewrowo_sem_H_S1
condition memcompare start 1 1 endevent

	//podaj S1 przed wjazdem do gagarinowa
event trasa14 multiple 0.0 memcell_start01
	gagariny_sem_W_S1
condition memcompare start 1 1 endevent

	//podaj S5 (zezwalaj na wjazd)
event trasa15 multiple 30.0 memcell_start01
      	gagariny_sem_W_S5
	gagariny_zwr01+
	gagariny_zwr02+
condition memcompare start 1 1 endevent

event start_mem_5 updatevalues 0.0 memcell_start01 start 2 1 endevent

	//manewry do zamiany loka na drugą strone skladu
event trasa20 multiple 40.0 memcell_start01
      	gagariny_sem_W_S1
	gagariny_zwr09-
	gagariny_sem_Tm6_Ms2
	start_mem_5
condition memcompare start 1 1 endevent

event trasa21 multiple 40.0 memcell_start01
	gagariny_zwr09+
	gagariny_zwr08-
	gagariny_zwr07-
	gagariny_zwr05-
	gagariny_zwr04-
	gagariny_zwr01-
	trasa21_a
condition memcompare start 2 1 endevent

event trasa21_a multiple 0.0 memcell_start01
	gagariny_sem_Tm6_Ms1
	gagariny_sem_Tm7_Ms2
	gagariny_sem_B_Ms2
condition memcompare start 2 1 endevent

event trasa22 multiple 40.0 memcell_start01
	gagariny_zwr02+
	gagariny_zwr01+

	gagariny_sem_B_S1
	gagariny_sem_Tm7_Ms1
	gagariny_sem_Tm3_Ms2
condition memcompare start 2 1 endevent

event trasa23 multiple 0.0 memcell_start01
	gagariny_sem_Tm3_Ms1
	trasa24
condition memcompare start 2 1 endevent

	//wyjazd z gagarinow
event trasa24 multiple 180.0 memcell_start01
	gagariny_sem_A_S2
	gagariny_zwr03-
	gagariny_zwr02-
	gagariny_zwr06+
condition memcompare start 2 1 endevent

	//s1 na wyjazdowy
event trasa25 multiple 0.0 memcell_start01
	gagariny_sem_A_S1
condition memcompare start 2 1 endevent

	//trasa
//----------------------------------

	//wjazd na stacje
event trasa30 multiple 0.0 memcell_start01
	semaforowo_sem_R_S13
	semaforowo_zwr12-
	semaforowo_zwr14-
	semaforowo_zwr10-
condition memcompare start 2 1 endevent

	//na stacji - S1 dla wjazdowego
event trasa31 multiple 0.0 memcell_start01
	semaforowo_sem_R_S1
	trasa32
condition memcompare start 2 1 endevent

	//ustaw wyjazd i S2
event trasa32 multiple 45.0 memcell_start01
	semaforowo_zwr06-
	semaforowo_zwr04-
	semaforowo_zwr01-
	semaforowo_sem_D_S2
condition memcompare start 2 1 endevent

	//na wyjazdowy podaj S1
event trasa33 multiple 0.0 memcell_start01
	semaforowo_sem_D_S1
condition memcompare start 2 1 endevent

	//na wjazdowy do zwrotnicowa podaj S1
event trasa34 multiple 0.0 memcell_start01
	zwrotnicowo_sem_P_S1
condition memcompare start 2 1 endevent

	//zezwalaj na wjazd na stacje
event trasa35 multiple 40.0 memcell_start01
	zwrotnicowo_sem_P_S5
	zwrotnicowo_zwr13+
	zwrotnicowo_zwr14+
	zwrotnicowo_zwr12-
	zwrotnicowo_zwr10-
condition memcompare start 2 1 endevent
	
	//na wjazdowy S1
event trasa36 multiple 0.0 memcell_start01
	zwrotnicowo_sem_P_S1
	trasa37
condition memcompare start 2 1 endevent

	//ustaw do manewrow
event trasa37 multiple 30.0 memcell_start01
	zwrotnicowo_zwr07-
	zwrotnicowo_zwr05-
	zwrotnicowo_zwr04+
	zwrotnicowo_zwr03+
	zwrotnicowo_zwr02-
	zwrotnicowo_zwr17-
	zwrotnicowo_zwr18-
	trasa38
condition memcompare start 2 1 endevent

	//zapodaj sygnal manewrowy
event trasa38 multiple 10.0 memcell_start01
	zwrotnicowo_sem_J_Ms2
condition memcompare start 2 1 endevent

event trasa39 multiple 10.0 memcell_start01
	zwrotnicowo_sem_J_S1
condition memcompare start 2 1 endevent

//------------------------------------------------------------------------------

node -1 0 start_eu_3 eventlauncher -29100.0 0.0 13700.0 1000 v 0 start10 none end 

event start10 multiple 0.0 none
	fabryka_zwr+
endevent

event start_mem_10 updatevalues 0.0 memcell_start01 start 1 2 endevent

	//podjazd pod semafor i czekaj

event trasa40 multiple 0.0 none
	start_mem_10
	trasa41
endevent

	//cała naprzod z fabryki
event trasa41 multiple 60.0 memcell_start01
	gagariny_sem_D_S2
	gagariny_zwr05+
	gagariny_zwr04-
	gagariny_zwr01-
condition memcompare start 1 2 endevent

	//na wyjazdowy podaj S1
event trasa42 multiple 0.0 memcell_start01
	gagariny_sem_D_S1
condition memcompare start 1 2 endevent

	//zazwalaj na wjazd do manewrowa i ustaw zwrotnice
event trasa43 multiple 0.0 memcell_start01
	manewrowo_sem_Z_S13
	manewrowo_zwr14+
	manewrowo_zwr09+
	manewrowo_zwr07-
condition memcompare start 1 2 endevent

	//na stacji odczep wagony i manewruj
event trasa44 multiple 40.0 memcell_start01
	manewrowo_sem_Z_S1
	manewrowo_zwr04-
	manewrowo_zwr03+
	manewrowo_zwr01+
	manewrowo_sem_F_Ms2
condition memcompare start 1 2 endevent

	//manewruj po drugi skład
event trasa45 multiple 30.0 memcell_start01
	manewrowo_sem_F_S1
	manewrowo_sem_Tm1_Ms2
	manewrowo_sem_Tm6_Ms2
	manewrowo_zwr01-
	manewrowo_zwr02-
	manewrowo_zwr05-
	manewrowo_zwr09-
	manewrowo_zwr14+
condition memcompare start 1 2 endevent

	//po drugiej stronie stacji - cd. manewry
event trasa46 multiple 30.0 memcell_start01
	manewrowo_sem_Tm1_Ms1
	manewrowo_sem_Tm6_Ms1
	manewrowo_zwr14-
	manewrowo_zwr13+
	manewrowo_sem_Tm8_Ms2
condition memcompare start 1 2 endevent
	
	//bierz drugi skład
event trasa47 multiple 0.0 memcell_start01
	manewrowo_sem_Tm8_Ms1
	trasa48
condition memcompare start 1 2 endevent

	//cala naprzod z drugim skladem
event trasa48 multiple 120.0 memcell_start01
	manewrowo_sem_I_S2
condition memcompare start 1 2 endevent

event trasa49 multiple 0.0 memcell_start01
	manewrowo_sem_I_S1
	gagariny_sem_W_S13
	gagariny_zwr05+
	gagariny_zwr01-
	gagariny_zwr04-
condition memcompare start 1 2 endevent
	
	//koniec trasy
event trasa50 multiple 240.0 memcell_start01
	gagariny_sem_W_S1
condition memcompare start 1 2 endevent


//-----------------------test--------------------------



//-----------------test-------------------------------------------
