Jump to content

Recommended Posts

Correct me if I'm wrong:

When bit goes from 0 to 1. In the next scan all -P- contacts for that bit go high for that scan. Similar with negative transition.

What happens if bit restarts during the scan when -P- contacts are high? Do they go down after net where bit was restarted or do they stay high during the whole scan?

Share this post


Link to post
Share on other sites

This question is unclear. Can you restate it?

I will say that something strange happens if a positive transition contact initiates an HMI call and then later in the same cycle if there is another use of the -P- it is ignored! As follows:

1) MB 0 goes high, MB 1 = zero

2) -P- of MB 0 SETS MB 1

3) -P- of MB 0 calls HMI screen (from ladder)

In this scenario, MB 1 will be SET and HMI screen gets called.

But reverse rungs 2 & 3, and the HMI screen gets called, but MB 1 remains zero. Why is that?

Share this post


Link to post
Share on other sites

I have to troubleshoot one program that ended up overbloated and probably far more complex than needed to be because of a lot of crucial changes and irrational functions that I was requested to make. I would like to rewrite it, but unfortunately there's not much room for experimenting at this time.

This is what's problematic in net 23:

Sequence goes like this:
1 - ML0 register is restarted (goes to 0) (also ML0 is linked to high speed input)
2 - 0.4 seconds delay
3 - MB 9 is set, MB101 is set
4 - Net 23 doesn't change value of ML13 (problem)

After manually changing value of ML13 in info mode it all works fine from that point on, PLC goes through that line of code as expected, it only stutters for the first time. These two registers aren't used much in other parts of program so that they could get overwritten somewhere in the process.

There are a lot of transition contacts in program and couple of strange bugs that happen "sometimes". Program wouldn't even work until I broke big nets into more simple ones (I learned that this is good practice the hard way). Your example does show that there's something strange with using transition contacts, it also gave me an idea to try.


I would like to better understand how PLC treats transition contacts. I assume it goes like this:
- SCAN 1 - MB0 is set
- SCAN 2 - MB0 transition contacts go high
- SCAN 3 - MB0 transition contacts go low
I assume it works like that because transitions can be used in net 1, and SET/RESET coil can be in net 20, for example. I don't have any Vision I could test this on at the moment.

I'll get around this problem, I am more interested in learning about this strange behavior and why big nets don't work as expected.

Share this post


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

why big nets don't work as expected

What is the answer to this math problem: 7-1x0+3/3=?

If you understand the PEMDAS rule you will get the correct answer of 8. However, if you just run the operations from left to right, you'll get 1. Every ladder rung in your program must be compiled to machine language before the PLC can execute the code. Do you know all the rules the compiler will use when you have a very large net? I certainly don't. Remember, like all computers, the PLC can only do one thing at a time and a large net can provide ambiguity (to humans) so the result can sometimes be unpredictable. To avoid this potential problem, always make your nets reasonably simple and break them into functional parts. It's also easier to troubleshoot and for another programmer to understand what you're doing.

  • Upvote 3

Share this post


Link to post
Share on other sites

Big nets

Review the STL code  for the net and often the STL sets itself up a bit different than the way you think in the net.

I have seen this.

 Sometimes re-writing the net helps,

 but, breaking the net up into smaller nets  removes the problem and the logic comes through  cleaner and  clearer

Share this post


Link to post
Share on other sites

Hi Isakovic,

I hope you are working with Vision PLC, as your post is in "Vision PLC series and VisiLogic" .

May be I lost where you posted project file, but virtual explanation will not always helps.

Post your project and we will have full picture.

1. Large/complicated Nets, or use number of rungs in one Net.

In most of cases this will lead to problems, and you cannot find where the problem starts.

Just split rungs and complicated Nets.

2.Calls to subroutines, or jumps, from complicated nets.

In most of cases leads to problems.

3.Transition contacts.

If you have the same transition contacts - replace all by one regular coil, which will be activated by one transition contact.

Many other things will be involved.

You say "There are a lot of transition contacts in program and couple of strange bugs that happen "sometimes". Program wouldn't even work until I broke big nets into more simple ones (I learned that this is good practice the hard way). Your example does show that there's something strange with using transition contacts, it also gave me an idea to try. "

Analyse STL, as DanT recommended, will show you how really Ladder compiled to code.

If you post your project as-is, it will be simplest to show you where potential errors may happen.

 

Share this post


Link to post
Share on other sites

Hi Alex,

Thanks for the suggestions. Yes, I am using a  Vison controller. There's this thread I found that deals with what goes "behind" ladder when using transitions, that I think answers my original question:

I'll get my hands on a new controller in a couple of days and experiment to get it clear in my head just when -P- and -N- go high and when they go low.

17 hours ago, AlexUT said:

If you have the same transition contacts - replace all by one regular coil, which will be activated by one transition contact.

I saw this in the manual also, might be a smart thing to do when you are forced to use a lot of transitions.

Share this post


Link to post
Share on other sites

Hi all,

I've been intrigued with this topic, as it covers ground I've had issues with now and then.  I always break nets up  more than probably necessary. But it does enable clearer understanding of flow when I revisit something.

 But Alex, you are essentially saying that if you have a host of transitional contact(s) usage in a program, put them in the very first nets running MBs.  And then use the MBs instead.  This is shown in the help files as a means to reduce the amount of execution time/usage, but nowhere does it actually recommend this as the method to ensure correct operation throughout the scan.  There is a difference and I think it should be made clear.

cheers,

Aus

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

×
http:///