Analog Programming & Advanced Control



Home | Forum | DAQ Fundamentals | DAQ Hardware | DAQ Software

Input Devices
| Data Loggers + Recorders | Books | Links + Resources



AMAZON multi-meters discounts AMAZON oscilloscope discounts


This section will examine the process of interfacing analog input and output variables to the Siemens S7-1200 processor. It will cover the fundamentals of analog I/O programming and its use in process control. An advanced industrial process control implementation will be briefly discussed.

GOALS:

- Perform analog module configuration and diagnostic.

- Perform and debug Siemens S7 analog I/O programming.

- Perform Siemens S7 PID configuration/programming.

- Understand PID control structure and performance.

Programmable logic controllers (PLCs) are the result of evolution of hardwired analog control systems. Analog is a keyword in the world of process control and automation. Most physical entities we would like to control in the real world are analog in nature. These include variables such as temperature, pressure, speed, acidity, position, level, flow rate, viscosity, displacement, weight, frequency, and many others.


AMAZON multi-meters discounts AMAZON oscilloscope discounts


All can be measured and quantified in time, and some exhibit self regulation ability. Self-regulation is the ability of a control variable to make adjustments and arrive at a stable state under small disturbances, which is a desired characteristic in the selected control variables. This section examines the process of interfacing analog input and output variables with the Siemens S7-1200 processor. It will cover the fundamentals of analog input-output (I/O) programming and its use in process control. Advanced process-control techniques will be discussed with a small industrial implementation.

1 Analog I/O Configuration and Programming

Standard modules are available off the shelf and can be interfaced with the Siemens S7-1200 PLC. The CPU used in this section has an analog input module with two inputs and an analog output module with one output. One of the available analog inputs and the analog output are configured and used in our coverage of analog programming and the implementation of closed-loop process control. Some of the Siemens S7-1200 typical analog I/O modules will be listed and followed by the steps to configure the module, scale the I/O, and program it.

1.1 Analog I/O Modules

The following is a brief list of typical analog I/O modules:

SB 1232 Analog Output (AQ). The S7-1200 Analog Output Module 6ES7 232-4HA30-OXB0 has one output with 12-bit resolution and can plug into the front of the CPU. It can be configured for ±10 V or 0 to 20 mA. This module is the one used and referenced in this section's programming examples.

SM 1231 Analog Input (AI). The S7-1200 Analog Input Modules are of two types: SM1231AI 4 (13-bit), which has four inputs with 12-bit resolution + sign bit, and SM1231AI 8 (13-bit), which has eight inputs with 12-bit resolution + sign bit and full-scale range -27,648 to 27,648. One AI4 module with two analog inputs is embedded in the CPU module.

SM 1232 Analog Output Module (AQ). The Analog Output Modules are also of two types, SM1232AQ 2 (13-bit), which has two outputs, and SM 1232AQ 4 (13-bit), which has four outputs with 12-bit resolution + sign bit and full scale range -27,648 to 27,648.

SM 1234 Analog Input Output Module (AI/AQ). The Analog Input Output Module is SM 1234 AI 4 (13-bit)/AQ 2 (14-bit), which has four inputs with 12-bit resolution plus one sign bit and two outputs with 13-bit resolution plus one sign bit.

Range Selection for Analog I/O Modules

Given the many analog devices available and the wide variety of applications, the analog I/O modules come with a variety of signals to accommodate voltage or current (±10 V, ±5 V, ±2.5 V, or 0 to 20 mA).

1.2 Configuring Analog I/O Modules

Signal modules including analog input and output can be added to the PLC processor. Fig. 1 shows the device-configuration screen. To start the configuration process, open Device Configuration for the PLC. Add your module, as shown in Fig. 2, and then configure each channel's properties, as illustrated in Fig. 3.

Note that for current-based signals, the only range available is 0 to 20 mA. If your signal is 4 to 20 mA, still configure it as 0 to 20 mA, and scale the input value as demonstrated in the figures.

Configuring the channel property for an analog input module to ±10 V will include a few menu clicks. Under the Project View screen, click on Device Configuration, and then add your module. Configure each channel's properties assuming the ±10-V format.

Fig. 1 Device configuration.

Fig. 2 Adding an analog input module.

Fig. 4 shows the process of configuring the channel property for an analog input module using a 0- to 20-mA signal format. To configure the current analog input module, follow the same steps used earlier, which are marked on the screen using arrows.

1.3 Analog I/O Diagnostic Configuration

Analog module diagnostic configuration initiates the protocol for handling signal exceptions during execution of the process-control program. Fig. 5 shows the screen for enabling the analog output module overflow diagnostics. Overflow and underflow can take place when the signal value exceeds the defined range, below the minimum and above the maximum values. As shown in the figure, click the Enable overflow and the Enable underflow in the Diagnostics checkbox. Sensors require frequent calibrations to maintain accurate input signals to the PLC analog input module. Occasionally, an out-of-calibration sensor can cause an overflow or an underflow. Enabling overflow/underflow will automatically trigger such events to the ladder program. The program also can manually check for out-of-range and reset values to the predefined limits.

