Cancel
Showing results for 
Search instead for 
Did you mean: 

get sensor ID

Valued Contributor
Valued Contributor

微信图片_20180602175823.png

as picture shoun  the sensor-1 destination is S3,I want to know  how  I can get the sensor  of S3.  namely I want to get the sensor of a station that I needed 

2 REPLIES

Betreff: get sensor ID

Gears Phenom Gears Phenom
Gears Phenom
param pTrack, pStation : object
-> integer

-- if no sensor is found on that track, return -1
result := -1

-- check each sensor on the track
for var s := 1 to pTrack.numSensors loop
	if (pTrack.sensorNr(s).Destination = pStation) then
		return pTrack.sensorNr(s).ID
	end
next
____________________________________________________________
Alex Dilg, Consultant at SimPlan AG (www.SimPlan.de)
This post was good and/or helpful to you? Please provide some Kudos, thank you!

Betreff: get sensor ID

Gears Phenom Gears Phenom
Gears Phenom
You would have to call this method with 2 parameters, the track-object and the station that you are looking for. If you do not know the track for each station, the method could instead loop over all tracks in the network.
____________________________________________________________
Alex Dilg, Consultant at SimPlan AG (www.SimPlan.de)
This post was good and/or helpful to you? Please provide some Kudos, thank you!