Learn how to use the PID Process Simulator built into the Free Do-more Designer software. This is a great way to set up and test your PID tuning without taking your system offline and also a great way to learn about PID. We'll show you from beginning to end how to get the most out of this really cool feature!
Download support materials mentioned in the video here: https://library.automationdirect.com/?p=11129
To see the other videos in this series:
PID Overview Part 1:
PID Overview PArt 2: Hardware
PID AutoTune Part A
PID Autotune Part B
Do-more PID Tuning Simulator Part A
Do-more PID Tuning Simulator Part B
PID Manual Tuning Part A
PID Manual Tuning Part B
PID With Ramp Soak
PID Loose Ends
In this video, we want to replace all of this process hardware stuff that we used in the previous videos with a software process simulation, so we can test our system and experiment with PID on the Do-more PLC simulator and not have to take our real system offline or worry about the possibly damaging our hardware while we develop and test our code. The PID instruction outputs 0 to 100%. The PLC simulator has 12-bit analog I/O, so unlike the previous video, we will need output scaling. The process simulation expects that on analog output WY0. The process simulation is just a first order filter with a delay. That is, it takes any change, delays it, rounds it off and sends it back out. Which if you think about it, describes most processes you’ll encounter. In fact, it looks just like the heater curves we had in the previous video, doesn’t it? We’ll see you how to configure the process simulator in just a minute. The process simulator sends the result back in on analog input WX0 as our Process Variable and that will appear as a 12-bit number on this PLC Simulator. We want to scale that to degrees Fahrenheit so we can enter degrees Fahrenheit as our setpoint, but how do we know what values to put here so this will match our hardware? Well, guess what? We already have that answer. Remember this graph we created in the previous video? With the heater power off, the box stayed at room temperature. Heater power at 25%, the box rose to this temperature. 50%, this temperature. 75 power got the box to this temperature and 100% heater power got the box to this temperature. Well, that’s it. Zero to 100% heater power scales to 72.3 to 160.1 degrees F. That’s our scaling. Which means, this 0-4095 scales to 72.3 to 160.1 degrees. Now we can manually enter our setpoint in degrees Fahrenheit and everything will work. So … we only have two things to do. Add a PID instruction, paying special attention to the scaling in that instruction, and configure and enable the process simulation. Let’s do it! To configure our process simulator, we need to know two things about the system we want to emulate, the dead time and the time constant. To get those, bring your system up to its operating level. I got our system up to the 110 degrees we have been shooting for and started recording the trace. Wait a little bit to capture some of that steady state data, and then you want to bump the PID output a few percent. I increased our output 5% just so it would be easier for us to see. Anything that gets your system to react a little is fine. We can see the temperature starting to rise. We want to let that run for however long it takes to get to a new stable value. I’m going to let ours run for an hour or two which is overkill, but it will let us see what the long term stability of our system is. Ok, about 2 hours have passed. I’ll hit the history button and we see that we are missing some of the blue process variable data. That’s because the display buffers aren’t large enough. This data is noisy, so it takes a lot of data points to capture that. The white setpoint and green output don’t change at all so their respective buffers didn’t run out. We right click, go to options and make the buffer larger it we want to, but since we were recording all of this trend data, all we have to do is stop the recording and save the data as either an csv file for spreadsheets or a trend archive. I’ll save both. If I bring up a new instance of Do-more Designer, I can import that trend simply by opening the file. Let’s zoom in so we can see this better. Right click, trend view options, and modify the time and vertical axis. We see our green output trace went up 5 percent as we requested, and the blue process variable rose from 110.5 degrees – I’m reading the cursor values down here - and would have settled out at around 115 degrees. These variations look rough but it’s really only plus or minus a degree. I’ll going to use this slide to zoom the time scale even more so we can measure the time constant which is the difference between when the process variable started to change and when it reaches 63 percent of its final value. That’s about here, so our time constant is this. If we zoom in even more, we see the output changed here, but the process variable didn’t really start to change until here. That’s the dead time Did we really have to do all of this measuring stuff to use the process simulator? No! We could have simply guessed what the dead time and time constant were and probably have gotten pretty close. So if you want to get up and running quickly, guess. If you want an accurate simulation – then measure. Great, now that we have our system dead time and time constant, we can finally set up our simulation. I created a new offline project and I’ll connect that to the simulated PLC. And remember, we only need to do two things: add a PID instruction and set up the process simulator. Here we go. Step 1: Add a PID instruction. Give it a structure name. All these default values are fine. We just need to do the scaling. We said the process variable is coming from analog input WX0 which is 12 bits and that we need to scale it from this to this. Make sure you enter these as REAL numbers with a decimal point. If you don’t add the decimal the Do-more engine will assume you wanted integer calculations which will change the scaled values from smooth plots to discrete stair steps and mess everything thing up. Let’s add our units label. And the output needs to scale back to the 12-bit 4095 number and go to analog output WY0. Done. And yes, we do want Do-more Designer to create that new OvenSim structure for us. I’m gonna force the PID instruction to be in auto mode at all times, just so I can show how to use the override feature in the PID view window. Let’s put the PLC in terminal mode so we can write the program to it and accept and write it out. Now that we are connected to the simulated PLC with an active PID instruction, we can bring up the PID view utility. I love this thing because it lets me control and view everything I need to know about PID in one place. When we tell the PLC to RUN, everything gets updated. Note that the default PID constants are all zero, so while PID is enabled, it isn’t actually doing anything. Let’s override the PID instruction and give ourselves manual control of the PID output. That does the same thing as turning this rung off. It doesn’t disable the instruction – it’s still running – it just gives US manual control of the output. Because we are in manual mode, this output box is now active, so we can manually enter the PID output values to drive the process. What process? We’ll we haven’t set that up yet have we? If we bring up the simulated PLC and click on “Sim,” we can set up the process simulator. All we have to do is enter our dead time and time constant. We can add noise if we want to – we’ll skip that for now, and we need to enable the process simulator. Hit update and we are good to go. The process simulation is now running. In the next video, we’ll run an Auto-Tune on our new simulated process and then we’ll run some live examples to see how well it works. Mostly though, we’ll see what a fantastic tool this is for getting comfortable with PID. Why? Because it allows you to try things you wouldn’t normally be able to do on your real system because it would take the system offline too long or be too expensive or possibly even too dangerous. Or maybe you don’t have access to the hardware. All those issues go away when you are running PID in a simulated environment. Click here to see all the videos in this play list. Click here to learn more about our award winning Free tech support options. And click here to subscribe to our YouTube channel so you will be notified when we publish new videos.