Page 2 of 4

Re: LED counter

Posted: 12 Jun 2008 14:04
by Tjark
This is awesome, very well done! I am thinking about the posibilities atm, what about a self regulating network :shock:

Example:

- Power station (a)
- Coal mines (b and c)
- Trains (<\> = network direction)
- Presignaling according to a memory track ( ! )

..................................................
.________<___[--a--]_____.....
/............................................\...
|.............................................|..
.\!______[--b--]_____>____/...
...\_____________[--c--]__/.....
..................................................

Each train has the orders to drop all cargo at the power station and thats it, no pick up orders what so ever. After it has finished the drop off, it moves on the mainline and starts heading to the power station to drop off again! But this is were the fun starts, the network forces the train to move to one of the two coal mines before it reach the power station again. The network makes the track descision by checking a bit (train) that says 1 if there is allready a train heading to/in the station or 0 if there is no train yet on that part of the track. When the train reaches the station it will autopick the coal thats waiting and move on.

I dont have this working yet, but it unlocks some cool posibilities, however dont expect some clean networking ;). I like the idea of simply unleaching some trains on the network with only 1 order to get them into action, and let the network do the job!

btw: when I give a train really no orders, the pathfinding doesnt seem to check the signals ahead. example: The moment a train reaches a T junction he randomly picks an option not looking at the next signal, so a sec after he chose the path he can stand still because the next signal has been red all the time... Is there a way to avoid this stupid behaviour when without using orders?

Re: LED counter

Posted: 12 Jun 2008 21:35
by Igloo
Hertogjan: the savegame uses a half-adder to count. Once you have the basic logical gates building an adder is not that hard a task (it is quite cumbersome though). The commented save game contains isolated examples of the gates (AND, OR and NOT). Using those it is possible to make an adder, which indeed is quite large and very, _very_ slow ;-P.

Tjark: it would be realy cool if those gates could be used in a meaningful network :D.

Re: LED counter

Posted: 12 Jun 2008 22:28
by Caesius
So who's willing to build a complete ALU that can accept user input in the form of ordering trains to proceed without signals?

Re: LED counter

Posted: 14 Jun 2008 20:13
by osai
Hello Igloo,

that is really amazing what you did. I think #openttdcoop will be able to use the gates, I already shrunk the size of the gates to make them react faster. I think this is the main problem of the gates. The delay could cause jams because the state of the output is not changing at the same time as the input changes.

Anyway I really like your work and it reminds me of a a shiftback system, I created. I'll have a closer look at your circuit and maybe try some things on my own.

p.s.: it looks like you mixed the signs of the logic gates in your commented savegame -> the ORs should be ANDs and the AND should be an OR gate (at your half adders).


Best Regards,
Osai

Re: LED counter

Posted: 15 Jun 2008 18:53
by Igloo
Hey osai,

thanks for the reply. I've read some of the articles on openttdcoop over the past weeks, I never expected people were that busy with this game =].

The speed is indeed a problem. This can be solved partly by smaller trains and partly by smaller gates. It is probably possible to make gates that are fast enough to be used in a network. Provided that the trains used in the network are not too small.

The labeling in the comments is as intended. It al depends how you define the 1's and 0's. I used: green light is a 1, red light is a 0. You probably looked at it the other way around.

I'm curious as to what your take is on these gates.

Igloo

Re: LED counter

Posted: 16 Jun 2008 22:32
by osai
Igloo wrote:The labeling in the comments is as intended. It al depends how you define the 1's and 0's. I used: green light is a 1, red light is a 0. You probably looked at it the other way around.

I'm curious as to what your take is on these gates.

Igloo
I really looked at this vice versa and still do. I am still working on this topic and will publish first results soon.

Re: LED counter

Posted: 17 Jun 2008 23:06
by VoxDissident
Wow... Brilliant and ridiculous. I am very impressed... and somewhat disgusted.

:)

-Vox

Re: LED counter

Posted: 17 Jun 2008 23:12
by osai
Hello all,

I finally posted my report about logic gates (@ openttdcoop.org). Enjoy Reading. Part 2 will follow soon.

Re: LED counter

Posted: 18 Jun 2008 10:44
by Tjark
Really great job!! I am looking forward to part2! I am still strugling to get these gates to work in a normal network and really do something usefull, but I have made a somewhat decent loadbalancer with them allready!

-Tjark

Re: LED counter

Posted: 18 Jun 2008 12:23
by Igloo
Nice article Osai, though it is confusing as hell to see you reverted the meanings of the 0 and 1 ;-). That design of the OR gate is quite efficient.
Hereby an implementation of the NOT-gate using a different idea. it should be faster (did you compute those speeds, if so, how?).

Re: LED counter

Posted: 18 Jun 2008 13:58
by Tjark
Image

Trains are balanced between 2 mines by using a NOT load balancer with a memory track

Re: LED counter

Posted: 18 Jun 2008 16:19
by osai
Interesting solution for NOT, Igloo. Indeed it might be a little bit faster, but I also searched for the minimum size. I calculated the reaction times using a screen-recorder with an correctness of 1/25s :) I could make it more detailed though, but I am not sure how often the OpenTTD screen is redrawn per second. I'll talk about speed of logic gates in Part II.

I am still not sure, if I just mixed the definition of green/red, 0/1. Because you construction for OR seems not be a or. Of cause changing the definition turns AND in OR or vice versa, but the logic of the OpenTTD signals, which is hardcoded, doesn't change.
Can you please sign the input and output of your OR construction in your led counter savegame.
Another question: Did you use rs-flipflops for saving the binary state of your counter or is it just a hacky construction?

Regards,
Osai

Re: LED counter

Posted: 18 Jun 2008 20:21
by Igloo
Nice one, Tjark =]

Osai:

It is fun to play around with those constructions. Unfortunately those double loops takes quite a bit of space.

Indeed the OR you use is equivalent to my AND and vice versa. In the commented save game each gate is build separately in the northernmost corner. All gates there have the input in the north and the output to the south.

The memory is not a RS flipflop. The problem with the system is that there is no clock pulse. Hence a more difficult construct is used. It was thought out on the spot, but looking at wiki it is a Master-slave D flip-flop.

Re: LED counter

Posted: 24 Jun 2008 01:57
by Caesius
Am I the only one who noticed the LED counter goes 1 - 2 - 7 - 4 - 5 - 6 - 1 (I think) or is it just me?

Re: LED counter

Posted: 24 Jun 2008 06:36
by planetmaker
Caesius wrote:Am I the only one who noticed the LED counter goes 1 - 2 - 7 - 4 - 5 - 6 - 1 (I think) or is it just me?
It's just you :P
No, I made the same observation with a savegame I downloaded a few days ago.

Re: LED counter

Posted: 24 Jun 2008 17:50
by Igloo
That is true for one of the versions :cry: . The trains on the main railline where not synced correctly. When they are synced the counter does work as intended

Re: LED counter

Posted: 30 Jun 2008 12:40
by Pixelz
I've made a faster NOT gate based on the one Igloo posted. It's main feature is that the trains (hopefully) doesn't stop moving. It does take up a bit more space but I didn't really try to make it small. It's probably possible to make one that's smaller and even faster.

Re: LED counter

Posted: 30 Jun 2008 19:21
by Mark0291
Hello,
After reading what Tjark said about making a self regulating network i figured it would be possible and came up with this network using NOT-Gates, memory cells and some dummy trains. What it does is making sure there is always a train waiting to enter the loading station. It also takes a train of the network if there are too many and adds a new train every month.

EDIT: Save is made using OTTD 0.6.0

Re: LED counter

Posted: 30 Jun 2008 20:31
by Igloo
Nice one, Mark! I've tried to figure it out, but I didn't think of this solution. Maybe it is possible to make this viable for a big network =].

Pixelz: I tried to copy your gate on my PC, but I can't get it working. When the input is green the train keeps running both the inner and outerloop, see picture.
Not_Pixelz.PNG
Not_Pixelz.PNG (61.33 KiB) Viewed 5490 times

Re: LED counter

Posted: 30 Jun 2008 23:56
by Pixelz
I've made a working example. The train sometimes loop like you described but it doesn't cause any flickering so it's all good.