Applies To:
  • CitectSCADA 5.xx

I have some Distributed Servers that I am also using as global clients at the same time. That is, I have many clusters and on each cluster server I have included the components from the other clusters that I want to view, such as pages and IO. That works fine and I continuously receive the IO from each of the cluster IOServers in addition to my own local IOServer. I then call the ClusterSetName() function to connect to a particular cluster when I want to view Alarm and Trend information from that remote server. Again this works fine, and if I call PageTrend() and pass it the name of some trend pens defined on the cluster server I am currently connected too, then the pens traces appear on my page correctly. These pens are not defined in my local project, because if they were, then my own local trend server would be processing them too which is not what I want.

My problem occurs when I don't reconfigure my trend pen names and I want to select some pens on the fly. The Pen Selection drop down list box only contains the pens that are defined in my local database. i.e. trends.dbf. How can I have this box get populated with pens that are defined on the Trend Server to which I am currently selected?


Yes this is correct. The trend pen selection list box is populated by entries in the local _trend.rdb file. This rdb file gets created when you compile your local project and it resides in your project directory. In order to access the pens from the remote database you will need to modify the cicode which populates the pen selection list box. The function being executed from the Select Pen button on the standard Trend Template is TrendSelectPen(30) and it is located in the cicode file in the Include project. This in turn calls a function _FormGetAllTrendPens() and you will see that this function performs a DevOpen() on a device called _Trend which is also defined in the Include Project. The _trend device enables access to the _trend.rdb at runtime.

I see at least two options:

1. You could compile a single RDB file that includes all the pens from every cluster and then create a device which references this rdb file, similar to the existing definition for the _trend.rdb. Then modify the code to reference your new _globaltrend device rather than _trend. Problems with this approach include the maintenance issue of having to manually modify the trend database and recompile in order to create a new rdb every time a trend pen is added or removed from any of the cluster projects. Also, the trend list will include ALL trend pens and not just the pens from the cluster you are connected too.

2. You could define a separate device for every _Trend.rdb file you will wish to access. You can use UNC paths in the File Name field of the device to access the remote _trend.rdb's. You would then modify the _FormGetAllTrendPens() function to first check which server you are currently connected too. This can be achieved via the ClusterGetName() function. Once you have ascertained which server you are connected too, you can then perform a DevOpen on the Trend Device appropriate to that server and thus generate the appropriate list.

General Notes:

a) In both cases you should create your own copies of the functions and store them in your own project and modify the templates to reference your own functions rather than simply modifying the existing functions in the Include project. This will prevent the loss of your changes, next time you reinstall Citect or a service pack.

b) You should do a search on _Trend in the file to ensure you modify every instance of where the _trend.rdb is accessed.

c) I have not tested either of these solutions.