DDE

From SysCAD Documentation
Jump to navigation Jump to search

Navigation: User Guide ➔ Data Sharing ➔ DDE


Introduction

OLE's predecessor, Dynamic Data Exchange (DDE) is a method of dynamically moving data among applications in the Microsoft Win32 Application Programming interface (API). The DDE protocols send messages between applications that share data and used shared memory to exchange data. Applications can use the DDE protocol for one-time data transfer and for continuous exchange in which applications send updates to one another as new data become available.

To allow DDE to be used with a SysCAD project, switch the DDE option on in the Project - Settings - IO Connections tab page.

Live Data Access

The value of any tag in the SysCAD Relational Tag DataBase (RTDB) may be accessed. A live link with the tag may be obtained. The value will continuously be updated as it changes in SysCAD. Selecting a conversion unit may set the units for the value shown. Only the engineering unit is case sensitive.

NOTE: The DDE option must be switched on in the Project - Settings - IO Connections tab page.

Refer to Examples for the syntax to use.

DDE Options

The DDE Options dialog box is to keep the user informed of the communication status between SysCAD and other packages (such as Excel). When SysCAD is running and communication established, the statistics page will list a summary of the communication between the packages:

User Guide image377.gif

and the tags page will list all the tags and their values passed through by DDE.

User Guide image378.gif

All values are updated as SysCAD is solving or running. The Refresh button refreshes the dialog box and the Force All button will force communication to take place regardless of value change.

DDEShare

DDEShare can be, but is not required to be used to get SysCAD to use DDE.

DDEShare is a program that comes with the Microsoft Win32 operating system. You may use this to access SysCAD from a remote box over a network using NetDDE. This only needs to be run on the SysCAD server box.

To set up the share, from command prompt, type in DDEShare to open the program, choose Shares - DDE Shares - Add a Share to open up the DDE Share Dialog box.

In the DDE Shares dialog box you will need to add two shares RTDB (relational tag database) and HISTORY. In the DDE Share Properties box you must enter RTDB as the share name, SysCAD as the application name (three places) RTDB as the topic name (three places) and enable the two check boxes.

The same procedure must be repeated for the HISTORY share.

Once this is done the shares need to be trusted. Selecting the share name and pressing the Trust Share button can do this.

The two check boxes on the left need to be enabled. Once this is done remote client boxes will be able to access SysCAD on a server box.

Examples

Note: Please make sure the SysCAD DDE option is switched on in the Options - Configure - Connections Dialog box before attempting the following examples.

Getting Values from SysCAD

On a local box the DDE syntax is as follows:

=APPLICATION|TOPIC!ITEM.

For SysCAD the application is SysCAD, the topic is RTDB and the item is the tag you require,

=SYSCAD|RTDB!tag

Examples:

=syscad|rtdb!tnk_1.Lvl

=syscad|RTDB!'tnk_1.lvl (%)'

On a remote box the DDE syntax is as follows:

='\\BOX_NAME\NDDE$'|SHARE_NAME!ITEM.

For NetDDE the Application and Topic map to a share name. The box name is the name of the computer with the SysCAD server and DDEShare, the share name is RTDB (as defined in DDEShare on the server) and the item is the tag you require,

='\\BOX_NAME\NDDE$'| RTDB!tag

Example:

='\\PMC_2\NDDE$'|RTDB!gc_1.a

Setting Values to SysCAD

To set a SysCAD tag a DDE poke to the RTDB topic can be used. The item would be the tag you wish to change, which may include conversion units. Example macros from Microsoft Excel are given below:

Sub DoDDEPoke()

cN = Application.DDEInitiate("syscad", "RTDB")

Application.DDEPoke cN, "XPG_1.Content.CuSO4(aq)", Range("A1")

Application.DDETerminate cN

End Sub

Sub DoNetDDEPoke()

cN = Application.DDEInitiate('\\SERVER\NDDE$', RTDB)

Application.DDEPoke cN, "Tnk_1.Lvl", Range("C3")

Application.DDETerminate cN

End Sub