CS Database and DIM-SharedVariable Tools

Two things should be kept in mind.
  • There are two tools ("DB and SVCreate", "DB Conversion") which can be used to edit the configuration of objects in the CS-Database. Until now, both tools are only working with an ODBC data source on the local machine. Both tools are working by default with the CS-Database, but you can edit any other database which has the correct format and is configured as an ODBC data source.
  • The interface of the DSC module towards LabVIEW has changed completely. Tags no longer exist and are replaced by Shared Variables. Two tools ("DB and SVCreate", "SV Editor") can be used to create and configure Shared Variable settings.

Importing (exporting) Objects to (from) the Database

Use the "DB Conversion" tool to import or export configuration data of objects. You can export the data for objects from the database to an ini-file and vice versa. As an example, this is useful transfer the configuration of objects from one system to another.

Edit Configuration Data for Objects

Use the "DB and SVCreate" tool to configure multiple instances without using MS-Access. You can create new entries either by using an existing configuration as default values or starting with an empty data sheet.

To edit instances, select the class they belong to in the classes list, then select one or more instances you want to edit in the instances list and press "edit instances". When editing the attribute values there are different forms which can be used to set the values, depending on the attribute type. (In some cases attributes which are actual of type string are used to store boolean or number values. The "as number"/"as bool"/"as Shared Variables" buttons provide the possibility to use other types than the original one.)

Using the 'apply attribute mapping' function

When using the BaseProcess attributes (Special/Interface/Address) to store data which actual belongs a child class, this funcion can be used to replace the attributenames when editing objects of this class. To use this, the mapping has to be entered in a class specific ini-file called 'CLASSNAME_mapping.ini' which is placed in the folder of the CSDB tools. The common old "mapping.ini" file containing all mappings for all classes no longer exists. Mapping files have the following format :
[Classname]
BaseProcessAttributeName = synonym
...

Creating a Shared Variable Configuration for a DSCIntProc Object

Basics

In LabVIEW 8.20 so-called Shared Variables are a proprietary protocol by National Instruments, which gives access to process variables that can be accessed over the network (for details on LabVIEW DSC and Shared Variables refer to the information available from National Instruments). Shared Variables serve for two purposes.
  1. Complex process variables for SCADA functionality like alarming and trending, provided by the DSC module of LabVIEW.
  2. Communication gateway to OPC. OPC items are mirrored to Shared Variables, which can then be accessed from LabVIEW.
Within CS, the DSCIntProc class provides the following functionality.
  1. Creation of Shared Variables during run-time.
  2. Gateway between Shared Variables and DIM.
Hence, the question on how-to configure and create Shared Variables and the SCADA funtionality is reduced to the question on how-to configure them using the DSCIntProc class. Multiple configurations of Shared Variables can be provided via comma seperated value (CSV) files. When an object of the DSCIntProc class is created, it can read a couple of such CSV files and create the Shared Variables. The following should be considered when using Shared Variables within CS.
  1. Using Shared Variables requires a "Shared Variable Engine".
    1. The "Shared Variable Engine" is started automatically.
    2. There is one (or none) "Shared Variable Engine" per node.
    3. A "Shared Variable Engine" is only required on the node, where Shared Variables are created.
    4. Reading and Writing to a Shared Variable requires the name of the node, where the "Shared Variable Engine" for that particular Shared Variable is running.
  2. A DSCIntProc object starts a process within the "Shared Variable Engine". The name of that process equals the name of the DSCIntProc object.
  3. A DSCIntProc object creates a Shared Variable as part of such a process.
  4. To conclude: Accessing the Shared Variable from somewhere in the network requires the name of the node (of the Shared Variable engine), the name of the process (within the Shared Variable engine) and the name Shared Variable itself.
  5. Connecting to an OPC servers requires a so-called IOServer, which belongs to a "process" within the Shared Variable engine.
  6. Presently, I recommend to use the "Variable Manager" to create an IOServer (see below).
  7. The DSCIntProc object serving as an OPC-DIM gateway should run on the same node as the OPC server. This avoids the mess of configuring the OPC server for remote access. This implies, that the IOServer and the Shared Variable engine also run on that node.
  8. The "Shared Variable engine" providing the Shared Variables with SCADA functionality (Alarming, Trending) can in principle be the same as the one serving as OPC-DIM gateway. However, I recommend to locate the SCADA stuff on a separate node.
  9. The SCADA functinality is only a back-end. This implies the following.
    1. SCADA properties are not being mirrored to DIM services
    2. SCADA properties are only available via dedicated tools using the concept of Shared Variables as network protocol.
  10. The configuration of Shared Variables is stored in one or more comma separated value (CSV) files. Each file can contain the configuration of many Shared Variables.

How to Configure a DSCIntProc Object

For creating Shared Variables, the DSCIntProc loads the CSV files containing a Shared Variable configuration. The names of the CSV files for that DSCIntProc object are configured via the "DB and SVCreate" tool.

How to Create an IOServer for OPC Connection

You will have two processes within the Shared Variable engine. One for the IOServer and one that is created by the DSCIntProc object. The process for the IOServer can be created by using the "Variable Manager" (MS-Windows->Start->All Programs->National Instruments->Variable Manager). In runtime systems, the "Variable Manager" must be started with administrator rights.
  1. Create a new process by a right-click on "Local System" -> "New Process ...". *Important: You may choose a nice name for yourself. However, the name of the process must differ from the name of the process created by the DSCIntProc object.
  2. Create a new IOServer by a right-click on the process created in the previous step.
  3. Browse to and select the right OPC server.
  4. You do not need to save the settings. They are somehow stored somewhere persistently even if you reboot the machine.

How to Create CSV Files

Using the "DB and SVCreate" Tool
  1. The developer of each class requiring Shared Variables provides a file named "CLASSNAME_SVTemplate.csv".
  2. When using the binaries of the CSDBTools, the "CLASSNAME_SVTemplate.csv" file should be copied to the "data" folder of the CSDBTools.
  3. Run the "DB and SVCreate" Tool
  4. Select the objects for which the Shared Variable configuration should be included
  5. Press "Create SV File"
Manually
In principle you can do this with any text editor or MS-Excel, but... . An alternative, you can use the LabVIEW development system and do the following.
  1. Create a library
  2. Add Shared Variables to the library.
  3. Start the "Multiple Variable Editor" (Tools->Shared Variable->Multiple Variable Editor).
  4. Load the library you have just created.
  5. You may still edit the Shared Variables (don't forget to save the library afterwards).
  6. Export the library to a CSV file.

Attention: If you need or forced to used special characters for either the shared variable name or the network url you shoud enclose the item with '. otherwise you may crash the shared variable process or the bound OPC server. (Experienced with the Siemens OPC server at PHELIX.)

How to Edit CSV Files

Most importantly, you would like to adjust the "network.URL", which binds a Shared Variable to the item published by an OPC server.
Using the "SV Editor" of the CSDBTools
  1. Select the path of the CSV file
  2. Load (later: Save) the data
  3. Edit manually by typing directly into the table
  4. Delete a Shared Variable by right-mouse click -> "Delete Row"
  5. (In principle you can even insert a new variable by inserting a new line, but entering the values is no fun)
  6. Do mass changes
    1. select Shared Variables using the "selectXXX" controls
    2. select a proporty to modify using the "modifyXXX" controls
    3. select the modification by using the "byValue" and "usingAction" controls
  7. Don't forget to save the CSV file

Manually

  1. Using a text editor
  2. Using MS-Excel
  3. Using the "Multiple Variable Editor" (Tools->Shared Variable->...)
    1. Import a CSV file (Warning: network bindings may become lost!)
    2. Do the changes
    3. Export back to the CSV file

Migration of DSC 7.1 Tag Configuration

  1. LabVIEW (8.x,2009)->Menue->Tools->DSC Module->Migrate->Configuration (.scf)...
    1. Follow instructions ...
    2. Rename generated LabVIEW.lvlib to mySharedVariables.lvlib
    3. Add mySharedVariables.lvlib to a LV-Project.
    4. View the lvlib contents. You should see the list of former Tags as Shared Variables .
  2. Context menue of mySharedVariables.lvlib ->Multiple Variable Editor...
    1. Set Description: Enable to True (Refer to next section for explanation.)
    2. Set Description: Description to DSC2DIM (Refer to next section for explanation.)
    3. Set Network-Published: Binding Type to Network-Published
    4. Set Network-Published: Access Type to read/write if it was set to write only
    5. Set Logging: Format to String if it was set to DSC 7.1 xxxx
  3. Context menue of mySharedVariables.lvlib ->Export Variables... to mySharedVariables.csv
  4. Use setNetworkURL.vi to enclose Network URL items that include special characters with '.

How to Configure the Relationship Between DIM Services and Shared Variables

The old "dim_dsc.txt" files no longer exist. The relationship between a DIM service and a Shared Variable is defined in the "Description" property of the Shared Variable configuration. The name of the DIM service is always identical to the name of the Shared Variable. Updates are always done "on change".
  1. The value of a Shared Variable is published to a DIM service. The "Description" must contain the keyword "DSC2DIM". Please keep in mind, that a DIM service must have a unique name within a DIM domain.
  2. The Shared Variable subscribes to a DIM service. The "Description" must contain the keyword "DIM2DSC". In case the DIM service is an array of values, the description of a class may contain the keyword ISARRAYNN, where NN is the number of values of the array. In this case, the DSCIntProc class will write updated value received from DIM to SVs named SVNAME_CHANNELMM, where MM is the index of the array element. Each SV of the SVNAME_CHANNELMM must be included in the csv file used to create the SV (Why? Because only if the array elements are created individually, they can have individual properties like alarms...).

For Developers: How to Create CSV Template Files

When creating CSV files, the "DB and SVCreate" tool uses class specific template files of the name "CLASSNAME_SVTemplate.csv". The easiest way to do this is to use development system of LabVIEW.
  1. Within the library (lvlib) containing your class, create a "template" library named "CLASSNAME_SVTemplate.lvlib
  2. Add the required Shared Variable to that "template" library. The naming convention for Shared variables is "INSTANCENAME_SHAREDVARIABLESUFFIX".
  3. Save the "template" library to the folder containing the VIs of your class.
  4. Edit the Shared Variables
    • Make sure that the property Network:AccessType is set to read/write. Otherwise the DSCInterface process causes fatal erros and you need to reboot the hosting PC.
  5. Export the "template" libray to a CSV file named "CLASSNAME_SVTemplate.csv". This is done by using the Tools->Shared Variable->Multiple Variable Editor. Save the template CSV file to the folder containing the VIs of your class.
  6. Add the template CSV file to the library (lvlib) containing your class.

-- DietrichBeck - 12 Jul 2007
Topic revision: r10 - 2011-11-28, StefanGoette
 
This site is powered by FoswikiCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding GSI Wiki? Send feedback
Imprint (in German)
Privacy Policy (in German)