Wincc Flexible Scripting Weirdness

cotang

Member
Join Date
Aug 2006
Location
calgary
Posts
58
I currently have a script that load on startup that reads maybe 16 values off a DB on my PLC. I take those values and then store them on another DB. I'm doing this for testing. I noticed that once in a while after the script is executed there no values in the destination DB. its like it going "too fast" or not reading it fast enough....

Anyone else encounter something like this?
 
The script is triggered once on form load. or when the HMI starts and loads the first screen. I then trigger a flag on the PLC where by if I leave the screen and come back it won't trigger again. Essentially every time I start the HMI it triggers it once. And sometimes it doesn't load values but run through the rest of the script.
 
Last edited:
Try to change it slightly so that it triggers once a PLC tag is above a limit value. In that way you make sure that the connection to the PLC is established.
 
Interesting topic....

So, what is the best way? I would assume a 'comms working' bit from wincc to the plc and a flank from this in the plc to run the script

How would you generate the comms working?
 
I would set the script to run upon "above limit" on a tag.
The tag point to a PLC address that is constantly set above the limit.
When WinCC Flex RT starts, all tags are assumed zero.
The moment the connection is OK, the tag will be read, and the script will be triggered.
 
I would set the script to run upon "above limit" on a tag.
The tag point to a PLC address that is constantly set above the limit.
When WinCC Flex RT starts, all tags are assumed zero.
The moment the connection is OK, the tag will be read, and the script will be triggered.

I Created a Tag and set the script to trigger on Above Limit and pointed the tag to a DB address with a a constant value that is above limit.

Now when I start it up the first time it works, I get my alarm (that I set so i can see if it triggered) BUT when I exit the Runtime and then start it up again it does not seem to trigger it.
 
That sounds odd.
It would mean that WinCC Flex can remember the state of the tags from the last time it was run.
I really do not understand how that is possible.
Is the alarm generated by a script ? If so, it is not because VBS has crashed on the PC ?
 
Nope, the alarm is generated by the HMI. OR whatever I select it as....

The script runs when it starts up but does'nt show the alarm. So not really an issue...but just weird.
 
Not at work at this moment since its 1am.. but here the break down.

Using Wincc Flexible Professional 2008 and a MP377

TAG_Name: Log_Init
Alarm High Setpoint: 5 (Alarm Custom is Checked.)
DB Value pointed to: 10
Events: On Alarm High Execute Script1

Script1:
Check Folder
If not Exist create
Create file (Have to use the open statement)
Close File
Set Flag for Script 2 to be On
End Script

AS far as I can tell script1 is executed everytime its starts but the alarm doesn't come up the second time. When I hard shut down the HMI and power back up its shows the alarm. So maybe something to do with the alarm buffer or something. I am using the built in message for high alarm so no custom systemerror synatx or anything.

Another thing maybe you might know, is that on my script2 I have an If statement that check for a certain condition before it allows to continue but it seems that it runs the script no matter what.

Script 2: (This gets called every 10 seconds)
If DB150.Flag = 5 then
... do statements
End If
End Script

The HMI seems to execute the IF statement through only on startup, which is so weird..... after everything is connected then it runs properly. So on startup when the PLC is not connected yet. It should see a zero and should NOT go through the IF statement but it does....
 

Similar Topics

When are scripts needed in WinCC Flexible ? I never needed them... I'm asking myself when I ever will need them...
Replies
47
Views
24,468
Hi, We have upgraded our laptop which includes Windows 11. It appears that WinCC flexible 2008 advanced does not support Windows 11. What...
Replies
11
Views
268
Hello everyone I Have an Issue with the usage of recipes in Wincc Flexible 2008, I create the recipe to change the values in a fast way The...
Replies
0
Views
110
Hi colleagues.We do data logging system.We want to record three temperatures under a certain condition. We prepared the project as follows. We do...
Replies
1
Views
759
Hello to everyone. I change the value of a "PQW" with a button in Wincc flexible. The code of the button is defined as M102.0. Value reset...
Replies
10
Views
4,583
Back
Top Bottom