Assignment 2 Code
Assignment 2 Code
Assignment 2 Code
Automation Portal
Reset input --- Adapter name the HscChannel.AddressString Adapter name the HscChannel.SpeedAndSourceDis‐
user control should user control should play
use for the address use for the Spee‐
string dAndSourceDisplay
Adapter name the HscChannel.OutputSource
user control should
use for the Output
Source
High speed counters (HSC)\HSC4\Hardware inputs\
Direction input --- HSCInput1_Status 1 Clock generator in‐ ---
put
Reset input --- Adapter name the HscChannel.AddressString Adapter name the HscChannel.SpeedAndSourceDis‐
user control should user control should play
use for the address use for the Spee‐
string dAndSourceDisplay
Adapter name the HscChannel.OutputSource
user control should
use for the Output
Source
High speed counters (HSC)\HSC4\Hardware inputs\
Reset input --- HSCInput2_Status 1 Clock generator in‐ ---
put
Direction input --- Adapter name the HscChannel.AddressString Adapter name the HscChannel.SpeedAndSourceDis‐
user control should user control should play
use for the address use for the Spee‐
string dAndSourceDisplay
Adapter name the HscChannel.OutputSource
user control should
use for the Output
Source
High speed counters (HSC)\HSC4\I/O addresses\Input addresses
Start address 1012 End address 1015 Organization block 0
Process image 0
High speed counters (HSC)\HSC4\Hardware identifier\Hardware identifier
Hardware identifier 260
High speed counters (HSC)\HSC5\General\Enable
Enable this high 0
speed counter
High speed counters (HSC)\HSC5\General\Project information
Name HSC_5 Comment
High speed counters (HSC)\HSC5\Function
Type of counting Count Operating phase Single phase
Counting direction User program (internal direction Initial counting di‐ Count up
is specified by control) rection
Frequency measur‐ -/-sec
ing period
High speed counters (HSC)\HSC5\Reset to initial values\Reset values
Initial counter value 0 Initial reference val‐ 0
ue
High speed counters (HSC)\HSC5\Reset to initial values\Reset options
Use external reset 0 Reset signal level -/-
input
High speed counters (HSC)\HSC5\Event configuration\
Generate interrupt 0 RidPrefixCvEqualsPv 49152 Event name: 0
for counter value
equals reference
value event.
Hardware interrupt: 0 Counter value equal Counter value equal to reference ValueNull 0
to reference value4 value4
ValueNull 0 EventPriority 6
High speed counters (HSC)\HSC5\Event configuration\
Generate interrupt 0 RidPrefixExternalRe‐ 49408 Event name: 0
for external reset set
event.
Hardware interrupt: 0 External reset4 External reset4 ValueNull 0
ValueNull 0 EventPriority 6
High speed counters (HSC)\HSC5\Event configuration\
Generate interrupt 0 RidPrefixDirection‐ 49280 Event name: 0
for change of direc‐ Change
tion event.
Hardware interrupt: 0 Change of direc‐ Change of direction4 ValueNull 0
tion4
ValueNull 0 EventPriority 6
High speed counters (HSC)\HSC5\Hardware inputs\
Clock generator in‐ --- HSCInput0_Status 1 Direction input ---
put
Reset input --- Adapter name the HscChannel.AddressString Adapter name the HscChannel.SpeedAndSourceDis‐
user control should user control should play
use for the address use for the Spee‐
string dAndSourceDisplay
Adapter name the HscChannel.OutputSource
user control should
use for the Output
Source
High speed counters (HSC)\HSC5\Hardware inputs\
Direction input --- HSCInput1_Status 1 Clock generator in‐ ---
put
Reset input --- Adapter name the HscChannel.AddressString Adapter name the HscChannel.SpeedAndSourceDis‐
user control should user control should play
use for the address use for the Spee‐
string dAndSourceDisplay
Adapter name the HscChannel.OutputSource
user control should
use for the Output
Source
Totally Integrated
Automation Portal
%FC9000
"MHJ-PLC-Lab-Function-S71200"
EN ENO
Network 2:
%FC1
"Scaling"
EN ENO
%ID30 %QD38
"Tag_5" SENSOR Scaled_in cm "Tag_9"
%QD42
Scaled_Sensor "Tag_12"
Network 3:
%FC3
"Proportional Control Logic"
EN ENO
%MD40 %QD34
"Tag_13" Set Point Drain Valve "Tag_6"
%ID30 %MD50
"Tag_5" SENSOR error_display "Tag_15"
%M100.0 %QD30
"Tag_16" Manual button Filling Valve "Tag_7"
%MD55
"Tag_17" Filling_manual
%MD60 Draining_
"Tag_18" manual
%MD45
"Tag_14" Kp
0001
0002 #Value:=PEEK(area := 16#82,
0003 dbNumber := 0,
0004 byteOffset := 511);
0005 #Value := #Value + 1;
0006
0007 POKE(area := 16#82,
0008 dbNumber := 0,
0009 byteOffset := 511,
0010 value := #Value);
0011
0012 POKE(area:=16#81,
0013 dbNumber:=0,
0014 byteOffset:=1016,
0015 value:=#Value_01_DW);
0016 POKE(area := 16#81,
0017 dbNumber := 0,
0018 byteOffset := 1020,
0019 value := #Value_02_DW);
0020
0021 POKE(area := 16#81,
0022 dbNumber := 0,
0023 byteOffset := 511,
0024 value := B#16#00);
0025
0026 FOR #forVal := 0 TO 120 DO
0027 FOR #forVal_2:=0 TO 10 DO
0028 #rdTimeReturn:=RD_SYS_T(#outputTime);
0029 #rdTimeReturn := WR_SYS_T(#outputTime);
0030 #rdTimeReturn := RD_SYS_T(#outputTime);
0031 #rdTimeReturn := WR_SYS_T(#outputTime);
0032 END_FOR;
0033 #SyncVal:= PEEK(area := 16#81,
0034 dbNumber := 0,
0035 byteOffset := 511);
0036 IF #SyncVal = #CompVal THEN
0037 GOTO M_1;
0038 END_IF;
0039 END_FOR;
0040 RETURN;
0041
0042 M_1:
0043 POKE(area := 16#81,
0044 dbNumber := 0,
0045 byteOffset := 511,
Totally Integrated
Automation Portal
0001 //IF tank level is < 40% = Fill Valve Opening 100%
0002 //IF tank level is > 40% AND < 80% = Fill Valve Opening 50%
0003 //IF tank level is > 80% = Fill Valve Opening 0%
0004
0005 IF #"Level in Percentage" < 40.0 THEN
0006 #"Fill Valve" := 10.0; // Statement section IF
0007
0008 ELSIF #"Level in Percentage" > 40.0 AND #"Level in Percentage" < 80.0 THEN
0009 #"Fill Valve" := 5.0; // Statement section ELSIF
0010
0011 ELSIF #"Level in Percentage" > 80.0 THEN
0012 #"Fill Valve" := 0.0;// Statement section ELSE
0013
0014 END_IF;
0015
0016 //Use Toggle button TO drain the level (at 50% flow rate)
0017 IF #"Drain Button" = 1 THEN
0018 #"Drain Valve" := 5.0;
0019 END_IF;
0053
0054