Jump to content

Level Crossing control


Empfohlene Beiträge

29 minutes ago, 220hotwheels said:

... the chauffeur with monkey wrench who keeps attacking my poor crossing barriers...

I'm beginning to suspect that it's you, the monkey..! :P
I see you're counting up when a train is coming; I can't see where you count down once they're passed.
I see you're counting into each barrier; is not just one enough..?
I see you're counting up, but I can't see where you're testing, with a condition, the result of this count.

May I suggest starting with a single 'Train approaching' counter as a Variable. Whenever a train is on approach, test the Variable : if it's Zero, close the barriers, then increment the Variable. If a second train comes while they're closed, test the Variable (it won't be Zero, so the barriers remain closed...), then increment the Variable Whenever a train clears the crossing, count down one.
Detect, at each change of 'Train approaching' Variable whether it's at Zero. If so, raise the barriers (all of them...).
See if that helps...

Ich beginne zu vermuten, dass du es bist, der Affe...! :P
Ich sehe, du zählst, wenn ein Zug kommt; Ich kann nicht sehen, wo du herunterzählst, wenn sie vorbei sind.
Ich sehe, du zählst in jede Barriere hinein; reicht nicht nur einer..?
Ich sehe, dass Sie hochzählen, aber ich kann nicht sehen, wo Sie das Ergebnis dieser Zählung mit einer Bedingung testen.

Darf ich vorschlagen, mit einem einzelnen 'Zug nähert'-Zähler als Variable zu beginnen. Wenn sich ein Zug nähert, testen Sie die Variable: Wenn sie Null ist, schließen Sie die Schranken und erhöhen Sie dann die Variable. Wenn ein zweiter Zug kommt, während sie geschlossen sind, testen Sie die Variable (sie wird nicht Null sein, damit die Schranken geschlossen bleiben...)
Erkennen Sie bei jeder Änderung der Variable 'Zug nähert' sich, ob sie auf Null steht. Wenn ja, erhöhen Sie die Barrieren (alle...).
Sehen Sie, ob das hilft...

Link zu diesem Kommentar
Auf anderen Seiten teilen

Hello Pete,

in your latest attempt (the small test layout) you are counting the trains going in and out, but without purpose.

That was much better before, where at least you checked the number before opening the barriers.
All that was missing then was the same check before closing.

You need one counter and one counter only for each level crossing. Not four (as you did now)

When the first train enters "the zone", you want to close all barriers.
When the last train exits "the zone", you want to open them.

 

vor 19 Stunden schrieb 220hotwheels:

I have ben playing around with all sorts

and therein lies your problem, Pete

You try things at random, hoping to strike it lucky.
You have no concept and you apply no logic.

Don't try to memorise these principles, Pete. 
You have to understand them. That's the only path to success.

Greets
Goetz

Link zu diesem Kommentar
Auf anderen Seiten teilen

1 hour ago, Dad3353 said:

I'm beginning to suspect that it's you, the monkey..! :P
I see you're counting up when a train is coming; I can't see where you count down once they're passed.
I see you're counting into each barrier; is not just one enough..?
I see you're counting up, but I can't see where you're testing, with a condition, the result of this count.

May I suggest starting with a single 'Train approaching' counter as a Variable. Whenever a train is on approach, test the Variable : if it's Zero, close the barriers, then increment the Variable. If a second train comes while they're closed, test the Variable (it won't be Zero, so the barriers remain closed...), then increment the Variable Whenever a train clears the crossing, count down one.
Detect, at each change of 'Train approaching' Variable whether it's at Zero. If so, raise the barriers (all of them...).
See if that helps...

Ich beginne zu vermuten, dass du es bist, der Affe...! :P
Ich sehe, du zählst, wenn ein Zug kommt; Ich kann nicht sehen, wo du herunterzählst, wenn sie vorbei sind.
Ich sehe, du zählst in jede Barriere hinein; reicht nicht nur einer..?
Ich sehe, dass Sie hochzählen, aber ich kann nicht sehen, wo Sie das Ergebnis dieser Zählung mit einer Bedingung testen.

Darf ich vorschlagen, mit einem einzelnen 'Zug nähert'-Zähler als Variable zu beginnen. Wenn sich ein Zug nähert, testen Sie die Variable: Wenn sie Null ist, schließen Sie die Schranken und erhöhen Sie dann die Variable. Wenn ein zweiter Zug kommt, während sie geschlossen sind, testen Sie die Variable (sie wird nicht Null sein, damit die Schranken geschlossen bleiben...)
Erkennen Sie bei jeder Änderung der Variable 'Zug nähert' sich, ob sie auf Null steht. Wenn ja, erhöhen Sie die Barrieren (alle...).
Sehen Sie, ob das hilft...

Hi Douglas

Many thanks for your advice, some of which definitely sounds a bit like monkey business!!

I can follow your comments to a point. One train runs round and operates the barriers correctly. If I check the variable just after the train has contacted the TC to close them then the variable count is. After it has passed the TC to open the barrier then the count is returned to zero. With both trains on the move the first passes the TC to close and adds 1 to the variable. If I stop that train before it gets to the crossing and allow the second one to proceed then the variable is increased to 2 . After both trains have passed their respective TC's to open the barriers then the variable returns to 0. So I conclude that is working fine. I have just had a message from Goetz which has basically told me the same thing as you have mentioned, no testing condition. I now think I know what to do in order to sort this out. I'll let you know how I get on.

Pete

Link zu diesem Kommentar
Auf anderen Seiten teilen

10 minutes ago, Goetz said:

Hello Pete,

in your latest attempt (the small test layout) you are counting the trains going in and out, but without purpose.

That was much better before, where at least you checked the number before opening the barriers.
All that was missing then was the same check before closing.

You need one counter and one counter only for each level crossing. Not four (as you did now)

When the first train enters "the zone", you want to close all barriers.
When the last train exits "the zone", you want to open them.

 

and therein lies your problem, Pete

You try things at random, hoping to strike it lucky.
You have no concept and you apply no logic.

Don't try to memorise these principles, Pete. 
You have to understand them. That's the only path to success.

Greets
Goetz

Hi Goetz

As you have already noted, Douglas has also replied with more or less the same advice. You are perfectly correct in your comment that I do tend to do things at random in the hope that I get it right, using only a little true knowledge. I do find however that, for me at least, repetition is the most effective way to address a problem especially when some of the instruction is not necessarily immediately obvious.

So time to try to apply a more logical approach. I'll let you know how I get on.

Cheers

Pete 

Link zu diesem Kommentar
Auf anderen Seiten teilen

vor 15 Minuten schrieb 220hotwheels:

repetition is the most effective way to address a problem

... in some cases, Pete. Craftsmanship for instance. Dexterity and similar skills.
But definitely not when you're learning control mechanisms. They are all about cause and effect. Nothing else.

Link zu diesem Kommentar
Auf anderen Seiten teilen

1 hour ago, Goetz said:

... in some cases, Pete. Craftsmanship for instance. Dexterity and similar skills.
But definitely not when you're learning control mechanisms. They are all about cause and effect. Nothing else.

I totally agree but without too much information to explain each element, its effects and aims then all you have left is a stab in the dark. It is rather like learning to become a motor mechanic. You either learn by example or you learn through training. Both provide you with a degree of information and one hopes skills to move forward but if the trainee is given the task of replacing the ABS system and left to get on with it then all he has available is the ability to take a stab in the dark.

Anyway that said I continue my deliberations with the crossing barriers and am trying to apply logic. Perhaps it is too early to say but I am hopeful that I might have seen the errors of my "stab in the Dark" days, certainly with one track, now to move on and see if the same logic will allow both tracks to control the barriers correctly. I'll let you know how things turn out even if the criminal element of my EV gets the better of me!!

Cheers

Pete

Link zu diesem Kommentar
Auf anderen Seiten teilen

15 hours ago, 220hotwheels said:

I totally agree but without too much information to explain each element, its effects and aims then all you have left is a stab in the dark. It is rather like learning to become a motor mechanic. You either learn by example or you learn through training. Both provide you with a degree of information and one hopes skills to move forward but if the trainee is given the task of replacing the ABS system and left to get on with it then all he has available is the ability to take a stab in the dark.

Anyway that said I continue my deliberations with the crossing barriers and am trying to apply logic. Perhaps it is too early to say but I am hopeful that I might have seen the errors of my "stab in the Dark" days, certainly with one track, now to move on and see if the same logic will allow both tracks to control the barriers correctly. I'll let you know how things turn out even if the criminal element of my EV gets the better of me!!

Cheers

Pete

Hi Goetz

Well I have taken your advice and tackled the problem with both logic and cause and effect. The net result is to at least have the barriers working fine on the close front. They also work OK on the open front although I don't seem to be able to achieve the "last train past" element for opening the barriers. Each train does this independently. My conclusion is that instead of having this instruction in the EV for each track that I somehow need to have this only once, perhaps in common instructions. My dilemma is just how to construct this so that it refers to each track. Are you able to point me in the right direction please.

Cheers

Pete

Level crossing barriers test layout.mbp

Link zu diesem Kommentar
Auf anderen Seiten teilen

vor 22 Minuten schrieb 220hotwheels:

My conclusion is that instead of having this instruction in the EV for each track that I somehow need to have this only once

That's already the case, Pete

With the code for track 1 and track 2, you affect the same counter. 
Trains on both tracks increment your number in barrier 1 when passing the entry contact.
And the decrement this one number when they pass the exit contact.

What's wrong is your condition for opening the barrier.
Your code states that any number larger than 0 will do. 

Ponder on why that isn't what you want.

Greets
Goetz
 

Link zu diesem Kommentar
Auf anderen Seiten teilen

2 hours ago, Goetz said:

That's already the case, Pete

With the code for track 1 and track 2, you affect the same counter. 
Trains on both tracks increment your number in barrier 1 when passing the entry contact.
And the decrement this one number when they pass the exit contact.

What's wrong is your condition for opening the barrier.
Your code states that any number larger than 0 will do. 

Ponder on why that isn't what you want.

Greets
Goetz
 

Hi Goetz

Many thanks for your further prompt to my little grey cells. As a result I think I now have the EV right and the barriers seem to perform as they should. If this is so then your confirmation that my solution is as correct as it should be rather than just a lucky guess at my view of logic would be appreciated after all I might as well get the most perfect EV solution rather than just one that seems to work. Assuming all to be correct then I will look to apply this to my layout.

Cheers

Pete

Level crossing barriers test layout.mbp

Link zu diesem Kommentar
Auf anderen Seiten teilen

@220hotwheels...

Just a tiny remark, if I may..? Your animations for the barriers are from 'Start', and work well until it so happens that they are only half-way up (or down...) before a second train comes along. In this case, they 'flick' to Start before doing the animation. To prevent this, it may be useful to have the animation go from 'Current', rather than 'Start'. If they're going up, but a train comes, they will go down from their present attitude, instead of going to 'Start'.
Just a thought; it looks OK from the brief run I did, and works well. Jolly Good, old chum. (y)

Nur eine kleine Bemerkung, wenn ich darf..? Ihre Animationen für die Schranken stammen von "Start" und funktionieren gut, bis sie zufällig nur auf halbem Weg (oder unten) sind, bevor ein zweiter Zug kommt. In diesem Fall "schnellen" sie zu Start, bevor sie die Animation ausführen. Um dies zu verhindern, kann es sinnvoll sein, die Animation von 'Aktuell' und nicht von 'Start' zu starten. Wenn sie aufsteigen, aber ein Zug kommt, werden sie von ihrer gegenwärtigen Haltung absteigen, anstatt zu 'Start' zu gehen.
Nur ein Gedanke; es sieht aus dem kurzen Durchlauf, den ich gemacht habe, in Ordnung aus und funktioniert gut. Jolly Good, alter Kumpel. (y)

Link zu diesem Kommentar
Auf anderen Seiten teilen

vor 13 Minuten schrieb 220hotwheels:

get the most perfect EV solution

Hi Pete,
that's not what you should be striving for.
Instead, you should work on gaining a better understanding.

Here's an example from your current attempt:

The outer condition checks if the variable has a value greater than 1.
And when that is not the case, the inner loop checks if it is greater than 0.
When both conditions (not > 1, but > 0) are met, the barriers are closed.

1856318895_twoconditions.jpg.4aaca4aed1ceafe5e92db58b7803e33a.jpg

If the value of Test Barrier 1.trains crossing is not greater than 1, but greater than 0,
what is it's value, considering it's always a whole number?

1113559841_onecondition.jpg.7e33fb122603051e1dc3f49d97bbb74e.jpg

And when you close the barriers, it's also time to set the deceleration value to 0.
Only then!

The afore mentioned aspects are only cosmetic. The behaviour is correct.
When it comes to opening the barriers however, matters are a little more serious.
You once had a smart system, where you first raised the barriers and then, after a short time delay, set the cars in motion.
Now you shuffled that order of events to where it no longer makes any sense.

Yyou are making progress.
But it's very difficult for me to decide if your

understanding improves or if you're just following orders ...
 

Greets
Goetz

vor 4 Minuten schrieb Dad3353:

In this case, they 'flick' to Start before doing the animation.

No, Doug, they don't!
Because his code only lowers the barriers for the first train.
 

 

Link zu diesem Kommentar
Auf anderen Seiten teilen

1 hour ago, Goetz said:

Hi Pete,
that's not what you should be striving for.
Instead, you should work on gaining a better understanding.

Here's an example from your current attempt:

The outer condition checks if the variable has a value greater than 1.
And when that is not the case, the inner loop checks if it is greater than 0.
When both conditions (not > 1, but > 0) are met, the barriers are closed.

1856318895_twoconditions.jpg.4aaca4aed1ceafe5e92db58b7803e33a.jpg

If the value of Test Barrier 1.trains crossing is not greater than 1, but greater than 0,
what is it's value, considering it's always a whole number?

1113559841_onecondition.jpg.7e33fb122603051e1dc3f49d97bbb74e.jpg

And when you close the barriers, it's also time to set the deceleration value to 0.
Only then!

The afore mentioned aspects are only cosmetic. The behaviour is correct.
When it comes to opening the barriers however, matters are a little more serious.
You once had a smart system, where you first raised the barriers and then, after a short time delay, set the cars in motion.
Now you shuffled that order of events to where it no longer makes any sense.

Yyou are making progress.
But it's very difficult for me to decide if your

understanding improves or if you're just following orders ...
 

Greets
Goetz

No, Doug, they don't!
Because his code only lowers the barriers for the first train.
 

 

Perhaps a bit of both! As for the vehicle movements. I hadn't really consider that and having taken a brief look the results are not good so I still have much work to do. For now however my little grey cells can't take any more logical thinking. Perhaps after I have watched "The Chain" and pondered further I might see the solution.

Cheers

Pete

Link zu diesem Kommentar
Auf anderen Seiten teilen

3 hours ago, Goetz said:

...No, Doug, they don't!...

(Preparation for a Pantomime 'Oh yes they do..!'... 'Oh no they don't'... etc... :D )

Maybe, dear friend, but when a First Train arrives whilst the barriers are still raising from the passage of a previous First Train (now passed...), the barriers do flick to Start before descending as they should. This is not a theoretical case; I wouldn't have mentioned it if I hadn't seen it with my own eyes. It won't happen often; it's just an infrequent coincidence, and is not a consequence of any programming elsewhere. It wouldn't occur at all if 'Current Position' was chosen, instead of 'Start', that's all. I didn't go into the rest of the code; I tend to do things a little differently anyway, so I'll leave that issue open. B|

(Vorbereitung für eine Pantomime 'Oh ja, sie tun..!'... 'Oh nein, das tun sie nicht'... etc... :D )

Vielleicht, lieber Freund, aber wenn ein Erster Zug ankommt, während die Schranken von der Durchfahrt eines vorherigen Ersten Zuges (jetzt passiert...) noch steigen, springen die Schranken zu Start, bevor sie wie vorgesehen absteigen. Dies ist kein theoretischer Fall; Ich hätte es nicht erwähnt, wenn ich es nicht mit eigenen Augen gesehen hätte. Es wird nicht oft passieren; es ist nur ein seltener Zufall und nicht die Folge einer anderweitigen Programmierung. Es würde überhaupt nicht auftreten, wenn 'Aktuelle Position' anstelle von 'Start' gewählt würde, das ist alles. Ich ging nicht auf den Rest des Codes ein; Ich tendiere sowieso dazu, die Dinge ein wenig anders zu machen, also lasse ich das Thema offen. B|

Bearbeitet von Dad3353
Link zu diesem Kommentar
Auf anderen Seiten teilen

vor 3 Minuten schrieb Dad3353:

but when a First Train arrives whilst the barriers are still raising from the passage of a previous First Train

Yes, Doug.
But that is a different matter altogether.

And a barrier that half opens and immediately closes again looks only marginally better.
To avoid this and have a proper, clean operation where the barriers only open between trains when at least a few cars can slip through, you need to separate the counter contact from the closing contact. A train must announce it's approach a fair time earlier before it triggers the lowering of the barriers. By doing so, it ensures closed barriers staying down while risen barriers stay open a little longer.

Link zu diesem Kommentar
Auf anderen Seiten teilen

8 minutes ago, Goetz said:

...But that is a different matter altogether...

Nevertheless, it's possible, whatever the timing, to have a trigger for closure whilst the barriers are rising. This can happen, wherever the contacts are placed. If the animation to close is started from the half-open barriers, it would be just like real life; they would quietly cease rising and calmly lower to their 'Down' position. That's all. No big deal. B|

Dennoch ist es unabhängig vom Zeitpunkt möglich, einen Auslöser für die Schließung zu haben, während die Barrieren steigen. Dies kann passieren, wo immer die Kontakte platziert sind. Wenn die Animation zum Schließen von den halboffenen Schranken aus gestartet wird, wäre es wie im echten Leben; sie hörten leise auf zu steigen und senkten sich ruhig in ihre 'unten'-Position. Das ist alles. Keine große Sache. B|

 

Bearbeitet von Dad3353
Link zu diesem Kommentar
Auf anderen Seiten teilen

vor 1 Minute schrieb Dad3353:

This can happen, wherever the contacts are placed.

Not, if you separate the counter contact from the close contact (with a good stretch of track between the two).
Trust me, Doug. I've done this before. With the studio. With EEP.

But you're correct in saying that skipping back to the starting position looks worse than a reversal of direction midway.
I simply prefer a mechanism where neither ever happens. And if it can't happen, you may as well start from the top.

Link zu diesem Kommentar
Auf anderen Seiten teilen

38 minutes ago, Goetz said:

Not, if you separate the counter contact from the close contact...

I'm in danger of disturbing this useful topic with this stuff, so I'll leave it there, unconvinced. :/

Ich bin in Gefahr, dieses nützliche Thema mit diesem Zeug zu stören, also belasse ich es dabei, nicht überzeugt. :/

Link zu diesem Kommentar
Auf anderen Seiten teilen

Hello Doug,

vor 1 Stunde schrieb Dad3353:

unconvinced. :/

Then allow me, please ...

In the following example, the steam train has a marginally longer round and runs at a speed 1 km/h slower than the railcar.
This causes the time gap between the two to increase slightly each round.

 

For two rounds, the barriers stay closed between the railcar leaving and steam train entering.
On the third round, the barriers open after the railcar. And this time they stay open long enough for a few cars to pass through.
They close again just in time before the steam train crosses.

level crossing example.mbp

The actual closing happens very late in this example. The barriers reach the down position at the very moment when the train arrives. This is deliberate to help you understand what's happening when and why.

I find this a very useful principle. That's why I'm so eager to demonstrate it.

Greets
Goetz

Bearbeitet von Goetz
layout improved with labels
Link zu diesem Kommentar
Auf anderen Seiten teilen

18 hours ago, Goetz said:

Hello Doug,

Then allow me, please ...

In the following example, the steam train has a marginally longer round and runs at a speed 1 km/h slower than the railcar.
This causes the time gap between the two to increase slightly each round.

 

For two rounds, the barriers stay closed between the railcar leaving and steam train entering.
On the third round, the barriers open after the railcar. And this time they stay open long enough for a few cars to pass through.
They close again just in time before the steam train crosses.

level crossing example.mbp 42.55 kB · 4 downloads

The actual closing happens very late in this example. The barriers reach the down position at the very moment when the train arrives. This is deliberate to help you understand what's happening when and why.

I find this a very useful principle. That's why I'm so eager to demonstrate it.

Greets
Goetz

Hi Goetz

Having watch The Chain I decided to begin my example of the level crossing barriers again and to work through it stage by stage noting just what happened as I made alterations to my EV. So I basically started off with everything working as it should, both cars and trains, from the original example that you provided and just on a single track. Then I stopped the loco on that track and checked that the one on the second track was fine. Next I set both locos in operation and noted that there were times when the timings for the trains to trip the 'close contact' meant that the barriers would jump if one of the trains was arriving too late and the barriers were beginning to open. I solved this by noting there positions of each loco and adjusting the position of each of the two 'close barriers' contacts. Thus far having run them for 30mins solid all has worked perfectly. I then addressed the operation of the vehicles and these too now seem to function as they should. As I worked through each stage I stopped to ask myself what was happening and how should I proceed to create the next step. Logic and cause and effect at work I hope.

Having now seen the example that you have produced to explain your methodology to Douglas I can now see how I might improve my rather haphazard attempt to create one that relied more on trial and error, so many thanks for that.

Cheers

Pete

Link zu diesem Kommentar
Auf anderen Seiten teilen

vor 49 Minuten schrieb 220hotwheels:

As I worked through each stage I stopped to ask myself what was happening and how should I proceed to create the next step.

Brilliant, Pete!
That's the way to do it.

And I'm happy to help you with this every step of the way.

Link zu diesem Kommentar
Auf anderen Seiten teilen

I've added a counter now to each track and am just monitoring the effects, so far so good so onwards and upwards, as they say. Once again many thanks for your help, I apologise for being something of a slow learner but with perseverance I think I get there in the end. You just need to have the patience of Jobe for members like me!!!

Cheers

Pete

Link zu diesem Kommentar
Auf anderen Seiten teilen

Erstelle ein Benutzerkonto oder melde dich an, um zu kommentieren

Du musst ein Benutzerkonto besitzen, um einen Kommentar verfassen zu können

Benutzerkonto erstellen

Neues Benutzerkonto für unsere Community erstellen.

Neues Benutzerkonto erstellen

Anmelden

Du hast bereits ein Benutzerkonto? Melde dich hier an.

Jetzt anmelden
×
×
  • Neu erstellen...