BVE WorldWide
Would you like to react to this message? Create an account in a few clicks or log in to continue.

Getting the stop point of a station for the ATS Plugin

3 posters

Go down

Getting the stop point of a station for the ATS Plugin Empty Getting the stop point of a station for the ATS Plugin

Post by zbx1425 Fri Aug 18, 2017 5:17 am

I'm trying to develop an ATS Plugin that adapts stop point check function, but I found the OpenBVEApi.Station.DefaultTrackPosition refers to the "sta begin" event, causing the ATO in my plugin stops the train hundreds of miles before the correct position. I searched in the source code and found the PluginManager doesn't provide them to the Plugin. Is there any way to get the stop position of the station for the plugin? I mean, I really don't want to put beacons because it will cause the train only work on specific routes.
By the way, how to acquire whether the ATC is equipped?
zbx1425
zbx1425

Posts : 143
Join date : 2017-08-18
Location : China

https://www.zbx1425.cn

Back to top Go down

Getting the stop point of a station for the ATS Plugin Empty Re: Getting the stop point of a station for the ATS Plugin

Post by Marc Riera Fri Aug 18, 2017 10:11 am

I'm developing a route and trains with ATO too and as far as I know, it's impossible to get the exact stop position without beacons. While a set of "standard" ATO beacons could be great in OpenBVE, the truth is that real-life ATO systems are very rarely cross-compatible and each requires specific configuration.

