Delay function in WinCC flexible

Hoffelhass

Member
Join Date
Sep 2011
Location
Home
Posts
13
Hello everybody,

I've just started working with WinCC Flexible and have been trying to get a delay or wait function in a script. I've seen the example given on the Siemens site (the one that uses "Now" and an offset), but I need a higher resolution of at least hundreds of milliseconds.
I've seen examples that use ANSI C and C script an WScript but I've been unable to replicate any of these successfully.

Can any of you help me out with this?

Greetings,

Hoffelhass
 
I think I know one way to achieve delay times in WInCC Flex, but I dont have it right here and now. Am traveling at the moment.

Anyway, VBS scripts and anything that has to run with milliseconds resolution is just a bad idea.

What are you trying to achieve ?
 
What I'm trying to achieve is this: when an operator holds down a "+" button, continuously increase a value.
I can't let the script run without a delay, because the value would rise as fast as the CPU could process it (which is obviously much too fast), running it with the example provided by Siemens means the value increases once every second, which is far slower than just pressing the button in rapid succession (which is what I'm trying to avoid).
 
Link how can you implement a wait function (delay) in a script?

Change the script row stoptime = startime + delaytime if you want to run faster than one second.

There is also a simulate tag property but that can only be used on the screen loaded event

Ah! Now I see! That was the example I mentioned in my first post, but I didn't realise that the code "DelayTime/24/3600" translated the value to seconds. By adding an additional /1000 at the end I managed to get a resolution of milliseconds.

Thanks!
 
You didnt write what you wanted to achieve. You wrote part of a possible solution.

IF you mean to increase a value in a PLC tag, then I strongly recommend to avoid doing it by a VBS script. Generally, VBS scripts should not "do" anything except secondary functions such as assisting with visualising something, or logging values, or something else that isnt critical.
There are quite many things to be aware of with VBS.
For example, the VBS script that is linked to in the FAQ will halt all other VBS scripts while the loop is running.

You can do it just as easily in the PLC.
Another tip is: For increasing the value constantly by a HMI pushbutton you should add some safety function in order to catch an eventual error in the HMI. A timeout for the case that the HMI button hangs for example. And/or maximum values to prevent exceeding hard limits, etc.
 
I see your point and thank you for your feedback and tips.

I'm just starting out programming PLCs and WinCC and this was part of me just messing around with WinCC. So not part of a serious project.
 

Similar Topics

Can anyone help with this in Automation Direct Directsoft 6. I am trying to use an input X1 as a busy signal. When X1 comes on I want to have a...
Replies
5
Views
1,793
Hi, i uploaded program from one melsec PLC,in Program timer T1 K20,T2 K100,T3 K250 is given but for timer 11 T11 D8030 is used, what is that ?.it...
Replies
13
Views
6,634
Hi Guys, I tried to put some delays/lag in output of a PID controller in Simatic. But I couldn't find any suitable function block there nor any...
Replies
0
Views
2,161
Build error occurs with TON ladder logic command. Time Input expected on block. Using Integer Tag under Control Local, and then hard number 19...
Replies
2
Views
752
I have an SLC 503 running a machine with a scanner and 1794 RIO. One of the functions is a register motor on a printing cylinder. The manual 3...
Replies
3
Views
1,273
Back
Top Bottom