i already moved it, just dl my patch and use itOwen wrote:-> deifne: It was temporary; I'm moving it to a patch option
NAND Patch
Moderator: OpenTTD Developers
-
- Engineer
- Posts: 48
- Joined: 05 Jul 2006 22:25
Not really, it does asynchronous logic simulation, and with some considerable track-laying could also do synchronous logic. You might also think of the number of trains passing a point in unit time as some sort of 'current'. It does not model electronics because there's no way to represent complex impedances (if you want to consider restriction of train flow as resistive, there's still no way I can see to model inductive or capacitive impedances, as there's no way to integrate or differentiate the current flow), amongst other things.DredFurst wrote:1 statement:
OpenTTD Does electronics simulation
There's also no clear way to model potential difference, except with the speed of a train, maybe...
I think the analogy starts to break down.
The useful thing about this stuff is it lets you create much more complex systems, where one part of track can influence the operation of another. The NAND function is the basic building block of this. A lot of digital logic can now be implemented with tracks and trains, but it remains to be seen what sort of useful transport-related control structures people can come up with.
Exciting patch.
I appreciate your work and all... but surely programmable signals would be far better than any number of extra pre-signals - they would remove the need for laying un-used track, so we can make things more compact 
edit: regardless of that, I just found a place in my game where a NAND would be very, very useful.

edit: regardless of that, I just found a place in my game where a NAND would be very, very useful.
Got nothing to do with this weird patch, but it's also with a little train that regulates the traffic.
Edit: fixed and added a funny maglev one, both 2 trains left - 2 trains right etc.
If you move the two-way signal from the maglev choohoo, you can change the amount of trains per branch at a time, atm it's 2-2, but can be set to 4-1 or something
Edit: fixed and added a funny maglev one, both 2 trains left - 2 trains right etc.
If you move the two-way signal from the maglev choohoo, you can change the amount of trains per branch at a time, atm it's 2-2, but can be set to 4-1 or something

- Attachments
-
- Rens Experiment, 27th Dec 2066.png
- Little choochoo delaying the maglev :O
- (194.36 KiB) Downloaded 635 times
The patch is awesome!!!! I updated it against trunk with some minor changes.
EDIT: Added Savegame with the logic gates (OR,AND,NAND,NOR,XOR,XNOR).
EDIT: Added Savegame with the logic gates (OR,AND,NAND,NOR,XOR,XNOR).
- Attachments
-
- NAND_signal.patch
- (8.84 KiB) Downloaded 231 times
-
- nand.sav
- savegame (nightly)
- (184.47 KiB) Downloaded 196 times
What does that mean - the circumstances? I determine what circumstances prevail. -- Napoleon Bonaparte
---
If we cannot end now our differences, at least we can help make the world safe for diversity. -- John F. Kennedy
---
Our problems are man-made, therefore they may be solved by man. No problem of human destiny is beyond human beings. -- John F. Kennedy
---
If we cannot end now our differences, at least we can help make the world safe for diversity. -- John F. Kennedy
---
Our problems are man-made, therefore they may be solved by man. No problem of human destiny is beyond human beings. -- John F. Kennedy
I've updated this patch to MiniIN 7267 and made graphic for nand signals, this graphic is necessary to run patched game. It is my first approach to OTTD sourcecode, so I could made something wrong.
- Attachments
-
- nnandw.grf
- Nand signals grf (red)
- (1.58 KiB) Downloaded 209 times
-
- Nand-MiniIN-7267.patch
- Nand signals MiniIN patch
- (11.99 KiB) Downloaded 167 times
I was playing around with Situation Switcher (found the idea at OpenTTDCoop) and made few pretty good and functionable variations. But I still knew something like NEG/NAND presignal would be handy to make it really perfect.
Then I tried to make my own NEG presignal but I could hardly understand the OTTD code around signals, although it actually worked. The main problem was the looping of these negations and the game has always freezed so I stopped trying for that time.
And then I found this thread after I saw a mention about NAND gates in the thread about programmable signals. Does anybody still work on this patch? And there is no activity in the other thread either
.
Then I tried to make my own NEG presignal but I could hardly understand the OTTD code around signals, although it actually worked. The main problem was the looping of these negations and the game has always freezed so I stopped trying for that time.
And then I found this thread after I saw a mention about NAND gates in the thread about programmable signals. Does anybody still work on this patch? And there is no activity in the other thread either

