Who Else Wants to Learn About On Off and PID Control?

Process control can be a bit intimidating. We will try and break down both On/Off and PID control in a fun way. This is a simple analogy without any math.

On/Off control can be used effectively with temperature control. Everyone’s house usually has a temperature controller that uses an On/Off control. When the temperature is below the set value (SV) the output switches on. The output will remain on heating the house until the present value (PV) is above the set value. At this point the output will then go off. The house will constantly be doing this in a cyclic way. This means that the temperature of the house will vary a few degrees.

We can plot this out like the sign wave above. The set point is at the middle. By the time the output is turned off the thermo mass continues to heat the house, before starting to cool down. The same is true when the output is turned back on. It will cool down a little more then start to heat up again. This is called hunting. We can not get exactly on the set point value and stay there.

Lets look at another way to explain:

You are in a car and can only use full gas or full brake. Racing toward the stop sign at full gas, you use full brake at the stop sign line. Naturally you go passed the stop sign and eventually come to a full stop. Putting the car in reverse, you again use full gas back toward the stop sign line. When you hit the line you apply full brake. Missing the mark again.  This is like On/Off control action.

If we wanted to control the method a little closer then we could program in a hysteresis. (Dead band) This is just a range in which nothing would happen. It would take into consideration the amount that we went over the line in both directions.

If we need to hit the stop sign target a little more accurately then we can now introduce another control method.

PID is a time based control logic. It will look at a control period (CP) and determine what to do for the next. In a temperature control application the control period would be 20 seconds. In a servo valve application, it can be 1 second. Lets look at each of the control methods in the PID with respect to our car analogy.

Proportional Control (P) – This will increase in amount based upon the error. The closer we get to the set point, the control period will be on for a longer period of time. (Reference to the output percentage  of control period time.)

In our example the car can be seen applying the brakes proportionally longer and longer times before the stop sign line is reached. If it goes over the stop sign line the car will apply the brakes even longer depending on the amount over the line. This is proportional control.

Integral (I) – Using just proportional control would always leave us below the set point. We need a method to reset us to the actual set point. This is where integration comes into play. It is interesting to note that PI control is one the most commonly used in the industry.

The car above is travelling along the road, following the dashed lines. If we used just proportional control we would find ourselves riding in the ditch. The integral control will move us into our lane and keep us close to the dash line.

Derivative (D) – This mode of control will look at rate of change and adapt our control to get us back to set point. Remember that everything is based upon a control period which is time. PI rely on the fact that everything remains constant in your control. D will take into account the differences over time.

In our car analogy the derivative function of the control will continually adjust as we move up the hill and down the other side. It will not do much as we drive along the straight road way.

We have looked at a very basic analogy of control logic without all of the details of math. This can aid in understanding what your process is doing and methods to correct. Further information can be obtained by the following references:

PID without a PhD By Tim Wescott
Understanding PID in 4 minutes
PID Control – A brief introduction
PID Controllers Explained

Nice project using PID:
Desktop Line Following Robot

Watch on YouTube : Who Else Wants to Learn About On / Off and PID Control?
If you have any questions or need further information please contact me.
Thank you,
Garry



If you’re like most of my readers, you’re committed to learning about technology. Numbering systems used in PLC’s are not difficult to learn and understand. We will walk through the numbering systems used in PLCs. This includes Bits, Decimal, Hexadecimal, ASCII and Floating Point.

To get this free article, subscribe to my free email newsletter.


Use the information to inform other people how numbering systems work. Sign up now.

The ‘Robust Data Logging for Free’ eBook is also available as a free download. The link is included when you subscribe to ACC Automation.

How to Make a One Shot in the PLC

A one shot in the PLC will turn an output on for one scan. This is used to trigger events that should only happen once. An example of this would be to increment a value in memory. If a one shot is not used, then every scan of the PLC will increment the value.