Fig. 3 Configuring analog input properties (±10 V).

Fig. 4 Configuring analog input properties (0 to 20 mA).

Fig. 5 Enabling overflow/underflow diagnostics.

The power circuit of an analog output must provide continuity in order to maintain current flow. Wire breaks cause the interruption of current flow to the analog input or from the analog output modules. Short circuits also will cause analog signal interruption. Wire breaks, exceeding the limit, and short circuits all will cause the following S7-1200 PLC light-emitting diodes (LEDs) to blink (color of blinking LEDs: red):

• The ERROR LED on the CPU

• The DIAG LED if it is a signal module

• The LED of the associated channel

Enabling the broken-wire diagnostic will require the following steps shown in Fig. 6:

• Browse the Project Tree for the Device configuration of your S7-1200 PLC.

• Click on your signal module in the Device configuration window.

• Select the Properties tab, and click AI4/AO2 in the navigation area.

• Scroll down to the channel you want to monitor.

• Choose the Current analog output type.

• Click the Enable wire-break diagnostics checkbox.

Fig. 6 Enabling analog output broken-wire diagnostics.

Enabling short-circuit diagnostics will require the following steps shown in Fig. 7:

• Browse the Project Tree for the Device configuration of your S7-1200 PLC.

• Click on your signal module in the Device configuration window.

• Select the Properties tab, and click AI4/AO2 in the navigation area.

• Scroll down to the channel you want to monitor.

• Choose the Voltage analog output type.

• Click the Enable short-circuit diagnostics checkbox.

1.4 Analog Input Range and Scaling

The low limit of an assumed 16-bit (1 implicit sign bit) analog I/O module is exceeded once the count value is less than 0 for current and less than or equal to

-4865 for voltage. The high limit is exceeded once the count value is more than or equal to 32,512. The analog input and output signals can be scaled to 0- to 20-mA input and output signals using the predefined global library functions Scale_current_input and Scale_current_output or by using the SCALE instruction in the Siemens ladder software. Fig. 8 graphs the scaling operation. The actual count values used by the Siemens analog modules are listed below:

Decimal range = 0 to 27,648

Overflow = 32,512 to 32,767

Undershoot = 0 to -4864

Underflow = -4865 to -32,768

The preceding figure maps the 4 mA to a 0 count and the 20 mA to 27,648 count using a linear scaling function. The mapping eliminates an area labeled

"Wire break" from 0 to 4 mA. Fig. 9 shows the initialization of the watch table tags for monitoring analog variables. The display format can be adjusted by selecting the desired format. The monitor icon at the top of the screen, shown shaded, must be activated to start the real-time monitoring. All monitored or forced values must have a prior definition in the PLC tags with the correct addresses and the associated matching formats. The software will validate inputs and prompt the user to make the needed corrections.

Fig. 10 Analog I/O programming.

1.5 Analog I/O Programming

This section demonstrates fundamental issues associated with analog I/O programming. Two analog signals are configured and used in all discussions; both are connected to the main CPU module. Configuration is not required for the two analog inputs and the analog output connected to the processor module. Other analog modules must be added and configured before use. AI2_1 is the analog input module (available on the processor module) used with two channels, each using two memory words (starting at IW64 and IW66). Each channel is coded in 16 bits using the format covered in the preceding section. Our programming will make use of the first analog input channel, IW64-IW65. AQ2_1 is the analog out put module used with one channel employing two memory words (starting at QW80). The output channel is coded in 16 bits using the same format used by the analog input signal. The SCALE and NORM instructions covered in Section 4 will be used repeatedly in the next analog programming example. The reader is advised to review and practice these instructions before proceeding.

The next example uses a 10-V potentiometer to supply the analog input signal.

The analog output is interfaced with a small voltmeter. The potentiometer setting is changed, and the corresponding changes in the voltmeter reading are recorded. This setting is very simple to implement in the laboratory or even at home, but it is typical of the actual PLC analog setting and interfacing in a more elaborate industrial application. No high-voltage or excessive-current devices/interfaces are used in this set ting. Precautions must be taken when dealing with high-voltage/current circuits.

The first network of our example, shown in Fig. 10, reads an analog input voltage signal (0 to 10 V) in the standard count range from 0 to 27,648. The count is normalized in the range 0.0 to 1.0. Next, the normalized value is scaled back in the range from 0 to 4095. Three tags are used in this network: AI_0-10V, the raw analog input (IW64); AI_0-1, the normalized intermediate tag (MD86), and AI_0-4095, the 12-bit scaled count (MD92). Only IW64 is the physical I/O address among the three used.

The second network produces half the value of Network 1 output count and stores it in the AI_0-2047 tag. The snapshot shown for Networks 1 and 2 is taken at an input analog count of 17,300, which is approximately 6.26 V. Network 3 normalizes the count produced by Network 2 and then scales it in the range from 0 to 27,648. The newly scaled value is stored in the AQ_0-10V physical output tag (QW80).

