Katerina

Using SET/RESET more than 1 times in a program

14 posts in this topic

Hi! I would like to ask if I can use SET/RESET commands more than one time (for the same value/address) in the same program.I have already created the program but there are a lot of warnings like:

WARNING: Duplicated output -  RSET 200.00 at rung 1 (6, 5) 
WARNING: Duplicated output -  SET 100.00 at rung 1 (6, 7) 
WARNING: Duplicated output -  RSET 200.01 at rung 2 (6, 3) 
WARNING: Duplicated output -  RSET 200.00 at rung 2 (6, 5) 

                           .......................

Do these warnings have to do with using set or reset many times for the same value?

I don't want  to put every set and reset of the same value together because this causes changes in the order (and consequently the priority)of the rungs.(I noticed this when I tried to do a simulation)

(I have attached a picture of a small part of the program so you can see clearly what I mean)

set_reset commands.jpg

Share this post


Link to post
Share on other sites
1 hour ago, Katerina said:

Do these warnings have to do with using set or reset many times for the same value?

Yes. This is just a warning. It can be turned off in CX Programmer Options but I wouldn't. I didn't analyze your program but the SET and RSET functions will work in duplication. Duplication of a standard OUT will not work as expected. Only the last instance will be evaluated.

The warnings are referencing Addresses where you are only showing Symbols in your ladder. There is an option to show either or both. Alternatively you can double click on the warning and it will highlight the offender.

Share this post


Link to post
Share on other sites

Warnings just mean they may be bad code.  Errors will keep you from downloading, warnings will not.

Share this post


Link to post
Share on other sites

Multiple SET/RESET of BOOLEAN flags are quite acceptable.

This is a love/hate methodology of programming techniques.

If you are comfortable with it then go ahead, nobody is going to beat you up for using it.

My personal preference is to use the STEP/SNXT instructions in OMRON and add the SET/RESET instructions within each step to build required logic.

 

 

Share this post


Link to post
Share on other sites
On 8/3/2016 at 3:18 PM, IO_Rack said:

Yes. This is just a warning. It can be turned off in CX Programmer Options but I wouldn't. I didn't analyze your program but the SET and RSET functions will work in duplication. Duplication of a standard OUT will not work as expected. Only the last instance will be evaluated.

The warnings are referencing Addresses where you are only showing Symbols in your ladder. There is an option to show either or both. Alternatively you can double click on the warning and it will highlight the offender.

What exactly do you mean by saying ''not work as expected. Only the last instance will be evaluated'' ??

I have tried to do some kind of simulation using force on/off.It seems to work as expected until a point where something goes wrong ( that is what I am trying to find out right now )

Share this post


Link to post
Share on other sites
On 10/4/2016 at 0:43 AM, BITS N BYTES said:

Multiple SET/RESET of BOOLEAN flags are quite acceptable.

This is a love/hate methodology of programming techniques.

If you are comfortable with it then go ahead, nobody is going to beat you up for using it.

My personal preference is to use the STEP/SNXT instructions in OMRON and add the SET/RESET instructions within each step to build required logic.

 

 

Hello! Is this methodology professionally avoided though?

What I am trying to do actually is translating Petri Nets into ladder .(Petri Nets are a mathematical way of programming  automated production systems in order to avoid deadlocks) So,  I use this repeated SET/RESET for variables  because I am following a standard translation methodology.

What are  STEP/SNXT instructions and how could they help me ?

Share this post


Link to post
Share on other sites

There's no reason not to use SET/RESET.  I do it frequently.  

If I am trying to create a sequence, I don't do it by set and reset of bits.  I create an integer and move a value into it.

As an example, I had a tank farm where tanks had 4 status.  Filling, Mixing, Draining, Empty.

So when filling was done, I reset Filling bit and set Mixing bit.  And so on to make the sequence.

But somehow I got on site once to find a tank was both filling and draining, which should be impossible with my logic.  But those 2 bits were both on.

So instead I move a 1 for filling, 2 for mixing, 3 for draining, and 4 for empty.  That way since there is only one integer and it can only have one value, there is no way to get into 2 states at the same time.

Share this post


Link to post
Share on other sites

I agree with Crossbow about using a register value to control sequencing. It virtually eliminates the possibility of multiple steps executing at the same time.

In general, I do not use SET/RESET to control real I/O points because the real I/O usually needs built-in safety interlocks in the logic. I often use SET/RESET to control internal logic bits when sequencing is involved or when the sequence calls a subroutine.

Edited by Mendon Systems

Share this post


Link to post
Share on other sites
23 hours ago, Katerina said:

What exactly do you mean by saying ''not work as expected. Only the last instance will be evaluated'' ??

I was referring to an OUT instruction vs. the SET / RSET.

Duplicate_Output.jpg.123e15b97e336f958f1

 

Now take a look at how the SET / RSET behave.

Duplicate_Output2.thumb.jpg.4c1bbb67ef55

Duplicate_Output3.thumb.jpg.4fc260d4ba34

 

These are not practical examples but demonstrate the possibilities. As you can see, there are various outcomes depending upon the Execution and the Order of Evaluation. This is why these guys have warned you about using them.

See if this understanding helps you to find your issue. If not then please explain what is 'going wrong'.

Share this post


Link to post
Share on other sites
On 13/4/2016 at 4:34 PM, IO_Rack said:

I was referring to an OUT instruction vs. the SET / RSET.

Duplicate_Output.jpg.123e15b97e336f958f1

 

Now take a look at how the SET / RSET behave.

Duplicate_Output2.thumb.jpg.4c1bbb67ef55

Duplicate_Output3.thumb.jpg.4fc260d4ba34

 

These are not practical examples but demonstrate the possibilities. As you can see, there are various outcomes depending upon the Execution and the Order of Evaluation. This is why these guys have warned you about using them.

See if this understanding helps you to find your issue. If not then please explain what is 'going wrong'.

Τhank you for your answer! To be honest, I got confused !

Regarding the first  picture :

1)       the rungs of the first picture seem to me very strange. I mean I would never put the open |  | and closed contact |/| of the same bit (CF113) connected to the same coil (W1.00). Is this an alternative way instead of using set/reset?

 

2)      I cannot understand why the second rung determines the state of the coil. For instance, in the very first example#1 in your picture ,considering that the plc starts ‘reading’ from the top rung to the bottom, the W1.00 should be activated (because it is connected with an open contact and it is the first rung) and stay activated for ever given that we have an always on contact.

Share this post


Link to post
Share on other sites
2 hours ago, Katerina said:

Τhank you for your answer! To be honest, I got confused !

 

Regarding the first  picture :

1)       the rungs of the first picture seem to me very strange. I mean I would never put the open |  | and closed contact |/| of the same bit (CF113) connected to the same coil (W1.00). Is this an alternative way instead of using set/reset?

 

No. You would not program like this and it is not an alternative to the SET / RSET. It's simply to demonstrate the state of the outputs under duplicate situations and to show how it differs from using the SET / RSET.

 

2 hours ago, Katerina said:

2)      I cannot understand why the second rung determines the state of the coil. For instance, in the very first example#1 in your picture ,considering that the plc starts ‘reading’ from the top rung to the bottom, the W1.00 should be activated (because it is connected with an open contact and it is the first rung) and stay activated for ever given that we have an always on contact.

 

 

This is how coils (OUT) are different from SET / RSET. Coils are always evaluated as either ON or OFF. Only the last evaluation of a coil will determine it's state.

I hope this makes better sense although this is not an issue with the problem you are experiencing. My reply was to explain why CX Programmer returns "Duplicated Output" warnings.

Can you take a snapshot of your SET / RSET problem in simulation and post it here?

Share this post


Link to post
Share on other sites
Just now, IO_Rack said:

No. You would not program like this and it is not an alternative to the SET / RSET. It's simply to demonstrate the state of the outputs under duplicate situations and to show how it differs from using the SET / RSET.

 

This is how coils (OUT) are different from SET / RSET. Coils are always evaluated as either ON or OFF. Only the last evaluation of a coil will determine it's state.

I hope this makes better sense although this is not an issue with the problem you are experiencing. My reply was to explain why CX Programmer returns "Duplicated Output" warnings.

Can you take a snapshot of your SET / RSET problem in simulation and post it here?

Well..after some changes I made, it seems to work ok (so far)!

I did the simulation using force on/off very carefully keeping track of the outputs. I hope this is enough!

Now I am thinking of another issue that has to do with communication of the program I have made with other plcs. Ι have posted it in another topic of this site regarding robots.

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now