Skip to Content

Project 1

We will make a project for liqiuid level control using PID Controller In TIA Portal, make a Dashboard in Ignition SCADA, take the data in MY SQL to analyze it And simulate the whole enviroment in Factroy IO.

We will only use OPC UA Communication Protocol to cummunicate with Factory IO and Igniton SCADA

No REAL Hardware is Requird, we will simulate the PLC program in PLCsim Advanced

What we will learn in this Process?

  1. Ladder Logic
  2. TIA Portal
  3. PID Controller
  4. Making OPC UA Connections
  5. Making Dashboard in Ignition SCADA
  6. Data Logging in MY SQL through Ignition
  7. Simulating Industrial Process in Factory IO
  8. Making Real Schematic Diagram for the Circuit Requird


Industrial Scenario: Maintaining Level in a Chemical Reactor (CSTR)

A Continuous Stirred-Tank Reactor (CSTR) is widely used in the chemical, pharmaceutical, and wastewater treatment industries.

1. The Challenge

The reactor's contents (reactants) need to be kept at a very precise and constant volume (level) to ensure a stable reaction rate, consistent product quality, and prevent the pump that feeds the next process step from running dry or the tank from overflowing.

ComponentRole
Controlled Variable (PV)The actual liquid level  inside the CSTR.
Setpoint (SP)The desired liquid level.
Manipulated Variable (MV)The opening/closing position of the outlet valve which controls the flow rate out of the tank.
Disturbance VariableThe inlet flow rate, which often fluctuates due to upstream processes.
ControllerThe PID controller continuously calculates the required change in the outlet valve position.

 

Why a PID Controller is Needed

Simple On/Off control (like a toilet float) is too aggressive and causes constant large swings (oscillations). A PID controller provides stability and precision:

  • P (Proportional): Provides an immediate, large response to a large error (level is far from the setpoint). For example, if the level suddenly rises, it immediately opens the outlet valve proportionally wider.

  • I (Integral): Eliminates steady-state error (the offset). If the level consistently settles slightly above the setpoint (P alone often can't eliminate this), the Integral action will slowly, but surely, continue to open the valve until the error is zero. This is crucial for precise level control.

  • D (Derivative): Provides a dampening action. It responds to the rate of change of the error. If the level is falling extremely fast, the D term will quickly close the valve a bit to prevent a rapid drop below the setpoint (overshoot or undershoot).

The Control Action

  • A Level Transmitter (sensor) continuously measures the current liquid level .7

  • The PID controller calculates the error.

  • The controller calculates a new output value (the $MV$) based on the P, I, and D actions:

A Screenshot from Factroy IO

Softwares required for this project


  1. TIA Protal V16
  2. PLCSim Advanced V4
  3. Factory IO
  4. MY SQL
  5. Ignition SCADA

PC is also Important for simulating all of the above simultaniously, so i5 with SSD is enough, but i am simulating all of it in i3-6006U CPU and 8GB of RAM

Let's start with Making ladder logic in TIA Portal
Only 4 networks need to be created to make the project working
WE used sms suffix after the tag to browse the tag easily in factroy io through opc ua protocol

Now create new project in tia portal v16 give it any name, then select 1516-3-PN/DP , Article no 6ES7 516-3AN02-0AB0, which will support opc ua simulation
Let's Assign IP Address in Device configuration

Now right click on project name and go to properties to enable the simulation support

The Main OB Network to be created is following
Then Click on "Add new block" and create a cyclic interrupt and in that create the following program


Now Start the PLC Sim Advanced V4 and turn on the virtual ethernet adaptor 

Now go to TIA Portal and click on " Go Online" than it will ask to assign PG/PC interface address so do it and again click on "Go Offline" than click on program block, compile the program , The Download icon will be enebled, Download the program and start the module.
Now some settings need to be done for PID Controller to perform the required task, so you can directly click on the cofiguration icon on PID block in ladder logic or You can go to your project -- Technology Object --- PID Compact --- Configuration





Now to communicate with other software, you need to enable the OPC UA server , so go to Divice configuration of plc and under opc ua server activate it
The endpoint URL for OPC UA server is very important here , we will leave everything as it is and go to last option "runtime licences" and select a requird licence

Now again Compile and download the program, and click on eye glass like icon which enebles monitoring of program  now go to Factory IO
Create new project, click on file then driver and select the OPC DA/UA driver


Now click on configuration paste the endpoint url of opc ua "opc.tcp://192.168.0.10:4840" in host, Now click on browse server and select the server, now we have written sms as suffix in our tag write sms in "Filter name that contain" ,and than again click browse, then go back and you will see all your tags


You can see how i mapped everything 

Now we will see the hardware required in factroy io
You need two Display , one cycinder , on start push button and one stop push button, and one potentiometer

set the both display property to integer and other things will remain as it is 


Now click on play icon above and then  start push button in factory io 

now gently rotate the potentiometer in factory io you will see change in level of liquid, now change the value of discharge value , you will observe level of liquid remain constant, this is called pid operation, the level of liquid will remin constant irrespective of opening of discharge valve

Now we will make a dashboard in ignitition scada to visualise the data, to do so, Install the ignition scada and its components first from given link or official website, Now create a opc ua connection with plcsim advanced ethernt adapter, also we will use this connection to log data into MYSql,
Now launch ignition Designer and create new opc ua standered tags with same data type and similar name, which is required to design the dashboard
Here you can observe i created all the tag required for dashboard, the neuroread you see is memory tag which is not used anywhere so don't worry

Now here you can see the whole dashboard that i created, you can edit the properties of each element by double clicking or using left side down window, and assign tags by simply dragging the tag to that element

Now we made a dashboard from where we can control our factory, now its time to process the data that we get from production, like how much liquid level was there for how much time, and we can do some math calculation with data also for improving the efficiency of plant 
To do that we will install MYSql in our PC and create a Database connection with ignition scada 
First go to settings of database 

Now select the jar file that you have download from the link and select the driver type mysql

Now we will go to http://localhost:8088/app/connections/databases and create a database connection

now put username and password of my sql there, now here you can see every table will be created in "world" database from now


Now go to Designer and create a new transaction group

here i have alreay created a group "my sql"
so right click on the space and create new opc item

Than write a data name , select data type that need to be logged ,and select the path by clicking on plc like icon , and selecting opc ua server
now 

Now do the settings like this for now  and save the project and eneble the group 
Now go to MYSql to see if data is really logging or not 

You can see data is logging successfully, now lets turn on factroy io and see the liquid level change 


You can clearly observe here the change, by changing the set point pid controller keep adjusting the liquid level