Home
Process Trend
|
Process Trend ActiveX ControlDevelopers GuideThis section of the document describes the programmatic interface to the Process Trend OCX. It assumes that the reader is familiar with VB Script, and has a general knowledge of Microsoft's ActiveX (COM) technology. Instantiating the ActiveX ControlThe Trend OCX is a standard ActiveX control, and therefore can be used within an ActiveX control container. It is anticipated that the most common use for the Trend OCX will be as a control embedded within a GUS graphic. Embedding the Trend OCX in a GUS graphic is a relatively straightforward procedure, and is described in more detail here.The demonstration version of the Trend OCX is embedded in a web page, and is designed to be viewed using Microsoft Internet Explorer, version 5.5 or later. When embedding an OCX in a web page, the OCX is referenced by Class ID. In the case of the Trend OCX, this is {7A562DB8-2595-45C8-A983-9EADD52A1C93}. The Class ID can be found from the registry if required (once the OCX has been installed). Using the Class ID, the Trend OCX is placed on the web page using the OBJECT tag, as follows: <OBJECT id=trendOcx classid=clsid:7A562DB8-2595-45C8-A983-9EADD52A1C93> </OBJECT> ConfigurationThe setup of the Trend OCX is much the same, irrespective of whether it is being used in a web page or in a GUS graphic.Most of the configuration properties of the Trend OCX are stored in the control's property bag by the control container. For example, when the control is embedded in a web page, these properties are visible as PARAM elements as part of the OBJECT tag: <OBJECT id=trendOcx style="LEFT: 0px; WIDTH: 818px; TOP: 0px; HEIGHT: 617px" height=617 width=818 classid=clsid:7A562DB8-2595-45C8-A983-9EADD52A1C93 VIEWASTEXT> <PARAM NAME="_ExtentX" VALUE="21643"> <PARAM NAME="_ExtentY" VALUE="16325"> <PARAM NAME="PhdHostName" VALUE="PHD"> <PARAM NAME="PhdMinConfidence" VALUE="100"> <PARAM NAME="PhdSampleMethod" VALUE="SNAPSHOT"> <PARAM NAME="PhdUserName" VALUE="PHD_READONLY"> <PARAM NAME="PhdPassword" VALUE="PHD_READONLY"> <PARAM NAME="HistoryWindow" VALUE="30m"> <PARAM NAME="Simulate" VALUE="True"> <PARAM NAME="NumTags" VALUE="1"> <PARAM NAME="GraphFrameColour" VALUE="808080"> <PARAM NAME="GraphBackColour" VALUE="0"> <PARAM NAME="GridVisible" VALUE="1"> <PARAM NAME="PtDescVisible" VALUE="1"> <PARAM NAME="TimebaseVisible" VALUE="1"> <PARAM NAME="MaxPhdSamples" VALUE="250"> </OBJECT> Simulating Visual PHDIt is often handy to simulate fetching data from PHD; this is most useful when there is no PHD server present.In the process of developing the Trend OCX, a Visual PHD Simulator was built. This is an ActiveX executable which runs on the local machine, and serves up data using methods and parameters matching those in the Visual PHD DLL. The Prog ID of the Visual PHD Simulator is "VisualPHDSim.Data", instead of "VisualPHD.Data" for the standard Visual PHD DLL. To use the simulator, the Simulate parameter of the Trend OCX needs to be set to True. The Trend OCX will start up the simulator if it is not already running. Connecting to PHDThe Trend OCX connects to PHD (or to the PHD Simulator) once its properties have been read in from the ActiveX control container.Once connected, it issues the PhdReady event. This indicates that PHD is connected, and that the Trend OCX is ready to accept tags. Tag SetupThe tags can be set up once the Trend OCX has connected to PHD and issued the PhdReady event.The first parameter to set is the number of tags to trend. This is done using the NumTags property. The tags themselves are defined by writing to the TagParameter(Index) property. Other parameters, such as the engineering units, point descriptor, and upper and lower range may also be set at this time. The Trend OCX adds the tags as a block, so it is necessary to call the DefineTags method to instruct the OCX to fetch the historical data and build the trend. Setting the TagParameter(Index) property without calling DefineTags will not cause a fetch of the newly defined tags. Real Time UpdateThe Process Trend OCX can accept real-time values from the ActiveX control container. This allows high definition real-time trending, with up to 1 second resolution.It also means that once the historical data has been fetched from PHD, there is no loading on PHD or on the network. The ActiveX control container writes real-time data to the OCX using one of the following methods:
|