I rewrote the nand patch. Technicaly it works, but I have the feeling that something is wrong with it.
TODO:
- Savegame conversion to be save with the semaphores
- New sprites for the nand signal
TODO:
- Savegame conversion to be save with the semaphores
- New sprites for the nand signal
- Attachments
-
- nand_new_r10462.patch
- (6 KiB) Downloaded 109 times
What does that mean - the circumstances? I determine what circumstances prevail. -- Napoleon Bonaparte
---
If we cannot end now our differences, at least we can help make the world safe for diversity. -- John F. Kennedy
---
Our problems are man-made, therefore they may be solved by man. No problem of human destiny is beyond human beings. -- John F. Kennedy
---
If we cannot end now our differences, at least we can help make the world safe for diversity. -- John F. Kennedy
---
Our problems are man-made, therefore they may be solved by man. No problem of human destiny is beyond human beings. -- John F. Kennedy
I am just working on it, too. I used a patch made from the 7267 MiniIN and merged it with the latest trunk manually but it has some issues, too. I think it is somewhere around signal bits because the game thinks I have looped NANDs and the ctrl-driven signal editing doesn't work well. (It is very similar to the first problems I've encountered while I was working on my own NEG signals.)skidd13 wrote:I rewrote the nand patch. Technicaly it works, but I have the feeling that something is wrong with it.
TODO:
- Savegame conversion to be save with the semaphores
- New sprites for the nand signal
Now I'll have a look at your version, skidd13.
So there it is. But it still yells that some NAND signals are looped. And the signals behave weird at all. I think it is still somewhere within the signal bits.
EDIT: I fixed some little glitches and it seems to work now. The only thing I am not sure about is the value for argument 'from' on the line added to settings.cpp.
NOTE: The savegames are most likely incompatible.
EDIT: I fixed some little glitches and it seems to work now. The only thing I am not sure about is the value for argument 'from' on the line added to settings.cpp.
NOTE: The savegames are most likely incompatible.
- Attachments
-
- nand_new_r10462_v2.patch
- some fixes, now it works better.
- (11.71 KiB) Downloaded 129 times
mamuf: small hint there's an edit button, so please don't double post until it might be necessary. 
I removed the loop stuff cause the warning sucks. What about a debug message (to the console) after a code preset value e.g. 20.
The loop is caused by the original pathfinder which is AFAIK still used for the signal handling. So a debug message to the console should be enough.
The savegame value in your settings.cpp is wrong. Should be 70 ATM. (Savegame bump needed).

I removed the loop stuff cause the warning sucks. What about a debug message (to the console) after a code preset value e.g. 20.
The loop is caused by the original pathfinder which is AFAIK still used for the signal handling. So a debug message to the console should be enough.
The savegame value in your settings.cpp is wrong. Should be 70 ATM. (Savegame bump needed).
What does that mean - the circumstances? I determine what circumstances prevail. -- Napoleon Bonaparte
---
If we cannot end now our differences, at least we can help make the world safe for diversity. -- John F. Kennedy
---
Our problems are man-made, therefore they may be solved by man. No problem of human destiny is beyond human beings. -- John F. Kennedy
---
If we cannot end now our differences, at least we can help make the world safe for diversity. -- John F. Kennedy
---
Our problems are man-made, therefore they may be solved by man. No problem of human destiny is beyond human beings. -- John F. Kennedy
Yep, I already edited the last post while I had fixed version. But maybe I should've better edit the last but one
Since the NAND sets itself red while the NAND-loop reaches it's limit, the warning is really useless. I agree that if this won't be merged with trunk it doesn't need any GUI. The DEBUG call is already at line 1773 in rail_cmd.cpp. Originally it was made with printf and someone wrote here it should be DEBUG only so I changed it but I am not sure about the values of the arguments:
So you suggest the loop check should have hardcoded limit? Maybe it still could be a patches' variable because it is used at to places in the code.

Since the NAND sets itself red while the NAND-loop reaches it's limit, the warning is really useless. I agree that if this won't be merged with trunk it doesn't need any GUI. The DEBUG call is already at line 1773 in rail_cmd.cpp. Originally it was made with printf and someone wrote here it should be DEBUG only so I changed it but I am not sure about the values of the arguments:
Code: Select all
DEBUG(misc, 0, "NOTICE: Broken off processing, found too many NAND signals\n");
The multiple usage is no reason to create a patch value.mamuf wrote:... but I am not sure about the values of the arguments:misc -> section of debug, misc seems to be OK IMOCode: Select all
DEBUG(misc, 0, "NOTICE: Broken off processing, found too many NAND signals\n");
0 -> debug_level, IIRC 0 is show message allways
"<string>" -> no need of declaration
mamuf wrote:So you suggest the loop check should have hardcoded limit? Maybe it still could be a patches' variable because it is used at to places in the code.
- Attachments
-
- nand_new_r10467.patch
- (7.68 KiB) Downloaded 122 times
What does that mean - the circumstances? I determine what circumstances prevail. -- Napoleon Bonaparte
---
If we cannot end now our differences, at least we can help make the world safe for diversity. -- John F. Kennedy
---
Our problems are man-made, therefore they may be solved by man. No problem of human destiny is beyond human beings. -- John F. Kennedy
---
If we cannot end now our differences, at least we can help make the world safe for diversity. -- John F. Kennedy
---
Our problems are man-made, therefore they may be solved by man. No problem of human destiny is beyond human beings. -- John F. Kennedy
The question is - Do you know what logic gates are in general? Logic gates like AND, OR, NOT and ohers? If not, read the wikipedia article for example: Logic gate.AlexW wrote:If it is possible for someone to explain this in village idiot/simpleton/layman's terms, I would be most appreciative. I simply can't get my head around the usage of NAND, even with the picture(s) that have been posted!
NAND is simply gate made of NOT and AND. Written in functional manner it looks like: NOT(AND(x, y)), where x, y are logic variables (values 1|0). In common electronics NAND is the simpliest gate in the meaning of number of transistors needed to build such gate. Other gates need more of them to be build. And you can build every single known logic gate of NANDs only.
Logic table for NAND:
Code: Select all
x y | NAND(x, y)
--------
0 0 | 1
0 1 | 1
1 0 | 1
1 1 | 0
-
- Tycoon
- Posts: 11501
- Joined: 20 Sep 2004 22:45
Who is online
Users browsing this forum: Semrush [Bot] and 9 guests