Nancygogogo

AB ML1100 Set a timer after the "less than" is true for 5 seconds

15 posts in this topic

Hi everyone,

I have a question on the ML1100 PLC. So in my program, I would like to set an alarm for low-level liquid. Since the data I got from the sensor are not stable,  I want to set a timer, such as when the level is less than 20% for continuously 5sec, it will turn on the alarm. I have a "less than" function, but I don't know which function I can use for the timer. The lung below does not work. Can anyone help and give some advice.

Thank you very much.

plc timer.png

Share this post


Link to post
Share on other sites

I would make sure timer T4:2 isn't used somewhere else in the program.

Put a jumper around the LEQ and make sure the timer times.

Check to make sure you are calling that routine.

Check to make sure there aren't any MCR rungs or jmp commands in that routine causing the code to be skipped over.

Share this post


Link to post
Share on other sites

Posted (edited)

On 3/3/2018 at 4:18 PM, Armadillo852 said:

I would make sure timer T4:2 isn't used somewhere else in the program.

Put a jumper around the LEQ and make sure the timer times.

Check to make sure you are calling that routine.

Check to make sure there aren't any MCR rungs or jmp commands in that routine causing the code to be skipped over.

1
1

The thing I am thinking is for the timer I use right now probably cannot meet my requirement. I am not quite sure. What I want is when the liquid level below 20%, the timer is on, if the timer could count from 5 down to 0, then hit the alarm, if not, then just wait for the liquid level below 20% for continuously 5sec. (Cause the input address is an analog input, not stable, the number will jump around 20% which make alarm sounds wield) Do you think the "Time on Delay" function can meet this, or there's any other function I can use? Please advise. Thank you.

I am sure that I did not use T4:2 anywhere else. And there is no MCR and JMP so far.

Edited by Nancygogogo

Share this post


Link to post
Share on other sites

So the timer does time, but the signal still bounces?  Are you saying that the signal will never be under 20% for 5 seconds due to noise or some other factor?  The logic you have shown should be timing given what you have in the pic.  Does it time if N7:0 is set to 20?  Have you tried as Armadillo mentioned jumpering around the leq instruction?  That would eliminate other issues as he mentioned if the timer starts timing.  If not then the problem is with duplicate timers or other issues he mentions.

If your signal is jumping to the point that it will not stay below 20 for 5 seconds then you could use two different values for hysteresis.  Say go below 20 to start the timer and go above 25 for it to stop.  Or maybe something needs to be done to fix a noise problem?  I think we need more info on this.

Share this post


Link to post
Share on other sites
On 3/3/2018 at 9:11 PM, PLCMentor.com said:

So the timer does time, but the signal still bounces?  Are you saying that the signal will never be under 20% for 5 seconds due to noise or some other factor?  The logic you have shown should be timing given what you have in the pic.  Does it time if N7:0 is set to 20?  Have you tried as Armadillo mentioned jumpering around the leq instruction?  That would eliminate other issues as he mentioned if the timer starts timing.  If not then the problem is with duplicate timers or other issues he mentions.

If your signal is jumping to the point that it will not stay below 20 for 5 seconds then you could use two different values for hysteresis.  Say go below 20 to start the timer and go above 25 for it to stop.  Or maybe something needs to be done to fix a noise problem?  I think we need more info on this.

1

Hi, thank you so much for the reply. The timer shows above, I think it looks like a right logic, but probably not. The signal will be under 20%, however, there are always too many noises. The logic right now is, there is a user input at N7:0 (as you say) when the liquid level is below the user input number, the alarm will be turned on. Since the signal is not stable at all (all the time), so if the user input is 20 without the timer, the buzzer will be turned on, and make the sounds immediately. For example, the reading (ex.1) from the sensor is 23, 22, 23, 25, 20, 23, 22... what I would like to achieve is, at the ex.1 situation, the alarm will not be turned on. At ex. 2, it will be turned on. Ex. 2, reading is, 22, 21, 20, 18, 19, 20, 20, 19, 19, 18, 17...(under 20 for like 5 seconds. If the reading back to larger than 20, the timer will be reset, until the reading keep staying under 20 for 5sec.) 

I was wondering if "Time on Delay" function is the right one for my purpose. What I am thinking for this function is once there is a reading is 20, the timer will start counting. Does this explanation make sense to you? I can provide more information if you want. Please advice, thank you very much.

Share this post


Link to post
Share on other sites

Posted (edited)

Your logic should work. Why is this a user input?

I agree with PLCMentor though, I would use a deadband logic. It does not have to be on at 20 off at 25 maybe on at 18 off at 22 your system will dictate the settings.

As others have pointed out why not correct the noise issue, or apply a filter (see txt)

Filtering.txt

Edited by Mickey

Share this post


Link to post
Share on other sites

Yeah I guess part of the problem is that none of us can figure out why the logic you have shown would not do what you say you need.  If what you shown is not working then you need to take a another look at armadillo's post.  Maybe you have used the timer somewhere else in your logic? 

In addition to the deadband you can also just latch in or better yet seal in your alarm output once it trips.  Reset it with an alarm acknowledge button or something.  Also your logic shown does not compare the float with 20 it compares with the value in N7:2 which is shown on your pic to be 0.

Share this post


Link to post
Share on other sites

The LEQ compare statement compares a Float to an Integer; try to compare similar-type elements.  In your pic, the timer should be timing as 0.0 <= 0, but their elements are not the same type.

Try using both integer variables in the LEQ compare statement.

1 person likes this

Share this post


Link to post
Share on other sites

Good catch, Kaiser_will. Rounding floats to integers doesn't always work as we expect.

 

Share this post


Link to post
Share on other sites

Posted (edited)

6 hours ago, kaiser_will said:

The LEQ compare statement compares a Float to an Integer; try to compare similar-type elements.  In your pic, the timer should be timing as 0.0 <= 0, but their elements are not the same type.

Try using both integer variables in the LEQ compare statement.

I am using the floating number is because the output of the filter  I use for the analog input is a floating number.

Filtering.txt

Edited by Nancygogogo

Share this post


Link to post
Share on other sites

Hi everyone, thank you so much for your answers, I got it!!!!!! I change the user input to an integer number and it works as expected. Then I reset the address for the user input and it works as well. I think there might be some problems with the address before... Thank you for all your help.

 

1 person likes this

Share this post


Link to post
Share on other sites
20 hours ago, Mickey said:

Your logic should work. Why is this a user input?

I agree with PLCMentor though, I would use a deadband logic. It does not have to be on at 20 off at 25 maybe on at 18 off at 22 your system will dictate the settings.

As others have pointed out why not correct the noise issue, or apply a filter (see txt)

Filtering.txt

Hi Mickey, I did use the same filter equation as yours, and I use 0.1 for the constant, but the output still not stable, as it said in the attached. The smaller the number the more damping. Ohhhh, so probably I can use 0.0001 as my constant? Cause before I thought 0.1 is the smallest number I could use....

Share this post


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

Hi Mickey, I did use the same filter equation as yours, and I use 0.1 for the constant, but the output still not stable, as it said in the attached. The smaller the number the more damping. Ohhhh, so probably I can use 0.0001 as my constant? Cause before I thought 0.1 is the smallest number I could use....

You can, but that is a lot of damping.

Just play until it helps.

Share this post


Link to post
Share on other sites
4 hours ago, Mickey said:

You can, but that is a lot of damping.

Just play until it helps.

 

Awesome~ Thanks, I got the number I want!!!

Share this post


Link to post
Share on other sites
3 hours ago, Nancygogogo said:

Awesome~ Thanks, I got the number I want!!!

You're welcome

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