Siemens PLC Programming Help

yogi.g2982

Member
Join Date
Jun 2012
Location
Pune
Posts
2
Hi all Expert,

I need help to develop PLC code. I have 11 no. of process tank in each tank thier is some process operation e.g Heater on/off,Temp.setpoint and Drain Valve on/off.For this process I want to use 5 no. of receipe in that receipe 3 no. of parameters setting is requied plz see below example for receipe-1.

for example Receipe-1 parameter Setting..


Tank Temp. Heater On/off Drain Valve On/off
Set point Selection Selection

Tank-1 50 0n off
Tank-2 60 on off
Tank-3 56 on on
Tank-4 67 on on
Tank-5 98 off off
Tank-6 102 off off
Tank-7 23 on on
Tank-8 14 on on
Tank-9 35 off off
Tank-10 67 off off
Tank-11 88 on on
Tank-12 56 on on


for remaining 2,3,4 and 5 receipes thier will be diferent setting like Temp set point,Heater on/off Selection and darin on/off selection it is totaly depend on process requirment.


Please help to How to write above PLC code.

Waiting for your positive reply.


Regards,

Yogendra G.
 
Hi all Expert,

I need help to develop PLC code. I have 11 no. of process tank in each tank thier is some process operation e.g Heater on/off,Temp.setpoint and Drain Valve on/off.For this process I want to use 5 no. of receipe in that receipe 3 no. of parameters setting is requied

Waiting for your positive reply.


Regards,

Yogendra G.

To start with -

Which Siemens PLC? Which HMI?
First list all the parameters that you will need for one tank, include any tolerance (+/-) parameters.
Decide if these parameters are to be duplicated across all tanks - or do certain tanks require different parameters?.
Then look at the recipe function within the HMI.

Decide which memory area of the PLC, the HMI recipe function will store the recipe information - DB etc
 
Last edited:
Example SCL implementation:

Code:
TYPE UDT1
    STRUCT
    TemperatureSetPoint:REAL;
    Heater:BOOL;
    DrainValve:BOOL;
    END_STRUCT
END_TYPE
TYPE UDT2
    STRUCT
    Tank:ARRAY[1..11] OF udt1;
    END_STRUCT
END_TYPE
TYPE udt3
     STRUCT
     Recipe:ARRAY[1..5] OF udt2;
     END_STRUCT
end_type

DATA_BLOCK DB1
    STRUCT
    Process:udt3;
    END_STRUCT
BEGIN
Process.Recipe[1].Tank[1].TemperatureSetPoint:=11.0;
Process.Recipe[1].Tank[1].Heater:=True;
Process.Recipe[1].Tank[1].DrainValve:=False;
Process.Recipe[1].Tank[2].TemperatureSetPoint:=12.0;
Process.Recipe[1].Tank[2].Heater:=True;
Process.Recipe[1].Tank[2].DrainValve:=True;
Process.Recipe[1].Tank[3].TemperatureSetPoint:=13.0;
Process.Recipe[1].Tank[3].Heater:=False;
Process.Recipe[1].Tank[3].DrainValve:=False;

Process.Recipe[2].Tank[1].TemperatureSetPoint:=21.0;
Process.Recipe[2].Tank[1].Heater:=True;
Process.Recipe[2].Tank[1].DrainValve:=true;
Process.Recipe[2].Tank[2].TemperatureSetPoint:=22.0;
Process.Recipe[2].Tank[2].Heater:=False;
Process.Recipe[2].Tank[2].DrainValve:=True;
Process.Recipe[2].Tank[3].TemperatureSetPoint:=23.0;
Process.Recipe[2].Tank[3].Heater:=False;
Process.Recipe[2].Tank[3].DrainValve:=True;
 
END_DATA_BLOCK

FUNCTION_Block FB1
VAR_INPUT
    Recipe:udt2;
    Tank:INT;
END_VAR
VAR_OUTPUT
TemperatureSetPointQ:int;
HeaterQ:BOOL;
DrainValveQ:BOOL;
END_VAR
TemperaturesetpointQ:=REAL_TO_INT(Recipe.Tank[Tank].TemperatureSetPoint);
HeaterQ:=Recipe.Tank[Tank].Heater;
DrainValveQ:=Recipe.Tank[Tank].DrainValve;
END_FUNCTION_BLOCK
FUNCTION_BLOCK FB2
VAR_INPUT
    Process:udt3;
    Recipe:INT;
END_VAR
VAR
fbTank1:fb1;
fbTank2:fb1;
fbTank3:fb1;
fbTank4:fb1;
fbTank5:fb1;
fbTank6:fb1;
fbTank7:fb1;
fbTank8:fb1;
fbTank9:fb1;
fbTank10:fb1;
fbTank11:fb1;
END_VAR
fbTank1(Recipe:=Process.recipe[Recipe],Tank:=1);
fbTank2(Recipe:=Process.recipe[Recipe],Tank:=2);
fbTank3(Recipe:=Process.recipe[Recipe],Tank:=3);
fbTank4(Recipe:=Process.recipe[Recipe],Tank:=4);
fbTank5(Recipe:=Process.recipe[Recipe],Tank:=5);
fbTank6(Recipe:=Process.recipe[Recipe],Tank:=6);
fbTank7(Recipe:=Process.recipe[Recipe],Tank:=7);
fbTank8(Recipe:=Process.recipe[Recipe],Tank:=8);
fbTank9(Recipe:=Process.recipe[Recipe],Tank:=9);
fbTank10(Recipe:=Process.recipe[Recipe],Tank:=10);
fbTank11(Recipe:=Process.recipe[Recipe],Tank:=11);
MW256:=INT_TO_WORD(fbTank1.TemperatureSetpointQ); 
Q0.0:=fbTank1.HeaterQ;
Q0.1:=fbTank1.DrainValveQ;
MW258:=INT_TO_WORD(fbTank2.TemperatureSetpointQ); 
Q1.0:=fbTank2.HeaterQ;
Q1.1:=fbTank2.DrainValveQ;
MW260:=INT_TO_WORD(fbTank3.TemperatureSetpointQ); 
Q2.0:=fbTank3.HeaterQ;
Q2.1:=fbTank3.DrainValveQ;
//..continue allocation fo i/o here
END_FUNCTION_BLOCK
DATA_BLOCK DB2  FB2
BEGIN
END_DATA_BLOCK

ORGANIZATION_BLOCK OB1
VAR_TEMP
    // Reserved
    info : ARRAY[0..19] OF BYTE;
    // Temporary Variables
END_VAR
FB2.DB2(Process:=DB1.Process, Recipe:=1); 
END_ORGANIZATION_BLOCK
 

Similar Topics

Hi, There's a problem I face with upgrading the OS from XP which has the Step 7 Lite installed to windows 10. As I can't use a cracked version of...
Replies
2
Views
626
Hi there, I have three pumps, I have to start first pump for 8 minute and after that it should be turned off and other one start simultaneously...
Replies
11
Views
1,860
Hi Sir, I am using S7-300/400. I am usually using FC 03 and FC04 to transfer (R/W) bool values by moving them DBs. However i want to R/W bool...
Replies
1
Views
2,064
Hello, Maybe topic does not describe the best what do I want but I will try to explain it now. I'll post this to HARDWARE and SOFTWARE section...
Replies
4
Views
2,499
Hello, So, I am working on improving my PLC knowledge at my new employer. We have well over 25 Siemens brains, Each with at least one HMI and all...
Replies
10
Views
3,199
Back
Top Bottom