Difference between A/B One-Shot instructions and Unity Pro |P| Positive Transition?

sanger

Member
Join Date
Nov 2005
Location
Toronto
Posts
172
I working on a program that was converted from ControlLogix to Unit Pro (M340).

The ControlLogix program used common Routines that were called multiple times with the appropriate data structure passed in as a parameter.

The common routines made ample use of One-shots. To keep the One-shots in one call instance from conflicting with the One-shots in another instance all of the One-shot used bits in the data structure that was passed in as a parameter.

This all worked well in the ControlLogix program but does not work as expected when using Positive Transition contacts |P| in Unity Pro. I need some information on exactly how Unity Pro implements the Transition contacts in order to devise a solution (e.g. Is it using a hidden bit to detect the transition, etc).

Here's a simplification of the logic in the two versions:

In ControlLogix


COP Buffer1 -> Temp
CALL CommonRoutine
COP Temp -> Buffer1

COP Buffer2 -> Temp
CALL CommonRoutine
COP Temp -> Buffer2

CommonRoutine
Temp.1 Temp.2
--| | ---[ONS] ---( ) Temp.3

Works Fine (One-shot transitions isolated between calls)



In Unity Pro


COP Buffer1 -> Temp
CALL CommonRoutine
COP Temp -> Buffer1

COP Buffer2 -> Temp
CALL CommonRoutine
COP Temp -> Buffer2

CommonRoutine
Temp.1
--| |------------( ) Temp.2

Temp.2
--|P|------------( ) Temp.3

Does not appear to work.
 
Modicon PLCs keep a record of the last scan state of a bit. The positive transition works by comparing the current state table to the previous scan state table. If there is a difference then the positive (or negative) transition contact will evaluate true.

Keep in mind that this works based on the change of state of the bit not the status of the rung.

An AB ONS instruction is based on the state of the rung. If the rung has evaluated true up to the one shot instruction then the instruction evaluates as true and then it stores that information in the storage bit address so that it does not evaluate true on the subsequent scan. When the rung evaluates false the one shot then clears the storage bit. The OSR and OSF work similarly except they are output instructions.

To see how the two might work differently lets compare these two rungs:

Modicon
A B C
---] [-------]^[------------( )---


AB
A B SB D
---] [-------] [---[ONS]----( )---



Lets say that in both cases input A is on. On a later scan input B transitions on.

In a Modicon PLC the positive transitional instruction will compare the current state of B with the last scan state of B. It will see that last scan B was 0 and that B is now 1 so it will then evaluate as true and pass true. Output C will turn on. After the scan the last scan state table is updated to reflect that B was on. In the next scan when the positive transitional instruction is evaluated the processor will see that the previous scan state of B matches the current scan state of B and the instruction will evaluate as false. Output C turns off.

In an AB PLC A was on and B turns on. With both A and B on the rung state will be true up to the ONS instruction. The ONS instruction will then evaluate the state of its storage bit. If the bit is 0 then the instruction knows the rung state has just changed from false to true. It then stores a 1 in the storage bit and passes true to the rung and output C turns on. On the next scan the ONS instruction will see that its storage bit is already set, so it will pass false to the rung and C turns off.

Now lets look at what happens when A and B are both off, and then B turns on first and some time later A turns on.

In the Modicon the positive transnational instruction works just like before, it evaluates the previous scan state table and sees that B has changed state from off to on. So it evaluates as true. However A is false so the rung is false and C does not turn on. On a later scan A turns on but the positive transitional instruction evaluates false because there is no change of state between the previous scan state of B and the current scan state of B and the rung is still false and C does not turn on - not on this scan or any subsequent scan.

In the AB PLC the rung is false because A is false. So even though B is on the ONS instruction still clears its storage bit and passes false to the rung so the output does not turn on. When A becomes true now the rung is true. The ONS instruction get a true input from the rung, it checks its storage bit, sees that it is off, and stores a 1 in the storage bit and passes true. Output C turns on. On the subsequent scan the ONS sees the storage bit is set and output C turns off functioning just like you would expect it to.

You can't simply copy the rungs when one shots are involved, you are going to have to re-think the logic in light of how the two instructions function.

You also need to remember that Modicon scans differently. A network is scanned from top to bottom then right to left. The scan moves down the first column of your ladder. Then it jumps to the top of the second column and scans down, then to the top of the third columns and scans down, etc. This can have implications that you may need to account for when translating a program.

I hope that helps.

I have to say though that going from CLX to a Modicon is going backwards. Just my opinion.
 
To continue:


This CLX rung
Tag.1 Tag.2 Tag.3
----| |-----[ONS]-----( )--


Would become
Tag.1 Tag.3
----|^|----------( )--


This CLX rung
Tag.1 Tag.2 Tag.3 Tag.4
---] [-------] [-----[ONS]------( )--



Would Become
Tag.1 Tag.2 Tag.4
---] [-----] [------( )


Tag.4 Tag.3
---]^[--------------
( )


There is still a subtle difference on the last one however. Because of the way the top down scan works the positive transitional on the second row has already been evaluated before Tag.4 gets set on the top row. It has to wait until the next scan. If you align the columns in your network so that the output to Tag.4 is in column 3 and the positive transitional is below in column 3 or in any column to the right column 3 then it will work for the current scan.

Tag.1 Tag.2 Tag.4
---] [-----] [------( )


Tag.4 Tag.3
--------------------]^[--------
( )

 
Last edited:
TConnolly - I had forgotten all that modicon scanning stuff - thanks for the reminder.

OP has another problem - he is copying Blocks of code into a Temp buffer for processing by a subroutine and the ONS Store is part of the buffer

He may have to write his own ONS where the store is in the buffer
eg shown to suit rockwell - may need modification for modicon

Bit 1 Bit 2 Bit_1_ONS
-| |----------|/|------------( )

Bit 1 Bit 2
-| |-------------------------( )

 
Sorry to butt in but now can you explain the |N| I apologize but I'm also forced to learn Modicon (formally A/B) but with Concept 2.6

This CLX rung

Tag.1 Tag.2 Tag.3 Tag.4

---] [-------] [-----[ONS]------( )--






Would Become

Tag.1 Tag.2 Tag.4

---] [-----] [------( )




Tag.4 Tag.3

---]^[--------------
( )


I think I understand how the |P| becomes true. But if let's say "tag 1 goes false would that make the |N| a true statement.
I apologize for my ignorance, I just can't seem to get it.
 
In unity, make Temp.2 as EBOOL type and directly use posite edge. So you can write the logic in one rung as shown below.

Temp.2
--|P|------------( ) Temp.3

EBOOL is enhanced BOOL which can store change status and force status along with status bit.
 

Similar Topics

Hello, I have a problem with AO- and AA-Tags. When I use for example the tag AO_Test with the address 200 and type the value 1,2 in, the AA-Tag...
Replies
7
Views
1,402
As per the title. This might seem like a basic question to many, but I'm unclear about the difference between a coil ( ) and an application...
Replies
28
Views
4,007
Good Morning , I have 2 Frequency Drive panels to build and commission . It is for 2 pump systems . Just wondering , what is the...
Replies
4
Views
1,958
Hi Experts, Good day! What are the differences between PCS7 SIMATIC Batch and PM Control? Do you have any manual like "Getting Started "...
Replies
0
Views
802
I have a Automation Direct Click Plus that you can buy option CPU slot modules for input/outputs. The slot modules have the options of sinking...
Replies
9
Views
2,805
Back
Top Bottom