Totally Integrated Automation Portal Program blocks Main [OB1] Main Properties General Name Main Number Numbering autom
Views 171 Downloads 4 File size 142KB
Totally Integrated Automation Portal
Program blocks Main [OB1] Main Properties General Name Main Number Numbering automatic Information Title "Main Program Sweep (Cy‐ Author cle)" Version 0.1 User-defined ID Name Input
1
Type
OB
Comment
Data type
Default value
Family
Comment
Bool Bool
Initial_Call Remanence Temp Constant
Initial call of this OB =True, if remanent data are available
Network 1: Code for Linking Siemens TIA and Factory IO
%FC9000 "MHJ-PLC-Lab-Function-S71200" EN
Symbol
ENO
Address
Type
Comment
Network 2:
%FC1 "Scaling" EN %ID30 "Tag_5"
Symbol "Tag_5" "Tag_9" "Tag_12"
ENO
SENSOR
Address %ID30 %QD38 %QD42
Scaled_in cm
%QD38 "Tag_9"
Scaled_Sensor
%QD42 "Tag_12"
Type Real Real Real
Comment
Network 3:
%FC3 "Proportional Control Logic" EN
Address %ID30 %QD34 %QD30 %ID34 %ID38
ENO
%ID34 "Tag_8"
Set Point
Drain Valve
%QD34 "Tag_6"
%ID30 "Tag_5"
SENSOR
Filling Valve
%QD30 "Tag_7"
%ID38 "Tag_11"
Symbol "Tag_5" "Tag_6" "Tag_7" "Tag_8" "Tag_11"
Language
Kp
Type Real Real Real Real Real
Comment
LAD
Totally Integrated Automation Portal
Program blocks MHJ-PLC-Lab-Function-S71200 [FC9000] MHJ-PLC-Lab-Function-S71200 Properties General Name MHJ-PLC-Lab-FunctionNumber S71200 Numbering manual Information Title Author Version 0.1 User-defined ID Name Input Output InOut Temp rdTimeReturn outputTime
Data type
UInt USInt USInt USInt USInt USInt USInt UDInt Byte Int Int Byte
CompVal Value_01 Value_01_DW Value_02_DW Return
Byte Byte DWord DWord
0001 0002 0003 0004 0005 0006 0007 0008 0009 0010 0011 0012 0013 0014 0015 0016 0017 0018 0019 0020 0021 0022 0023 0024 0025 0026 0027 0028 0029 0030 0031 0032 0033 0034 0035 0036 0037 0038 0039 0040 0041 0042 0043 0044 0045
Type
Default value
16#34 16#11 16#A165_D992 16#58BE_4401
Void
#Value:=PEEK(area := 16#82, dbNumber := 0, byteOffset := 511); #Value := #Value + 1; POKE(area := 16#82, dbNumber := 0, byteOffset := 511, value := #Value); POKE(area:=16#81, dbNumber:=0, byteOffset:=1016, value:=#Value_01_DW); POKE(area := 16#81, dbNumber := 0, byteOffset := 1020, value := #Value_02_DW); POKE(area := 16#81, dbNumber := 0, byteOffset := 511, value := B#16#00); FOR #forVal := 0 TO 120 DO FOR #forVal_2:=0 TO 10 DO #rdTimeReturn:=RD_SYS_T(#outputTime); #rdTimeReturn := WR_SYS_T(#outputTime); #rdTimeReturn := RD_SYS_T(#outputTime); #rdTimeReturn := WR_SYS_T(#outputTime); END_FOR; #SyncVal:= PEEK(area := 16#81, dbNumber := 0, byteOffset := 511); IF #SyncVal = #CompVal THEN GOTO M_1; END_IF; END_FOR; RETURN; M_1: POKE(area := 16#81, dbNumber := 0, byteOffset := 511,
FC
Comment
Int DTL
YEAR MONTH DAY WEEKDAY HOUR MINUTE SECOND NANOSECOND SyncVal forVal forVal_2 Value Constant
MHJ-PLC-Lab-Function-S71200
9000
Language
Family
Comment
SCL
Totally Integrated Automation Portal
0046 0047 0048 0049 Symbol #CompVal #forVal #forVal_2 #outputTime #rdTimeReturn #SyncVal #Value #Value_01_DW #Value_02_DW
value := B#16#0);
Address 16#34
16#A165_D992 16#58BE_4401
Type Byte Int Int DTL Int Byte Byte DWord DWord
Comment
Totally Integrated Automation Portal
Program blocks Scaling [FC1] Scaling Properties General Name Scaling Numbering automatic Information Title Version 0.1
Number
Type
Author User-defined ID
Name Input
Data type
SENSOR Output
Real
Scaled_in cm Scaled_Sensor InOut Temp
DInt Real
Scaled_in_cm_real Constant Return
Real
FC
Comment
Default value
Comment
//Convert the range 0.0- 10.0 to Percentage 0-100% #Scaled_Sensor := 10.0 * #SENSOR; //Convert the range 0.0- 10.0 to Height range 0-300 cm #Scaled_in_cm_real := #SENSOR * 30.0; #"Scaled_in cm" := REAL_TO_INT(#Scaled_in_cm_real);
Symbol #"Scaled_in cm" #Scaled_in_cm_real #Scaled_Sensor #SENSOR
Address
Type DInt Real Real Real
Language
Family
Void
Scaling
0001 0002 0003 0004 0005 0006 0007
1
Comment
SCL
Totally Integrated Automation Portal
Program blocks Automation Control (ON/OFF) [FC2] Automation Control (ON/OFF) Properties General Name Automation Control (ON/ Number OFF) Numbering automatic Information Title Author Version 0.1 User-defined ID Name Input
Data type
Level in Percentage Drain Button Output
Real Bool
Fill Valve Drain Valve InOut Temp Constant Return
Real Real
Automation Control (ON/OFF)
0001 0002 0003 0004 0005 0006 0007 0008 0009 0010 0011 0012 0013 0014 0015 0016 0017 0018 0019
2
Type
FC
Language
Comment
Default value
Family
Comment
Void
//IF tank level is < 40% = Fill Valve Opening 100% //IF tank level is > 40% AND < 80% = Fill Valve Opening 50% //IF tank level is > 80% = Fill Valve Opening 0% IF #"Level in Percentage" < 40.0 THEN #"Fill Valve" := 10.0; // Statement section IF ELSIF #"Level in Percentage" > 40.0 AND #"Level in Percentage" < 80.0 #"Fill Valve" := 5.0; // Statement section ELSIF ELSIF #"Level in Percentage" > 80.0 THEN #"Fill Valve" := 0.0;// Statement section ELSE END_IF; //Use Toggle button TO drain the level (at 50% flow rate) IF #"Drain Button" = 1 THEN #"Drain Valve" := 5.0; END_IF;
Symbol #"Drain Button" #"Drain Valve" #"Fill Valve" #"Level in Percentage"
Address
Type Bool Real Real Real
Comment
THEN
SCL
Totally Integrated Automation Portal
Program blocks Proportional Control Logic [FC3] Proportional Control Logic Properties General Name Proportional Control Logic Number Numbering automatic Information Title Author Version 0.1 User-defined ID Name Input
Data type
Set Point SENSOR Kp Output
Real Real Real
Drain Valve Filling Valve InOut Temp
Real Real
error kpp u Constant Return
Real Real Real
3
Type
FC
Comment
Default value
Language
SCL
Family
Comment
Proportional Gain
proportional gain
Void
Proportional Control Logic
0001 // Input ID38 0-10.0 == 1 to 10 0002 // Scaling Formulae 0003 // Scaled Output = ((Output Max - Output Min)*(Input to be scaled - Input min.))/(Input max - Input min) + Output Min. 0004 // In our case: 0005 // Input Min = 0, Input Max = 10, Output min = 1, 0006 // Output Max = 10 and Input to be scaled is Kp (Proportional gain from Pot) 0007 #kpp := (((10.0 - 1.0)/(10.0 - 0.0))*(#Kp - 0.0))+ 1.0; 0008 0009 //Error 0010 #error := #"Set Point" - #SENSOR; 0011 0012 //Proportional Control 0013 #u := #error * #kpp; 0014 0015 //Output 0016 #"Filling Valve" := #u; 0017 #"Drain Valve" := - #u; // SP = 50% and Level is 100% 0018 0019 Symbol #"Drain Valve" #"Filling Valve" #"Set Point" #error #Kp #kpp #SENSOR #u
Address
Type Real Real Real Real Real Real Real Real
Comment
Proportional Gain proportional gain
Totally Integrated Automation Portal
Program blocks / System blocks Program resources This folder is empty.