Fig. 11 shows the PLC watch table snapshots for the six tags used in our analog I/O example. The first screen shows a full watch table with all used fields highlighted and pointed to by an arrow. The PLC Watch and Force table is an important tool frequently used during the process-control software development, implementation, and checkout.

2 PID Control Configuration and Programming

Proportional-integral-derivative (PID) closed-loop control is one of the most widely used process-control techniques. It reacts to process errors or deviations from desired behavior using a strategy based on knowledge about error values, the history of error, and the future forecast of errors. This section will cover PID closed-loop control with practical aspects of its implementation in industrial automation.

2.1 Closed- Loop Control System

As stated in Section 1, a control system is a collection of hardware and software designed to produce desired process behavior in real time. Fig. 12 shows the functional block diagram for single-variable closed-loop process control. The control-system loop includes the process, final control element, controller, error detector, and measurement element. The following are the key variables and associated action in the closed loop:

• The set point is the user-defined desired value of the controlled variable, which is the process variable to be regulated.

• Measurement-element output indicates the controlled-variable status, also called process output variable or feedback signal.

• The error is the difference between the set point and the controlled variable.

• Output is an indication produced by the controller to initiate the action to be taken by the final control element to correct the error.

Fig. 7 Enabling short-circuit diagnostics.

Fig. 8 Scaling 4- to 20-mA signal count. Digital, counts; Software range; Wire break; Current

Fig. 9 Monitoring analog signal count.

Fig. 10 Analog I/O programming.

Fig. 11 PLC Watch and Force table snapshots.

Fig. 12 Single-variable closed-loop control.

[ Controlling variable Manipulated variable Error Set point Controlled variable measurement Controlled variable Final control element Measurement sensor transmitter Process Controller]

• The final control element is the actuator that brings about the changes in the process and selected controlled variable. The output of the final control element is called the process controlling or manipulating variable.

Fig. 13 Step-change responses.

2.2 Control-System Time Response

Time response of the control system can be determined based on the time characteristic of the process-controlled-variable value- following a step change in the controlling-variable output value y. Most control systems are self-regulating, which means that a new controlled-variable equilibrium is reached immediately or shortly after a process change or disturbance. For example, the speed of an induction motor settles at the value that produces the required load torque. The motor will run at this equilibrium point under the same load conditions (for a rotating object, equal force and load lead to constant speed). A small increase in load due to disturbances will force the motor to decelerate (load greater than motor torque) and reach a lower speed point of equilibrium after a short period of oscillation. Thus the speed of the induction motor is an excellent candidate for selection as controlled variable. Motor speed control is a very common application in process control.

Fig. 13 plots a process-controlling variable output response to a step input change in the controlling variable for a possible controller implementation. Other responses are possible through a different controller design.

The time response can be determined using the controlled-variable delay time Tu, recovery time Tg, and final value xmax. The variables are determined by applying a tangent line to the maximum value and the inflection point of the step response. In many systems it is not possible to drive the process and record the response characteristic up to the maximum value because the process-controlled variable cannot exceed a specific limit. In this case, the rate of controlled-variable rise is used to identify the system. The controllability of the system can be defined based on the ratio Tu/Tg , as shown in Tbl. 1.

A controlled system with dead and recovery times reacts to a step change in the controlling-variable process input, as shown in Fig. 14. Td is the dead time, which is the time interval from initiating a change in the process input signal (controlling variable) to the point where we observe the start of the process output (controlled variable) response. The controllability of a self-regulating controlled system with dead time is determined by the Td/Tg ratio. The dead time Td

must be a small fraction of the recovery time Tg for good controllability. Processes with large dead times are extremely difficult to control and include large boiler drums' temperature, cascaded tanks' liquid volume, and irrigation canal's downstream water-level controls. In a typical temperature-control application, as shown in Fig. 15, the temperature inside a tank is selected as the controlled variable, whereas the heater current represents the controlling variable of the closed-loop feedback controller.

===

Tbl. 1 System Controllability

Process Type Tu/Tg System Controllability Slow reacting <0.1 Very good Reacting 0.1 to 0.3 Can be controlled Fast Reacting >0.3 Difficult to control

===

Fig. 14 Control process with dead-time response.

Fig. 15 shows an oscillatory control-system response with no dead time.

The controlled variable reacts immediately after a set-point change, reaching and then exceeding the new set point. Finally, it goes through attenuating oscillations, reaching a steady-state value within the allowable dead band. The total time for the controlled variable to reach the new steady-state value is called the settling time TD. In Fig. 14, response, TD = (Td + Tg + Tu ). Settling time is an important measure of control-system performance. Typical system behavior will show several and repeated oscillations before reaching a steady-state condition. The maximum error emax in the controlled variable corresponds to the first overshoot response and is also a good measure of controller performance. In systems where oscillations are not permitted, different control strategies and controller designs are used. This includes the use of ON/OFF control, set-point ramping to the final target using small increments, and a slow response-tuned controller.