One shots are known by several other names. Differential Up (DIFU), Differential Down (DIFD), One Shot Relay (OSR), Powerflow Modifier, Leading edge contact, Trailing edge contact, etc. This all relates to the programmable controller that you are programming.

Lets take a look at programming a one shot using bit logic only. We will program both a leading edge one shot and a trailing edge one shot bit. This program will work in all PLCs.
Note: The white background in the increment (INC) instruction just indicates the reset for the animation.

Leading edge one shot bit: This will turn on a bit for one scan when the input condition makes a transition from 0 to 1. (Off to on)
When input X0 turns on C0 is turned on for one scan. This is because it is in series with the C1 lead work bit. The next rung will latch this on and not unlatch it until the input condition X0 turns off. C0 will only be on for one scan when X0 turns on.

Trailing edge one shot bit: This will turn on a bit for one scan when the input condition makes a transition from 1 to 0. (On to off)
When input X0 turns off C2 is turned on for one scan. This is because it is in series with C3 trail work bit. The next rung will latch this on and not unlatch it until the input condition X0 turns off.

The Do-more PLC has several different ways to do the leading and trailing edge one shots. Here are a couple:

The leading or trailing edge contact instruction will allow logic flow for one scan from a transition. (On to off / Off to on)

The leading and trailing edge Powerflow Modifier is placed before the output. It will turn multiple input signals into a one shot for the output.

Watch on YouTube : How to Make a One Shot in the PLC
If you have any questions or need further information please contact me.
Thank you,
Garry



If you’re like most of my readers, you’re committed to learning about technology. Numbering systems used in PLC’s are not difficult to learn and understand. We will walk through the numbering systems used in PLCs. This includes Bits, Decimal, Hexadecimal, ASCII and Floating Point.

To get this free article, subscribe to my free email newsletter.


Use the information to inform other people how numbering systems work. Sign up now.

The ‘Robust Data Logging for Free’ eBook is also available as a free download. The link is included when you subscribe to ACC Automation.

Creating a Flip Flop Circuit in the PLC

A flip flop curcuit in a PLC usually has one input and two outputs. When the input is activated, the two outputs latch on/off opposite to each other alternately.  Basically it is used to toggle (latch) an output on and off with just one input. In the PLC it is a single input that will toggle an output on and off each time the input signal is activated.

Here is an example of a hard wired flip flop circuit using relays.

The PLC program will be a little different than the relays because of the way in which the PLC scans. Scanning takes place from left to right, top to bottom. The output conditions from the logic are available to the next rung as the logic is solved. Outputs and inputs are read usually only once at the end of the scan. Remember to think of the outputs in the PLC as make before break. This is the opposite of the relay logic presented above which is break before make.

Lets look at the logic. This is programmed using the Do-More Programming Software which comes with a simulator. This full programming package is free of charge and can be downloaded here.

The input is on a leading edge instruction. (One Scan) If output 2 is on then it will set output 1. If output 2 is not on then it will reset output 1. The third line of code will determine the state of output 2 based upon output 1.

You may be asking yourself why do we not just use the conditions from output 1 to control output 1.  This is because if we substituted output 1 for the conditions on the input then the output 1 would never turn on/off. The output conditions are available for the next line of PLC code. This would allow the output to be set and reset within the scan without being updated. Using output 2 is the only way in which this logic would work.

Here is an automated picture to show the input toggling on / off and the outputs flip flopping.

Note: An emergency condition can be added to the set or reset rungs to automatically control the output either way.

Watch on YouTube : Creating a Flip Flop Circuit in the PLC
If you have any questions or need further information please contact me.
Thank you,
Garry



If you’re like most of my readers, you’re committed to learning about technology. Numbering systems used in PLC’s are not difficult to learn and understand. We will walk through the numbering systems used in PLCs. This includes Bits, Decimal, Hexadecimal, ASCII and Floating Point.

To get this free article, subscribe to my free email newsletter.


Use the information to inform other people how numbering systems work. Sign up now.

