SPLat Logo

PID characterization: Interfacing to the SPLat

NOTICE: Our web site is being updated, but is currently experiencing extreme slowness due to host issues. Please contact us directly.
NOTICE: SPLat Controls has moved. We are now at 1/85 Brunel Rd, Seaford, 3198. map

PID characterization: Interfacing to the SPLat

You will need to interface your process to the SPLat. That means driving the process's control input from an output of the SPLat, and getting feedback from the process input back into the SPLat.

The SPLat output you use may or may not be an analog output. With my contraption I used a digital output. I programmed the SPLat to vary the average power by duty cycle switching the power to the resistor, just like the "simmerstats" used on some electric stoves. I used some code that would turn the output on for 'n' out of every 256 10mS intervals, giving a cycle time of 2.56 seconds (way short enough for the contraption's dominant time constant of around 10 minutes).

I have provided you a choice of output resolutions: Infinite, 8-bit and 1-bit. 1-bit, seemingly an impossibly low resolution, is actually one of the most common and effective control modes, applied in refrigeration and a host of other applications. It is commonly called 'bang-bang' control (bang, it goes full on, bang, it goes full off!). 1-bit resolution can work quite well on things like heaters, where the target process has a long dominant time constant.

Adding noise or a periodic waveform - sometimes referred to as 'dither' - to the continuous controller output before it's chopped back to 1 bit by a comparator can create a degree of continuous control action referred to as 'duty cycle control'. However this technique should only be used if the output device can be switched on and off very frequently without adverse impact - you definitely wouldn't use it on a compressor motor. Natural measurement noise alone may sometimes be enough to provide a degree of duty cycle control. The control processor has to operate at a reasonably high sampling rate for this control mode to function well. If it is working well it can combine the benefits of good steadiness of the controlled variable close to setpoint, and rapid application of full control effort if the error increases.

Duty cycle control can be simulated with PIDAssist.

Of course, with bang-bang control there's always a small amount of cycling in the controlled variable as the controller switches the forcing function on and off. However, as long as the process has a reasonably long time constant, the residual variation can be quite acceptable. Of more concern sometimes are the full range swings in the forcing function, eg. surges in an electrical supply as a motor is turned on and off. Avoiding these step disturbances can be one advantage in going to fully continuous control (such as the growing use of variable speed drives for air conditioning compressors).

The SPLat input will probably be an analog input. I used a thermistor to sense temperature. What you use is up to you and your process. It may be a pressure sensor or a flow meter. In the latter instance it may be a pulse type, so you would use a counting digital input.

There are three major tasks in interfacing your process to the SPLat board for open loop characterization:

  1. Making the electrical interface.
  2. Making the programming (SPLatWare) interface.
  3. Get the logging working

Making the electrical interface

For the electrical interface you need an output from the SPLat that can control the process, and an output from the process back into a SPLat input. With my contraption the output was a simple digital output driving the heater/resistor, and the input was an analog input connected to a thermistor. You may have some other arrangement. If you have a custom SPLat you may have a customised interface, say a high current PWM output for driving a proportional hydraulic valve.

Making the SPLatWare interface

There is a SPLat program called OPENLOOP.SPT in the folder "/SPLat Programs" under PIDassist. That program is a template for you to use to create a simple open loop control and data logging function. Now is the time to look at OPENLOOP.SPT.

The program contains 4 places where you must insert code and one place where it is optional.

OPENLOOP.SPT interfaces to PIDassist using the SPLatLink protocol. With SPLatLink certain RAM locations within the SPLat are accessed by PIDassist. The addresses of those locations are "hardwired" in PID assist, so don't try changing them in the SPLat program.

OPENLOOP.SPT is a template for a scheme whereby the process drive is set from the MMi200 front panel. You can also set it from the SetPoint control in PIDassist. If you chose to do that, the setpoint value will appear as a floating point number at RAM address 40 (SP).

In data logging mode PIDassist monitors SPLat RAM location 49, which is called CalcFlag. Each time it changes PIDassist reads out the number in location 50, PIDin, and saves it to the log file. (it also logs address 51, PIDout, but it is not used at this stage). Because it is changes in CalcFlag that determine the logging frequency, the SPLat program is in control of timing. If you study OPENLOOP.SPT you will see that it uses timer 0 to increment CalcFlag once per second. You can change the logging frequency to slower rates, if that suits your application, but 1 reading per second is about as fast as it can go. If your process has a dominant time constant less than say 30 seconds you will have to devise your own method of gathering response data.

Get the logging working

I suggest you make a version of OPENLOOP.SPT where the drive level you set is stored in PIDin, and practice logging on that (i.e. before hooking up to your process).

  1. Connect the SPLat to your computer and launch PIDassist.
  2. Select the "All in SPLat" mode.
  3. Ensure that PIDassist connects by observing the connection status panel. (Hint, if it fails, make sure SPLat/PC is not connected. Exit SPLat/PC if necessary, some versions don't release the COM port)
  4. Set the horizontal display rate (Horiz. S/div) to a fast rate.
  5. Select a log file (.csv) from the file menu (or just use the default)
  6. Enable "Log to file". The green "LED" in the display control pane should start blinking at the logging rate (once per second if you leave my default).
  7. Change the drive level on the SPLat controller. The green trace should change. Leave it for a short while to get some data on disk.
  8. Use Explorer to find the log file and double-click it. Assuming you have Excel installed it will launch and show your data.
  9. Highlight the data and make a line chart. You should see the changes you made to the drive setting.
  10. Go back to PIDassist and observe the error message. What happens is that Excel locks out the file, when it is loaded, and so PIDassist is denied access. If you want to preview a log file make a copy of it in Explorer and view the copy.

It pays to get the logging procedure down pat before you start in on your real process.