2.3 Control-System Types

Controlled systems are classified based on their time response to step changes in the controller output value. We distinguish between the following controlled systems:

• Self-regulating controlled systems

• Proportional-action controlled systems

• First-order controlled systems

• Second-order delay-element controlled systems

• Non-self-regulating controlled systems

• Controlled systems with dead time

===

High threshold Low threshold Dead band emax Controlled variable New set point Old set point Settling time TD Fig. 15 Typical oscillatory closed-loop control.

===

Processes with no self-regulation or with excessive dead time are difficult to control and require special and more complex control techniques, which include feed forward, cascaded control, and dead-time compensation. These techniques are not covered in this guide. The following is a brief coverage of the three most common self-regulating controlled systems:

Proportional-Action Controlled Systems

In proportional-action controlled systems, the controlled-variable process value follows the controller output value (controlling variable) almost immediately. The ratio between the controlled variable (process output) and the controlling variable (process input) is defined as the proportional gain of the controller. Fig. 16 shows a gate valve that can be used to control steam flow in a piping system in a temperature-control application. The valve opens by lifting a wedge out of the path of the steam. Gate valves are used primarily to permit or prevent the flow of liquid or gas. A specifically designed proportional-action controlled gate valve can be used for regulating liquid flow. In this case, opening of the valve represents the controller output (controlling variable) value, and the corresponding liquid/ gas flow rate or its effect, as in temperature- or level-control applications, is the process-controlled variable value. The relation between the two variables is direct and almost immediate but often not linear.

Fig. 17 shows the block-diagram symbol for the gate valve proportional action controlled system and the dynamic behavior of the controlled variable (liquid temperature inside the tank) after a step change in the manipulated variable (valve position, controlling variable). Ideal control action without any lag is not possible in practical systems. The characteristic curves clearly show that a proportional action controlled system exhibits self-regulation because a new equilibrium is reached immediately after a step change. The following is the ideal equation relating the temperature T to the valve position Y: T = Kp × Y where Kp

is the process proportional gain.

Fig. 16 Industrial gate valve.

Small values for the proportional gain will produce slow response and large residual steady-state errors. Large proportional-gain values can speed up the response but also may cause large temperature oscillations. Excessive proportional gains can cause large and unsustainable oscillations, which can force a manual or an automatic system shutdown. Selecting and tuning the controller parameters, including the proportional gain, will be discussed later in this section.

Fig. 17 Proportional-action controlled system.

First-Order Controlled Systems

In a first-order system-controlled application, the controlled-variable value initially changes in proportion to the change in the controller output, the controlling variable value. The rate of change of the controlled-variable value is reduced as a function of the time elapsed until process steady state is reached. This type of control is also known as a PT1 system. A water container that is heated with steam is an example of a first-order controlled system. In simple controllers, the time behaviors for the heating and cooling processes are assumed identical.

Control is clearly more complex with different process cooling and heating time characteristics.

Second-Order Delay-Element-Controlled Systems

In a second-order delay-element-controlled system, the process-controlled value does not immediately follow a step change in the controller output value. The process-controlled value initially increases in proportion to the positive rate of rise in the controller output value and then approaches the set point at a decreasing rate of rise. The controlled system shows what is known as a proportional response characteristic with second-order delay element. Pressure, flow-rate, and temperature controls are all examples of this type, which is also known as PT2 system.

2.4 Controller Behavior

A controller provides the necessary feedback adjustments to the process in real time to bring about the desired changes in the selected controlled variable. A precise adaptation of the controller to the desired controlled-variable time response depends on the precise setting of the control strategy, parameter tuning, and the controller's ability to react adequately to set-point and load disturbances. Controller feedback can have a proportional action (P), a proportional-derivative action (PD), a proportional-integral action (PI), or a proportional-integral-derivative action (PID). ON/OFF control is a special flavor of proportional control but with controller output either OFF (%0) or ON (%100). Controller actions are triggered by deviations in the controlled-variable behavior caused by process disturbances, load changes, or the initiation of a new set point. The step response of the controller depends on its type. Fig. 18 shows the step response of a proportional action (P) controller, a proportional-derivative (PD) controller, and a PID controller. Proportional-integral (PI) control is most common, which can help to improve the control-system response and reduce the final steady-state errors. A controller with derivative action is not appropriate if the control system has pulsing measured quantities, as in the case of pressure or flow process control.

Fig. 18 Closed-loop control types and performance.

2.5 Selection of the Suitable Controller Structures

===

Tbl. 2 Controlled-System Structure Selection

Controlled System Controlled Structure P PD PI PID With dead time only Unsuitable Unsuitable Suitable Unsuitable PT1 with dead time Unsuitable Unsuitable Well suited Well suited PT2 with dead time Unsuitable Suited conditionally Well suited Well suited Higher order Unsuitable Unsuitable Suited conditionally Well suited Not self-regulating Well suited Well suited Well suited Well suited

====

Tbl. 3 Physical-Quantity Control-Structure Choices

