wincc prototype problem

A

Thread Starter

ahmed hamed

dear friends;
i have a problem in using prototypes. i have 2 prototypes one for a valve and the other for the pop_up that control that vale, i want to make the pop_up appears when i click on the vale so the pop_up have the same tagename and linked to the same structure
plesse if any one know any thing related to such problem replay for me soon as i have a very short time to solve such problem
 
R

Ronald Nijssen

Dear Friend,

If you are using version 5.0 then you will find that the pop-up is controlled by a Picture Window, this Picture Window has a property
"TagPrefix", on a mouse event that is part of your Valve symbol you will need to set the TagPrefix property appropriatly and make the PictureWindow visible by setting the "Display"attribute, you will need to write a script with two lines of code to do this
You will have to make sure that the tag(s) you use for your valve object have a name that consists of a Prefix and a Suffix, where the suffix occurs for every valve (e.g. V123_status, V123_command, V456_status, V456_command)where the Prefix is equal to the Valve name and the suffix makes sense In your pop-up you can link any IO field or other object or script to the Suffix only ( like in the example "_status", "_command"), by setting the
TagPrefix to "V123" before you make the pop-up visible WinCC will automatically create TagNames inside your pop-up that are a combination of the TagPrefix and the spcified Tagname (suffix)

To set the TagPrefix and make the pop-up visible you will have to call these three functions in your script:
SetVisible(lpszPictureName,"PICTUREWINDOWNAME",0); //Return-Type :BOOL, Close PictureWindow if it was still open
SetTagPrefix(lpszPictureName,"PICTUREWINDOWNAME","VALVENAME");
//Return-Type :BOOL, Set the TagPrefix
SetVisible(lpszPictureName,"PICTUREWINDOWNAME",1); //Return-Type :BOOL, Display the PictureWindow

Please replace PICTUREWINDOWNAME by the name of the PictureWindow Object and VALVENAME by your Valve name

You can make the script "generic" and read the ValveName from your Valve Object Name, providing that you make the Object Name equal to the Valve
Name, in that case you could reference the ObjectName itself,

You will call the following functions in your script when that's the case:
SetVisible(lpszPictureName,"PICTUREWINDOWNAME",0); //Return-Type :BOOL
SetTagPrefix(lpszPictureName,"PICTUREWINDOWNAME",lpszObjectName);
//Return-Type :BOOL
SetVisible(lpszPictureName,"PICTUREWINDOWNAME",1); //Return-Type :BOOL

Kind Regards
Ronald

(if you need more help or use V4.0x please feel free to contact me direct)
[email protected]
 
M
Actually, you don't have to write an action. If you only want to do the two operations mentioned below, and if all of your selection (tag prefix
that is) is done in the parent picture of the picture window you can do it with direct connection.

First set up the Direct Connection for your triggered event (mouse action for example on a selection button) enter the tag prefix as a constant and send it to the tag prefix property of the appropriate picture window using the direct connection dialog.

Next, select the picture window object and look in the events tab of the properties box for the Tag prefix change event. In here add a direct
connection that copies the picture name property from the picture window back to itself. This will cause the picture to reload in the picture window
with the new tag prefix.

Be aware that tag prefixing changes ALL tags that are used within the affected window, including those used in actions. This can lead to some time
consuming debugging if care is not taken.

If you send give me an e-mail address that can accept attachments I will see about knocking up a quick example. I use v5.0 SP2, if you don't have the same version there wont be any point in me sending you the example.

Regards
Mark Hutton
 
Top