There are two special beacons in OpenBVE, however, to automatically pass information about route ATC to plugins. They are universal and implicit (you don't need to add them to the route):

Beacon -16777215: If the optional data is 0, the track is not ATC-ready. If 1, ATC is available and the train must switch to ATC. If 2, the track is ATC-equipped. If 3, ATC is available and the train must switch to ATS.

Beacon -16777214: The optional data contains the current speed limit (beacon.Optional & 4095) and its track position (beacon.Optional >> 12).

OdakyufanAts uses both of them, so you can check the source to get more details about how to read all this data from a plugin. I think it should be documented in OpenBVE too, as this is part of the simulator but is not specified anywhere.

Marc Riera

Posts : 28
Join date : 2015-12-21
Location : Barcelona, Spain

Back to top Go down

Getting the stop point of a station for the ATS Plugin Empty Re: Getting the stop point of a station for the ATS Plugin

Post by leezer3 Fri Aug 18, 2017 2:42 pm

Try today's build Smile

This adds the following to the API:
Code:
OpenBveApi.Station.StopPosition

This describes the track location of the stop position applicable to the train, and requires no beacons.

Note:
This is not backwards compatible, but it's universal, which I think is as good as you're going to get Smile

Assuming this works OK for you, I'll push a stable build (probably the end of next week now)

leezer3

Posts : 1967
Join date : 2011-08-23

http://www.bvecornwall.co.uk

Back to top Go down

Getting the stop point of a station for the ATS Plugin Empty Re: Getting the stop point of a station for the ATS Plugin

Post by leezer3 Fri Aug 18, 2017 2:55 pm

Marc Riera wrote:Beacon -16777215: If the optional data is 0, the track is not ATC-ready. If 1, ATC is available and the train must switch to ATC. If 2, the track is ATC-equipped. If 3, ATC is available and the train must switch to ATS.

Beacon -16777214: The optional data contains the current speed limit (beacon.Optional & 4095) and its track position (beacon.Optional >> 12).

Odakyufan wrote the ATC implementation for openBVE (and for that matter, IIRC OdakyufanATS is actually a much newer version of the default ATC / ATS plugin)

I have absolutely no documentation on why these numbers are used, other than possibly just to not conflict with anything else. (16777215 is actually 256 * 256 * 256, so possibly the largest possible beacon number that could have been used, but that's just a guess....)

Looking at Mackoy's plugin headers, ATC / ATS switching don't appear to be members/ supported, and so I'd guess that these were only supported with the 'default' BVE2 / 4 safety systems implementation, which the included plugin clones.

leezer3

Posts : 1967
Join date : 2011-08-23

http://www.bvecornwall.co.uk

Back to top Go down

Getting the stop point of a station for the ATS Plugin Empty Re: Getting the stop point of a station for the ATS Plugin

Post by zbx1425 Sat Aug 19, 2017 10:42 am

leezer3 wrote:Try today's build Smile

This adds the following to the API:
Code:
OpenBveApi.Station.StopPosition

This describes the track location of the stop position applicable to the train, and requires no beacons.

Note:
This is not backwards compatible, but it's universal, which I think is as good as you're going to get Smile

Assuming this works OK for you, I'll push a stable build (probably the end of next week now)
Thank you! I'll start working again. By the way, why don't you give the plugin the right to read the in-game data, rather than wrapped data?
zbx1425
zbx1425

Posts : 143
Join date : 2017-08-18
Location : China

https://www.zbx1425.cn

Back to top Go down

Getting the stop point of a station for the ATS Plugin Empty Re: Getting the stop point of a station for the ATS Plugin

Post by zbx1425 Sat Aug 19, 2017 10:46 am

leezer3 wrote:
Marc Riera wrote:Beacon -16777215: If the optional data is 0, the track is not ATC-ready. If 1, ATC is available and the train must switch to ATC. If 2, the track is ATC-equipped. If 3, ATC is available and the train must switch to ATS.

Beacon -16777214: The optional data contains the current speed limit (beacon.Optional & 4095) and its track position (beacon.Optional >> 12).

Odakyufan wrote the ATC implementation for openBVE (and for that matter, IIRC OdakyufanATS is actually a much newer version of the default ATC / ATS plugin)

I have absolutely no documentation on why these numbers are used, other than possibly just to not conflict with anything else. (16777215 is actually 256 * 256 * 256, so possibly the largest possible beacon number that could have been used, but that's just a guess....)

Looking at Mackoy's plugin headers, ATC / ATS switching don't appear to be members/ supported, and so I'd guess that these were only supported with the 'default' BVE2 / 4 safety systems implementation, which the included plugin clones.
They are in OldCode/TrackManager.cs, line 517 "internal static class SpecialTransponderTypes".
Also, they're used by the built-in ATC system in the game.
zbx1425
zbx1425

Posts : 143
Join date : 2017-08-18
Location : China

https://www.zbx1425.cn

Back to top Go down

Getting the stop point of a station for the ATS Plugin Empty Re: Getting the stop point of a station for the ATS Plugin

Post by zbx1425 Sat Aug 19, 2017 10:50 am

Marc Riera wrote:I'm developing a route and trains with ATO too and as far as I know, it's impossible to get the exact stop position without beacons. While a set of "standard" ATO beacons could be great in OpenBVE, the truth is that real-life ATO systems are very rarely cross-compatible and each requires specific configuration.

There are two special beacons in OpenBVE, however, to automatically pass information about route ATC to plugins. They are universal and implicit (you don't need to add them to the route):

Beacon -16777215: If the optional data is 0, the track is not ATC-ready. If 1, ATC is available and the train must switch to ATC. If 2, the track is ATC-equipped. If 3, ATC is available and the train must switch to ATS.

Beacon -16777214: The optional data contains the current speed limit (beacon.Optional & 4095) and its track position (beacon.Optional >> 12).

OdakyufanAts uses both of them, so you can check the source to get more details about how to read all this data from a plugin. I think it should be documented in OpenBVE too, as this is part of the simulator but is not specified anywhere.
I know it. Actually according to the code there are five special beacons.
/// Marks the status of ATC.
internal const int AtcTrackStatus = -16777215;
/// Sets up an ATC speed limit.
internal const int AtcSpeedLimit = -16777214;
/// Sets up an ATS-P temporary speed limit.
internal const int AtsPTemporarySpeedLimit = -16777213;
/// Sets up an ATS-P permanent speed limit.
internal const int AtsPPermanentSpeedLimit = -16777212;
/// For internal use inside the CSV/RW parser only.
internal const int InternalAtsPTemporarySpeedLimit = -16777201;
}
But I don't now how to use them. Thank you. And your opinion is right anyway. It's just like it in the real life... but I really want to play more routes with my train.
zbx1425
zbx1425

Posts : 143
Join date : 2017-08-18
Location : China

https://www.zbx1425.cn

Back to top Go down

Getting the stop point of a station for the ATS Plugin Empty Re: Getting the stop point of a station for the ATS Plugin

Post by leezer3 Sat Aug 19, 2017 11:41 am

zbx1425 wrote:
leezer3 wrote:Try today's build Smile

This adds the following to the API:
Code:
OpenBveApi.Station.StopPosition

This describes the track location of the stop position applicable to the train, and requires no beacons.

Note:
This is not backwards compatible, but it's universal, which I think is as good as you're going to get Smile

Assuming this works OK for you, I'll push a stable build (probably the end of next week now)
Thank you! I'll start working again. By the way, why don't you give the plugin the right to read the in-game data, rather than wrapped data?

The internals of the game are in many places an absolute confusing jumble Razz

The second reason is because it's somewhat complicated to do that easily.
Michelle's basic train plugin design is essentially a cloned version of Mackoy's original plugin interface, and it's dug rather closely into the internal workings of the sim itself, which is not designed to have modification of any of it's data externally.

Add to that the fact that most of the existing code has a lot of dangerous assumptions in place, and it's not going to happen any time soon Sad

leezer3

Posts : 1967
Join date : 2011-08-23

http://www.bvecornwall.co.uk

Back to top Go down

Getting the stop point of a station for the ATS Plugin Empty Re: Getting the stop point of a station for the ATS Plugin

Post by zbx1425 Tue Aug 22, 2017 5:59 am

leezer3 wrote:Try today's build Smile

This adds the following to the API:
Code:
OpenBveApi.Station.StopPosition

This describes the track location of the stop position applicable to the train, and requires no beacons.

Note:
This is not backwards compatible, but it's universal, which I think is as good as you're going to get Smile

Assuming this works OK for you, I'll push a stable build (probably the end of next week now)

We have stastart before, and stastop now, why don't you add staend by the way?
zbx1425
zbx1425

Posts : 143
Join date : 2017-08-18
Location : China

https://www.zbx1425.cn

Back to top Go down

Getting the stop point of a station for the ATS Plugin Empty Re: Getting the stop point of a station for the ATS Plugin

Post by leezer3 Tue Aug 22, 2017 3:28 pm

zbx1425 wrote:
leezer3 wrote:Try today's build Smile

This adds the following to the API:
Code:
OpenBveApi.Station.StopPosition

This describes the track location of the stop position applicable to the train, and requires no beacons.

Note:
This is not backwards compatible, but it's universal, which I think is as good as you're going to get Smile

Assuming this works OK for you, I'll push a stable build (probably the end of next week now)

We have stastart before, and stastop now, why don't you add staend by the way?

Should probably be able to add that, but it's a slightly more complex problem than the last-
Conceptually, it's not (so) clear as to whether the reported end of the station should be that defined by the last .Stop command (whether applicable to your train or not), or simply the acceptable outside bounds of the last acceptable stop point including tolerances.

leezer3

Posts : 1967
Join date : 2011-08-23

http://www.bvecornwall.co.uk

Back to top Go down

Getting the stop point of a station for the ATS Plugin Empty Re: Getting the stop point of a station for the ATS Plugin

Post by zbx1425 Thu Aug 24, 2017 7:13 am

leezer3 wrote:
zbx1425 wrote:
leezer3 wrote:Try today's build Smile

This adds the following to the API:
Code:
OpenBveApi.Station.StopPosition

This describes the track location of the stop position applicable to the train, and requires no beacons.

Note:
This is not backwards compatible, but it's universal, which I think is as good as you're going to get Smile

Assuming this works OK for you, I'll push a stable build (probably the end of next week now)

We have stastart before, and stastop now, why don't you add staend by the way?

Should probably be able to add that, but it's a slightly more complex problem than the last-
Conceptually, it's not (so) clear as to whether the reported end of the station should be that defined by the last .Stop command (whether applicable to your train or not), or simply the acceptable outside bounds of the last acceptable stop point including tolerances.
I mean the position of the "Station End" event.
zbx1425
zbx1425

Posts : 143
Join date : 2017-08-18
Location : China

https://www.zbx1425.cn

Back to top Go down

Getting the stop point of a station for the ATS Plugin Empty Re: Getting the stop point of a station for the ATS Plugin

Post by Sponsored content


Sponsored content


Back to top Go down

Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum