Page 1 of 1
[0.16.51] Train waiting for "Circuit" from "Read train con
Posted: Thu Aug 23, 2018 8:07 pm
by mhcmega
[0.16.51] Train waiting for "Circuit" condition, calculated from "Read train content", requires additional wait condition to work properly
Note: Subject length limit makes it hard to make meaningful title
I wanted train to depart after any of its two products:
green boards or
copper plates depleted.
So I used option "Read train content" on Station and calculated in
Arithmetic calculator:
And set train "Wait until" to
This does not work, train stops and immediately starts.
I additionally added 1 second wait, then train stopped and waited until any of two products depleted.
IMO train exports its content data and reads circuit condition in the same tick. But signal "A", based on content read from train, is updated in next tick. So train departures basing on outdated signal.
Expected solution:
Trains stopped on station that uses
"Read train contents", that also uses
"Wait until: Circuit", should wait long enough before reading signal that signals state can be updated.
Alternatively, all trains wait at least one tick after stop, before deciding about departure.
Work around:
Add
"AND 1 seconds passed" to "Wait until"
Re: [0.16.51] Train waiting for "Circuit" from "Read train con
Posted: Fri Aug 24, 2018 4:58 am
by boskid
Not a Bug
Circuit network has finite, non zero delay because it is tick-based. You may get content from train in one tick, but at the same time, wait condition is already meet because signal A is still equal to 0 (it will be available in next tick as there is one logic component between). Additional wait time prevents condition beeing meet in first tick after train arrival.
Fixing this as you want would require developers to introduce arbitrary delay to trains, which may be appropriate for you but not for more complicated logics requiring more ticks to compute.
btw, your condition using multiplication looks like workaround to simple OR condition - you should be able to set condition right in train schedule: "copper = 0" OR "gc = 0" (use "and/or" button in train schedule options)
Re: [0.16.51] Train waiting for "Circuit" from "Read train con
Posted: Fri Aug 24, 2018 6:34 pm
by mhcmega
boskid wrote:your condition using multiplication looks like workaround to simple OR condition
I knew there should be simple solution... Thank You!
boskid wrote:Fixing this as you want would require developers
This can be booth
FAD (Functions As Designed),
Won'tFix or
SimpleFix, let's developers decide.
E.g if architecture is:
Code: Select all
tick_start
Train_stops
Train_decide_of _departure
Make_circut_logc
tick_end
then fix is simple changing to
Code: Select all
tick_start
Train_stops
Make_circut_logc
Train_decide_of _departure
tick_end
As we have no idea what is architecture inside, fix can simple, can be hard, or maybe FAD
Re: [0.16.51] Train waiting for "Circuit" from "Read train con
Posted: Fri Aug 24, 2018 10:07 pm
by DaleStan
You skipped a tick in there:
Code: Select all
tick 1 start
Train stops
All devices read network (Combinator reads nothing)
All devices write network (Combinator writes nothing, stop writes train contents)
Train decides on departure, based on "A=0" signal
tick 1 end
tick 2 start
All devices read network (Combinator reads train contents)
All devices write network (Combinator writes signal A, stop again writes train contents)
Train decides on departure, based on "A=BIGNUM" signal
tick 2 end
If you switch the read and write order, you get the same effect:
Code: Select all
tick 0 start
All devices write network (No train present; train stop writes nothing.)
All devices read network (combinator reads nothing)
tick 0 end
tick 1 start
Train stops
All devices write network (Combinator, having read nothing, writes nothing; stop writes train contents)
All devices read network (Combinator reads train contents)
Train decides on departure, based on "A=0" signal
tick 1 end
tick 2 start
All devices write network (Combinator writes signal A, stop again writes train contents)
All devices read network
Train decides on departure, based on "A=BIGNUM" signal
tick 2 end
The output of any combinator is always based on the previous tick's input. This isn't helpful in this case, but it prevents infinite loops waiting for a circuit network to stabilize and it allows clocks and delay circuits.
Infinite loop: Connect the output of a combinator to its input. Set the combinator to Each+1=>Each. What values should be observed on the network?
Clock: What that Each+1=>Each combinator actually does (roughly).
Delay: Daisy-chain three Each+0=>Each combinators between an input and an output for a 1/20 second delay between an event and its reaction.
Re: [0.16.51] Train waiting for "Circuit" from "Read train con
Posted: Sat Aug 25, 2018 3:33 pm
by mhcmega
Code: Select all
All devices write network (Combinator, having read nothing, writes nothing; stop writes train contents)
All devices read network (Combinator reads train contents)
Given combinator order is reversed for me. I would rather expect ReadAll_Input->Caclulate->WrietAllOutput