Physical Quantity Controller Structure P PD PI PID Sustained Control Deviation No Sustained Control Deviation Temperature For low performance requirements and proportional action controlled systems with Tu/Tg < 0.1

Well suited The most suitable controller structures for high-performance requirements (except for specially adapted special controllers) Pressure Suitable, if the delay time is inconsiderable Unsuitable The most suitable controller structures for high-performance requirements (except for specially adapted special controllers) Flow rate Unsuitable, because required GAIN range is usually too large Unsuitable Suitable, but integral action controller alone often better Hardly required

====

To achieve optimal control results, select a controller structure that is suitable for the controlled system and that you can adapt to the controlled system within specific limits. Tbl. 2 provides an overview of suitable combinations of a controller structure and controlled system. Tbl. 3 provides an overview of suitable combinations of a controller structure and physical quantity.

In the case of PI and PID controllers, which represent the most common types of controllers, controlled-variable oscillations occur. Experience shows that extensive tuning of the initial parameters is always necessary. Level control and temperature control inside very large containers or a set of cascaded containers are examples of systems with dead time. Dead time represents the time that has to expire before a change can be measured at the system output. In systems with dead time, changes in the controlled variable owing to the controller action are delayed by the amount of the dead time. A system with Tu/Tg > 0.3 is typically difficult to control. Several technical sources provide a best starting guess for the PID parameters based on known process models. Most PID parameter-value recommendations are based on a one-quarter-decay controlled-variable behavior, which means that consecutive overshoot oscillations maintain this decay ratio.

Additional tuning of selected controller parameters must be performed during system checkout. Other tuning parameters are available for different and commonly desired process-control behavior.

Fig. 19 PID instruction block.

3 PID Instruction

PID closed-loop control is a common method of process control in most industrial and commercial applications. This section will cover the use of PID instruction blocks in the Siemens S7-1200 PLC system. Similar structures exist in most other PLC brands with slight changes in format but the same basic operation. Fig. 19 shows the details of the PID instruction block. The PID block includes two parameter sets, one for input and one for output values.

Tbl. 4 PID Instruction Input Parameters --- Parameter Data Type Default Description

Tbl. 4 lists the PID input parameters. Three of the parameters are internal to the PID. Reset is a Boolean parameter that, when set, will cause a restart of the PID controller. It is initially defaulted to FALSE. Manual enable is defaulted to FALSE, and when set, it disables the PID controller and forces a manual output value on the PID output. This output value is defined in the Manual value input parameter. The remaining three input parameters-Set point, Input, Input PER-are used during normal automatic operation of the PID controller. Input is the process variable to be con trolled, as defined in the user-application program. Input PER refers to the actual analog input variable. The controller calculates the process-variable error relative to the desired set point. PID tuning parameters discussed earlier are not listed in this table but must be defined during PID configuration and programming. Desired PID control selection is accomplished through the definition of these tuning parameters. Proportional (P), proportional-integral (PI), proportional-derivative (PD), and proportional integral-derivative (PID) control mode selections are all possible. Tbl. 5 lists the PID output parameters. Three of these parameters are the scaled value of the input process variable Scaled input, the PID output in real format Output, and the output analog value Output PER. Other output parameters are well defined in the table.

Tbl. 5 PID Instruction Output Parameters Parameter Data Type Default Description

3.1 SIMATIC S7-1200 Tank-Level PID Control

This section details the implementation of a PID control of a tank-level process using the Siemens Step 7 Basic software. Description of all the steps needed to program and implement the desired tank-level regulation is included, along with the associated commands and the SIMATIC software screens.

A sensor measures the tank level and converts it into a 0- to 10-V signal; 0 V corresponds to the level when the tank is empty (01), whereas 10 V is the level indication for a completely filled tank (10001). The sensor is connected to the first analog input of the SIMATIC S7-1200. An S1 switch (I0.0) is used to initiate a sudden set-point change in the tank level. This level is to be controlled alternatively for the 01 level (S1 = 0) or 7001 level (S1 = 1).

A PID_Compact controller integrated in the Siemens Step 7 Basic V10.5 software is used. This PID controller, in turn, controls a pump as the manipulated variable by means of a 0- to 10-V analog output signal. The following is the simplified I/O assignment list for this control process:

Address Symbol Data Type Comment

%IW 64 X_Level_Tank1 Int Analog input actual level filling

%QW 80 Y_Level_Tank1 Int Analog output manipulated value

%I 0.0 S1 Bool Sudden set-point change enabler

For project management and programming, the software Totally Integrated Automation Portal is used. Here, under a uniform interface, components such as the controller, visualization, and networking of the automation solution are set up, parameterized, and programmed. Online tools are available for error diagnosis.

In the following 28 steps, a project can be set up for the SIMATIC S7-1200, and the solution for the task can be programmed:

1. The central tool is the Totally Integrated Automation Portal. It is called here with a click (? Totally Integrated Automation Portal V11) (Fig. 20).

Fig. 20 Totally integrated automation portal.

