Controlling temperature with a got exchanger through a modulating valve in chemical industry

Controlling temperature with a got exchanger through a modulating valve in chemical industry

Introduction

In industrial applications, the need to control temperature is usual. A typical element used and designed with this purpose is the hot exchanger, which interchanges two or more fluids with different temperatures.
Ardbox PID loopIn this post we are going to explain how to implement a temperature control through a modulating valve that will regulate the amount of steam that enters the hot exchanger, in order to heat the chemical process. To fulfill the specified requirements, Opiron electronics has developed a PID algorithm which will run on the Ardbox PLC from Industrialshields. Hot Exchanger Logic

Obviously, the main purpose of the aglorithm that we are going to make is a program to control the temperature of the pipe where the chemical process flows.  The element that will give us the chance to regulate the temperature is a modulating valve that has an analog input interface (0 / 10 Vdc) where we are going to send the setpoint from our PLC.

The modulating valve will control the amount of steam that flows to the pipe, and therefore the temperature (the more amount of steam we send, the more temperature there is in the pipe).

To control the temperature, we will use a PID algorithm and a temperature sensor as the input. However, there are other elementary elements to program:

  • valve open / close
  • pump on / off

These will be used from a process safety point of view: basically, if the temperature of the process is out of the limits (>80 ºC).

See below the developed code by Opiron:

2014111_arduino_code

 

// Industrial Shields by BOOT & WORK CORP.
// Powered by Opiron Electronics -www.opiron.com-
// Jan.2015 technical information for newsletter
// This sketch demonstrates how to use a PID with 
// an ARDBOX ANALOG PLC. The sketch is inspired in a
// real project of a chemical plant, where we have to 
// control the temperature of a pipe.
// PID explanation: The purpose of the pid is to 
// control a loop with a temperature sensor and
// a modulating valve. The modulating valve has 
// an analog input where we can send the setpoint
// Keywords: PID, industrial automation, modulating valve
/////////////////////////////////
//// PLC: ARDBOX ANALOG MODULE///
//// Number of Digital inputs: 2  
//// Number of Digital outputs: 3
//// Number of Analog inputs: 1
//// Number of Analog outputs: 1
//// you need to configurate the correctly switch position for running like digital / analog or PWM mode.
//////////////////////////////
//// Ardbox Pins Used:
//// Q0.9 --- PIN 0 --- Digital Output (24Vdc) --- Start / Stop pump
//// Q0.8 --- PIN 1 --- Digital Output (24Vdc) --- Open / Close feeding valve
//// Q0.7 --- PIN 7 --- Digital Output (24Vdc) --- Light alarm indicator
//// I0.3 --- PIN 4 --- Digital Input (24Vdc)  --- Pump runs confirmation 
//// I0.2 --- PIN 8 --- Digital Input (24Vdc)  --- Feed Valve Opened Ok
//// I0.9 --- PIN A0 --- Analog Input (0/10Vdc) --- Feeding Temperature signal
//// Q0.6 --- PIN A3 --- Analog Output (0/10Vdc) --- Setpoint to Modulating Valve

//libraries
#include 

//Pins defintion
#define Pump_Output 0        // Start / Stop pump
#define Valve_Output 1       // Open / Close feeding valve
#define Light  7             // 1 = Red (alarm) / 0 = false (Ok)
#define Pump_Input 4         // Pump Runs Ok
#define Valve_Input 8        // Feed Valve Opened Ok
#define Temperature A0       // Feed Temperature (after PID)
#define ModulatingValve A3   // Setpoint to Modulating Valve

// Other constants
#define HighTemp  80
#define LowTemp  40
#define intervalValve 10000
#define intervalPump 10000
#define intervalTemperature 60000

// Variables
unsigned long Valvetime;            // We use time to check if Valve opens when we have sent an Open Order
double Setpoint, Input, Output;     // PID Values
double kp = 2.5, ki = 30.3, kd = 5.1;         
unsigned long PIDwindowStartTime;   // Use it to compare PID Window Time
unsigned long PumpwindowStartTime;  // Use it to compare Valve Opening time
unsigned long ValvewindowStartTime; // Use it to compare Valve Opening time
unsigned long TemperaturewindowStartTime; // Use it to compare Temperature out of range
boolean valvefail;                  // 0 = Valve OK, 1 = Valve fails
boolean pumpfail;                   // 0 = Pump OK, 1 = Pump fails
boolean tempfail;                   // 0 = Temp OK, 1 = Temp fails

// Objects
PID TemperaturePID(&Input, &Output, &Setpoint,kp,ki,kd, DIRECT);

void setup() 
{ //Configuration is here:

  //Pin settings
  pinMode(Pump_Output, OUTPUT);
  pinMode(Valve_Output,OUTPUT);
  pinMode(Light,OUTPUT);
  pinMode(Pump_Input,INPUT);
  pinMode(Valve_Input,INPUT);

  // turn the PID on
  TemperaturePID.SetMode(AUTOMATIC);
  Setpoint=60;

  // Ini variables
  valvefail=0;
  pumpfail=0;
  tempfail=0;

} // End setup

void loop() {    // The code in loop() runs repeatedly:

if (tempfail)   // Alarms check I: tempfail
{
  digitalWrite(Pump_Output,LOW);
  digitalWrite(Valve_Output,LOW);
  digitalWrite(Light,HIGH);
}

else if (valvefail) // Alarms check II: Valve can't be opened
{
  digitalWrite(Pump_Output,LOW);
  digitalWrite(Valve_Output,LOW);
  digitalWrite(Light,HIGH);
}

else if (pumpfail) // Alarms check II: Pump doesn't start properly
{
  digitalWrite(Pump_Output,LOW);
  digitalWrite(Valve_Output,LOW);
  digitalWrite(Light,HIGH);
}

else 
  {
    digitalWrite(Pump_Output,HIGH);
    digitalWrite(Valve_Output,HIGH);
    digitalWrite(Light,LOW);
    Input = analogRead(Temperature);
    if (Input> HighTemp || Input < LowTemp)     {     if(millis() - TemperaturewindowStartTime>intervalTemperature)  //We count 1 minute             
    { 
      TemperaturewindowStartTime += intervalTemperature;
      tempfail=1;
    }
    }
    else
    {
      tempfail=0;
    }
    TemperaturePID.Compute();
    analogWrite(ModulatingValve, Output);
    if (Pump_Input==0)    //We wait for the Opened confirmation from the valve
    {
    if(millis() - PumpwindowStartTime>intervalPump)  //We count 10s until the Valve is Opened. If the Valve doesn't return the opened confirmation, we send an alarm                
    { 
      PumpwindowStartTime += intervalPump;
      pumpfail=1;
    }
   } // end If Pump_Input
   else if (Pump_Input==1)
   {
    pumpfail=0;  
   } // end Valve_Input==1
    if (Valve_Input==0)    //We wait for the Opened confirmation from the valve
    {
    if(millis() - ValvewindowStartTime>intervalValve)  //We count 10s until the Valve is Opened. If the Valve doesn't return the opened confirmation, we send an alarm                
    { 
      ValvewindowStartTime += intervalValve;
      valvefail=1;
    }
   } // end If Valve_Input
   else if (Valve_Input==1)
   {
    valvefail=0;  
   } // end Valve_Input==1

  } // end else, normal conditions
} // end loop
POWERED BY OPIRON ELECTRONICS

 

Comments are closed.