Screens with Parameters

The up-to-date automation techniques often require resources with parameters, in order to use only one resource repeatedly to get the required parameters.

The parameter techniques applied to Screens permit one only screen to be created, which can be called up many times with different parameters. In this case the parameters are the variables from the Movicon Real Time DB.

 

 

Movicon allows the functionalities, associated to displaying and animating the screen's vectorial drawings and Templates, to be indexed. The programmer will find this functionality extremely useful when handling projects containing screens with identical graphics, but different variables associated.

Let's take a plant containing 4 identical tanks as an example where only one screen is to be created and which can be called up by 4 buttons, one for each tank. The screen has to have parameters, which means it has to contain dummy variables which will be replaced in Runtime with real variables of each single tank.

In this case it is clearly necessary to have use of the indexing techniques (or parameter techniques), so that the variables associated to the Screen in the programming stage are replaced by the ones needed during Runtime, in function with the parameter file used for opening  the Screen.

The parameter file is a simple text file (UNICODE format) within which the associations between the 'dummy-variable' and real-variable' are specified. This file has to be created by the programmer, and is to be inserted in the "Parameter File" properties of the 'Screen Commands'.

 

Parameterized  screens load the Parameter File while the screen is being loaded.  Therefore it is fundamental that the parameterized screen not be already loaded in Ram which means you must make sure that you have disabled the  "Keep always in Memory" option and set the "Close Screen Delay" property to "zero" beforehand.

 

The use of parameters containing expressions/calculations might cause the screen to take time opening due to the fact that this operation also involves the use of the script engine.

The slow opening of the screen page largely depends of the characteristics of the device where Movicon is running and it usually more evident in Windows CE.

 

Parameter File

Movicon provides a resource through which you can edit these parameter files directly from the Movicon development environment. By invoking the "New Parameter File" command from the Project Explorer "Parameter Files" Group you can directly edit a file in table format. The following window will open:

 

 

The Alias column represents the name of the "Parameter Variable", being the name of the variable which will be replaced with the name of the variable to be displayed each time on screen. The "Variable (Tag)" column represents the effective variable which must be passed to the screen to replace the Alias one. The parameter files associated to the same screen contain the same Aliases, while the variables associated to the Aliases are different.

The parameter files are created in the project's  "RESOURCES" folder by Movicon and will be saved in UNICODE format with the ".movpar" extension. The file's internal will be structured with the following syntax:

 

<Alias>,<Variable(Tag)>

 

When right clicking on the table the parameters will appear in a text menu with the commands needed for inserting a new Alias and selecting variables from the Real Time DB:

 

 

where:

 

New Alias: adds a new line to the table for inserting a new parameter

Browse  Variable(Tag)...: allows you to select the variable from the project's Real Time DB with the Browse window

 

The browse window, for selecting variables, can be opened directly by clicking on the "Variable (Tag) field while keeping the ALT key pressed.

 

The parameter file can always be edited manually with a normal text editor as long as the characteristics described above are respected which involve the syntaxes inside the file and saving it in UNICODE format. The files created by the Movicon resource and those created manually should be structured in the same way.

 

In the  "Variable(Tag)" field you can also insert a sting that doesn't necessarily have to correspond to the name of a variable from the RealTimeDB. You can specify a single bit of a variable or also a basic expression instead which practically means you can enter the syntax which is usually supported in the field where the alias has been inserted:

 

 

 

Example

In the example described above a Screen has been created with a tank and two animation variables, VAR1 and VAR2 (dummy variables). At this point the parameter file has to be created for each Tank to be displayed where the associations between dummy variables and the real variables are to be done. The four files shown below have been created with a text editor, but their contents are structured in the same way as those created by Movicon.

 

Tank1.txt

VAR1,TK01_LL

VAR2,TK01_HL

 

Tank2.txt

VAR1,TK02_LL

VAR2,TK02_HL

 

Tank3.txt

VAR1,TK03_LL

VAR2,TK03_HL

 

Tank4.txt

VAR1,TK04_LL

VAR2,TK04_HL

 

As you can see the dummy variables are always the same in the four files, while the real variables change according to the Tank. At this point the only thing remaining to do is to associate the parameter file, one at a time, to the required Screen opening command to display the data of one tank or of another.

 

The opening of a Screen with parameters can also be executed with the appropriate Basic Script functions as well as by using the Movicon 'Command List'.

 

 

See Also