2. Programs for the SIMATIC S7-1200 are managed in projects. We are now setting up such a project (? Create new project ? Tank_PID ? Create) (Fig. 21).

Fig. 21 Creating a new project.

3. Next, First steps are suggested for configuration. First, we want to Configure a device (? First steps ? Configure a device) (Fig. 22).

Fig. 22 Configuring a new device.

4. Then, we Add new device with the Device name controller_tank. To this end, we select CPU1214C from the catalog, with the matching order number (? Add new device ? controller_tank ? CPU1214C ? 6ES7 ? . . . ? Add) (Fig. 23).

5. The software now changes automatically to the Project view with the open hardware configuration. Additional modules can be added from the hardware catalog (to the right!). Here the signal board for an analog output is to be inserted using drag and drop (? Catalog ? Signal board ? AO1 × 12 bits ? 6ES7 232- . . .) (Fig. 24).

6. In Device overview, input and output addresses can be set. Here the CPU's integrated analog inputs have the addresses %IW64 to %IW66, and the integrated digital inputs have the addresses %I0.0 to %I1.3. The address of the analog output on the signal board is %QW80 (? Device overview ? AQ1 × 12 bits ? 80 . . . 81) (Fig. 25).

Fig. 23 Selecting and adding the CPU.

Fig. 24 Adding the signal board for an analog output.

Fig. 25 Configured devices overview.

NOTE PID control applies to any system with a measurable process-controlled variable that can be regulated using a controlling variable to derive an appropriate actuator. The dynamic nature of the interactions between the controlling and controlled variables depends greatly on the process, but process changes happen so fast. Analog interface with the process is needed in order to allow the PLC to capture the controlled-variable real-time measurements and provide the desired regulation through its output to the actuator (controlling variable). This will be shown in the final steps of this section during PID tuning and monitoring activities.

7. For the software to later access the correct CPU, its IP address and subnet mask have to be set (? Properties ? General ? PROFINET interface ? Ethernet addresses ? IP address: 192.168.0.1 ? subnet mask: 255.255.255.0) (Fig. 26).

Fig. 26 Setting the CPU PROFINET IP address.

8. Because modern programming uses tags instead of absolute addresses, the global PLC tags have to be specified here. These global PLC tags are descriptive names with a comment for the inputs and outputs that are used in the program. Later, global PLC tags can be accessed by means of this name.

These global tags can be used in the entire program in all blocks. In program navigation, select controller_tank [CPU1214C DC/DC/DC], and then select PLC tags. With a click, open the PLC tags table, and enter, as shown below, the names for the inputs and outputs (? controller_tank

[CPU1214C DC/DC/DC] ? PLC tags ? Default tag table) (Fig. 27).

9. To create the function block FC1, in project navigation, select controller_ tank [CPU1214C DC/DC/DC] and then Program blocks. Next, click on Add new block.

(? controller_tank [CPU1214C DC/DC/DC]? Program blocks

? Add new block) (Fig. 28).

Fig. 27 Setting the PLC tag names.

10. Select Organization block ( OB), and type the name Cyclic interrupt.

As programming language, specify FBD. Numbers are assigned automatically (OB100). We leave the permanent scan time at 100 ms. Accept the inputs with OK (? Organization block ( OB) ? Cyclic interrupt ? FBD ? Scan time 100 ? OK) (Fig. 29).

NOTE

The PID controller has to be called with a permanent scan time (here 100 ms) because its processing is critical with respect to time. The controller could not be optimized if it would not be called accordingly.

11. The organization block Cyclic interrupt [OB100] will be opened automatically. Before the program can be written, its local tags have to be specified. In the case of this block, only one tag type is used:

Fig. 28 Creating a new function block.

Type Name Function Available In Temporary/ Local data Temp Tags that are used to store temporary intermediate results.

Temporary data are retained only for one cycle.

Functions, function blocks, and organization blocks

12. In our example, only one local tag is needed: Temp: w_level_tank1, with data type Real. This tag stores the set point for tank1 as an intermediate value. It is important in this example to use the correct data type Real; otherwise, it is not compatible in the following program with the PID controller block used. For the sake of clarity, all local variables also should be provided with sufficient commentary (Fig. 30).

Fig. 29 Creating a new organization block.

Fig. 30 Creating/declaring local variables/tags.

