Solutions
...
Litmus Production Record Datab...
Interacting with Litmus Produc...

Adding or Modifying an Event definition

7min

Use Cases

Litmus Production Record Database is capable of monitoring tag data for production events and then record these events.

This does require to setup an event definition which includes what trigger to monitor and what to collect first.

User can do this either by using applications such as:

  • Microsoft SQL Server Management Studio
  • MSSQL CLI

This can also be used for building custom solutions based on applications which allow for an ODBC connection such as:

  • Excel
  • C#
  • .Net
  • Python

Litmus does provide such as custom solution which can be downloaded from our Central Portal.

Method

Execute Stored Procedure PROREC_Event_ProcessEventConfiguration

Note

Do learn more about the event monitoring concept and how to define it, please read the document

Input Variables

Variable name

Datatype

Description

Example

@EventNodeName

VARCHAR(50)

The name of the root Node of a data model. Mandatory!

Can not be NULL or Empty

DownTime





@EventName

VARCHAR(50)

The unique name of the Event.



Mandatory!

Can not be NULL or Empty

DownTimeL1M2

@EventDescription

VARCHAR(256)

An optional short description of the event. Can be used to share some information about the event with other users,



Can be set to NULL.

Down time recording for asset L1M2

@TriggerConditionName

VARCHAR(50)

The name of the trigger condition.



Trigger Condition names have to be unique per event.



Mandatory!

Can not be NULL or Empty

StartDownTimeL1M2

@TriggerTag

VARCHAR(256)

Pipe symbol "|" separated definition of the device, tag and item which is the trigger to be monitored.



Mandatory!

Can not be NULL or Empty

L1_Machine2_1_MB|isFaulted|Value

@Condition

VARCHAR(50)

The condition for which the trigger tag is to be monitored for. Possible Values:

  • equalTo
  • onChange
  • greaterThan
  • smallerThan
  • greaterequalThan
  • smallerequalThan

Mandatory!

Can not be NULL or Empty

equalTo

@ConditionValue

VARCHAR(256)

The value to monitor the tag for, if the condition is not 'onChange'.



Mandatory for all Conditions except 'onChange' !

1

@EventProRecItem

VARCHAR(512)

Pipe symbol "|" separated definition of the data model item.

This includes the node name.

If the item is defined under a specific hierarchy level, then all the level names.

And the item name.



Mandatory!

Can not be NULL or Empty

DownTime|Asset

@isIdentifier

BIT

Is this Item an Identifier?



Possible Values:

1 = Yes

0 = No



To learn more about Identifiers, please read this document.

1

@atStart

BIT

If the trigger does execute, is the item written to a new event (creates a new Production Record ID) or is it written to the previous event.



Possible Values:

1 = Yes

0 = No

1

@ItemValueSource

VARCHAR(50)

Defines the source for the item once a trigger does fire.



Possible Values:

  • TimeOfTrigger
  • isConstant
  • ValueFromTag
  • isCalculation

Mandatory!

Can not be NULL or Empty

isConstant

@ItemValue

VARCHAR(256)

The value for the item corresponding with the value source.



Options are:



@ItemValueSource = TimeOfTrigger -> @ItemValue = NULL



@ItemValueSource = isConstant -> @ItemValue = a constant value



@ItemValueSource = ValueFromTag -> @ItemValue = Pipe symbol "|" separated definition of the device, tag and item which is the trigger to be monitored.



@ItemValueSource = isCalculation -> @ItemValue = Pipe symbol "|" separated definition of the device, tag and item which is the trigger to be monitored.

L1_Machine2_1_MB

@CalculationType

VARCHAR(52)

If the @ItemValueSource is 'isCalculation', define the type of calculation.



Possible Values:

  • Average
  • Maximum
  • Minimum
  • StandardDeviation
  • Median
  • Sum
  • Mode



Can be set to NULL if ItemValueSource is not 'isCalculation'.

NULL

@TimeFrameStartItem

VARCHAR(512)

If the @ItemValueSource is 'isCalculation', define which data model item will provide the start time for the required time period.

This is defined as a Pipe symbol "|" separated definition of the data model item.

This includes the node name.

If the item is defined under a specific hierarchy level, then all the level names.

And the item name.



Can be set to NULL if ItemValueSource is not 'isCalculation'.

NULL

@TimeFrameEndItem

VARCHAR(512)

If the @ItemValueSource is 'isCalculation', define which data model item will provide the end time for the required time period.

This is defined as a Pipe symbol "|" separated definition of the data model item.

This includes the node name.

If the item is defined under a specific hierarchy level, then all the level names.

And the item name.



Can be set to NULL if ItemValueSource is not 'isCalculation'.

NULL

How to use

To insert an event, call the stored procedure PROREC_Event_ProcessEventConfiguration using the T-SQL EXEC or EXECUTE keyword and provide the Input variables. Below is an example using T-SQL in SQL Server Management Studio:

EXECUTE [LE_ProductionRecord].[dbo].[PROREC_Event_ProcessEventConfiguration] @EventNodeName = N'DownTime', @EventName = N'DownTimeL1M2', @EventDescription = N'Down time recording for asset L1M2', @TriggerConditionName = N'StartDownTimeL1M2', @TriggerTag = N'L1_Machine2_1_MB|isRunning|Process_Value', @Condition = N'equalTo', @ConditionValue = N'1', @EventProRecItem = N'DownTime|Main_Classification|Sub_Classification|FaultCode', @isIdentifier = 1, @atStart = 1, @ItemValueSource = N'isConstant', @ItemValue = N'Unclassified', @CalculationType = NULL, @TimeFrameStartItem = NULL, @TimeFrameEndItem = NULL;

Result

The stored procedure will verify that the provided values are correctly formatted and then create any new node, levels and items or modify existing items.

The result can be read back from the log table PROREC_Misc_Log.

Below is an example using T-SQL in SQL Server Management Studio:

SELECT TOP (100) [LogID] ,[LogType] ,[LogProcedure] ,[LogEntry] ,[LogTime] FROM [LE_ProductionRecord].[dbo].[PROREC_Misc_Log] WHERE [LogProcedure] = 'PROREC_Event_ProcessEventConfiguration' Order by LogID Desc

With the result returned

add new event
add new event