Greetings! Second post here...
I've been programming AB plc equipment for some time now so I am pretty comfortable with the function set although I've been scratching my head over how to go about writing a piece of code for the application that I am currently charged with.
Instead of trying to explain all of the particulars about the application, I'll attempt to explain this in general terms. I have an object (a train actually) that will move from left to right. There are 5 boxes, numbered 1 through 5 (also left to right) and each has the ability to determine the presence of the train (we call them “track circuits”). Under normal operation, the object will move according to the following crude diagram.
1 2 3 4 5
[X] [ ] [ ] [ ] [ ]
[X] [X] [ ] [ ] [ ]
[ ] [X] [ ] [ ] [ ]
[ ] [X] [X] [ ] [ ]
[ ] [ ] [X] [ ] [ ] and so forth.
On rare occasions, a track circuit will fail and the failure-mode is such that the system then thinks the train is still present when in fact it is not. Therein, the failure pattern is as follows:
1 2 3 4 5
[X] [ ] [ ] [ ] [ ]
[X] [X] [ ] [ ] [ ]
[ ] [X] [ ] [ ] [ ]
[ ] [X] [X] [ ] [ ]
[ ] [X] [X] [ ] [ ] Tk. Ckt. #2 failed. Train occupies #3
[ ] [X] [X] [X] [ ]
[ ] [X] [ ] [X] [ ]
[ ] [X] [ ] [X] [X]
[ ] [X] [ ] [ ] [X]
[ ] [X] [ ] [ ] [X] [X]
[ ] [X] [ ] [ ] [ ] [X]
The train length (the “consist”) is variable. As it moves from one track circuit to another, it will always show two adjacent cells occupied at the same time until the rear of the train vacates the circuit to the left (remember it is moving to the right). On the other hand, depending on the train’s length, it may occupy up to three adjacent cells simultaneously. Under normal operation (no track circuit failures), there will never be any gap between occupied circuits.
One might suggest that a table could be created with patterns that represent all of the possible logic states that indicate a failure and compared to the current pattern of track circuit states. Unfortunately, this is rapid-transit and depending on the time of day and status of the operation (delays, etc.), there could be two trains that are moving through the same area with only a single unoccupied track circuit between them.
I considered a check-in/check-out system whereby a counter is incremented each time a train enters the section and decremented as it leaves. At that point (i.e. when the counter’s accumulator = zero), if there were one or more circuits indicating “occupied,” I could declare a failure. However, when train density is high, the section that I am monitoring may never be unoccupied (.ACC=0).
Any ideas? I’m looking more for a general direction as opposed to ladder examples. In the end, the excitement comes from generating code that achieves the goal!
(BTW-When there is a failure, trains approaching it are automatically slowed down and then forced to stop short of the failed circuit, as if there was a real train present. That being said, these failures don't typically persist too long as the train operators report them to a central control center. I am simply interested in solving the problem out of accedemic interest.)
Thanks in advance,
Jimmy
I've been programming AB plc equipment for some time now so I am pretty comfortable with the function set although I've been scratching my head over how to go about writing a piece of code for the application that I am currently charged with.
Instead of trying to explain all of the particulars about the application, I'll attempt to explain this in general terms. I have an object (a train actually) that will move from left to right. There are 5 boxes, numbered 1 through 5 (also left to right) and each has the ability to determine the presence of the train (we call them “track circuits”). Under normal operation, the object will move according to the following crude diagram.
1 2 3 4 5
[X] [ ] [ ] [ ] [ ]
[X] [X] [ ] [ ] [ ]
[ ] [X] [ ] [ ] [ ]
[ ] [X] [X] [ ] [ ]
[ ] [ ] [X] [ ] [ ] and so forth.
On rare occasions, a track circuit will fail and the failure-mode is such that the system then thinks the train is still present when in fact it is not. Therein, the failure pattern is as follows:
1 2 3 4 5
[X] [ ] [ ] [ ] [ ]
[X] [X] [ ] [ ] [ ]
[ ] [X] [ ] [ ] [ ]
[ ] [X] [X] [ ] [ ]
[ ] [X] [X] [ ] [ ] Tk. Ckt. #2 failed. Train occupies #3
[ ] [X] [X] [X] [ ]
[ ] [X] [ ] [X] [ ]
[ ] [X] [ ] [X] [X]
[ ] [X] [ ] [ ] [X]
[ ] [X] [ ] [ ] [X] [X]
[ ] [X] [ ] [ ] [ ] [X]
The train length (the “consist”) is variable. As it moves from one track circuit to another, it will always show two adjacent cells occupied at the same time until the rear of the train vacates the circuit to the left (remember it is moving to the right). On the other hand, depending on the train’s length, it may occupy up to three adjacent cells simultaneously. Under normal operation (no track circuit failures), there will never be any gap between occupied circuits.
One might suggest that a table could be created with patterns that represent all of the possible logic states that indicate a failure and compared to the current pattern of track circuit states. Unfortunately, this is rapid-transit and depending on the time of day and status of the operation (delays, etc.), there could be two trains that are moving through the same area with only a single unoccupied track circuit between them.
I considered a check-in/check-out system whereby a counter is incremented each time a train enters the section and decremented as it leaves. At that point (i.e. when the counter’s accumulator = zero), if there were one or more circuits indicating “occupied,” I could declare a failure. However, when train density is high, the section that I am monitoring may never be unoccupied (.ACC=0).
Any ideas? I’m looking more for a general direction as opposed to ladder examples. In the end, the excitement comes from generating code that achieves the goal!
(BTW-When there is a failure, trains approaching it are automatically slowed down and then forced to stop short of the failed circuit, as if there was a real train present. That being said, these failures don't typically persist too long as the train operators report them to a central control center. I am simply interested in solving the problem out of accedemic interest.)
Thanks in advance,
Jimmy