The ‘Robust Data Logging for Free’ eBook is also available as a free download. The link is included when you subscribe to ACC Automation.

Building a PLC Program That You Can Be Proud Of – Part 4

In part 1 we looked at writing PLC programs to control a traffic light using discrete bits and then using timed sequencing using indirect addressing. Part 2 used indirect addressing for inputs as well as output to control the sequence of pneumatic (air) cylinders in the program. Part 3 returned to the traffic light application and expand our program significantly. We looked at the sequence of operation using Input, output and mask tables. Part 4 will now continue with the programming of the logic in the PLC.

Let’s look at the sequence that we are controlling:
Note that I have colour coded the outputs that will be on in the sequence. This makes it easier to read how the lights will behave. All bits without ‘1’ are assumed to be ‘0’. The pedestrian walk signals flash before they change to the do not walk signals.

The weekend sequence looks like this. We have overlap of the red signal lights. The arrows are not used.

The weekday off peak times sequence looks like this. We have an advanced flashing green light for the north and west traffic.

The weekday peak times sequence is as follows. The turn arrows have been added for the north/south and west/east directions.

It is important to note that the sequencing and information contained in these charts must be understood fully before programming can begin. Take the time to review and understand the following tables. Here is a copy of the excel table complete with the inputs, mask and outputs.

This method of programming can have vast number of applications. Here are some of the advantages of using this method:

  • Modification of the program without extensive rewriting
  • Integration with a Human Machine Interface (HMI) to control, modify and/or troubleshoot
  • Ability to sequence forward and backward
  • Easily understood logic to follow. Looking at he pointers can the on compare instruction will quickly tell you what sensor is not being made.
Troubleshooting this method of programming is easily done. Compare the bits in the input pointed word to the actual bits form the input in binary format. The difference is the input/output that is not working.

The program is basically broken down into three sections:

  • Inputs – Setting bits in the input channel based upon actual and internal conditions.
  • Control  – Control of the pointers, mask and setting the output channel.
  • Outputs – Using the output channel to activate the actual and internal actions required.

 Inputs:

The program is all controlled by one on-delay timer. This sets the minimum time between each step.

Control:

This section of the control will tell the PLC what to do when the unit is first powered on. It resets the pointers and moves the initial output setting to the output word. You will see that since we have three different sequences running, there are three different reset rungs in parallel. The table input pointer is compared to the last value +1 of the sequence running.

The mask calculation is next. This is used to ignore the inputs that we do not want to see or may not know the status during the execution of the program.  

You will notice that the first three sequences are all the same. On this step we then determine if the pointers need to be changed for the other two. The first is for weekday off peak times.  

This is for the weekday peak times.  

We now compare the actual inputs after the mask with the input table word. If they are equal then move the output table word to the output channel and increment the pointers to the next step.  

Outputs:

The actual outputs are set using the output word bits. You will note that the flashing green lights are done when both green outputs are not on. This way will give me the greatest flexibility when developing different sequences. The do not walk signal is not part of the sequence but is controlled when the flashing walk or walk is not on.

The program will not change much for completely different sequences.

This program and the data tables can be downloaded here. Note that in order to run this program you must call up the input, mask and output tables and write them to the simulator or PLC.

In Part 5 will will make a Game of Simon by learning all about bit manipulation and sequencers.

Watch on YouTube : Building a PLC Program that You can be Proud Of – Ultimate Traffic Light Control

If you have any questions or need further information please contact me.
Thank you,
Garry



If you’re like most of my readers, you’re committed to learning about technology. Numbering systems used in PLC’s are not difficult to learn and understand. We will walk through the numbering systems used in PLCs. This includes Bits, Decimal, Hexadecimal, ASCII and Floating Point.

To get this free article, subscribe to my free email newsletter.


Use the information to inform other people how numbering systems work. Sign up now.

The ‘Robust Data Logging for Free’ eBook is also available as a free download. The link is included when you subscribe to ACC Automation.