Tank filling is a good example of sleep mode.
Often you want to fill a tank, but then let it draw down to some level before refilling.
That way the motor is only running small portion of the time which saves you money on power bills
and wear and tear on your machine. We’ll do the tank filling example,
so we can re-purpose the hardware we used in the Quick Start videos.
This is the system we used in those videos. The only differences are: we’ll turn the valves off
and just use this pipe to fill the tank. We don’t need a pressure sensor. Instead, we’ll
use an ultrasonic sensor to detect the water level. The ultrasonic sensor uses a different
pin for the signal, so I had to swap signal wires at the drive. And, the ultrasonic sensor is a
4-20 mA sensor while the pressure sensor was a zero to 10-volt sensor. So, I had to flip this little
switch on the I/O module to current and change Parameter 233 which we’ll cover in a minute.
Here’s the actual hardware. This WEG CFW500 drive controls this motor which pumps the water into
the tank via this pipe. These valves are closed and this one is opened so water flows like this.
I’ll block out the valves and pressure sensor to remind us we aren’t using them. There’s a manual
valve on the outlet so we can change the load by changing how fast the water leaves the tank.
I also added a styrofoam disk with LEDs on it to make it easier for you to see the water level
and I just mounted the ultrasonic sensor on a board that I laid across the top of the tank,
so it could look down and see the styrofoam LED disc floating on top of the water. I configured
the ultrasonic sensor to give me a large reading up here and a small reading down here, so we can
measure how full the tank is - zero percent full or 100% full, for example. We’re using the same
switches as in the previous videos and we’ll use the remote HMI again because it does a better job
of showing us the things we need to see. I’ll re-arrange the screen to make it
easier for you to see the drive's HMI, control switches, and tank.
This is the PID configuration we used in the CFW500’s Soft PLC Internal PID video.
We’ll use that version of PID because I just finished that video and everything is still set up
and I like the way the Soft PLC version shows all the information on the remote HMI.
Everything we do here will apply directly to the drive’s built-in PID,
you just use different parameter numbers. I’ll give you a cross-reference list at the end of this
video that shows you how to convert everything we do here to the drive’s built-in PID.
We only need to change a couple things. Parameter 233 needs to be changed to 4
to 20 milli-amps to match the ultrasonic sensor. Since we’ll be measuring the fill
level of a tank in percent we need to change our PID units to percent in Parameter 510.
PV min and PV max need to be zero to 100%. I also modified the PID coefficients for tank
filling – I’ll explain why and how I did that at the end of this video for anyone that’s curious.
Let’s highlight everything we changed in red to make it easier for you to see the differences.
I put the sleep mode related parameters down here. We need to make sure sleep
mode units in Parameter 516 is set to Hz or RPM, you can’t use anything else.
We’ll use RPM. And Parameter 517 has to be set to zero decimal places when using RPM units. If you
use hertz, you have to use a single decimal place. One side note - this is the firmware version of the
drive I am using. In that version, even though you set Parameter 517 to zero decimal places,
the display shows Parameter 1028 as having 1 decimal place. So this is really 1500, not 150,
for example. That will probably be fixed by the time you see this video – WEG is very responsive
to things like this – but just beware if you have an older firmware version like I do.
To enable sleep mode, we need to put a motor speed here.
Let’s say we want to fill the tank to this level. That’s our set point. When PID sees the water is
way down here, we get a large difference between where we want to be and where the water is.
That is, we get a large difference between the desired set point and the process variable. PID
responds by going to the max motor speed. As the water level rises and gets close to the set point,
PID backs off on the motor speed all the way to whatever speed is required to maintain this level.
That speed will change depending on how fast water is being pulled from the tank.
In tank filling applications like this, most of the time we don’t want to maintain the water
level. Instead, we want to turn the motor off and let the tank drain down to some lower level
where it turns the motor back on to refill the tank. That way the motor is only used to
fill the tank and isn’t burning energy trying to maintain the tank level, especially if it
is running at low speeds where the pump gets real inefficient or even cavitates and stops pumping.
So all we have to do is tell PID when the motor speed drops to some minimum level, to turn itself
off. And when there is a large enough difference between here and here, turn it back on.
We know from the previous video that this pump stops pumping water at around 18 Hz or around 1000
RPM, so let’s set our min speed at 1500 RPM so we are well above the point where the pump becomes
inefficient. Let’s fill the tank to 75% full. That will be our set point, so we enter that here.
So when PID gets the tank near this level and the motor slows down to the point that it starts to get
inefficient, sleep mode will turn the motor off. Let’s have the level drop 50% before the motor
turns back on. So when sleep mode sees the water level drop 50% below the set point it should turn
the motor back on so that’s what we put here. This is really important to remember:
Sleep mode doesn’t monitor these absolute levels. It monitors the motor speed up here to decide
when to turn the motor off, and it looks for the relative difference between these two to decide
when to turn the motor back on. Why not just monitor the absolute levels? Well, if you have
a high-demand situation that will drain the tank quickly, this allows PID to keep the motor running
to service that high demand. Otherwise, the motor will be cycling on and off quickly to try and keep
up with the demand which can end up costing you more wear and tear on the system and more power.
This method gives you the flexibility to manage how PID uses your system.
And the lower level being relative to the the set point means when you change the set point,
the lower level changes with it – you don’t have to change that too!
The delay times allow you to add hysteresis if you have a messy process and don’t want
intermittent waves or splashes or bubbles to trigger sleep mode. We don’t really have a
need for delays in this video so we’ll make both of those one second just so we can see
how it works without extending the video too much. So, all we did was change a couple things up here
and add the four sleep mode parameters. Not bad at all.
I already entered those parameters into the drive - we see our 75% full set point here,
for example. And let’s turn the water level LEDs on to make it easier to see the water level.
In the SoftPLC Internal PID video we found that these were labeled for the drive’s built-in PID
and that the SoftPLC’s version we are using uses the opposite contact state.
I’ll mark them like this to remind us of that. Let’s switch to auto mode … and switch to Run.
PID sees a big difference here – bigger than the 50% we asked for – so it starts
to automatically fill the tank. We see the water level LEDs rise and the actual sensor
feedback over here on the HMI display. Notice on this initial fill the output
current is going a little nuts and if you listen to the audio you can hear the system oscillating.
That’s caused by the PID coefficients we are using. We’ll take a closer look
at why that’s happening at the end of the video. Remember, sleep mode isn’t watching this level,
it’s watching the motor speed and is waiting for it to drop to the 1500 RPM we entered.
And you can see as the water level approaches the 75% set point,
PID starts to slow the motor down. When the motor speed gets down to the 1500 RPM it waits 1 second
and then puts PID to sleep which stops the motor. We get this alarm message telling us sleep mode is
active. That alarm is important because sleep mode can re-engage PID at any time without warning.
I’ll open the tank's drain valve to give us a medium load. The water level drops. That’ll take
a couple minutes so I’ll fast-forward the video so we don’t have to wait.
And when it drops 50% below the set point, sleep mode waits for the one-second delay we gave it,
clears the alarm, and then enables PID which cranks up the motor speed
to the max to try and overcome the huge difference. We see the tank filling.
OK, the water level is getting close and we see PID starting to back off on the motor speed.
When the motor speed hits 1500 RPM, sleep mode waits the one-second delay we asked for
and then disables PID. And we get the sleep mode alarm again.
I’ll fast forward through a few cycles so you can see it do its thing
So how cool is that? The drive is automatically filling the tank for us without the need for an
external PLC to monitor the process and enable or disable the drive. Which saves you time, effort,
and panel real estate. Sleep mode allows the drive to do it by itself for Free. And all we had to do
was change a couple PID parameters and enter the 4 new parameters for sleep mode. Not bad at all.
And if we use the drive’s built-in PID function – not the SoftPLC’s Internal PID we are using
here - we can free up the drive’s SoftPLC. To do that, just switch to the drive’s built-in
PID – this video shows how to set that up - and use the drive’s sleep mode parameters instead of
the SoftPLC’s sleep mode parameters. Other than that, it works exactly the same way.
That should be enough to get you started with sleep mode.
If you want to know why I chose the PID coefficient parameters we used here,
then this section is for you. Tank filling is a different kind of PID process.
When you’re trying to maintain something like the pressure in a system for example,
eventually, the pressure levels off for a given motor speed.
If you increase the motor speed, the pressure increases, and levels off someplace else.
In tank filling, the tank just keeps filling. It doesn’t reach some level and stop.
And increasing the motor speed just fills it faster – again never leveling off.
Tank filling is called an Integrating PID Process and needs to be tuned differently.
If you want to learn more about that, then check out this series of videos on the GS4 family of
drives. It’s a different drive family but the methods used to tune the tank filling PID loop
apply exactly the same way to any drive. For this video, I just went to the table
in the user manual with recommended PID coefficients for different types of applications
and I saw that for level filling PID, there’s a special note which says for forward or
direct-acting systems, measure the fastest time it takes to fill the tank – for this demo
that would be from 25 to 75% with the output valve closed – and divide 0.5 by that time.
When I tried that, PID stopped filling way below the 75% I wanted. It would have gotten
there eventually, but when the motor speed fell below the 1500 RPM we set to protect the pump,
sleep mode put the system to sleep. Again, sleep mode doesn’t care about the tank level,
it only cares about the motor speed. So I kept increasing the I coefficient until
I got close to 75% fill level. And that’s how I came up with the .08 coefficient we used here.
But, remember when we first started filling the tank at the beginning of the video?
The output current went a little crazy and we could hear the system oscillating? What happened?
Well, when a tank filling operation oscillates like that it means the I coefficient is too large.
Remember, we set the I coefficient to get the tank from 25% to 75%. But when we first started
out, we had a larger distance to go, which takes more time. And according to our formula, we needed
a smaller I coefficient. But because I knew that most of the time I would be filling from 25% to 75%
I left the I coefficient at the aggressive value, which was also the value that got me to 75%.
Let’s try that. I’ll double the I coefficient and save it. Fast forward through the rest of
the cycle. This time when the tank fills you can see the current going
nuts after the I term has integrated up and you can hear the system oscillating.
And if we wait for it - yep, the tank filled PAST the 75% value – another indication that I was too big.
Why did it do that? Well, PID was too aggressive so the level was going to overshoot. And when
PID slowed the motor down to compensate, sleep mode saw the motor speed drop below the 1500 RPM
and put the system to sleep. Again, sleep mode monitors the motor speed, not the tank level.
Let’s do the other extreme. While the tank is draining, let’s cut the original .08 value for
the I coefficient in half to 0.04. Save it and I’ll fast forward through the cycle. The system
didn’t oscillate, but it also doesn’t reach the 75% fill mark before going to sleep. Again, that
tells us that I was too small. It would have gotten to 75% eventually, but because sleep mode is watching
the speed of the motor and PID slowed the motor to below the 1500 RPM we set to protect the pump,
sleep mode put the system to sleep. Hopefully, that will give you some insight
on how to set up the I coefficient of the PID algorithm when doing a tank filling application.
Click here to learn more about the CFW 500 family of variable frequency drives.
Click here to learn about AutomationDirect’s free award-winning support options and click
here to subscribe to our YouTube channel so you will be notified when we publish new videos.