Controllers
Introduction
This section covers the PID, Ratio, Split Range and MPC controllers.
The proportional integral derivative controller (PID controller) is a generic controller widely used in models and in industrial control.
Ratio control is used to ensure that two or more process variables are kept at the same ratio even if they are changing in value. Examples of ratio control include burner air/fuel ratio, blending two liquids, or adjusting heat input in proportion to material flow. For ratio control, a remote setpoint is selected.
Split range control splits an output signal to two or output objects. It is commonly used to control two valves. In a typical configuration, one is fully open while the other is fully closed. If one is 25% open, the other may be 75% open.
Model predictive control (MPC) is an advanced control option which uses a model to predict the behavior of the plant and to accordingly adjust numerous output signals.
Connections

The connections page allows process variable sources and output target objects to be selected. Valve unit operations make ideal output targets because they provide the most realistic and natural response. For a valve output object, the actuator desired position will be controlled, rather than the valve opening (which is a function of various other considerations). For a valve, you can also choose whether to control the main valve, the bypass valve, or either of the two block valves around the main valve.
If the output object is a duty stream or material stream, then click on Control Valve and be sure to supply the minimum and maximum available. These values are used to convert the control signal to a duty or flow rate or other type of value.

Note that some controllers support multiple connections. For example, the split range range controller allows two outputs to be selected. You can change which connection is being shown by using the spinner control . The ratio controller allows two process variable inputs to be connected.
Parameters - Configuration

The controller Mode determines the behavior of the controller. The following modes may be available, depending on the configuration and type of controller:
- Off - The controller does not perform any calculates and is inactive.
- Man - In manual mode the controller OP is specified directly by the user, and not calculated by the a control algorithm.
- Auto - In automatic mode the controllers operates by itself, adjusting the output based on the various settings.
- Indicator - The controller does not calculate an output value and may not even have an output connection. This mode is also handy for accessing all values via OLE or for just monitoring a value.
- Ramping - This mode is active while the setpoint is temporarily being ramped, as configured and enabled on the Parameters, Advanced page.
- Casc - Cascade control is available when a remote setpoint source has been selected on the connections page. Effectively the output of the primary controller manipulates the setpoint of the secondary controller.
- AutoTune - The controller is currently busy tuning itself. This mode is active when one of the options on the auto tuning page is selected.
The execution can be internal or external. Internal means the Petro-SIM controller code is active. External means that an external DCS or other system is performing control calculations and controller output values are being passed to Petro-SIM via OLE functions or other means.
SP is the target setpoint for the process variable PV. OP shows the current controller output signal.
Kc, Ti and Td and controller algorithm constants that determine the gain, integral and derivative control algorithm contributions.
When applicable, the PV range must be specified. This is used to convert PV values such as temperature into a control signal.
A ratio controller also has an option on this page to enable ratio control. When active, the desired PV ratio can be specified instead of an absolute setpoint.
Ratio Control

The controller should be configured such that PV 1 (as opposed to PV 2) is impacted by the output object of the split range controller (e.g. PV 1 can be flow rate into the valve that is the output object). PV 2 is typically coming from another line or controlled by a different controller. The value of PV 2 is shown as Ref. PV on the Parameters, Operation page. If the Ratio is specified to be 1.5, then PV 2 = Ref.PV = may be equal to 200 say, whereas PV 2, being controlled by the ratio controller, will then be driven to 300. The ratio controller functions just like a regular PID controller, except that its setpoint is calculated as Ratio * Ref.PV, or Ratio * PV 2.
Split Range Control

The split range controller works essentially just like a regular PID controller, except that two output connections are allowed. The setpoint provided is generally that of OP 1 as opposed to OP 2.
Parameters - Configuration

This page is generally used for controllers with multiple connections to allow ranges for the PV and OP values to be provided.
Parameters - Advanced

Set point ramping allows the setpoint to be temporarily boosted or reduced.
SetPoint Options control settings such as whether the SP should update and track the PV value while the controller is in manual mode, or whether to retain its original value.
The limit values are used inside the control algorithms to convert values values to signals.
Four algorithms are available:
- PID Velocity Form
- PID Positional Form (ARW)
- PID Positional Form (NoARW)
- PID Manual Loading
The velocity form is incremental, dealing with rate of change. The positional form deals with values which are actual position (e.g. valve opening) value.
ARW refers to the presence of anti-reset windup, which can be a problem if the control loop is temporarily taken out of control. During such times the integral portion of the control can rise to high values (wind up), which lengthens the time it takes the control loop to get back to minimal error. The term "wind-up" is a way of viewing the integral term as a spring that takes a long time to "unwind".
Auto Tune

While the integrator is running (and the process is fairly lined out with the controller PV close to the setpoint) click on Start Autotuner. This will perform some response testing and calculate tuning parameters for the controller. Click Accept to accept the new parameters.
The auto tuner will automatically exit auto tuning mode once it has calculated new parameters, a process that generally does not take long. But if the process conditions are not suitable, the controller can be taken out of auto tuning mode by clicking Stop Autotuning.
Note that is unlikely that any automatic tuning will by default produce the exact desired response. But properly used, auto tuning can be very helpful.
The autotuner calculates the amplitude and period of oscillation. For a PI controller the values are calculated as follows:
For a PID controller the equations are as follows:
IMC Design

This is an internal model control (IMC) based single-loop controller design method. Effectively, another way of tuning the controller. If values for the process gain, process time constant, process delay, and design Tc (the closed loop time constant) are known, entering them will calculate PID tuning parameters. These values can be determined by doing step testing, as described by numerous authors.
Scheduling

Based on either the PV or SP, it is possible to have three sets of controller tuning parameters and have the controller automatically flip between them.
Alarms

It is possible to define low low, low, high and high high alarms, for the controller PV (process variable), OP (output), SP (setpoint), DV (disturbance variable) and the RS (remote setpoint) signals. These alarms are displayed by the controller in its view as well as in the left bottom status view of Petro-SIM.
The deadband is used to prevent an alarm from going on and off repeatedly if the value varies close to the alarm value.
PV Conditioning

Control signals can fail in numerous ways or be off for some reason or another. The controller can also simulate these failures:
- None - The true PV value is used by the controller.
- Fixed Signal - The PV value fails to a specific value or freezes at the value it has at the time of failure.
- Bias - The PV signal has a fixed offset, or is drifting over time.
In addition, the PV can be sampled only so often and held fixed when not sampled.
Signal Processing

A filter and noise can be applied to a controller signal. The filter effectively repeatedly averages the signal with the filter value over time, depending on the filter time. The noise is randomly added and as such may result in a simulation not being completely reproducible if restarted.
Note that while these may be useful in providing modeling realism, they are not frequently used.
Feed Forward
Feed forward control measures disturbances to improve control. The gain (Kp), time delay, and time constants of the process must be specified.
MPC
Model predictive control, which generally controls all the outputs of a plant section or unit operation, allows for very efficient control, if it has a good model of the process.
The MPC controller in Petro-SIM, which allows experimentation with MPC control, will be supported in future releases.