I want to try VBS programming in WINCC6.2 and calculate the real-time bad rate of production equipment. I have two plc variables: a1 (unsigned32int), a2 (unsigned16int), and WINCC6.2 script variable a3 (scripttagfloat32). I want to calculate once every minute: a3=a2/a1*100. How can VBS be programmed to achieve this function? Kenwood Portable Radio,Kenwood Vhf Handheld Radio,Kenwood Dual Band Portable Radio,Kenwood Vhf Portable Radio Guangzhou Etmy Technology Co., Ltd. , https://www.digitaltalkie.com
A: First create the variables tag1, tag2, tag3 in a1, a2, a3.vbs:
Dimmytag, mytag1, mytag2
Mytag=hmiruntime.tags("tag1").read
Mytag1=hmiruntime.tags("tag2").read
Mytag2=mytag1/mytag*100
Hmiruntime.tags("tag3").writemytag2
The above script is placed in wincc's global vbs script, setting the trigger period to 1 minute.