[Mod] Advanced Trains [advtrains] [2.4.3]

User avatar
BuckarooBanzay
Member
Posts: 437
Joined: Tue Apr 24, 2018 05:58
GitHub: BuckarooBanzay
IRC: BuckarooBanzai
In-game: BuckarooBanzai

Re: [Mod] Advanced Trains [advtrains] [2.0.1 TSS]

by BuckarooBanzay » Post

Any idea what could cause this:

Code: Select all

minetest_1           | 2019-05-26 20:05:52: ERROR[Main]: ServerError: AsyncErr: environment_Step: Runtime error from mod '' in callback environment_Step(): /data/world//worldmods/advtrains/advtrains/nodedb.lua:252: attempt to index local 'ndbnode' (a nil value)
minetest_1           | 2019-05-26 20:05:52: ERROR[Main]: stack traceback:
minetest_1           | 2019-05-26 20:05:52: ERROR[Main]: 	/data/world//worldmods/advtrains/advtrains/nodedb.lua:252: in function 'restore_all'
minetest_1           | 2019-05-26 20:05:52: ERROR[Main]: 	/data/world//worldmods/advtrains/advtrains/init.lua:38: in function 'func'
minetest_1           | 2019-05-26 20:05:52: ERROR[Main]: 	/usr/local/bin/../builtin/common/after.lua:20: in function </usr/local/bin/../builtin/common/after.lua:5>
minetest_1           | 2019-05-26 20:05:52: ERROR[Main]: 	/usr/local/bin/../builtin/game/register.lua:419: in function </usr/local/bin/../builtin/game/register.lua:399>

I had a new corruption just a few minutes ago :(
The line numbers might be off +/-1 line (https://github.com/pandorabox-io/advtrains)
¯\_(ツ)_/¯ Not active here anymore, contact me on the minetest discord, irc, lemmy or github (for programming issues)

User avatar
orwell
Member
Posts: 958
Joined: Wed Jun 24, 2015 18:45
GitHub: orwell96
IRC: orwell96_mt
In-game: orwell
Location: Raxacoricofallapatorius

Re: [Mod] Advanced Trains [advtrains] [2.0.1 TSS]

by orwell » Post

Uh, it looks like both saves are out of sync again. There`s an ID in the ndb binary data which doesn`t correspond to a node name (saved in main save file)
Hm, you could just check for nil there and skip the iteration if "ndbnode" is nil.
Lua is great!
List of my mods
I like singing. I like dancing. I like ... niyummm...

User avatar
BuckarooBanzay
Member
Posts: 437
Joined: Tue Apr 24, 2018 05:58
GitHub: BuckarooBanzay
IRC: BuckarooBanzai
In-game: BuckarooBanzai

Re: [Mod] Advanced Trains [advtrains] [2.0.1 TSS]

by BuckarooBanzay » Post

orwell wrote:Uh, it looks like both saves are out of sync again. There`s an ID in the ndb binary data which doesn`t correspond to a node name (saved in main save file)
Hm, you could just check for nil there and skip the iteration if "ndbnode" is nil.
Hey there, i figured it out:

Short version:
i'm stupid!

Long version:

My recent addition to my monitoring mod overwrote the ndb_save function (https://github.com/thomasrudin-mt/monit ... c02c182848)
but failed to return the result. The same result that should get written in the "advtrains" save-file :(
That way on every restart/crash the node-db was "corrupted" due that the nodeid's could not be found...

I almost went mad yesterday when i saw all tracks convert to some random advtrains node over and over again... :X

Anyways: sorry for the wrong bug-report and thanks for the support :)
¯\_(ツ)_/¯ Not active here anymore, contact me on the minetest discord, irc, lemmy or github (for programming issues)

User avatar
Miniontoby
Member
Posts: 616
Joined: Fri Mar 01, 2019 19:25
GitHub: Miniontoby
IRC: Miniontoby
In-game: Miniontoby
Location: The Netherlands

Re: [Mod] Advanced Trains [advtrains] [2.0.1 TSS]

by Miniontoby » Post

Hey orwell, can you make a video how to make a trainline with two turnouts for two platforms so that I can see it on the mapserver???
Working on mtctl ---- Check my mod "Doorbell" -- Stay safe

gpcf
Member
Posts: 382
Joined: Fri May 27, 2016 10:48
GitHub: gpcf
In-game: gabriel

Re: [Mod] Advanced Trains [advtrains] [2.0.1 TSS]

by gpcf » Post

Can someone please make a tram vehicle in Blender? We have a tram line nouw on the linuxworks server.

yw05
Member
Posts: 366
Joined: Tue May 07, 2019 12:59
GitHub: y5nw
IRC: y5nw
In-game: ywang
Location: Germany

Re: [Mod] Advanced Trains [advtrains] [2.0.1 TSS]

by yw05 » Post

gpcf wrote:Can someone please make a tram vehicle in Blender? We have a tram line nouw on the linuxworks server.
I would say that you can look at those in Düsseldorf (I saw them during my trip to Germany) or use subway wagons, since I do see some subway lines go above the ground. Use the JR wagons on the server along with speed restriction rail.
Miniontoby wrote:Hey orwell, can you make a video how to make a trainline with two turnouts for two platforms so that I can see it on the mapserver???
I don't understand why one train line would need two turnouts for two platforms in the same station.

User avatar
Miniontoby
Member
Posts: 616
Joined: Fri Mar 01, 2019 19:25
GitHub: Miniontoby
IRC: Miniontoby
In-game: Miniontoby
Location: The Netherlands

Re: [Mod] Advanced Trains [advtrains] [2.0.1 TSS]

by Miniontoby » Post

I will need it.
Working on mtctl ---- Check my mod "Doorbell" -- Stay safe

yw05
Member
Posts: 366
Joined: Tue May 07, 2019 12:59
GitHub: y5nw
IRC: y5nw
In-game: ywang
Location: Germany

Re: [Mod] Advanced Trains [advtrains] [2.0.1 TSS]

by yw05 » Post

Miniontoby wrote:I will need it.
Do you mean you need the interlocking (this is an old screenshot without interlocking) of this part?
Image
Attachments
20190603_211413.jpg
20190603_211413.jpg (469.51 KiB) Viewed 1092 times

User avatar
Miniontoby
Member
Posts: 616
Joined: Fri Mar 01, 2019 19:25
GitHub: Miniontoby
IRC: Miniontoby
In-game: Miniontoby
Location: The Netherlands

Re: [Mod] Advanced Trains [advtrains] [2.0.1 TSS]

by Miniontoby » Post

yes that, but I will can see the trainline on the Mapserver (with Mapserver_mod)
Working on mtctl ---- Check my mod "Doorbell" -- Stay safe

User avatar
BuckarooBanzay
Member
Posts: 437
Joined: Tue Apr 24, 2018 05:58
GitHub: BuckarooBanzay
IRC: BuckarooBanzai
In-game: BuckarooBanzai

Re: [Mod] Advanced Trains [advtrains] [2.0.1 TSS]

by BuckarooBanzay » Post

Miniontoby wrote:yes that, but I will can see the trainline on the Mapserver (with Mapserver_mod)
I think you mean the "trainline markers" from the mapserver mod (and server): viewtopic.php?f=14&t=21999

Those are placed manually at the moment and look like this on the map:
https://pandorabox.io/map/#0/-1768/622/11

The blocks look like this:
Image

The documentation is here: https://github.com/thomasrudin-mt/mapserver but the part about the train poi's is currently not written :/

In short it works like this
: place the blocks along your trainline and ensure that the "index" field counts upwards (it should do that automatically) to generate a line along the path.
The Line name should be the same on all blocks.
If you want to mark a station just fill out the "Station" field with the name of your station...
¯\_(ツ)_/¯ Not active here anymore, contact me on the minetest discord, irc, lemmy or github (for programming issues)

yw05
Member
Posts: 366
Joined: Tue May 07, 2019 12:59
GitHub: y5nw
IRC: y5nw
In-game: ywang
Location: Germany

Re: [Mod] Advanced Trains [advtrains] [2.0.1 TSS]

by yw05 » Post

Miniontoby wrote:yes that, but I will can see the trainline on the Mapserver (with Mapserver_mod)
I'm not a server admin and do not know how to use Mapserver, but I can show you my interlocking. The following is the interlocking of one of my stations from the west side. The ARS rules are written with the same color of the routes.
Image
Attachments
20190604_131750.jpg
20190604_131750.jpg (252.37 KiB) Viewed 1092 times

yw05
Member
Posts: 366
Joined: Tue May 07, 2019 12:59
GitHub: y5nw
IRC: y5nw
In-game: ywang
Location: Germany

Re: [Mod] Advanced Trains [advtrains] [2.0.1 TSS]

by yw05 » Post

@orwell:
I'm planning some tram lines (running on streets) and I don't want to kill other users. What speed should I use for ATC?

User avatar
orwell
Member
Posts: 958
Joined: Wed Jun 24, 2015 18:45
GitHub: orwell96
IRC: orwell96_mt
In-game: orwell
Location: Raxacoricofallapatorius

Re: [Mod] Advanced Trains [advtrains] [2.0.1 TSS]

by orwell » Post

speed 3 is the threshold. Speed <=3: no damage, Speed >3: death.
Regarding the trams, I might implement a system for "driving on sight" that utilizes the LZB system to slow down trams when people are on the tracks.
Lua is great!
List of my mods
I like singing. I like dancing. I like ... niyummm...

yw05
Member
Posts: 366
Joined: Tue May 07, 2019 12:59
GitHub: y5nw
IRC: y5nw
In-game: ywang
Location: Germany

Re: [Mod] Advanced Trains [advtrains] [2.0.1 TSS]

by yw05 » Post

orwell wrote:speed 3 is the threshold. Speed <=3: no damage, Speed >3: death.
Ok, but S3 is even slower than walking so I guess I'll probably not do it for now.
orwell wrote:Regarding the trams, I might implement a system for "driving on sight" that utilizes the LZB system to slow down trams when people are on the tracks.
I guess one way to do this is by making "crossing tracks" that temporarily slows down the train to S3. In other places we can simply use fences. IRL people don't cross the street whereever they want to. So what is the breaking distance of subway wagons at SM to B3, or is there a way to calculate it?

User avatar
orwell
Member
Posts: 958
Joined: Wed Jun 24, 2015 18:45
GitHub: orwell96
IRC: orwell96_mt
In-game: orwell
Location: Raxacoricofallapatorius

Re: [Mod] Advanced Trains [advtrains] [2.0.1 TSS]

by orwell » Post

The LZB does this all the time, calculating brake distances and braking the train
Lua is great!
List of my mods
I like singing. I like dancing. I like ... niyummm...

yw05
Member
Posts: 366
Joined: Tue May 07, 2019 12:59
GitHub: y5nw
IRC: y5nw
In-game: ywang
Location: Germany

Re: [Mod] Advanced Trains [advtrains] [2.0.1 TSS]

by yw05 » Post

orwell wrote:The LZB does this all the time, calculating brake distances and braking the train
Ok, and it seems like the equation to calculate the "distance needed to accelerate from v0 to v1 with acceleration a" (line 86 of advtrains/lzb.lua) can be simplified:

Code: Select all

s
= v0*(v1-v0)/a+a/2*(v1-v0)/a*(v1-v0)/a <= What I got according to your code
= (v1*v0-v0*v0)/a+(v1-v0)*(v1-v0)/2/a
= (v1*v0-v0*v0)/a+(v1*v1-2*v1*v0+v0*v0)/2/a
= (2*v1*v0-2*v0*v0+v1*v1-2*v1*v0+v0*v0)/2/a
= (2*v1*v1-2*v1*v1-2*v0*v0+v0*v0+v1*v1)/2/a
= (v1*v1-v0*v0)/2/a 

piet
Member
Posts: 40
Joined: Mon May 06, 2019 10:16
In-game: piet

Re: [Mod] Advanced Trains [advtrains] [2.0.1 TSS]

by piet » Post

orwell i have a problem... when i do pipeworks on then is advtrains and digtron mod unknowm items

User avatar
dan75
New member
Posts: 7
Joined: Fri Oct 05, 2018 19:20

Re: [Mod] Advanced Trains [advtrains] [2.0.1 TSS]

by dan75 » Post

Hello Mintest and AdvTrains Community,

at first I have to thank you for your great efforts in this awesome mod! I really like the Interlocking feature and all the automation possibilities.

I started playing around with this mod around a week ago - it's fantastic!
But I have a little problem with my Interlock Configuration. I'm not sure if it's a problem with AdvTrains or (more likely) my lack of understanding the Interlock system.

I have the following situation (a little hard to describe):

Code: Select all

                                   Platform B
                         /---|-------------------|---\
-----==LINE 1==>----|---/----|---<==LINE 2==-----|----\---|----------:|
                                   Platform A

==LINE 1==> Train "Line 1" going right
<==LINE 2== Train "Line 2" going left
-/- Turnout
| TCB
:| end of track
Line 1 should get a route to Platform B and the track section going left should be released when Line 1 reaches Platform B so that Line 2 could proceed to the left.

Then Line 1 reverses on Platform B and waits for a green signal on the left side of platform B and goes back left then.

Unfortunately this only works once because when Line 1 leaves Platform B to the left, the train isn't deleted from Platform B's section state.

So when this situation occurs again, Line 1 gets a red signal and can't proceed to Platform B because the system thinks there is a train on Platform B which is not.

When I then reset the section state of Platform B manually, Line 1 proceeds to Platform B and Line 2 can continue to the left. But if Line 1 leaves Platform B again, the section isn't freed again until I manually reset the section state.

This problem doesn't occur if I only run Line 1 without Line 2. Line 1 goes then to Platform B reverses and after leaving Platform B the train is deleted from the section state automatically.

What am I doing wrong?

Best wishes,
dan

yw05
Member
Posts: 366
Joined: Tue May 07, 2019 12:59
GitHub: y5nw
IRC: y5nw
In-game: ywang
Location: Germany

Re: [Mod] Advanced Trains [advtrains] [2.0.1 TSS]

by yw05 » Post

dan75 wrote:I have the following situation (a little hard to describe):

Code: Select all

                                   Platform B
                         /---|-------------------|---\
-----==LINE 1==>----|---/----|---<==LINE 2==-----|----\---|----------:|
                                   Platform A

==LINE 1==> Train "Line 1" going right
<==LINE 2== Train "Line 2" going left
-/- Turnout
| TCB
:| end of track
Line 1 should get a route to Platform B and the track section going left should be released when Line 1 reaches Platform B so that Line 2 could proceed to the left.

Then Line 1 reverses on Platform B and waits for a green signal on the left side of platform B and goes back left then.

Unfortunately this only works once because when Line 1 leaves Platform B to the left, the train isn't deleted from Platform B's section state.

So when this situation occurs again, Line 1 gets a red signal and can't proceed to Platform B because the system thinks there is a train on Platform B which is not.

When I then reset the section state of Platform B manually, Line 1 proceeds to Platform B and Line 2 can continue to the left. But if Line 1 leaves Platform B again, the section isn't freed again until I manually reset the section state.

This problem doesn't occur if I only run Line 1 without Line 2. Line 1 goes then to Platform B reverses and after leaving Platform B the train is deleted from the section state automatically.
Can you please post a screenshot?
Anyway, according to your graph, it seems like your forgot the TCB at the left (red):
Image
Without the TCB that I marked red, L2 has to wait until L1 leaves the next TCB at the left. If you don't have one there...
Also, such single-track lines are not recommended because deadlocks are possible.
Attachments
20190615_080244.jpg
20190615_080244.jpg (142.53 KiB) Viewed 1092 times

User avatar
dan75
New member
Posts: 7
Joined: Fri Oct 05, 2018 19:20

Re: [Mod] Advanced Trains [advtrains] [2.0.1 TSS]

by dan75 » Post

Hello yw05,

Here's a screenshot from the left looking to the right:

Image

As you can see I have a TCB before the turnout and it's connected to a signal. Also there are TCBs at both other ends of the turnout. Together they form a track section named "T1".

The route which Line 1 and Line 2 take from the left signal of the Platforms is actually spanned across the section T1 and one more track section after the leftmost (red marked in your image) TCB to another TCB leading into a turnout where Line 1 and Line 2 split up again. So both Lines if coming from a platform have to wait until the other train left the track section after the red marked TCB. This is intended, but maybe wrong?

For trains coming from the left the route ends at the leftmost TCB marked red in your image. Then the trains are routed through T1 to the end of the platform (for Line 1 the route is spanned over section T1 and section Platform B).

I'm just playing around, so I used a single-track-line for simplicity.

I really don't know why this is not working. It seems that the interlock system thinks Line 1 is still on Platform B when in reality it already left. I can see the train number in the "Show Track Section" form of Platform B, when there in fact is no train on it.
Attachments
Screenshot Minetest AdvTrains
Screenshot Minetest AdvTrains
scrshot-20190615-0245.jpg (468.15 KiB) Viewed 1092 times

User avatar
h-v-smacker
Member
Posts: 115
Joined: Wed Nov 29, 2017 23:04
GitHub: h-v-smacker
In-game: Smacker

Re: [Mod] Advanced Trains [advtrains] [2.0.1 TSS]

by h-v-smacker » Post

dan75 wrote:

Code: Select all

                                   Platform B
                         /---|-------------------|---\
-----==LINE 1==>----|---/----|---<==LINE 2==-----|----\---|----------:|
                                   Platform A

==LINE 1==> Train "Line 1" going right
<==LINE 2== Train "Line 2" going left
-/- Turnout
| TCB
:| end of track
Three things:

One — the routes should not overlap extensively, the number of situations where partial re-use of route segments can happen is not that big. In your case, the outer TCBs should have two routes set, each ending in the section having the platform (one route for A, the other for B). So they should be like (segment with the switch) -> (switch state lock) -> (end in the end of the next section).

Platform segments should have signs in outbound directions, and routes ending in the sections immediately past the TCBs in front of the switches. So it should be like (segment with platform) -> (continue to switch segment) -> (switch state lock) -> (end at the end of the next segment).

Two — ARS is not a very docile beast. It often tries to overdo its duties. At stations the most likely scenario would be for ARS on the exit signal to reserve the route for a train that just pulled into the platform simply because it happened to stop close enough to the exit signal.

Three — Sections are serious business. Ideally, create sections as the final step, when everything is built and ready (and TCBs are placed and tied to track segments), and you are absolutely certain you have the desired scheme. If you mix placing TCBs and creating sections, you can often find yourself in a situation where the partition of sections is whacked. For example, if you accidentally created a section between two TCBs, and then added a TCB between them. And it's often a lot of effort to undo an erroneous layout of sections when you tied signals and routes and everything to them.

In your case, that would mean that each section with the switches, as the sections with platforms A and B, and the sections to left and right of them, are all different sections (you can give them names to avoid remembering numbers).
Linux Forks, the Best Forks: linux-forks.de // Play @ LinuxWorks Next Generation

yw05
Member
Posts: 366
Joined: Tue May 07, 2019 12:59
GitHub: y5nw
IRC: y5nw
In-game: ywang
Location: Germany

Re: [Mod] Advanced Trains [advtrains] [2.0.1 TSS]

by yw05 » Post

Smacker:
That second thing you mentioned also happened to me on LinuxWorks Server, and I ended up making a route that spans multiple sections (with some other signals having ARS disabled) without knowing why I had to do that.

User avatar
h-v-smacker
Member
Posts: 115
Joined: Wed Nov 29, 2017 23:04
GitHub: h-v-smacker
In-game: Smacker

Re: [Mod] Advanced Trains [advtrains] [2.0.1 TSS]

by h-v-smacker » Post

yw05 wrote:Smacker:
That second thing you mentioned also happened to me on LinuxWorks Server, and I ended up making a route that spans multiple sections (with some other signals having ARS disabled) without knowing why I had to do that.
Yep, I think that a stop track at least should make the ARS on the nearest signal wait until the train resumes its movement. I mean, who knows how long the stop is? What if it's a whole minute? Current approach of ARS is "greedy".
Linux Forks, the Best Forks: linux-forks.de // Play @ LinuxWorks Next Generation

User avatar
dan75
New member
Posts: 7
Joined: Fri Oct 05, 2018 19:20

Re: [Mod] Advanced Trains [advtrains] [2.0.1 TSS]

by dan75 » Post

dan75 wrote:

Code: Select all

                                   Platform B
                         /---|-------------------|---\
-----==LINE 1==>----|---/----|---<==LINE 2==-----|----\---|----------:|
                                   Platform A

==LINE 1==> Train "Line 1" going right
<==LINE 2== Train "Line 2" going left
-/- Turnout
| TCB
:| end of track
Hello h-v-smacker,
thanks for your answer.
h-v-smacker wrote: Three things:

One — the routes should not overlap extensively, the number of situations where partial re-use of route segments can happen is not that big. In your case, the outer TCBs should have two routes set, each ending in the section having the platform (one route for A, the other for B). So they should be like (segment with the switch) -> (switch state lock) -> (end in the end of the next section).

Platform segments should have signs in outbound directions, and routes ending in the sections immediately past the TCBs in front of the switches. So it should be like (segment with platform) -> (continue to switch segment) -> (switch state lock) -> (end at the end of the next segment).
This is what I did.
h-v-smacker wrote: Two — ARS is not a very docile beast. It often tries to overdo its duties. At stations the most likely scenario would be for ARS on the exit signal to reserve the route for a train that just pulled into the platform simply because it happened to stop close enough to the exit signal.
I think the trains stop with enough space between it and the exit signal on the platforms. I'll keep your advice in mind.
h-v-smacker wrote: Three — Sections are serious business. Ideally, create sections as the final step, when everything is built and ready (and TCBs are placed and tied to track segments), and you are absolutely certain you have the desired scheme. If you mix placing TCBs and creating sections, you can often find yourself in a situation where the partition of sections is whacked. For example, if you accidentally created a section between two TCBs, and then added a TCB between them. And it's often a lot of effort to undo an erroneous layout of sections when you tied signals and routes and everything to them.

In your case, that would mean that each section with the switches, as the sections with platforms A and B, and the sections to left and right of them, are all different sections (you can give them names to avoid remembering numbers).
That's what I did. And I gave them Names to easily distinguish and identify them. And I was as careful as I could when creating sections. Surely I make mistakes sometimes, but I checked and doublechecked the track sections. As far as I can tell they are set as intended and advised.

Best wishes,
dan

yw05
Member
Posts: 366
Joined: Tue May 07, 2019 12:59
GitHub: y5nw
IRC: y5nw
In-game: ywang
Location: Germany

Re: [Mod] Advanced Trains [advtrains] [2.0.1 TSS]

by yw05 » Post

h-v-smacker wrote:
yw05 wrote:Smacker:
That second thing you mentioned also happened to me on LinuxWorks Server, and I ended up making a route that spans multiple sections (with some other signals having ARS disabled) without knowing why I had to do that.
Yep, I think that a stop track at least should make the ARS on the nearest signal wait until the train resumes its movement. I mean, who knows how long the stop is? What if it's a whole minute? Current approach of ARS is "greedy".
I spent some 15 minutes only to fix the interlocking at that area...
Yes, ststions tracks near signals often occupy sections that aren't really used. That's how I know when a train is arriving at a station - look at the signal :P
Another thing: I think orwell should make the train say something like "Waiting for signal..." when it stops in front of one, otherwise it may appear to be weird. Once a got off a train when the signal was red and about 10 seconds later the train left...

Post Reply

Who is online

Users browsing this forum: No registered users and 24 guests