Professional Documents
Culture Documents
Task 9 - Description: Wincc V7
Task 9 - Description: Wincc V7
TASK 9 - DESCRIPTION
SIMULATION SCRIPT
We have done step-by step a simple SCADA System for water treatment
system. Anyway now we make some fun and create simulation in SCADA's
scripts so we can train our skills what we have learned during WinCC
SCADA Level1 course and we can make our visualization alive.
We could use also button with vbscript or global action to get same result =
script running.
hmiruntime.Tags("SIMULATION").Write(1)
After that in script we put some Dim and into this prepared tags we read
values from analog signals from system (flow1, flow2 and tank_level)
Dim flow1
flow1 = HMIRuntime.Tags("Flow1.VALUE").read
Dim flow2
flow2 = HMIRuntime.Tags("Flow2.VALUE").read
Dim level
level = HMIRuntime.Tags("Tank_level.VALUE").read
Below script's fragment is preparing data for out Depth_pump. Every time
we turn ON this pump script is changing speed value to display on screen.
If this pump is running we can also simulate flow counting. Look if flow
values is less than 60 we just adding 1 to show progress and if our flow is
greater we take 6 to make our simulations looks "live".
After calculation script is updating Flow1.Value to show this on screen and
log data to archiving system.
if HMIRuntime.Tags("Depth_pump.STATUS").Read = 1 Then
HMIRuntime.Tags("Depth_pump.OUT_PV").Write(100)
If flow1 < 60 Then
flow1 = flow1+1
Else
flow1 = flow1-6
End If
HMIRuntime.Tags("Flow1.VALUE").Write(flow1)
if our depth pump is not running we have 2 lines to make .STATUS =0 and
Flow1 = 0 (to show our depth_pump is OFF on screen).
In our situation os simulation water_pump should work always.
If HMIRuntime.Tags("Water_pump.STATUS").Read = 1 Then
HMIRuntime.Tags("Flow2.VALUE").Write(flow1)
Else
HMIRuntime.Tags("Flow2.VALUE").Write(0)
End If
Else
HMIRuntime.Tags("Depth_pump.OUT_PV").Write(0)
HMIRuntime.Tags("Flow1.VALUE").Write(0)
End If
HMIRuntime.Tags("Water_pump.STATUS").write(1)
'HMIRuntime.Tags("Water_pump.OUT_PV").Write(100)
Script below is changing valves status to mak water flow in pipes. So if we
have enough flow in flow1 we set aerator ON and OPEN 2 vales.
If (HMIRuntime.Tags("F1_Z1.STATUS").Read And
HMIRuntime.Tags("F1_Z4.STATUS").read ) Then
If level < 9000 Then
level = level + 90
End If
HMIRuntime.Tags("Tank_level.VALUE").write(level)
End If
If HMIRuntime.Tags("Depth_pump.ALARM").Read = 1 Then
HMIRuntime.Tags("Depth_pump.STATUS").Write(0)
End If
If HMIRuntime.Tags("Aerator.ALARM").Read = 1 Then
HMIRuntime.Tags("Aerator.STATUS").Write(0)
End If
If HMIRuntime.Tags("Air.ALARM").Read = 1 Then
HMIRuntime.Tags("Air.STATUS").Write(0)
End If
If HMIRuntime.Tags("Purging_pump.ALARM").Read = 1 Then
HMIRuntime.Tags("Purging_pump.STATUS").Write(0)
End If
If HMIRuntime.Tags("Severs_pump.ALARM").Read = 1 Then
HMIRuntime.Tags("Severs_pump.STATUS").Write(0)
End If
If HMIRuntime.Tags("Water_pump.ALARM").Read = 1 Then
HMIRuntime.Tags("Water_pump.STATUS").Write(0)
End If
FULL SCRIPT:
hmiruntime.Tags("SIMULATION").Write(1)
Dim flow1
flow1 = HMIRuntime.Tags("Flow1.VALUE").read
Dim flow2
flow2 = HMIRuntime.Tags("Flow2.VALUE").read
Dim level
level = HMIRuntime.Tags("Tank_level.VALUE").read
If HMIRuntime.Tags("Depth_pump.STATUS").Read = 1 Then
HMIRuntime.Tags("Depth_pump.OUT_PV").Write(100)
If flow1 < 60 Then
flow1 = flow1+1
Else
flow1 = flow1-6
End If
HMIRuntime.Tags("Flow1.VALUE").Write(flow1)
If HMIRuntime.Tags("Water_pump.STATUS").Read = 1 Then
HMIRuntime.Tags("Flow2.VALUE").Write(flow1)
Else
HMIRuntime.Tags("Flow2.VALUE").Write(0)
End If
Else
HMIRuntime.Tags("Depth_pump.OUT_PV").Write(0)
HMIRuntime.Tags("Flow1.VALUE").Write(0)
End If
HMIRuntime.Tags("Water_pump.STATUS").write(1)
'HMIRuntime.Tags("Water_pump.OUT_PV").Write(100)
If HMIRuntime.Tags("Depth_pump.ALARM").Read = 1 Then
HMIRuntime.Tags("Depth_pump.STATUS").Write(0)
End If
If HMIRuntime.Tags("Aerator.ALARM").Read = 1 Then
HMIRuntime.Tags("Aerator.STATUS").Write(0)
End If
If HMIRuntime.Tags("Air.ALARM").Read = 1 Then
HMIRuntime.Tags("Air.STATUS").Write(0)
End If
If HMIRuntime.Tags("Purging_pump.ALARM").Read = 1 Then
HMIRuntime.Tags("Purging_pump.STATUS").Write(0)
End If
If HMIRuntime.Tags("Severs_pump.ALARM").Read = 1 Then
HMIRuntime.Tags("Severs_pump.STATUS").Write(0)
End If
If HMIRuntime.Tags("Water_pump.ALARM").Read = 1 Then
HMIRuntime.Tags("Water_pump.STATUS").Write(0)
End If