// blokada SBL 3-stawna - semafor przed wjazdowym
// (p1) - nazwa, (p2)(p3)(p4) - lokacja, (p5) rotacja, (p6) symbol (p7) sterowanie poprzednim semaforem sbl (jego nazwa)
// uwaga - do toru za semaforem musi byc przypisane zdarzenie NAZWASEMAFORA_s1
// a do toru przy semaforze oczywiscie zdarzenie NAZWASEMAFORA_sem_info
// semafor ten jest kompatybilny z tarcza ostzegawcza (moze byc stosowany jako 7my parametr SS5zpcpbY.inc)

origin (p2) (p3) (p4)
rotate 0 (p5) 0
//model semafora 3komorowego blokady liniowej:
node -1 0 (p1) model 0.415 0 0 0 sem/glowice/S3YPzcp_dd.t3d tabl/(p6) Lights 0 0 1 endmodel   
node -1 0 none model 1.82 -1.1 -7.7 0 PKP/post-P.t3d none endmodel
//node 800 150 none lines 110 110 110  100.0                                      //linia zeby byl maszt //widoczny z daleka
//0.0 0.0 0.0	0.0 4.0 0.0 
//endline

//node -1 0 none model 1.82 -1.1 -7.7 0 PKP/post-P.t3d none endmodel     			      //slup
node -1 0 W18 model 0 0.45 0 180 ip/pkp/w18.t3d none endmodel				//wskaznik W18

// SHP
node -1 0 none triangle_strip material ambient: 150.0 150.0 150.0 diffuse: 150.0 150.0 150.0 specular: 229.5 229.5 229.5  endmaterial metal/MetalFrictionPattern1.tga
-1.0 0.3 1.5 	0.0 1.0 0.0  0.0 2.0 end
-1.0 0.3 0.5 	0.0 1.0 0.0  0.0 0.0 end
-1.2 0.3 1.5 	0.0 1.0 0.0  0.5 2.0 end
-1.0 0.3 0.5 	0.0 1.0 0.0  0.0 0.0 
endtri

rotate 0 0 0
endorigin

//sygnalizacja SHP:
event (p1)_SHP putvalues 1.0 none (p2) (p3) (p4) CabSignal -1 -1 endevent

node -1 0 (p1)_sem_mem memcell (p2) (p3) (p4) SetVelocity -1 0  none endmemcell

//zdarzenia okreslajace predkosc przy tym semaforze
event (p1)_sem_info_stop updatevalues 10.0 (p1)_sem_mem SetVelocity 0.0 20 endevent
event (p1)_sem_info_vmax updatevalues 1.0 (p1)_sem_mem SetVelocity -1 -1 endevent
event (p1)_sem_info_v100 updatevalues 1.0 (p1)_sem_mem SetVelocity -1 100 endevent
event (p1)_sem_info_v40 updatevalues 1.0 (p1)_sem_mem SetVelocity -1 40 endevent
event (p1)_sem_info_nextstop updatevalues 1.0 (p1)_sem_mem SetVelocity -1 0 endevent

event (p1)_s1 multiple 1 (p1)_sem_mem (p1)_sem_ligh1 (p1)_sem_info_stop (p7)_s5 condition memcompare * -1 * endevent
event (p1)_sem_ligh1 lights 0.0 (p1) 0 1 0 endevent

event (p1)_os1 multiple 1 none (p1)_sem_ligh1o (p1)_sem_info_nextstop (p7)_s2 endevent
event (p1)_sem_ligh1o lights 0.0 (p1) 0 0 1 endevent

//ponizsze zdarzenia os2...os4 wyzwalane sa tylko gdy nie bylo S1:

event (p1)_os2 multiple 1 (p1)_sem_mem (p1)_sem_ligh2o (p1)_sem_info_vmax (p7)_s2 condition memcompare * -1 * endevent
event (p1)_sem_ligh2o lights 0.0 (p1) 1 0 0 endevent

event (p1)_os3 multiple 1 (p1)_sem_mem (p1)_sem_ligh3o (p1)_sem_info_v100 (p7)_s2 condition memcompare * -1 * endevent
event (p1)_sem_ligh3o lights 0.0 (p1) 2 0 0 endevent

event (p1)_os4 multiple 1 (p1)_sem_mem (p1)_sem_ligh4o (p1)_sem_info_v40 (p7)_s2 condition memcompare * -1 * endevent
event (p1)_sem_ligh4o lights 0.0 (p1) 0 0 2 endevent


//odczyt z pamieci (zdarzenie przypisane do toru przy semaforze):
event (p1)_sem_info getvalues 1.0 (p1)_sem_mem endevent

