/-----------------------------------------\
|  ATS-SN / ATS-P / ATC / TASC / ATO / EB |
|           Plugin for openBVE            |
\-----------------------------------------/

The plugin is free to redistribute or modify. You can find the source code in the 'source' folder.

Please note that newer versions might change in backward-incompatible ways, so save a copy of the source code if you like any particular version.



Beacons
=======


	Type		Data
	----		----

	0		SwitchSystem
	S-type transponder. Place about 600m before a signal.
	SwitchSystem is 0 to switch between ATS-SN and ATS-P, or -1 to not.

	1		SwitchSystem
	SN-type transponder. Place about 20m before a signal.
	SwitchSystem is 0 to switch between ATS-SN and ATS-P, or -1 to not.

	2		Cars
	Accidental departure transponder.
	Cars is 0 for all cars, or any other number for that amount of cars.

	3		SwitchSystem
	P-pattern transponder. Place some between 600m and 50m between a signal.
	SwitchSystem is 0 to switch between ATS-SN and ATS-P, or -1 to not.

	4		SwitchSystem
	P-stop transponder. Place about 25m/30m before a signal.
	SwitchSystem is 0 to switch between ATS-SN and ATS-P, or -1 to not.

	5
	(unused)

	6		AABBDDDD
	TASC-pattern transponder. Place about 400/500m, 50m, 10m, 1m and 0m before the stop point.
	AA is the minimum number of cars.
	BB is the maximum number of cars, or 0 for any.
	DDDD is the distance to the stop point in meters.
	Examples: 03040500 for 3-4 cars in 500m, 00080010 for up to 8 cars in 10m, 00060000 for 6 or more cars in 0m.

	7		DDDAABBCC
	ATC route speed notification. Place at section boundaries to inform about the route speed.
	DDD is the distance to the next section in m. Set to 0 for non-continuous braking.
	AA is the route speed in the block started here in km/h.
	BB is the route speed in the following block in km/h, or 0 to switch from ATC to ATS.
	CC is the route speed in the block following the next block in km/h.
	Example: 100755555 for 75 km/h now, 55 km/h in 100 m, and 55 km/h beyond that.

	8		Speed
	ATS-P route speed transponder. Similar to Track.Pattern for openBVE's built-in ATS.
	Speed is the new route speed in km/h.



Section aspects (ATC)
=====================

	101		X (emergency brake)
	102		0 km/h (service brake)
	103		25 km/h
	104		40 km/h
	105		55 km/h
	106		65 km/h
	107		75 km/h
	108		83 km/h
	109		90 km/h (83 km/h in 1 block)
	110		90 km/h (83 km/h in 2 blocks)
	111		90 km/h (83 km/h in 3 blocks)
	112		90 km/h (free way)

	ATS -> ATC sections:
		Track.Section 0;2;4
		Track.Section 0;101;103;104;105;106;107;108;109;110;111;112
		(station here)
		Track.Section 0;101;103;104;105;106;107;108;109;110;111;112
		Track.Section 101;102;103;104;105;106;107;108;109;110;111;112

	ATC block section:
		Track.Section 101;102;103;104;105;106;107;108;109;110;111;112

	ATC -> ATS sections
		Track.Section 101;102;103;104;105;106;107;108;109;110;111;112
		Track.Section 101;102;103;104;105;106;107;108;109;110;112
		Track.Section 101;102;103;104;105;106;107;108;109;112
		Track.Section 101;102;103;104;105;106;107;108;112
		Track.Section 101;102;103;104;105;106;107;112
		Track.Section 101;102;103;104;105;106;112
		Track.Section 101;102;103;104;105;112
		Track.Section 101;102;103;104;112
		Track.Section 101;102;103;112
		Track.Section 101;102;112
		Track.Section 101;112
		(station here)
		Track.Section 0;2;4

	The plugin was designed to work in 100m blocks, so set one Track.Section every 100m.

	Every ATC section must be paired with a beacon type 7 to indicate the route speed limit and the section length.



Readouts for atsI and pluginState[i]
====================================

	Index		Meaning			Values
	-----		-------			------
	0		lamp: SN power		0 - 1
	1		lamp: SN			0 - 1
	2		lamp: SN run		0 - 1
	3		lamp: P power		0 - 1
	4		lamp: P pattern		0 - 1
	5		lamp: P service		0 - 1
	6		lamp: P			0 - 1
	7		lamp: failure		0 - 1
	8		lamp: ATC power		0 - 1
	9		lamp: ATC			0 - 1
	10		lamp: ATC service		0 - 1
	11		lamp: ATC emergency	0 - 1
	12		lamp: TASC power		0 - 1
	13		lamp: TASC pattern	0 - 1
	14		lamp: TASC service	0 - 1
	15		lamp: ATO			0 - 4
	16		ATC speed			in m/h
	17		lamp: EB			0 - 1
	18		lamp: ATC pattern		0 - 1
	19		lamp: ATC advance		0 - 1
	..		.....				..
	21		display: system		0 - 4
	22		display: TASC		0 - 2
	23		display: ATO		0 - 3
	24		display: ATC rapid	0 - 1
	..		.....				..
	30		lamp: brake			0 - 1
	31		lamp: power			0 - 1
	..		.....				..
	99		true				1



Sounds
======

	Index		Meaning		Type
	-----		-------		----
	0		ATS-SN chime	looping
	1		ATS-SN alarm	looping
	2		ATS/ATC ding	once
	3		EB beep		looping