13. After the local tags are declared, the program can be entered by using the tag names. (Tags are marked with the symbol #.) Here, in the first two networks- with a MOVE instruction, respectively-either the floating-point number 0.0 (S1 = = 0) or 700.0 (S1 == 1) is copied to the local tag #w_fuel_ tank1 (? Instructions ? Move ? MOVE) (Fig. 31).

14. The controller block PID_Compact is moved to the third network.

Because this block does not have multi-instance capability, it has to be assigned a data block as a single instance. It is generated automatically by Step 7 (? Advanced instructions ? PID ? PID_Compact ? OK) (Fig. 32).

15. Wire this block, as shown here, with the set point (local tag #w_fuel_ tank1), actual value (global tag X_Level_Tank1), and manipulated variable (global tag Y_Level_Tank1). Then the configuration screen of the controller block can be opened (? #w_level_tank1 ? X_ Level_Tank1 ? Y_Level_Tank1 ? ) (Fig. 33).

16. Here we have to make the Basic settings, such as controller type, and wire the internal controller structure (? Basic settings ? Controller type Volume ? 1 ? actual value: Input_PER (analog) ? manipulated value: Output_ PER) (Fig. 34).

17. At Process value settings, we set the measuring range from 0 to 10001. The limits also have to be adjusted (? Process value settings ? Scaled high 1000.01 ? High limit 1000.01 ? Low limit 0.01? Scale low 0.01) (Fig. 35).

18. At Advanced settings, there are also Process value monitoring and a manual setting for the PID parameters. By clicking on , the project is saved (? Advanced settings ? Process value monitoring ? PID Parameters ? ) (Fig. 36).

19. To load the entire program to the CPU, first select the folder controller_ tank, and then click on the symbol . Download to device. (? controller_tank ? ) (Fig. 37).

Fig. 31 Entering the program with documentation.

20. If the PG/PC interface was not specified previously (refer to Laboratory 2.1 in Section 2), a window is displayed where this can still be done (? PG/PC interface for download ? Load) (Fig. 38).

21. Now click on Load once more. During downloading, the status is displayed in a window (? Load) (Fig. 39).

22. The successful download is now displayed in a window. Click on Finish (? Finish) (Fig. 40).

23. Next, start the CPU by clicking on the symbol (? ) (Fig. 41).

24. Confirm the question whether you are sure you want to start the CPU with OK (? OK) (Fig. 42).

25. By clicking on the symbol (monitoring ON/OFF), the status of the blocks and tags can be monitored while the program is tested. However, when starting the CPU, the controller PID_Compact is not activated.

To this end, start commissioning by clicking on the symbol (? Cyclic interrupt[OB200] ? PID_Compact ? Commissioning) (Fig. 43).

26. On an operating screen, control variables can be displayed as shown in Fig. 44.

27. With Measurement Stop/Start, variables can be plotted in a diagram, including the set point, the actual value, and the manipulated variable. After the controller is loaded to the control system, it is still inactive. This means that the manipulated variable remains at 0%. Now select Tuning mode, Pre-tuning and then Pre-tuning Start (? Measurement ? Start ? Tuning mode ? Pre-tuning ? Start).

Fig. 32 Entering the PID block.

Fig. 33 Configuring the PID block.

Fig. 34 Controller structure and basic setting.

Fig. 35 Process variable setting.

Fig. 36 Assigning the PID closed loop control parameters.

28. Now, self-tuning starts. In the field Tuning status, the current work steps and errors that occur are displayed. The progress bar shows the progress of the current work step (Fig. 45).

29. If self-tuning was executed without error messages, the PID parameters have been optimized. The PID controller changes to the automatic mode and uses the optimized parameters. The optimized parameters are retained at power ON and CPU restarts. With the button , the PID parameters can be loaded to the project (? ) (Fig. 46).

NOTE For faster processes, such as speed control, fine-tuning should be selected for optimization. A cycle is executed here that lasts several minutes, where all PID parameters are determined and set. The parameters values can be monitored in the data block after the project is loaded.

Fig. 37 Downloading the program to the CPU.

Fig. 38 Defining the access nodes interface for download.

Fig. 39 Program load and associated status.

Fig. 40 Start modules and finish the download.

Fig. 41 Start CPU and begin program scanning.

Fig. 42 Confirm the CPU run mode.

Fig. 43 Commissioning the PID loop.

Fig. 44 Displaying and monitoring process variables.

Fig. 45 Tuning and online status of the PID controller.

Fig. 46 PID fine tuning.

QUIZ and Lab Project

QUIZ:

1 What are the actual decimal count values used by the Siemens analog I/O modules? What does it means in terms of A/D conversion resolution?

2 What is the function of the Wire break in scaling analog I/O signal?

3 Describe the function of the Normalize and Scale instructions used in analog I/O processing.

4 An analog input voltage signal in the range from 0 to 10 V is received in the standard form

0 to 27,648. If the signal is connected to the PLC-configured analog input module, perform the following:

a. Show a ladder network to scale the analog input signal (0 to 10 V) to the corresponding 12-bit digital count (0 to 4095).

b. Show another network to scale the signal to engineering units in the range from 50 to 350°F.

5 For Problem 4, show a network(s) to validate the input signal and force the equivalent standard digital count to be in the range 0 to 27,648.

6 Refer to Problem 4; if the equivalent standard digital count is from 0 to 15,300, what is the equivalent normalized count? Assuming a normalized count of 0.6257234, what is the equivalent 12-bit resolution count?

7 Show a network(s) to scale two analog input signals from 0 to 10 VDC to engineering units in the range of 50 to 3001b/in^2. The two analog signals represent two measurements of pressure inside a boiler drum. Design ladder logic to calculate the average pressure in pounds per square foot, and then move 10 percent of the average amount to the analog output module. Use the analog addresses on the CPU module and the signal board.

8 Define the following terms, and give an example of each:

a. A closed-loop control system

b. An open-loop control system

c. A single-variable control system

d. A multivariable control system 8.9 Define the following terms, and quantify their influence on control-process behavior:

a. Dead time

b. Settling time

c. Recovery time

d. Delay time

10 Explain two methods used to determine the time response of a control system.

11 Draw a block diagram for a single variable closed loop, and describe the function of each block operation.

12 How is the time response of a control system determined?

13 Self-regulated control systems discussed are classified as three types (as shown below). Briefly explain each type.

a. Proportional-action controlled systems

b. First-order controlled systems

c. Second-order delay-element controlled systems

14 An induction motor is a self-regulating device. The steady-state torque and speed are a linear relation in the operating range. As load increases, the motor torque increases and the speed decreases, and a new steady-state operating state is reached. Draw the relation between torque and motor speed. Show how self-regulation works under a small-motor load change.

15 What does non-self-regulating control system mean? Give an example.

16 Fig. 47 shows the behavior of the controlled variable under transient conditions.

Answer the following:

a. If the set point is 200°F and the dead band is ±4°F, determine the maximum error in °F.

b. What is the settling time? How much is it in this example?

Fig. 47 Control variable transient, homework Problem 16.

17 The diagram in Fig. 48 shows a closed-loop system for tank outlet flow control. Redraw the diagram to include a supervisory control system, and describe the advantages of supervisory control.

Fig. 48 Tank level closed-loop control, homework Problem 17.

18 Study the network shown in Fig. 49, and answer the following questions:

a. What is the effect of the LIMIT instruction on the analog input count?

b. Show another way of achieving the same LIMIT function.

Fig. 49 Homework Problem 18.

19 What is the concept of controllability? What is the effect of dead time on controllability? Show examples of variation of controllability.

20 What is the effect of dead time on controller design? Which control techniques are more suitable for processes with large dead times?

Projects

Lab 1: Tank-Level Sensor Measurement Processing and Monitoring

The objective of this laboratory is to provide hands-on knowledge of the analog programming used in commercial and industrial applications.

Process Description:

This lab demonstrates fundamental issues associated with analog I/O programming. Two analog signals are configured and used as tank-level measurements, and both are connected to the main CPU module. Analog input 1 (IW64) measures tank level 1, and analog input 2 (IW66) measures tank level 2. The two measurements are used to generate an average for the two tanks levels. The average is sent to an analog output module, which converts the digital count to a 0- to 10-V analog signal to be displayed on the local panel meter and in engineering units on the HMI.

Lab Specs:

• The first network in this lab should read an analog input voltage signal (0 to 10 V) in the standard count range from 0 to 27,648. The count is normalized in the range 0.0 to 1.0. Next, the normalized value is scaled back in the range from 0 to 4095. Use three tags in this network: AI_0-10V, the raw analog input (IW64); AI_0-1, the normalized inter mediate tag (MD86); and AI_0-4095, the 12-bit scaled count (MD92). Only IW64 is the physical I/O address among the three used.

• Repeat the first step for the second analog input IW66 using Network 2.

• The third network calculates the average of the two tank-level scaled counts and places the result in MD 98, tag name TANKS-AVE.

• Network 4 normalizes the count produced by Network 3 and then scales it in the range from

0 to 27,648. The newly scaled value is stored in the AQ_0-10V tag, which corresponds to the physical output address QW80. This value is displayed on the local panel meter.

• Network 5 converts the average level to engineering units from 0 to 40 m. The value is displayed on the designated tag on the HMI.

Implementation Steps

• Configure the two-input PLC analog module attached to the CPU.

• Configure the single analog output signal board connected to the CPU.

• Use two 10-V potentiometers to supply the analog input signals (0 to 10 V) to the input module.

• Change the potentiometer setting in the defined range to represent a tank level in engineering units in the range of 0 to 40 m.

• Configure a Status page in the HMI to display the two tank levels and their average in meters as you change the potentiometer setting from the minimum to the maximum volt age (0 to 10 V).

• Also display the digital count in 12-bit resolution on the HMI Status page.

• Monitor the voltmeter readings, and verify the analog signal scaling and the measured values compared with the potentiometers' settings.

Lab Requirements:

• Assign the system inputs.

• Assign the system outputs.

• Program the required networks. Use three functions: analog input validation, analog input scaling, and analog average calculation.

• Download the program, and go online.

• Record your observations for input and output values in digital count, analog signal value, and corresponding engineering units.

• Simulate the program using the training unit or the Siemens simulator. Configure the watch table, and then verify that the program is running according to the process specifications.

Ladder Program Listing (No Documentation) See Fig. 50.

Fig. 50 Lab 1 ladder.

NEXT:

PREV.

All related articles   Top of Page   Home



Updated: Monday, March 9, 2015 18:52 PST