Referencing of Data-Objects

SUMMARY

Describes how Data Objects can be referenced.

CONTENTS

  1. Introduction
  2. Task formulation
  3. Decision – What type of reverence should be used?
  4. Referencing via FORMAL PARAMETER
  5. Referencing using 'Reference Objects'

Introduction

When creating pictures for a project certain portions (motor-control, valve-conditions, etc.) usually will recur, i.e. identical in appearance and functionality – but differ in the Data Objects bound to.
For such a case ALPHA-VISION® offers the opportunity to reduce work input considerably by using references.

The recurring part is created once, placed in a picture as often as needed and then referenced to different Data-Objects.

There are two ways of referencing available.


'Formal parameter' as well as 'Reference objects' are placeholder that will be replaced in due time by real existing Data Objects.
Which type of referencing is to be used depends on the aappearance that is expected.

By means of a fictitious task we will defer to the two different potentialities.

Task formulation

Three generators are to be controlled and monitored; all 3 generators are identical and differ only by the Data Objects used for control and monitoring.
DATA OBJECT Generator 1 Generator 2 Generator 3
Control G1_C G2_C G3_C
Current G1_A G2_A G3_A
Voltage G1_V G2_V G3_V
Speed G1_N/ G2_N G3_N

Decision – What type of reverence should be used?

All 3 generators should be controlled and monitored at the same time:
A figure for the generator is created and placed 3 times; the figures are parameterized using ‘Formal Parameters’

The generator should be displayed once and show electively the values and control elements of generator 1, 2 or 3:
The generator is created once and parameterized using ‘Reference Objects’.

Referencing via FORMAL PARAMETER

A figure with all the displays and control elements for the generator is created. Instead of binding real Data Objects to the elements of the figure ‘Formal Parameters’, that are free selectable names, are used.

As FORMALPARAMETER we chose:
Control=Contrl / Current=Current / Voltage=Voltage / Speed=RpM

The created figure is placed in a picture as ‘Generator 1’ and selected; after placing a figure the ‘FORMALPARAMETER’ and 'Object name' are always identical when looking to it in the category ‘Figure parameter’.
Select the first line; the ‘Object name’ is duplicated to the field 'Actual parameter'. Now modify 'Actual parameter' to "G1_C", the Data Object actually wanted there.
You may input the wanted Data-Object directly or by using the '>>' button.
Via the ‘Modify’ button the 'Actual parameter' is adopted as 'Object name'.

Modify any further 'Object name' in the same way.

The created figure is also placed as Generator 2 and 3 and parameterized accordingly.



Note:
At compiling a project it is not verified whether a Data-Object bound in a figure really exists. Only placing a figure in a picture (or in another figure) generates a warning if the Data Object defined as 'Object name' does not exist.

Referencing using 'Reference Objects'

The displays and control elements for the generator are created in a picture, as Data-Objects appropriate Reference-Objects are used; the Reference-Objects must exist or be created.

See: Create Reference-Objects in the AvET.

As Reference Objects we will use:
Control=REF_GEN_C / Current=REF_GEN_A / Voltage=REF_GEN_V / Speed=REF_GEN_N

Note:
The displays and control elements for the generator may also be created as a figure. If Reference Objects are bound to the elements of the figure the FORMAL-PARAMETER needn’t be adjusted.


Switching between Generators in runtime.

Three buttons are created (Generator 1 to 3).

VARIANT 1:
Via the buttons any four Reference Objects for a Generator are referenced directly to the according Data-Objects.
( RfPo_SetRefId)

As example the button for Generator 1:

RfPo_SetRefId(REF_GEN_A,G1_A);
RfPo_SetRefId(REF_GEN_C,G1_C);
RfPo_SetRefId(REF_GEN_N,G1_N);
RfPo_SetRefId(REF_GEN_V,G1_V)
		 
WARNING
The action sequence of all actions defined must not exceed 255 characters, any action beyond that limit is dismissed without any error message or warning.


The buttons for Generator 2 and 3 are defined accordingly.

VARIANT 2:
The buttons refer to sections of a configuration file where the references Reference-Object=Data-Object are listed.
( Usr_SetRefObjs)
In that way the restriction of 255 characters of actions sequence is omitted.

Buttons for Generator 1-3:

Usr_SetRefObjs(SELECTGEN, GENERATOR _1)
Usr_SetRefObjs(SELECTGEN, GENERATOR _2)
Usr_SetRefObjs(SELECTGEN, GENERATOR _3)
		 

The appendant configurations file "SELECTGEN.ini":
(The name of the file as well as the section names are arbitrary, but there must reflect the Definitions.)

[GENERATOR_1]      ;Section name
REF_GEN_C= G1_C
REF_GEN_A= G1_A
REF_GEN_N= G1_N
REF_GEN_V= G1_V
[GENERATOR_2]      ;Section name         
REF_GEN_C= G2_C
REF_GEN_A= G2_A
REF_GEN_N= G2_N
REF_GEN_V= G2_V
[GENERATOR_3]      ;Section name        
REF_GEN_C= G3_C
REF_GEN_A= G3_A
REF_GEN_N= G3_N
REF_GEN_V= G3_V
		 



Note:
The "SELECTGEN.ini" must be copied to the runtime area.


WARNING
If a Reference-Object is redefined the redefinition is valid for any appearance of that Reference-Object in the whole project.


See also: