HCBBS Forum (English)
Submit Chemical Projects / Find Solutions
Amplify Your Requirements on a Broader Chemical Platform *Engineering · Technology · Equipment · Solutions*
Submit Request

WinCC VBS language explanation

2016-01-26View Original

Thread Content

This post was last edited by jerry512158 on 2016-1-26 at 11:22.
sub onclick{byval item}
V_Dis "main.FrameWindow2:main01","1#Anion exchanger backwash inlet valve",5, 1, "Anion_FJ2.",1
end sub
***************************************************************************
Sub V_Dis(Byval Pic, Byval Name, Byval Num, Byval V_Num, Byval Prefix, Byval Mode)
Dim a, b, c
HMIRuntime.Tags("Dev_Num").Write Num
HMIRuntime.Tags("Dev_V_Num").Write V_Num
Set a = HMIRuntime.Screens(Pic).ScreenItems("ValveWindow")
a.CaptionText = Name
a.TagPrefix = Prefix
a.Visible = False
a.Visible = True
a.PictureName = "Operation Window - Valve"
c = Pic & ".ValveWindow:Operation Window - Valve"
Set b = HMIRuntime.Screens(c).ScreenItems("Mode")
If Mode = 1 Then
b.Visible = True
Else
b.Visible = False
End If
End Sub
I hope that someone knowledgeable can explain each line in detail. I would be extremely grateful
Reply #22016-01-26
Let me try to answer: sub onclick(byval item) is a control click event that executes a custom action V_Dis. The V_Dis action has six parameters: 1. First, assign the value 5 to the WinCC variable Dev_Num. 2. Second, assign the value 1 to the WinCC variable Dev_V_Num. 3. Third, set the internal variable a to be the “Valve Window” object in the picture Pic. 4. Fourth, make the title bar of the “Valve Window” object in picture Pic display “1# Anion Bed Backwash Inlet Valve”. 5. Fifth, set the variable prefix for the “Valve Window” object in picture Pic to “Anion_FJ2.” 6. Sixth, make the “Valve Window” object in picture Pic invisible (hide it). 7. Seventh, make the “Valve Window” object in picture Pic visible again. 8. Eighth, set the image displayed by the “Valve Window” object in picture Pic to be “Operation Window – Valve”. 9. Ninth, set the internal string variable c to “main.Picture Window 2:main01.Valve Window:Operation Window – Valve”. 10. Tenth, set the internal variable b to be the “mode” value of the picture window main01 within the main picture window. 11. This controls whether the mode control is visible or not. WinCC has a main screen called “main”. On this main screen, there is a “Screen Window Object 2”; inside this window object lies the screen “main02”. On main02, there is another screen window object named “Valve Window”. This “Valve Window” is used for human-machine interaction to control valves. It also contains a screen called “Operation Window – Valve”. V_DIs passes along a variable prefix of “Anion_FJ2”; it is through the parameter Name that it is determined which valve should be controlled. In this example, it is used to control the “1# Anion Bed Backwash Inlet Valve”. On the “Operation Window – Valve” screen, there is a control element called “Mode”. Whether this element is visible depends on whether the last function of V_Dis is visible. The variable prefixes are chosen based on the common control methods for devices of the same type, with similar variable names; for example, valves are uniformly named as ***_remote, ***_Ready, ***_Running, ***_Start, etc., where the *** part serves as the prefix. In this case, the “Operation Window Valve” page can be used as a template that can be reused repeatedly – all that is needed each time is to pass different prefixes to the screen form object “Valve Window”. I hope this can help you.
Reply #32016-01-26
Thank you. There are two points I don’t understand. 1. What is the purpose of the two assignments in V_Dis "main.画面窗口2:main01","1#Anion exchanger backwash inlet valve",5, 1, "Anion_FJ2.",1? (1. In the first step, the WinCC variable Dev_Num is assigned the value 5; 2. In the second step, the WinCC variable Dev_V_Num is assigned the value 1.) 2. And what does the final “1” represent?
Reply #42016-01-26
This post was last edited by Sichuan Instrument Control Beginner on 2016-1-26 at 15:48. Since I can’t see the entire project, I assume that dev_num is the device identifier, with a value of 5; dev_v_num, I guess, represents the valve number within the device, with a value of 1. These two identifiers are likely to be used in the panel control system. The last 1 is used to control whether the mode control is visible. I speculate that this mode refers to text displays such as manual/automatic or normal/fault; it is displayed when the value is 1, and hidden when it is 0.

Submit a Project

**Looking for Chemical Technology, Equipment & Solutions?** No Registration Required Broader Platform Exposure | Global Chemical Service Provider Connections

Submit Request — Free Consultation

Disclaimer

This is an automated machine translation of the original thread. Some technical terms may have inaccuracies; the original text shall prevail. Click "View Original" at the top right to access the source page, which supports IP-based automatic real-time language translation. Please watch out for contact details and sales inducements to prevent fraud. All content and translations are for reference only, representing solely the poster's personal views. For enquiries, email service@hcbbs.com.