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 :
BaseProcessAttributeName = synonym
Creating a Shared Variable Configuration for a DSCIntProc Object
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.
Within CS, the DSCIntProc class provides the following functionality.
- Complex process variables for SCADA functionality like alarming and trending, provided by the DSC module of LabVIEW.
- Communication gateway to OPC. OPC items are mirrored to Shared Variables, which can then be accessed from LabVIEW.
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.
- Creation of Shared Variables during run-time.
- Gateway between Shared Variables and DIM.
- Using Shared Variables requires a "Shared Variable Engine".
- The "Shared Variable Engine" is started automatically.
- There is one (or none) "Shared Variable Engine" per node.
- A "Shared Variable Engine" is only required on the node, where Shared Variables are created.
- 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.
- A DSCIntProc object starts a process within the "Shared Variable Engine". The name of that process equals the name of the DSCIntProc object.
- A DSCIntProc object creates a Shared Variable as part of such a process.
- 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.
- Connecting to an OPC servers requires a so-called IOServer, which belongs to a "process" within the Shared Variable engine.
- Presently, I recommend to use the "Variable Manager" to create an IOServer (see below).
- 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.
- 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.
- The SCADA functinality is only a back-end. This implies the following.
- SCADA properties are not being mirrored to DIM services
- SCADA properties are only available via dedicated tools using the concept of Shared Variables as network protocol.
- 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.
- 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.
- Create a new IOServer by a right-click on the process created in the previous step.
- Browse to and select the right OPC server.
- 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
- The developer of each class requiring Shared Variables provides a file named "CLASSNAME_SVTemplate.csv".
- When using the binaries of the CSDBTools, the "CLASSNAME_SVTemplate.csv" file should be copied to the "data" folder of the CSDBTools.
- Run the "DB and SVCreate" Tool
- Select the objects for which the Shared Variable configuration should be included
- Press "Create SV File"
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.
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.)
- Create a library
- Add Shared Variables to the library.
- Start the "Multiple Variable Editor" (Tools->Shared Variable->Multiple Variable Editor).
- Load the library you have just created.
- You may still edit the Shared Variables (don't forget to save the library afterwards).
- Export the library to a CSV file.
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.
- Select the path of the CSV file
- Load (later: Save) the data
- Edit manually by typing directly into the table
- Delete a Shared Variable by right-mouse click -> "Delete Row"
- (In principle you can even insert a new variable by inserting a new line, but entering the values is no fun)
- Do mass changes
- select Shared Variables using the "selectXXX" controls
- select a proporty to modify using the "modifyXXX" controls
- select the modification by using the "byValue" and "usingAction" controls
- Don't forget to save the CSV file
- Using a text editor
- Using MS-Excel
- Using the "Multiple Variable Editor" (Tools->Shared Variable->...)
- Import a CSV file (Warning: network bindings may become lost!)
- Do the changes
- Export back to the CSV file
Migration of DSC 7.1 Tag Configuration
- LabVIEW (8.x,2009)->Menue->Tools->DSC Module->Migrate->Configuration (.scf)...
- Follow instructions ...
- Rename generated LabVIEW.lvlib to mySharedVariables.lvlib
- Add mySharedVariables.lvlib to a LV-Project.
- View the lvlib contents. You should see the list of former Tags as Shared Variables .
- Context menue of mySharedVariables.lvlib ->Multiple Variable Editor...
- Set Description: Enable to True (Refer to next section for explanation.)
- Set Description: Description to DSC2DIM (Refer to next section for explanation.)
- Set Network-Published: Binding Type to Network-Published
- Set Network-Published: Access Type to read/write if it was set to write only
- Set Logging: Format to String if it was set to DSC 7.1 xxxx
- Context menue of mySharedVariables.lvlib ->Export Variables... to mySharedVariables.csv
- 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".
- 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.
- 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.
-- DietrichBeck - 12 Jul 2007
- Within the library (lvlib) containing your class, create a "template" library named "CLASSNAME_SVTemplate.lvlib
- Add the required Shared Variable to that "template" library. The naming convention for Shared variables is "INSTANCENAME_SHAREDVARIABLESUFFIX".
- Save the "template" library to the folder containing the VIs of your class.
- 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.
- 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.
- Add the template CSV file to the library (lvlib) containing your class.