[MOD 0.15] SmartTrains 2.0.5

Topics and discussion about specific mods
SoZ
Manual Inserter
Manual Inserter
Posts: 2
Joined: Sun Nov 13, 2016 3:19 pm
Contact:

Re: [MOD 0.14] SmartTrains 1.1.6

Post by SoZ »

SoZ wrote:Yesterday was running fine, but today, everytime I open a train GUI I get this error:

Error while running event Custom event (ID 56) _ _ SmartTrais_ _/gui.lua:252:attemp to perform arithmetric on fields 'ticks'(a nil value) stack traceback: _ _SmartTrains_ _/control.lua:1478: in function <_ _SmartTrains_ _/control.lua:1474> [C]: in function 'pcal' _ _SmartTrains_ _/control.lua:1474: in functions <_ _SmartTrains_ _/control/lua:1383>

What is this?
Ok, I saved the map, disable it, reloaded, saved, re-enabled it, and loaded, and it's working... but I had to reconfigure every train line
Chel
Burner Inserter
Burner Inserter
Posts: 7
Joined: Mon Mar 21, 2016 8:15 pm
Contact:

Re: [MOD 0.14] SmartTrains 1.1.6

Post by Chel »

Choumiko wrote:I did a quick test and it seems to work for me.
Thinks to consider:
- For refueling to work, the Refuel checkbox in the has to be ticked, but since the stations get added that should be the case.
- The refueling station gets removed if every locomotive in the train has enough fuel (So if even one loco has 1 coal/whatever fuel less, refueling is not done). It will be removed when the train arrives at the next station.

To get a bit more info you can use /c remote.call("st", "toggleFlyingText") in the console. It will show some info above the train. For refueling that would be: "Refuel station added" -> "refueling" -> "Refueling done" -> "Refueling station removed"
Chel wrote:I have a single large refuelling station, but trains are bunching up there; each loco has in the region of 587 (of 600) coal on board, so there is clearly no need for them to refuel for a long time. Amending the GUI settings in the client seems to correctly influence the first visit, but as the station remains in the schedule, the setting becomes irrelevant thereafter.
A vanilla loco can hold 150 coal, are you using modded locomotives and/or increased stack sizes? I looked at the code and it shouldn't matter, but just to make sure. A modlist would be helpfull i think.
Hi, sorry for the late reply just wanted to be sure of things today. I use several mods, though they're all fairly mainstream. The locos in question are, I think, from Bob's Logistics (though not 100%). Each holds 3 stacks of 200 coal. In the image below, we see the fuel load of the silver train; 587/600, yet it is coming for more fuel, as the refuel station hasn't been removed from it's schedule.
stacks.PNG
stacks.PNG (635.91 KiB) Viewed 10672 times
My trains are all 4-8, and the fuelling station at the top of the image has all 4 locos filling to 3 full stacks of 200 each.

My ST settings are thus, and the 'refuel' box is ticked:
STsettings.PNG
STsettings.PNG (124.98 KiB) Viewed 10672 times


Mods:
mods1.PNG
mods1.PNG (13.25 KiB) Viewed 10672 times
mods2.PNG
mods2.PNG (12.34 KiB) Viewed 10672 times
mods3.PNG
mods3.PNG (13.74 KiB) Viewed 10672 times
mods4.PNG
mods4.PNG (12.88 KiB) Viewed 10672 times
mods5.PNG
mods5.PNG (14.36 KiB) Viewed 10672 times
If you like I can provide a zip of my mods folder and a save file.

As for the flying text, no output once it was set to true and the game run for around 10 minutes.



Thanks for the prompt response, let me know if you need anything more.
Choumiko
Smart Inserter
Smart Inserter
Posts: 1352
Joined: Fri Mar 21, 2014 10:51 pm
Contact:

Re: [MOD 0.14] SmartTrains 1.1.6

Post by Choumiko »

Thanks for the details. I think I found the issue: In the Settings you have it set to leave above 20000 MJ, that's a value that doesn't fit in the locomotive. For a 200 stacksize it would be 4800MJ (8MJ/coal I think?) To be on the safe side make it 4799, since I'm not sure whether I check with > or >= ;)

I guess as a safeguard I could remove the refueling station if the locomotives are completely filled.
Chel
Burner Inserter
Burner Inserter
Posts: 7
Joined: Mon Mar 21, 2016 8:15 pm
Contact:

Re: [MOD 0.14] SmartTrains 1.1.6

Post by Chel »

Choumiko wrote:Thanks for the details. I think I found the issue: In the Settings you have it set to leave above 20000 MJ, that's a value that doesn't fit in the locomotive. For a 200 stacksize it would be 4800MJ (8MJ/coal I think?) To be on the safe side make it 4799, since I'm not sure whether I check with > or >= ;)

I guess as a safeguard I could remove the refueling station if the locomotives are completely filled.
Good spot, that's exactly what it was. Took a while to fine tune it, had to drop the limit to 4600 MJ (575 coal, of 600 max) before it was reliable. Obviously with such a large capacity it took me a while to be sure that trains were now behaving properly.

Regarding the value I had set, 20 GJ, I accept that was too big, I just bunged in an arbitrarily large number, as I knew that the wait time would trigger before too long - I had no idea that the trains would keep trying! I think that that's a mistake that a lot of people will make, so your idea of coding around this is a good one, I think.

Thanks again for the quick help, and for the mod in general :O)
Choumiko
Smart Inserter
Smart Inserter
Posts: 1352
Joined: Fri Mar 21, 2014 10:51 pm
Contact:

Re: [MOD 0.14] SmartTrains 1.1.5

Post by Choumiko »

Updated to SmartTrains 1.1.7
  • disabled loading saves with a SmartTrains version < 0.3.97 (You can still update them by downloading SmartTrains 1.1.6 manually)
  • refuel station now gets removed if the trains locomotives are full
Chel
Burner Inserter
Burner Inserter
Posts: 7
Joined: Mon Mar 21, 2016 8:15 pm
Contact:

Re: [MOD 0.14] SmartTrains 1.1.7

Post by Chel »

Good man, we all appreciate the work you're doing :O)
Bizobinator
Fast Inserter
Fast Inserter
Posts: 193
Joined: Fri May 06, 2016 10:35 pm
Contact:

Re: [MOD 0.14] SmartTrains 1.1.7

Post by Bizobinator »

Fantastic mod! Though, I do have a small thing that happens. So, I have SmartTrains make sure that all my trains refuel whenever they get low on juice. But, once they've filled up & left, it doesn't remove the refuel station from the itinerary. So, the trains end up visiting the refuel depot each loop.

Right now, I just manually make sure to go through & check every now and then. Any idea what might be going on?
Choumiko
Smart Inserter
Smart Inserter
Posts: 1352
Joined: Fri Mar 21, 2014 10:51 pm
Contact:

Re: [MOD 0.14] SmartTrains 1.1.6

Post by Choumiko »

I need at least screenshots of the SmartTrain settings, the trainline settings if the trains are on a line or the traininfo if they are not. The save file will also do :)
Just to make sure:
Choumiko wrote: Thinks to consider:
- For refueling to work, the Refuel checkbox in the has to be ticked, but since the stations get added that should be the case.
- The refueling station gets removed if every locomotive in the train has enough fuel (So if even one loco has 1 coal/whatever fuel less, refueling is not done). It will be removed when the train arrives at the next station (or as of 1.1.7 once the train leaves the refuel station).

To get a bit more info you can use /c remote.call("st", "toggleFlyingText") in the console. It will show some info above the train. For refueling that would be: "Refuel station added" -> "refueling" -> "Refueling done" -> "Refueling station removed"
Phantum
Long Handed Inserter
Long Handed Inserter
Posts: 62
Joined: Sat Jun 11, 2016 12:20 am
Contact:

Re: [MOD 0.14] SmartTrains 1.1.7

Post by Phantum »

so lately I keep getting spammed by Warning, a train has taken longer than 10 minutes between stations, even though the train is going back and forth to different stations as my combinator system sends it, am I doing something wrong? or would that be from a different mod? o.0

Edit: Ah must be something between Fat Controller and this. o.0
---
I am a Streamer,
Fallen Sun Gaming by Name,
Factorio is Sometimes my Game.
For Some Goodness
Join me
on http://www.twitch.tv/fallensungaming

FSG may or may not be subliminally implanted in this signature
Choumiko
Smart Inserter
Smart Inserter
Posts: 1352
Joined: Fri Mar 21, 2014 10:51 pm
Contact:

Re: [MOD 0.14] SmartTrains 1.1.7

Post by Choumiko »

It was SmartTrains fault, though the message is from FatController. I managed to solve it in FatController: https://mods.factorio.com/mods/Choumiko ... Controller
The proper fix in SmartTrains would require a lot of testing, since it involves a function that handles the jumpTo rules, and i'm too tired right now plus the function has a comment to not change it (and i can't remember why, so i rather not touch it :D )
User avatar
siggboy
Filter Inserter
Filter Inserter
Posts: 988
Joined: Tue Mar 29, 2016 11:47 am
Contact:

Re: [MOD 0.14] SmartTrains 1.1.7

Post by siggboy »

Choumiko wrote:plus the function has a comment to not change it (and i can't remember why, so i rather not touch it :D )
That's just amazing, and I have a lot of respect for how well you trust yourself :).

"Write protection by comment", I love it.
so lately I keep getting spammed by Warning, a train has taken longer than 10 minutes between stations, even though the train is going back and forth to different stations as my combinator system sends it, am I doing something wrong? or would that be from a different mod? o.0
I've always wondered why that is, and it's why I disabled that warning in TFC. Glad it's now fixed.
Is your railroad worrying you? Doctor T-Junction recommends: Smart, dynamic train deliveries with combinator Magick
Bizobinator
Fast Inserter
Fast Inserter
Posts: 193
Joined: Fri May 06, 2016 10:35 pm
Contact:

Re: [MOD 0.14] SmartTrains 1.1.6

Post by Bizobinator »

Choumiko wrote: - The refueling station gets removed if every locomotive in the train has enough fuel (So if even one loco has 1 coal/whatever fuel less, refueling is not done). It will be removed when the train arrives at the next station (or as of 1.1.7 once the train leaves the refuel station).
That may be what was causing it. I had the "leave when above this energy level" set to right at the train's max limit. I think what was happening was that the inserters would fill up one fuel slot to 199 (vs. 200) b/c it couldn't insert a whole stack.

I'll keep you posted. I haven't had an issue since I changed that around yet. I'll let you know if it comes back.
Phantum
Long Handed Inserter
Long Handed Inserter
Posts: 62
Joined: Sat Jun 11, 2016 12:20 am
Contact:

Re: [MOD 0.14] SmartTrains 1.1.7

Post by Phantum »

Choumiko wrote:It was SmartTrains fault, though the message is from FatController. I managed to solve it in FatController: https://mods.factorio.com/mods/Choumiko ... Controller
The proper fix in SmartTrains would require a lot of testing, since it involves a function that handles the jumpTo rules, and i'm too tired right now plus the function has a comment to not change it (and i can't remember why, so i rather not touch it :D )

No worries haha, I just disabled the message from Fat Controller for the time being! :)
---
I am a Streamer,
Fallen Sun Gaming by Name,
Factorio is Sometimes my Game.
For Some Goodness
Join me
on http://www.twitch.tv/fallensungaming

FSG may or may not be subliminally implanted in this signature
Choumiko
Smart Inserter
Smart Inserter
Posts: 1352
Joined: Fri Mar 21, 2014 10:51 pm
Contact:

Re: [MOD 0.14] SmartTrains 1.1.6

Post by Choumiko »

Bizobinator wrote:That may be what was causing it. I had the "leave when above this energy level" set to right at the train's max limit. I think what was happening was that the inserters would fill up one fuel slot to 199 (vs. 200) b/c it couldn't insert a whole stack.
Yes, that was most likely the issue. I don't know what inserters you are using or how the new stack inserters behave. Can they insert a fraction of what they are holding or is it all or nothing? Haven't played since they were added :roll: :D

On another topic:

I got a pullrequest that changes the Destination # signal to output the number that is setup in the mapping if the train at the station is set to use the mapping (and a mapping for that station exists). Is anybody using this feature at all and how bad will this change break existing setups?
Currently the Destination signal will always output the number that corresponds to the trains destination in the schedule (e.g. 4 if the destination is in the 4th position in the schedule)
If you don't know what i'm talking about then don't worry, i think there are only a few people that use that feature :mrgreen:
Xeteth
Fast Inserter
Fast Inserter
Posts: 158
Joined: Tue Feb 17, 2015 6:06 am
Contact:

Re: [MOD 0.14] SmartTrains 1.1.6

Post by Xeteth »

Choumiko wrote:I got a pullrequest that changes the Destination # signal to output the number that is setup in the mapping if the train at the station is set to use the mapping (and a mapping for that station exists). Is anybody using this feature at all and how bad will this change break existing setups?
Currently the Destination signal will always output the number that corresponds to the trains destination in the schedule (e.g. 4 if the destination is in the 4th position in the schedule)
If you don't know what i'm talking about then don't worry, i think there are only a few people that use that feature :mrgreen:
I currently only use the destination signal to essentially tell when a train has departed from a station, where exactly it is going is not needed as a signal for my system. So this chance wouldn't break my setup at all afaik :)
(It will still be the same signal type though right? I currently use a decider that is "When Destination# > 0, output x = 1" just to detect a train leaving, so as long as the signal type stays the same I assume this will still work)
Phantum
Long Handed Inserter
Long Handed Inserter
Posts: 62
Joined: Sat Jun 11, 2016 12:20 am
Contact:

Re: [MOD 0.14] SmartTrains 1.1.6

Post by Phantum »

Choumiko wrote:
Bizobinator wrote:That may be what was causing it. I had the "leave when above this energy level" set to right at the train's max limit. I think what was happening was that the inserters would fill up one fuel slot to 199 (vs. 200) b/c it couldn't insert a whole stack.
Yes, that was most likely the issue. I don't know what inserters you are using or how the new stack inserters behave. Can they insert a fraction of what they are holding or is it all or nothing? Haven't played since they were added :roll: :D

On another topic:

I got a pullrequest that changes the Destination # signal to output the number that is setup in the mapping if the train at the station is set to use the mapping (and a mapping for that station exists). Is anybody using this feature at all and how bad will this change break existing setups?
Currently the Destination signal will always output the number that corresponds to the trains destination in the schedule (e.g. 4 if the destination is in the 4th position in the schedule)
If you don't know what i'm talking about then don't worry, i think there are only a few people that use that feature :mrgreen:

https://www.reddit.com/r/factorio/comme ... mofo_halp/

This is how I'm currently using them, and my dilemma with that, not sure if that would have an effect on it, but I think it might, not too sure though. I don't honestly even understand how station mapping works :/

Scroll down to the comment TheZombiee made and my response (phantumjosh)
---
I am a Streamer,
Fallen Sun Gaming by Name,
Factorio is Sometimes my Game.
For Some Goodness
Join me
on http://www.twitch.tv/fallensungaming

FSG may or may not be subliminally implanted in this signature
User avatar
siggboy
Filter Inserter
Filter Inserter
Posts: 988
Joined: Tue Mar 29, 2016 11:47 am
Contact:

Re: [MOD 0.14] SmartTrains 1.1.6

Post by siggboy »

Choumiko wrote:I got a pullrequest that changes the Destination # signal to output the number that is setup in the mapping if the train at the station is set to use the mapping (and a mapping for that station exists). Is anybody using this feature at all and how bad will this change break existing setups?
Currently the Destination signal will always output the number that corresponds to the trains destination in the schedule (e.g. 4 if the destination is in the 4th position in the schedule)
If you don't know what i'm talking about then don't worry, i think there are only a few people that use that feature :mrgreen:
My system would not be affected by this because it does not use station mappings.

However, in my opinion it's a good pull request, because the "destination number" ("D#") signal should always output the effective destination -- i.e. after remapping -- since in the case of remapping the original value is actually wrong.

It's the same with the "station number" static signal ("S#" signal). If a remapping is applied, the effective value is correct, not the original value. (I think the current implementation already works that way, but I'm not sure since I've never used the remapping.)

So, in short, both the "S#" and the "D#" signals must take remapping into account.

As Xeteth said, you should not change anything else about this, i.e. leave the timings and the signal type, because changing those would surely break all sorts of things...
Is your railroad worrying you? Doctor T-Junction recommends: Smart, dynamic train deliveries with combinator Magick
Choumiko
Smart Inserter
Smart Inserter
Posts: 1352
Joined: Fri Mar 21, 2014 10:51 pm
Contact:

Re: [MOD 0.14] SmartTrains 1.1.7

Post by Choumiko »

I think the only situation where it would be a problem is with a Train station that gets visited by 2 different lines, one with mapping and one without AND where this station has a combinator setup that uses the destination signal for both these lines (AND it would have to use the actual value and not only D# > 0 like Xetheth does).
Type and all will stay the same, it will only output a different value if station mapping is set for the line and the station has an actual mapping)
siggboy wrote:It's the same with the "station number" static signal ("S#" signal). If a remapping is applied, the effective value is correct, not the original value. (I think the current implementation already works that way, but I'm not sure since I've never used the remapping.)
Yes, something like that. If mapping is set it's the mapped value, if the station is in only one line it's the position in the schedule, else it's 0 (i think :D )
User avatar
siggboy
Filter Inserter
Filter Inserter
Posts: 988
Joined: Tue Mar 29, 2016 11:47 am
Contact:

Re: [MOD 0.14] SmartTrains 1.1.7

Post by siggboy »

Choumiko wrote:I think the only situation where it would be a problem is with a Train station that gets visited by 2 different lines, one with mapping and one without AND where this station has a combinator setup that uses the destination signal for both these lines (AND it would have to use the actual value and not only D# > 0 like Xetheth does).
It still would not be a problem if the signal value is always the effective destination in both cases.

So, for the line that does not use the mapping, the original value is output. The other line would get the mapped value.

As I understand the mod should be able to do this dynamically (i.e. take into account the setting for the correct line per train).

If there are any ambiguities then it would be preferable to only output a binary value, over a station number that might be flat out wrong. So this should be either solved completely or not at all, in my opinion.

The user should be allowed to expect the effective, correct value from the combinator in all cases.
Is your railroad worrying you? Doctor T-Junction recommends: Smart, dynamic train deliveries with combinator Magick
Choumiko
Smart Inserter
Smart Inserter
Posts: 1352
Joined: Fri Mar 21, 2014 10:51 pm
Contact:

Re: [MOD 0.14] SmartTrains 1.1.7

Post by Choumiko »

That's how it works, no ambiguities. (The only exception would be a line with mapping where the destination station doesn't have a mapping assigned, but the whole discussion is about such an advanced/exotic feature that i would flat out say that case would be an user error :lol: )

Alright, next update will include that change + support/integration of another train mod i'm working on (Not much, just collecting some statistics like avg. Roundtrip time, time spent/wasted at signals, etc.)
Post Reply

Return to “Mods”