The SecsHost .NET component is designed to provide a high-level
starting point when deploying Host SECS Interface software using the
Microsoft
.NET Framework . The .NET component features a fully CLS
(Common
Language Specification) compliant API and can be used from any of the
.NET
programming languages, including C#, C++, Visual Basic, and Java.
Without any code development, the component is able to communicate with
GEM standard equipment, manage dynamic Event Reports, upload and
download
process programs, and manage Equipment Constant values. The
component
also imbeds extensive fallback logic that accommodates working with
non-standard
and non-GEM compliant equipment. A supervisory application is
provided
with source code that enables you to interactively configure and manage
multiple Host interfaces. Application source code is also
provided
for a Host Graphical User Interface (GUI), and related dialogs such as
property editing, and a window to display detail on the data that is
being
exchanged over the SECS interface. The SecsHost component
operates
with or without these windows being present - it is a true component
that
can be imbedded and deployed in an application of your own
design.
An application developer registers event handlers and callback
delegates
to receive asynchronous inputs such as Event Reports, Alarm Reports, or
specified SECS message types. The example application code
demonstrates
using these techniques without undue complexity. You can readily
understand how to use the component and get on with building your own
application,
or you can customize the application we provide to meet your own
requirements.
The SecsHost .NET component is provided as the following files:
In order to run the example application, you need to have either the .NET development software installed, or the .NET runtime installed. The .NET runtime can be downloaded from Microsoft as the file, dotnetfx.exe. Note that the .NET runtime is not presently distributed with or built into the Windows operating systems.
The distribution is designed and tested for Windows XP Professional, and similar up-to-date Windows Professional versions such as Windows Vista or Windows 2000 Pro.
The Hume developed SecsHost component is a "component" as defined by the Microsoft .NET Framework. As such, it implements the System.ComponentModel.IComponent interface. Hume Integration is also using the word "component" to describe high level customizable applications such as their Data Collection Component.
The SecsHost .NET component uses the SECS/GEM application files provided in the Hume Datahub SDK product. The developer needs to install the Hume Datahub SDK, and specify on the SETUP screen that the GEM/SECS applications should be installed. The SecsHost component is able to find the Datahub SDK files using the environment variable DMH_BIN which is set when the Datahub SDK is installed.
The situation is simpler for a runtime deployment of your host application. Instead of installing the Datahub SDK, you can simply deploy a single file executeable, SecsServer.exe. This file is provided by Hume Integration for the usual case of using the as-provided SDK files. If you have customized the SDK files, you are able to create a custom version of SecsServer.exe using a build script. We encourage you to use the full SDK during development so that you have the toolset documentation, the debugging tools, and you are able to view the SDK GEM application source code. When you are ready for deployment, you can download the SecsServer.zip archive from the Hume customer support website to obtain the SecServer.exe program and its build script.
DMH_DOTNET_TCLDIR=C:/usr/local/gem/serverIn a runtime deployment, the SecsServer executeable file is placed in a directory of your choice as specified by the DMH_DOTNET_TCLDIR environment variable. The default directories used for process program transfer and trace logging are subdirectories of where the SecsServer.exe or SecsServer.tcl file is found.
The component software uses the namespace Hume.SECS. Coding is easier if you add the statement using Hume.SECS; to the using statements of your application source code. By doing this, the namespace name, Hume.SECS, can be omitted from name references. A Visual Basic developer uses the Imports statement for the same purpose.
The SecsHost software uses the HumeDMH.dll component internally to control a SECS interface server using the Hume DMH message system. You may want to explore using the DMH message for your own application requirements such as integrating multiple host interfaces deployed on multiple computer systems. The Hume SECS software is able to play the host role and the equipment role in multiple instances in the same SECS server process.
Your primary focus as a developer is using the class SecsHost. This class implements public methods to send and receive SECS messages, and manage a host SECS interface. We suggest you get started by running the GemHostApp.exe application and take a look at the various windows and dialogs in action. You probably want to have the SecsHostEditor dialog in your application to let your users easily configure Host interfaces. Run the application against real equipment, explore the example GUI, and develop confidence that the core logic will work well in your custom application. Decide whether you will modify the GemHostApp project for your own requirements, or create your own application, and include selected features of the Hume application by adding selected files and code to your project.
Here is the general flow of using and configuring the SecsHost:
Imports Hume.SECS
Public Class MainForm
Inherits System.Windows.Forms.Form
Public WithEvents sh As SecsHost
Dim mrd As SecsMsgReceiveDelegate
Public Sub receiveSecsMsg(ByVal sender As System.Object, ByVal stream As Integer, ByVal func As Integer, _
ByVal sendReply As Boolean, ByVal transactionID As Integer, ByVal TsnData As String, ByVal header As String)
End Sub
#Region " Windows Form Designer generated code "
...
#End Region
Private Sub MainForm_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
sh = New SecsHost("gemhost", "GEMHOST")
mrd = AddressOf receiveSecsMsg
sh.MessageTypeAdd(10, 5, mrd)
End Sub
End Class
As general guidance, when you expect a string value, you will get a
two element list, of the form "A:n {this is n chars of text}". If
a string value does not have imbedded white space, it may be formatted
without braces, such as "A:8 OneToken". When you use the ListElement
or ListSplit methods to parse the text, they
take
care of parsing and removing surrounding braces for you. If an
empty
string is sent, you will see a one element list, A:0. SECS has
the
notion of array data - 0 or more values of a given type. When you
expect to receive a single numeric value, you receive a two element
list,
with the type code as the first element, such as "U4:1 290". You
can also receive an empty array "U4:0" or an array with more than one
value
as in "U4:3 0 1 2". Binary data values are formatted using
C-language
hexadecimal integer notation, for example, "B:3 0x00 0x01 0x02".
You can use the BinToInt method to convert
these
values to integer values. With received data, the type code has a
length value appended to it after a colon. With data that you
format
for sending, the length information is optional, the data is parsed to
determine the length. See the TSN.html
document for more details.
| Semi Octal type code | TSN type code | Meaning & Examples |
| 00 | L | List, L, L:0, "L {A {atc 100}} {A 1.0.0}", "L:2 {L:2 {U4 200} {U4 210}} {B 0}" |
| 10 | B | binary - unsigned 8 bit data, "B 0", "B 1 2 3" |
| 11 | TF | boolean data, TSN type codes BL or BOOLEAN are also accepted as input, "TF 1" |
| 20 | A | Character string data. Traditionally this has meant
printable
ASCII characters but some implementations are sending any 8 bit
characters
including nulls using this type. "A {hello world}", "A hello" |
| 21 | J | Japan International Standard (JIS-8) encoded text. This format is not commonly used or supported because in the past the SEMI standards have failed to identify specific reference documents. |
| 22 | V1..VE | Variant data, also known as Localized Character Strings. Your .NET unicode text is automatically converted into the chosen encoding. V1 is for Unicode 2.0, V2 is for UTF-8 encoding. See the TSN.html document for more details. "V1 {sent as Unicode}" |
| 30 | I8 | 8-byte signed integer, use hex notation for the value, "I8 0x123456789abcdf01" |
| 31 | I1 | 1-byte signed integer, "I1 -3" |
| 32 | I2 | 2-byte signed integer, "I2 99", "I2 15 -7 99" |
| 34 | I4 | 4-byte integer signed, "I4 -5" |
| 40 | F8 | 8-byte floating point, "F8 6.02e23", "F8 0.1" |
| 44 | F4 | 4-byte floating point, "F4 1.0" |
| 50 | U8 | 8-byte unsigned integer, use hex notation for the value, "U8 0x7fffffffffffffff" |
| 51 | U1 | 1-byte unsigned integer, "U1 0" |
| 52 | U2 | 2-byte unsigned integer, "U2 512" |
| 54 | U4 | 4-byte unsigned integer, "U2 979" |
Logic in your application can send SECS messages or initiate conversations using the SendSecsMsg method. For HSMS communication, if you are sending a message and not waiting for the reply, SendSecsMsg can be used from your GUI code without fear of making your GUI unresponsive. In some cases you need to wait for a SECS reply message. If you are using HSMS, under most circumstances, the reply or failure to reply will be resolved within a few seconds. The unusual circumstance is that you still have a TCP/IP connection so your send is successful, but then there is no reply, and you wait the full T3 period. If the risk of this delay is not acceptable, you can create a new thread, and use the new thread to perform the SECS conversation where you need to wait for the reply message.
For SECS-I serial communication, timing is somewhat different. With SECS-I there is no underlying TCP/IP connection that can signal the application when it is broken. So there is a higher risk of your sending thread being in an unresponsive wait to determine if a send is successful, and then in a longer wait to obtain the reply. So you may want to use a separate thread than your GUI thread to send SECS messages or conduct send-and-reply conversations.
| Property Access | Description |
| bool autoInit | Configures whether the interface should execute initialization logic automatically when an online control state is established or re-established. Since the actions performed during initialization are configurable using other properties, most application will configure the individual actions, and leave this overall flag at its default value of true. |
| bool autoStart | Configures whether the interface should be started automatically with communication enabled. This property is used if the interface is created using the constructor method that accepts the property values as string array arguments. The default value is false. |
| int BAUD | If you are using the SECS-I, RS-232 connection type, this property sets the baudrate of the serial port. The default value is 9600. |
| string CEID_OFFLINE | The event report identifier (CEID) that signifies that the equipment is transitioning to an off-line control state. This value is used by the logic that tracks the equipment control state. The default value is "4000". |
| static DmhClient SecsPort.dmh | SecsHost and SecsPort instances use a shared connection to the DMH message system in order to communicate with the SECS server process. The connection instance, dmh, is public in case you want to access it in your application. |
| string CommState | Read-only value of your GEM Communication State. Possible values are DISABLED, ENABLED {NOT COMMUNICATING}, and COMMUNICATING. The StateChange event is used to obtain asynchronous notification of this property value change. |
| int ConnectionType | Configures the basic choice of connection type. IntelliSense prompting shows the choices. The value 0 means SECS-I RS-232, 1 means SECS-I terminal server, 1993 is for non-standard Draft HSMS, 1995 is for standard HSMS. The default is 1995. |
| string ControlState | A read-only value of the GEM Control State. Possible values are OFF-LINE and ON-LINE. |
| int DEVID | The SECS Device ID. An identifier imbedded in SECS header data usually left at the default of 0. The SecsHost software has adaptive logic to correct an improper value. Settable range is 0..32767. |
| static SecsPort.DMHGroupName | The DMH message system groupname used by the SECS server. The same groupname should be specified to the constructor of every SecsHost or SecsPort instance in the application in order to share the same SECS server process. |
| string HsmsHost | For an active HSMS connection, specifies the TCP/IP hostname or IP address of the Host computer. The default value is "localhost". |
| bool HsmsPassive | For an HSMS connection, whether the SecsHost plays the passive, TCP/IP server role. The default value is false since the usual role for the host is non-passive. |
| int HsmsPort | For an HSMS connection, the TCP/IP socket port number. Defaults to 5555. |
| bool MULT | A flag used for SECS-I only to specify whether the equipment can handle owing more than one reply at a time. The default value is true. |
| string Name | The SecsHost name passed to the constructor and used in the SECS server process as a Tcl command name, a global array name, and an identifier in SQL table records. |
| string RecipeDirectory | A pathname to the file system directory where Process Program files are located. The default value is the relative subdirectory "<Name>_recipes" of the directory where the SECS server is executing. Note that by default, each interface has its own directory for Process Program files. Reading this property returns the absolute directory path to the process program directory. |
| bool ReportsClear |
This boolean property controls whether to delete all existing event reports during initialization before defining new ones. When this value is false, the report definition logic deletes reports one at a time as each new report is defined to make sure the report ID is not in use The value can be set true to eliminate possible undesired event reports, or to have only a single deletion message sent when setting up new reports. The default is false. |
| bool ReportsEnable |
Setting this boolean property true insures that all equipment based events are enabled for reporting during initialization. If the value is set false, only the events that are specifically configured with data reports or for being enabled are enabled. However, if there are no event reports configured, then all equipment based event reports are enabled irrespective of this property setting. So, the meaning of the property is to insure that all equipment based events are enabled, and the false value is not used for disabling event reports. The default value is true. |
| int RTY | SECS-I maximum send retry, range 0..31, default 3 |
| string SerialPort | For a SECS-I connection, the serial port device such as "COM1". The default value is "COM1". |
| string SpoolInit | Controls initialization of equipment spooling. The allowed values are PURGE, UNLOAD, or IGNORE. The default value is UNLOAD. |
| string State | A read-only value of the low-level connection state. Possible values include OFFLINE, LISTENING, and COMMUNICATING. You will see the OFFLINE state if the connection to the host is broken, or in the case of SECS-I implicitly broken by a conversation timeout. The StateChange event is used to obtain asynchronous notification of this property value change. |
| int T1 | SECS-I Inter-Character Timeout in milliseconds, range 100..10000, default 500 |
| int T2 | SECS-I Protocol Timeout in milliseconds, range 200..25000, default 10000 |
| int T3 | SECS Reply Timeout in milliseconds, range 1000..120000, default 45000 |
| int T4 | SECS-I Inter-Block Timeout in milliseconds, range 1000..120000, default 45000 |
| int T5 | HSMS Connect Separation Timeout - the delay between re-connection attempts in milliseconds, range 1000..240000, default 10000. The T5 timer value is also used for SECS-I host logic as a retry timer for communication attempts. |
| int T6 | HSMS Control Transaction Timeout in milliseconds, range 1000..240000, default 5000 |
| int T7 | HSMS Not Selected Timeout in milliseconds, range 1000..24000, default 10000 |
| int T8 | HSMS Network Intercharacter Timeout, default value 5000. This value is not used. |
| int TRACE | Used as a bitfield to control diagnostic trace information
for SECS
port activity which is passed to the application in the SecsTrace
event.
By setting specific bits, the corresponding output is turned on.
General Tracing: (TraceType = trace) Receive Tracing: (TraceType = rtrace) Send Tracing: (TraceType = strace) |
| RcResult SetTraceSaving(bool save, bool compress, int
maxDayFiles,
string saveDir, string zipCmd)
public class RcResult { bool TraceDataSaved bool TraceDataIsCompressed string TraceSaveDir int TraceSaveMaxDayFiles string TraceSaveZipCmd |
The toolset software has the
configurable
feature of continuously saving the SECS communication trace data to
files
- one file per day, up to a maximum number per year, and optionally
compressing
the closed file from the previous day shortly after midnight. The
SetTraceSaving
method is used to reconfigure the logging feature with the various
properties
being set atomically in one call. The RcResult return value is
used
as follows. If the rc value is less than 0 the SetTraceSaving()
arguments were not acceptable and an error message is provided as the result
string. If the rc value is 0, the call succeeded. If the rc
value is greater than 0, the call succeeded with an advisory message as
the result string. For example, a message occurs if
compression
is set true but there is a maximum of only 1 file, so there is no
distinct
file for the previous day to compress.
The saving logic writes each day's output to a distinct file, in the directory named by the saveDir argument. The maxDayFiles argument controls how many day files are saved per year. It can be configured between 1 and 366. When file saving is initiated, the output filename is set to traceNNN.txt where the NNN value is the current day of the year, 0 to 365, modulo the maxDayFiles value. If this file already exists and has been written to earlier in the same day, then the output is appended to it, otherwise the file is created as a new file. Note that if the maxDayFiles value is set to 1, each day's output is saved to the same filename, trace000.txt. The default values provide for saving the data from each connection in a separate directory. Separate directories are required for each connection. When trace data is being written, the compress argument controls whether the logic attempts to compress the output file when it is closed at the end of the day (midnight). For compression to occur, the maxDayFiles value must be greater than 1 and a non-blank compression command must exist as the zipCmd argument. The default assignment of zipCmd is similar to zip -m tracetxt.zip. This command causes the data file from the previous day to be moved into the tracetxt.zip archive, creating the archive if it does not exist. The compression logic appends the day file name to the configured command before execution. Only trusted persons should be allowed to configure the compression command because of the security considerations. |
int TracewinMaxWidth |
The approximate maximum number of characters to display in a single line of the trace window. This value guards against excessive data use when long messages such as recipe transfer occur and the trace window is displaying connection activity. Range 1000..120000, default 4000. |
| string tDATAID | The SECS TSN type code for DATAID items. Defaults to U4. |
| string tDATALENGTH | The SECS TSN type code for DATALENGTH items. Defaults to U4. |
| string tLENGTH | The SECS TSN type code for LENGTH items. Defaults to U4. |
| string tPPID | The SECS TSN type code for PPID items. Defaults to A. |
| string tREPGSZ | The SECS TSN type code for REPGSZ items. Defaults to U4. |
| string tRPTID | The SECS TSN type code for RPTID items. Defaults to U4. |
| string tTOTSMP | The SECS TSN type code for TOTSMP items. Defaults to U4. |
| string tTRID | The SECS TSN type code for TRID items. Defaults to A. |
| bool useS1F3 | Whether to use S1F3 during initialization to query Status Variable values. After initialization, subsequent value changes are ordinarily known to the host by being received in event reports. The default value is true. |
| bool useS1F11 | Whether to use S1F11 during initialization to determine Status Variables. Since the set of variables does not ordinarily change, and can be loaded from saved data, the initialization query can be disabled if it is time consuming. The default value is true. |
| bool useS1F13 | Whether to use S1F13 during initialization to establish communications. The default value is true, and is almost always appropriate since the logic will use S1F1 if S1F13 is rejected. However, there is some defective equipment in use that gets confused if it receives S1F13. |
| bool useS1F17 | Whether to use S1F17 during initialization to request the Online Control State. The default value is true. |
| bool useS2F13 | Whether to use S2F13 during initialization to query Equipment Constant values. The default value is true. |
| bool useS2F29 | Whether to use S2F29 during initialization to determine Equipment Constants. The default value is true. Since the set of constants does not ordinarily change, and can be loaded from saved data, the initialization query can be disabled if it is time consuming. |
| bool useS2F31 | Whether to use S2F31 during initialization to synchronize the equipment clock. The default value is true. |
| bool useS5F5 | Whether to use S5F5 during initialization to determine Alarm types. The default value is true. This query is not used during every initialization. It is only used if the logic sees an enabled alarm type that it does not already know about. |
| bool useS5F7 | Whether to use S5F7 during initialization to determine enabled Alarms. The default value is true. |
| bool useS13 |
This boolean property chooses whether to enable using Stream 13 large process program transfer message types. In addition to the Stream 13 messages, this property also enables or disables using S7F27, S7F29, S7F37, S7F38, S7F41, and S7F42 which are used with Stream 13 for transferring large unformatted, process programs. The default value is true which causes an S13F9 reset message to be sent during initialization. Stream 13 message types are preferred for transferring large data sets because the data is split into multiple smaller messages which require less memory use. |
| Event Handler and Argument Data | Description |
| All event handlers - NOTES
|
We are documenting both events and most of the delegate
callback functions
in this section. Events are somewhat easier to develop with
because
of better handling by the .NET IDE tools. However, they cannot
return
values to the event initiator. In some cases we have elected to
use
delegate callbacks in order to receive and use application return
values.
The IntelliSense code generation of the .NET IDE turns around the usual sequence of writing an event handling method and then registering it. Instead, try registering an event handler using the += operator. Press the Tab key when prompted to create event handling methods with the correct arguments. The .NET framework hides the difference between executing a static method or an object method as an event handler. You are able to use either kind of method. When the event happens, your handler method is called. You can cast the event sender object to (SecsHost) to have a reference to the component instance. |
| void AlarmReport(object sender, AlarmReportEventArgs e) class AlarmReportEventArgs : EventArgs { |
This event is raised upon receiving an S5F1 alarm report message. Modern GEM equipment posts events for alarm set and alarm clear conditions so the idea of alarms as distinct from events is becoming obsolete. |
| void EventReport(object sender,EventReportEventArgs
e)
class EventReportEventArgs : EventArgs { |
Use the EventReportDefine
method to
create data collection event reports. Your application needs to
call
the Initialize method after defining the
desired
event reports to setup and enable the desired event reports with the
equipment.
After Initialize is called, only the event reports you have configured
are enabled with the equipment. So if you want the equipment to
report
all of its events, call the method EventsEnable
after calling Initialize.
Events can be given meaningful names and descriptions using the EventUpdate method. In the event report data, you receive both the underlying event identifier sent by the equipment, the CEID value, and the identifier for the event you have optionally customized, the EventID. The data of the event report is passed as a ListDictionary instance which contains variable name and value pairs. The variable names are from the VFEIname column of the SECS server ei_variable table. You are able to assign your own variable names using the VariableUpdate method. Using a host given name for variables allows the logic to ensure that each name is unique, and provides for uniform naming across equipment instances. If you do not provide your own name values for variables, the default variable names are assigned using the naming conventions of the Sematech Virtual Factory Equipment Interface (VFEI) standard. The ability to rename events and variables is referred to as Virtual Reporting. The default
names for
variables are computed as follows. The variable names defined by
the equipment are folded to uppercase, with white space and
non-alphanumeric
letters being replaced by underscores. Hyphens are not changed.
An
underscore is inserted for each transition from lowercase to
uppercase
in the equipment provided name. If the computed name is not
unique
for the equipment instance, the name is made unique by concatenating an
underscore and the variable ID. For example, the equipment
variable
name PPExecName is assigned the default name PP_EXEC_NAME. The
following
8 computed names are exceptions to the naming algorithm and are
reassigned
based on the Sematech VFEI standard: |
| SecsMessageReceiveDelegate | See the MessageTypeAdd method described in the next section to see how to receive SECS messages in your application. |
| void SecsTrace(object sender, SecsTraceEventArgs e)
class SecsTraceEventArgs : EventArgs { |
This event provides you with the detailed information of SECS message traffic that is viewed in the SECS Trace window - see the Tracewin method. The flow of information is controlled by setting the TRACE property. |
| static void SecsPort.ServerError(object sender,
ServerErrorEventArgs
e)
class ServerErrorEventArgs : EventArgs { |
The SecsHost class reports Tcl programming errors that are trapped in the SECS Server process as ServerError events. An example would be trying to send an improperly formatted SECS message. These error events will happen during development but should be rare once the code is debugged. |
| void StateChange(object sender, ValueChangeEventArgs
e)
class ValueChangeEventArgs : EventArgs { |
This event notifies your application of state value changes.
Possible varname
values include
|
| METHOD | DESCRIPTION |
| General Comments
|
The List manipulation methods are actually implemented by the HumeDMH.dll component, and exposed for your convenience by the SecsHost component. |
| RcResult AlarmAdd(string ALID, string ALTX, string
ID_TSN)
struct RcResult { |
This method is used to manually add alarm definitions for
equipment
that does not support discovery of alarm types using S5F5. The ALID
argument value is the alarm type identifier which is usually an
integer.
The ALTX argument is static text for the alarm description and
it
is limited to 40 characters in length. The ID_TSN
argument
is the SECS item data type for the ALID in TSN
notation such as U4.
If the method succeeds, the rc field in the result structure
is set
to 0. It is not an error if the alarm definition already exists, the
argument
values are used to update the existing definition. A non-zero
result
indicates an error, and the result string should be examined.
Possible
error return codes include: |
| void AlarmEnable(string ALID, bool is_enabled) | Enable or disable reporting of an Alarm type (S5F1). |
| bool AlarmIsEnabled(string ALID) | Test if the reporting of an alarm type is enabled |
| bool AlarmIsSet(string ALID) | Test if the alarmed state is currently set |
| DataTable AlarmTable() | This method returns current data from the SECS Server ei_alarm table for the SecsHost instance. The columns of the table include: spname, ALID, is_enabled, is_set, ALTX, host_managed, and host_wants_enabled. |
| int BinToInt(string binValue)
|
Converts a SECS B (Binary - Semi "10") data value usually formatted as a hexadecimal string to an integer value. |
| void CommDisable() | Disable SECS communication. The SecsHost is initialized without communication enabled so using this method only makes sense after CommEnable has been called. |
| RcResult CommEnable()
struct RcResult { |
Enables SECS communication. The CommState
property value will change and StateChange
events
will be received. These changes are the asynchronous indications
for success or failure to establish communication. You may want
to
display the trace window in order to see
detailed information on the status of communication attempts. If
there is an error setting up the connection, the return code value will
be non-zero, and the result string will be an error message. |
| RcResult ConnectTypeHsmsActive(string host_or_ip, int port) | This method is an alternative to setting the underlying property values to specify an active HSMS connection type, and calling ConnectTypeSet(). |
| RcResult ConnectTypeHsmsPassive(int port) | This method is an alternative to setting the underlying property values to specify a passive HSMS connection type, and calling ConnectTypeSet(). |
| RcResult ConnectTypeSerial(string comDevice, int baudrate) | This method is an alternative to setting the underlying property values to specify a SECS-I connection type, and calling ConnectTypeSet(). |
| RcResult ConnectTypeSet()
struct RcResult { |
This method is called to use the current property values and initialize a SECS interface for the indicated connection type. It is called by the ConnectType<Type> methods. If you are setting connection property data directly, call this method after your property values are set. The method returns the value 0 to indicate success. If communication is enabled when this method is called, it becomes disabled as a result of setting up the new connection. A non-zero return code value indicates an error setting up the connection, in which case the result will be an error message. |
| RcResult ConnectTypeTerminalServer(string host_or_ip, int port) | This method is an alternative to setting the underlying property values to specify a SECS-I connection type over a TCP/IP terminal server connection and calling ConnectTypeSet(). |
| void ControlStateOffline() | This method sends a S1F15R message to request the offline control state. |
| int ControlStateOnline() | This method sends a S1F17R message to request the online control state. If the return value is 0 or 2 the online state is indicated. |
| void Copy(SecsHost dest) | This method copies the configurable SecsHost property values to another instance. |
| string CopyAll(SecsHost dest) | This method calls Copy to copy the current property values to another instance, and it also copies table records of events, event reports, alarms, variables, etc in the SECS Server to the destination instance. The return value is a string formatted as a list of two integers - the total number of table rows found, and the number of rows copied. In normal circumstances, the two values are equal. |
| void DebugDMHStatus(bool show) | This method causes the DMH message system status window to either be shown or dismissed. |
| void DebugInspect() | This method can be used to exec the Inspect introspection debugger. |
| void DebugTclConsole(bool show) | This method causes a console window for the SECS Server to be shown or dismissed. |
| void DebugTableWindow(bool show) | This method causes the Datahub table management GUI to be shown or dismissed. |
| void DebugTraceWindow(bool show) | This method is used to display a window which updates to show SECS message traffic and state information for the SecsHost. There are menu options to control the data displayed, and menu actions to save the displayed data to the file system. This method invokes the Tcl version of the Trace window which is created by the SECS Server process. See the Tracewin method to instantiate a native .NET window with similar function. Including the .NET window version in your application is desirable to help diagnose communication problems. |
| void Dispose() | As a .NET component, the SecsHost inherits a public Dispose method that can be called to shutdown. |
| RcResult EventAdd(string CEID, string ID_TSN,
string eventName,
string description)
struct RcResult { |
This method is used to manually add event definitions for
equipment
that does not support discovery of event types. The CEID
argument
value is the event type identifier which is usually an integer.
The ID_TSN
argument is the SECS item data type for the CEID in TSN
notation such as U4. The eventName argument is a virtual
name
for the event type defined by the user. The desciption
argument
can be used to provide guidance in selection lists. If any of the
arguments ID_TSN, eventName, or desciption are
provided
as null or empty strings, then default values are used: U4 for ID_TSN,
and the CEID value as a string for the eventName.
If the method succeeds, the rc field in the result structure
is set
to 0. No error occurs if an event definition with the same CEID
already
exists - the other fields are updated per the call arguments. A
non-zero
result indicates an error, and the result string should be
examined.
Possible error return codes include: |
| string [] EventChoice() | This method returns an array of {CEID EventName Description) string values of event types that do not currently have an associated event report. The method is used to help implement the GUI feature of new report creation. |
| Equipment Constant Update see ParameterUpdate | Equipment Constant is a misnomer. |
| int EventDiscovery() | The SECS-II standard does not provide a way to discover equipment events. This method is called to attempt event discovery by enabling all events and asking the equipment which events are enabled. This technique requires that the equipment support the underlying message types and implements an EventsEnabled variable that has the expected name. A positive return value indicates the number of new event types discovered. Negative return values indicate various failure modes. |
| int EventsEnable() int EventsEnable(string CEIDlist, bool is_enabled) |
Called with no arguments, EventsEnable requests that the equipment enable all event reports. By providing arguments, you can request the enabling or disabling of selected events. The SecsHost automatically enables the reporting of events for which you have configured event reports during online initialization. A negative return value indicates an unexpected internal error. The value 0 means success, and 1 means at least one of the events does not exist. |
| bool EventIsHostEnabled(string CEID) | Test if reporting of an event type has been configured in the SecsHost software to be enabled during the initialization logic. |
| bool EventIsReported(string CEID) | Test if the reporting of an event is currently established with the equipment. |
| int EventReportDefine(string eventName, string [] varNames) | Create or update an event report configuration. The eventName
argument is the virtual name of the event which can be configured to be
different than the CEID value by using the EventUpdate
method.
The varNames argument is an array of the virtual names of the
variables
whose values are to be reported when the event occurs. The method
VariableChoice
provides a current list of virtual variable names. You can use
the VariableUpdate
method to provide your own virtual variable names. The default
virtual
variable names are assigned per the conventions of Sematech as
explained
in the EventReport Event section above.
After calling this method, you need to call the Initialize
method to have your desired event reports setup and enabled with the
equipment.
The Initialize method is called automatically whenever an
online
control state is established if the AutoInit
property
is true.
The method returns 0 for success, -1 if the eventName is not known, or -2 if a variable is not known. If you have more than one machine event with the same virtual event name, each machine event will be setup with the desired report. |
| void EventReportDelete(string eventName) | Delete an event report configuration. |
| string [] EventReportConfig(string virtualName) | This method returns a four element string array for the configuration of an event report. The elements are CEID, virtualName, Description, and Variables. Use ListSplit to split the Variables element into the individual virtual variable names. A null is returned in case of error. |
| DataTable EventReportConfigs() | This method returns a DataTable of the existing event report configurations. The table columns are CEID, EventName, Description, and Variables. |
| DataTable EventTable() | This method returns a DataTable featuring a subset of the SECS server's event table for the current SecsHost. The included columns are: spname, CEID, VFEIname, host_managed, host_wants_enabled, event_class, is_reported, and description. |
| string EventUpdate(string CEID, string eventName, string description) | Assign or update the virtual event name and description for an event type. Per the SECS-II standard, events use integer values for identifiers. There is no standardization of values. You are able to provide meaningful names and descriptions for events. You can use this feature to great advantage and create virtual equipment drivers with standard event and variable names. If the description value is passed as null, the current value for the event is not changed. |
| int Initialize() | Performs online initialization which enables communication
and sets
up event reports. Initialization is controlled by your settings
of
property values, and configured items. It optionally includes:
The return value is 0 for success. Error return values
include:
-1 TIMEOUT, 1 communication failed, 2 not online, 3 clock set, 4
setting
of Eq. Constants, 5 disabling of events & reports, 6 event &
report
enabling, 7 alarm management, 8 Spool init, or ei_custom_init error. |
| StringBuilder ListAppend(string list, string
element);
StringBuilder ListAppend(StringBuilder list, string element1); StringBuilder ListAppend(StringBuilder list, string element1, string element2); StringBuilder ListAppend(StringBuilder list, string element1, string element2, element3); StringBuilder ListAppend(StringBuilder list, string
element1,
string element2, element3, element4); |
These methods are used to add one to four list elements to text that is formatted as a Tcl list. It is a good programming practice to use ListAppend or ListJoin to build a Tcl list, in order to make sure that imbedded white space or other special characters are properly delimited with curly braces or escaped with backslashes. A null value may be passed as any of the string argument values, in order to represent an empty list or empty element. However, a null value should not be passed as a System.Text.StringBuilder argument. The System.Text.StringBuilder class is designed to support more efficient string modification than using instances of the string class. The input StringBuilder objects are modified by reference and returned as the return value of the methods. You can construct a StringBuilder instance that does not contain any characters to represent an empty list. The overloaded method calls make it convenient to add up to four list elements in one call. If you need to add more elements, call the methods repeatedly. |
| string ListElement(string list, int index1);
string ListElement(string list, int index1, int index2); string ListElement(string list, int index1, int index2, int index3); |
This function is similar to the lindex function of Tcl. It will parse text formatted as a Tcl list and return the specified element. Indexing starts from 0. Arguments index2 and index3 may be used to indicate that parsing of the TclList should continue up to two additional levels as a nested list structure. If a specified index is out of bounds, an empty string is returned. Not all strings are valid Tcl lists. If an invalid list is parsed, the method call throws the FormatException. |
| string ListJoin(string [] argv); | Joins together strings as Tcl list elements forming a result string that is a Tcl list. Braces are added as needed to delimit empty elements, or to delimit special Tcl character sequences involving backslashes , square brackets, etc. |
| string [] ListSplit(string list) | ListSplit( ) parses a string formatted as a Tcl list into an array of string elements. The function understands the Tcl usage of quotes, braces and backslash sequences. Not all strings are valid Tcl lists. If an invalid list is parsed, the method call throws the FormatException. Failure occurs when there are unmatched braces, unmatched quotes, or non-whitespace following braces or quotes. |
| void MessageTypeAdd(int stream, int function,
SecsMessageReceiveDelegate
callback)
delegate void SecsMessageReceiveDelegate(object sender, int stream, int function, bool send_reply, int transactionID, string TSN_data, string header) |
Call this method to have SECS messages processed by your custom handler methods when the SecsHost has established communication with the equipment. You can provide for new SECS message types, or you can replace the SecsHost handling of particular messages. For example, you could take over the handling of S6F3 discrete data reports for equipment that uses non-standard formats. Use the SendReply, SendS9, and SendAbort methods to send reply messages. |
| void MessageTypeRemove(int stream, int function) | This method is used to cancel SECS message handlers that you have setup using MessageTypeAdd or to cancel the handling of particular messages by the built-in SecsHost logic. If you have called MessageTypeAdd for the specified message type, the Add is cancelled. If you have not called MessageTypeAdd, the SECS server is told not to handle the message. Unhandled primary messages are replied to with an abort reply. |
| RcResult ParameterAdd(string varID, string ID_TSN,
string value_TSN,
string varName, string virtualName, string description)
struct RcResult { |
This method is used to manually add parameter (ECV)
definitions for
equipment that does not support discovery of them using S2F29.
The varID
argument value is the parameter identifier which is usually an
integer.
The ID_TSN argument is the SECS item data type for the varID
in TSN notation such as U4. The value_TSN
argument is the data type of the parameter value in TSN
notation
such as "F4". The varName argument is a name for the
parameter
as defined by the equipment. The virtualName argument is
a
name for the parameter chosen by the user. The desciption
argument can be used to provide guidance in selection lists. If
any
of the arguments ID_TSN, varName, virtualName,
or desciption
are provided as null or empty strings, then default values are
used:
U4 for ID_TSN, the varID value as a string for
the varName, and programmatic mapping of the varName value
for the virtualName.
If the method succeeds, the rc field in the result structure
is set
to 0. No error occurs if a definition with the same ID already
exists
- the other fields are updated per the call arguments. A non-zero
result indicates an error, and the result string should be
examined.
Possible error return codes include: |
| string ParameterUpdate(string varID, string newValue) | Use this method to set the value of an Equipment Constant. The return value is "0" for success, -1 and an error message if improper data is used, "1" if the variable does not exist, "2" if the equipment refuses to change the value at present, and "3" if the equipment rejects the new value. |
| string [] ProcessProgramList() | Obtain the current list of process programs using S7F19R. The return value is null in case of error such as the equipment not being online or not supporting S7F19. |
| RcResult ProcessProgramDownload(string pathname)
struct RcResult { |
Download a process program to the equipment using Stream 7
messages. The process program must be in the process program
directory. If there is no saved table record in file ei_ppid.tab describing the process
program file, the logic assumes that the file format contains both the
PPID and PPBODY in text TSN notation which was the upload format used
prior to May 2008. The return
value
of the method call is a two element structure, a return code and
text. The return
code
is 0 for success, in which case the text will be the PPID (the process
program name). Possible error codes include: -1 unexpected transaction error -2 file not found -6 SECS transaction error -10 file open or read error -11 no upload description data and the file data is not consistent with the older upload format |
RcResult ProcessProgramLargeRequest(string ppid) struct RcResult { int rc; // return code string result; } |
This method initiates the upload
of a process program to the host
using the message types of Stream 13 which are designed for large data
set transfers. Using these messages is more complex than the
usual
Stream 7 transfer messages so they are less commonly supported.
The ppid
argument value is the process
program
identifier used by the equipment. The upload logic saves only the
data passed as the body of the
process program in the uploaded file. The ppid value used to identify
the process program may not be a valid filename. The upload logic
assigns a unique filename to the uploaded program, using the ppid value
if possible. The logic also creates or updates a file of SQL
statements, ei_ppid.tab, in
the process program directory. The ei_ppid.tab file saves the ppid
value to filename mapping, as well as the datatype of the transferred
program. The ei_ppid.tab file has to be preserved along with the
uploaded process programs in order to download them in the future. The return value is a two element structure, a return code and text. The return code is 0 if the transfer is initiated successfully as determined by the reply to S7F41. The transfer is not complete when the method returns. The large data set transfer logic receives the file in the subdirectory, dataset_transfer, of the directory set by the ProcessProgramDir property. When the transfer is complete, if there is already an earlier version of the process program file in the process program directory, then there is a StateChange event with the name dataset_delete and the newvalue being the ppid value, which informs you that the earlier version file is being replaced. Next, there is a StateChange event with the name dataset_upload and the newvalue being the ppid value which informs you of the successful upload completion. Proper GEM equipment will also post UploadSuccess or UploadFailure data collection event reports to indicate completion as well. If the transfer does not complete successfully, there is additional status information is the SECS server table ei_dataset_xfer. It is possible to query this table or subscribe to data changes of this table to better integrate transfer status information. Possible error results include values of the ACKC7 reply to S7F41 and the following: 1 permission not granted 4 PPID not found 6 other error -6 error when sending S7F41 or receiving the S7F42 reply -14 A large PP receive is already in progress for ppid -15 Stream 13 transfers are disabled either from configuration or initialization failure -17 error when parsing the S7F42 reply |
RcResult ProcessProgramLargeSend(string filename) struct RcResult { int rc; // return code string result; } |
This method initiates the
download of a process program to the equipment using
the message types of Stream 13 which are designed for large data
set transfers. Using these messages is more complex than the
usual
Stream 7 transfer messages so they are less commonly supported.
The filename argument value
is the file name of a previously uploaded process program in the
process program directory. The file is expected to contain only
the data of a process program - this transfer method is not compatible
with the previously used upload format that saved both the PPID and
PPBODY in TSN notation. The filename
may not be the same as the process program identifier, ppid. The saved information
in the ei_ppid.tab file in the
ProcessProgramDir
is checked for a
possibly different ppid.
The return value is a two element structure, a return code and text. The return code is 0 if the transfer is initiated successfully as determined by the reply to S7F37. The transfer is not complete when the method returns. After the data has been sent to the equipment, per GEM, the equipment is expected to verify the byte count of the download process program file using S7F29. When this verification occurs with the correct byte count, there is a StateChange event with the name dataset_download and the newvalue being the ppid value. If the transfer does not complete successfully, there is additional status information is the SECS server table ei_dataset_xfer. Possible error results include values of the ACKC7 reply to S7F37 and the following: 1 permission not granted 6 other error -4 PPID filename not found -6 error when sending S7F37 or receiving the S7F37 reply -14 A large PP receive is already in progress for ppid -15 Stream 13 transfers are disabled either from configuration or initialization failure -17 error when parsing the S7F38 reply |
| RcResult ProcessProgramUpload(string ppid)
struct RcResult { |
Upload a process program from the equipment to our file
system.
The return value is a two element structure, a return code and
text.
The return code is 0 for success, in which case the text will be the
pathname
of the saved program.. Possible error codes include -1 unexpected transaction error -2 upload refused or failed -3 file system error |
| void SecsHost()
void SecsHost(string spname, string dmhGroup) void SecsHost(string spname, string [] cols, string [] row) void SecsHost(System.ComponentModel.Icontainer c) |
The constructor. The spname argument becomes
the name
of a global data item and a Tcl command in the SECS Server
process.
It needs to be unique for each SecsHost instance, and not coincide with
a keyword in the Tcl programming language. The default value of spname
is similar to host0. The name should be a single alphanumeric
token.
One of the constructor forms accepts property values as string arrays. This form is used by our example Supervisor application. Take a look at the source code for the SecsHost to understand the names used for the property values. Essentially there is a direct mapping of properties to column names in an SQL table, ei_startup, which is used to manage interface startup information. The dmhGroup argument becomes the DMH message system group name used by the SecsHost and SECS Server process. If you are instantiating more than one SecsHost instance in your process, construct each instance using the same dmhGroup name argument so that the SECS Server process is shared. If you want to have both SecsHost and SecsPort equipment interfaces in the same application, use the constructor choices that allow you to specify the same dmhGroup argument value so the SECS Server is shared. The groupname chosen needs to be unique among other DMH server instances on the computer where the SecsHost is executing. The default value is GEMHOST. This value does not conflict with the default value for Hume Datahub instances which is mbx, or the default value for the GemEqApp which is GEM. The name should be a single alphanumeric token. The SECS Server process can be debugged remotely by connecting to the DMH mailbox SERVER_RPC@hostname:dmhGroup using the Inspect application or using the DMH mailbox SERVER_SQL@hostname:dmhGroup by the hubclient application. |
| void SendAbort(int stream, int primaryFunction) | This method is used to send an F0 abort message in lieu of a proper reply. It is used to indicate that the received message is not appropriate in the current context. |
| void SendReply(int stream, int function, int
transactionID)
void SendReply(int stream, int function, int transactionID, string TSN_data) |
This method is used by your custom SECS message handling logic to send reply messages either with or without data. The reply data is formatted as Tcl Secs Notation text. |
| void SendS9(int function, string header) | This method is used to indicate an error condition response
to a received
message - it is sent in lieu of a normal reply. You will not
receive
a message type, unless you register for it. In general, host
software
has less of a need to send Stream 9 messages than equipment software. |
| string SendSecsMsg(int stream, int function, bool
reply_wanted,
string TSN_data, bool wait4reply)
RcResult SendSecsMsgRcResult(int stream, int function, bool reply_wanted, string TSN_data, bool wait4reply) struct RcResult {
|
These methods are used to send a primary SECS message,
optionally indicating
a reply is wanted, and optionally indicating that the call should wait
for a reply. A null or empty string value may be used for the TSN_data
argument
when a header only message is to be sent. If a multiblock
enquire/grant
transaction is required for the message type, the SecsHost software
does
it automatically. The reply value for the SendSecsMsg()
method
is a string formatted as a two element list. The first element is
an integer code, and the second element is reply or diagnostic
data.
The SendSecsMsgRcResult() method is identical in function,
except
that the return data is parsed into a structure. The possible
return
values are:
string reply = secshost.SendSecsMsg(1,17, true,
"", true); |
| static void ServerSQLCmd(string sql) | Send an SQL command to the SECS Server process without waiting for a reply. This method is used by the SecsHostsoftware and made public in case of custom requirements. |
| static string ServerSQLReply(string sql) | Send an SQL command to the SECS Server process and wait for the reply. This method is used by the SecsHost software and made public in case of custom requirements. |
| static void ServerTclCmd(string tclCommand); | Send a Tcl command to the SECS Server process without waiting for a reply. This method is used by the SecsHost software and made public in case of custom requirements. After a SecsHost instance has been constructed and the connection type set, the TclCmd( ) method should be used instead of this method for commands that are directed to a particular interface instance. Why? Doing so serializes the commands for a particular interface, and provides re-entrant execution protection. |
| static string ServerTclReply(string tclCommand); | Send a Tcl command to the SECS Server process and wait for the reply message. This call is used by the SecsHost software and made public in case of custom requirements. After a SecsHost instance has been constructed and the connection type set, the TclReply( ) method should be used instead of this method for commands that are directed to a particular interface instance. |
| static int SuperSave() | Save the SECS server table data including interface startup configurations. You can write your own applications with your own persistence mechanisms. Our example Supervisor application uses this method to save the state of the configured interfaces for the next session. |
| static void SupervisorStart (string DmhGroup) | This method is the startup call for our Supervisor application example. It restores data from the last SuperSave call, and instantiates all of the configured interfaces. The interfaces that are configured with autoStart true, are enabled for communication. |
| static DataTable SecsHost.TableRead(DataTable table, string query) | The TableRead and TableSchema static methods provide generic capability to create DataTable instances in your .NET application that clone data from the SECS Server process. First, the TableSchema method is used to create an empty DataTable that has the desired schema. Next, the TableRead method is used to load or refresh rows of data using a fresh query of the server table data. Look at the source code for the SecsHost AlarmTable method for an example. |
| static DataTable SecsHost.TableSchema(string tablename, string columns) | Clone the schema of a Server Table or subset - see the description of TableRead directly above. |
| void TclCmd(string tcl) | This method is used to send Tcl code to the SECS server command mailbox for the connection. It is used by the SecsHost software and made public to support custom requirements. |
| string TclReply(string tcl)
RcResult TclReplyRcResult(string tcl) struct RcResult { |
These methods are used to send Tcl code to the SECS server command mailbox for the connection and wait for the evaluation result. They are used by the SecsHost software and made public to support custom requirements. With TclReply() the string return value is structured as a list and may be parsed using ListSplit or ListElement. The first element is a return code for the evaluation with 0 meaning success. The second element is the return value from the executed Tcl code, or an error message if the return code is not 0. With TclReplyRcResult( ) the same data has been parsed and is returned as separate fields in the RcResult data structure. |
| int TraceSetup(string traceId, int periodSeconds, int totalSamples, int samplesPerReport, string SVIDs) | Control TRACE Reports - a convenience method to send the
S2F23R message.
If totalSamples is 0, the trace is disabled. If totalSamples
is greater than 0, you should insure that it is an even multiple of samplesPerReport.
The reporting period value specified in seconds, periodSeconds,
is subject to equipment limitations. The SVIDs argument
is
a white space delimited list of Status Variable identifiers. The
return values are 0 = success, 1 = too many SVIDs, 2 = no more traces
allowed,
3 = invalid period specified, -1 = error such as not being in online
communication,
-2 = at least one unknown SVID, -3 at least one variable is not a
Status
Variable (class SV).
The method also creates or updates event report configuration data so that the S6F1 trace reports are received as event reports with the CEID of TRACE_REPORT. When there are multiple samples per report, the event report logic parses the received data into multiple event reports, one per sample. In this situation you will usually want the CLOCK variable as one of the reported items to know the observation time of the sample. If you want to have more than one trace report series active at a time, then you can use the MessageTypeAdd() method to register for the S6F1 messages and receive them directly without using the virtual event report receiving logic. |
| void Tracewin(bool show); | The SecsHost is able to instantiate and manage a Form window class, Tracewin, which provides a controllable display of the data being exchanged across the SECS interface. The argument is set to true to display the window, or false to close the window. There are menu options to provide hex dump formatting of the data, or higher level descriptive formatting. There are also menu actions to save the displayed data to the file system. |
| RcResult VariableAdd(string varID, string ID_TSN,
string varName,
string virtualName, string description, string varClass)
struct RcResult { |
This method is used to manually add variable definitions for
equipment
that does not support discovery of them. The varID
argument
value is the variable identifier which is usually an integer. The
ID_TSN
argument is the SECS item data type for the varID in TSN
notation such as U4. The varName argument is the name for
the variable as defined by the equipment. The virtualName
argument is a name for the variable chosen by the user. The desciption
argument can be used to provide guidance in selection lists. The varClass
argument value is set to "SV" for Status Variables and "DVVAL" for Data
Value variables. If any of the arguments ID_TSN, varName,
VFEIname,
or desciption are provided as null or empty strings, then
default
values are used: U4 for ID_TSN, the varID
value
as a string for the varName, and programmatic mapping of the varName
value
for the VFEIname.
If the method succeeds, the rc field in the result structure
is set
to 0. No error occurs if a definition with the same ID already
exists
- the other fields are updated per the call arguments. A non-zero
result indicates an error, and the result string should be
examined.
Possible error return codes include: |
| string [] VariableChoice() | This method returns a list of variable names which are candidates for use in dynamic Event Report configuration. A null value is returned in case of error. |
| string VariableGetId(string virtualNames)
string [] VariableGetId(string [] virtualNames) |
These methods are used to map variable Virtual names assigned by using the VariableUpdate method or assigned by default when the variables are first known, to the identifiers used by the equipment. The latter are typically integer values such as SVID's or ECID's. If called with a string argument, the virtualNames value may contain 1 or more white space separated names, and the result will be a white space separated list of the corresponding Ids. An empty result is returned for an unknown name value. If called with a string array argument, each array element is expected to contain a single name, and a string array result is returned for the corresponding Id values. |
| HostVariableInfo VariableGetInfo(String varID)
public struct HostVariableInfo { |
This method returns the known configuration and value information of a variable or Equipment Constant Variable (ECV). A structure with the varID set to null is returned for an unknown varID input value. The information comes from the replies to messages that are sent during the online initialization, from data received in event reports and trace reports, or from the restored table data of a previous session. |
| RcResult VariableQuery(int varID) RcResult VariableQuery(String varName) RcResult VariableQueryVirtual(String virtualName) struct RcResult { int rc; // return code string result; } |
These methods are used to obtain
the value of a Parameter or Status Variable using the numeric or name
identifier. The varName
argument represents the name given the variable by the
equipment.
Note that some equipment has the same variable names used more than
once. The VariableQueryVirtual
method uses the virtual variable name
as the argument value which is unique for each variable. For the
methods to succeed, you must be communicating in an online state, and
the variables must be known from the replies that are received during
online initialization to S1F11 and S2F29. The variable data can
either
be discovered during the current session, or known by loading variable
data saved from a previous session. If the method succeeds, the rc field in the result structure is set to 0. A non-zero rc result indicates an error, and the result string can be examined for a description. Possible error return codes include: -1 unexpected error -2 communication is not enabled -3 unknown identifier (can occur if initialization queries have not been completed) -6 no reply TIMEOUT, abort reply, or Stream 9 error reply |
| string VariableGetVirtualName(string Ids)
string [] VariableGetVirtualName(string [] Ids) |
These methods are used to map variable identifiers which are typically integer values (SVID, ECID, etc) to the Virtual names assigned by using the variableUpdate method or assigned by default when the variables are first known. If called with a string argument, the Ids value may contain 1 or more white space separated Id values, and the result will be a white space separated list of the corresponding Virtual names. An empty name result is returned for an unknown Id value. If called with a string array argument, each array element is expected to contain a single Id, and a string array result is returned for the corresponding Virtual names. |
| DataTable VariableTable() | This method returns a current subset of the SECS server variable table for the SecsHost instance. The included columns are varID, varname, VFEIname, description, varclass, value_TSN, varmethod, varvalue, host_setval, host_managed, and t_latest. |
| int VariableUpdate(string varID, string virtualName, string description) | You are able to assign meaningful names and descriptions to the equipment variables using this method. The virtualName values are used in Event Report configurations and as the variable names in the Event Report event data. If the description field is passed as a null value, the current description is not changed. |
This section of the document has information on the built-in features
of the SecsHost software in regards to the SEMI E5 and GEM standards.
There is only one other variable record of note. The AUTO_INIT_RESULT variable exists to save the execution result when the initialization logic executes automatically. It is common to configure this variable to be part of the event report for the AUTO_VIRT_INIT event. This dynamic event report can be configured and received even if the underlying equipment does not support dynamic event reports. The event report is created and managed by the SecsHost software. There are three other events that are synthesized in the SecsHost software and presented to the application using the same mechanisms used to dispatch equipment based event reports. Here is a list of the built-in driver events:
| Type | Sender | Data Format | Comments |
| S1F1R | H, E | "Are You There?" | |
| S1F2 | H | L | "On Line Data" |
| S1F3R | H | L [<SVID>]* <SVID> := {U4 <varID>} |
"Selected Equipment Status Request" |
| S1F4 | E | L [<SV>]* | "Selected Equipment Status Data" The data type of the SV value depends on the variable. |
| S1F11R | H | L [<SVID>]* | "Status Variable Namelist Request" |
| S1F12 | E | L [{L:3 <SVID> <SVNAME> <UNITS>}]+ | "Status Variable Namelist Reply" |
| S1F13R | H,E | L | "Establish Communications Request" |
| S1F14 | H | L:2 {B 0} L | "Establish Communications Request Acknowledge" |
| S1F15R | H | "Request OFF-LINE" | |
| S1F16 | E | <OFLACK> | "OFF-LINE Acknowledge" |
| S1F17R | H | "Request ON-LINE" | |
| S1F18 | E | <ONLACK> | "ON-LINE Acknowledge" |
| S2F13 | H | L [<ECID>]* | "Equipment Constant Request" |
| S2F14 | E | L [<ECV>]* | "Equipment Constant Data" |
| S2F15R | H | L [{L:2 <ECID> <ECV>}]* | "New Equipment Constant Send" |
| S2F16 | E | <EAC> | "New Equipment Constant Ack" |
| S2F17R | H | "Date and Time Request" | |
| S2F18 | E | A:16 YYYYMMDDHHMMSScc A:12 YYMMDDHHMMSS |
"Date and Time Data" |
| S2F23R | H | L:5 <TRID> <DSPER> <TOTSMP> <REPGSZ> {L [<SVID>]+} | "Trace Initialize Send" |
| S2F24 | E | <TIAACK> | "Trace Initialize Acknowledge" |
| S2F25R | H,E | B [<b>]* | "Loopback Diagnostic Request" |
| S2F26 | H | B [<b>]* | "Loopback Diagnostic Data" |
| S2F29R | H | L [<ECID>]* | "Equipment Constant Namelist Request" |
| S2F30 | E | L [L:6 <ECID> <ECNAME> <ECMIN> <ECMAX> <ECDEF> <UNITS>]+ | "Equipment Constant Namelist" |
| S2F31R | H | A:16 YYYYMMDDHHMMSScc A:12 YYMMDDHHMMSS |
"Date and Time Set Request" |
| S2F32 | E | <TIACK> | "Date and Time Set Acknowledge" |
| S2F33R | H | L:2 <DATAID> {L [{L:2 <RPTID> {L [<VID>]*}]*} | "Define Report" |
| S2F34 | E | <DRACK> | "Define Report Acknowledge" |
| S2F35R | H | L:2 <DATAID> {L [<CEID> {L [<RPTID>]*}]*} | "Link Event Report" |
| S2F36 | E | <LRACK> | "Link Event Report Acknowledge" |
| S2F37R | H | L:2 <CEED> {L [<CEID>]*} | "Enable/Disable Event Report" |
| S2F38 | E | <ERACK> | "Enable/Disable Event Report Acknowledge" |
| S2F39R | H | L:2 <DATAID> <DATALENGTH> | "Multi-block Inquire" |
| S2F40 | E | <GRANT> | "Multi-block Grant" |
| S4F25R | H | L:2 <DATAID> <DATALENGTH> | "Multi-block Inquire" |
| S4F26 | E | <GRANT> | "Multi-block Grant" |
| S5F1R | E | L:3 <ALCD> <ALID> <ALTX> | "Alarm Report Send" |
| S5F2 | H | B 0 | "Alarm Report Ack" |
| S5F3R | H | L:2 <ALED> <ALID> | "Enable/Disable Alarm Send" |
| S5F4 | E | <ACKC5> | "Enable/Disable Alarm Ack" |
| S5F5R | H | <ALID vector> | "List Alarms Request" |
| S5F6 | E | L [{L:3 <ALCD> <ALID> <ALTX>}]* | "List Alarm Data" |
| S5F7R | H | "List Enabled Alarm Request" | |
| S5F8 | E | L [{L:3 <ALCD> <ALID> <ALTX>}]* | "List Enabled Alarm Data" |
| S6F1 | E | L:4 <TRID> <SMPLN> <STIME> {L [<SV>]+} | "Trace Data Send" |
| S6F3[R] | E | L:3 <DATAID> <CEID> [{L:n {L:2 <DSID1> {L:m [{L:2 <DVNAME> <DVVAL>}]*}}]* | "Discrete Variable Data Send" |
| S6F4 | H | B 0 | "Discrete Variable Data Ack" |
| S6F5R | E | L:2 <DATAID> <DATALENGTH> | "Multi-block Data Send Inquire" |
| S6F6 | H | B 0 | "Multi-block Grant" |
| S6F11R | E | L:3 <DATAID> <CEID> {L [{L:2 <RPTID> {L [<V>]+}}]+} | "Event Report Send" |
| S6F12 | H | B 0 | "Event Report Ack" |
| S6F13R | E | L:3 <DATAID> <CEID> {L [{L:2 {U4 <rptid>} {L [{L:2 {U4 <vid>} <V>}]+}}]+} | "Annotated Event Report Send" |
| S6F14 | H | B 0 | "Annotated Event Report Ack" |
| S6F23R | H | <RSDC> | "Request or Purge Spooled Data" |
| S6F24 | E | <RSDA> | "Request or Purge Spooled Data Ack" |
| S7F1R | H,E | L:2 <PPID> <LENGTH> | "Process Program Load Inquire" |
| S7F2 | E,H | <PPGNT> | "Process Program Load Grant" - The SecsHost always sends B 0. |
| S7F3R | H,E | L:2 <PPID> <PPBODY> | "Process Program Download" |
| S7F4 | E,H | <ACKC7>< |