Model 30

Model 30 Description

Model 30 calls a stored procedure on a database in the server defined by the ODBC ConnectString property at a specific interval (specified by the TINT property).  Each row returned from the stored procedure named in the SpName (NewEvents) property is created as a new production event. The timestamp comes from the Turnup Tag.  There must be a value in the Turnup Tag within the defined Maximum TT Differential property for the Turnup Tag timestamp to be used as the Event Timestamp. These rows have to be in a specific format.  The row ID of each row that is successfully processed is then used as a parameter into the stored procedure named in the SpName (RemoveEvents) property.

The functionality in this model is available only if you have purchased the Quality Module.

IMPORTANT: The ODB connection must NOT have the parameter "Enable Lazy Close Support" selected to avoid locking the Plant Applications tables.

Model 30 Properties

The following Model properties are set up using the Plant Applications Administrator:

Property

Description

Maximum Run Time (Seconds)

optional: Type the number of seconds you want the model to run. The default is 0 (zero), which means the model will not time out. Typically, you will want to limit the run time of the model only if troubleshooting the model (for example, one of the stored procedures is in an infinite loop).

Model Processing Group

Used for multithreading. See the Multithreading topic for more information.

Turnup Tag

The timestamp of the last good value of this tag is used for the production event timestamp.

TINT:(Interval) Minutes

Interval at which the SpName (NewEvents) stored procedure is called on the server named in the ODBCConnectString.

ODBC Connect String

DSN=xx;UID=yyy; PWD=zzz;

Machine

This is a unique production unit number – not necessarily the PU_Id but just a unique number in the system. The value of this property is passed in to the stored procedure named in the NewEvents. This property allows you use the same server and stored procedure for multiple events in Plant Applications.

Tappi Begin

This value is used as the 1st characters of the Tappi or Event Number and is passed into the NewEvents stored procedure.

SpName (NewEvents)

Stored Procedure used to create new production events. The header prototype for this stored procedure must look like this:

CREATE PROCEDURE spLocal_NewEvents

@ TappiBegin varchar(30), --value of the property TappiBegin

@machnum varchar(30), --value of the property Machine

@misc varchar(30) -- value of the property Misc

AS

SpName (RemoveEvent)

Stored Procedure used to mark the events on the remote system as processed. The header prototype for this stored procedure must look like this:

CREATE PROCEDURE spLocal_EventProcessed

@ UniqueRowID int --from result set from NewEvents stored procedure

AS

Max TT Diff (Minutes)

There must be a value in the Turnup Tag within this value for the timestamp of the Turnup Tag to be used as the Event Timestamp.

Log Only (TRUE)

If True, no events will be created.

Misc

Sent into the NewEvents stored procedure.

Var Desc (Optional)

 

The result set of this stored procedure must look like this:

Declare ResultsSet30 Table(

   UniqueRowId int,

   PlantApplicationsEventNum varchar(25),

    TimestampYear int,

    TimestampMonth int,

    TimestampDay int,

    TimestampHour int,

    TimestampMinute int,

    TimestampSecond int,

    TransType int DEFAULT(1), --means ”r;Insert”

    ProdCode varchar(25) DEFAULT('') )-- this value is ignored

Select  * from ResultSet30

See Also