Events
prerequisites before configuring the event types, make sure the docid\ sqqolo1tj cwlxz4m5x85 and docid\ in ezegwrotydez3cgrye are configured configuring the event types let's start by creating the mixing batch event type go the the events page and click + create event type enter the following name mixing batch description the entire mixing process parent no parent with the event created, select it and click the purple icon add property attach the following properties to the mixing batch event type name description datatype type uom average power the average power usage for the batch number simple kwatt batchid the unique batch identifier string simple max level the max tank level number simple litre recipe the recipe used for this batch string simple total energy (j) the total energy usage of all the steps number simple joule total energy (kwh) the total energy usage of all the steps number simple kwatth next, let's create the sub events for the 3 phases of our batch go the the events page and click + create event type create an event type for each name description parent filling step mixing batch filling step mixing batch mixing step mixing batch mixing step mixing batch emptying step mixing batch emptying step mixing batch for each of these event types, add a single event type property name description datatype type uom total energy (j) energy usage of step number simple joule now we have created all event types, we go back to the asset tree and attach our event types to our mixer assets associating the event types to the assets go the the assets page and select line 1 > mixer click the yellow + configure event set the following basis detection mode historian event type mixing batch parent empty settings data reference data reference assetproperty asset property select line 1 > mixer > running from the tree refresh interval 1m grace period 0m the mixing batch event type is now attached to the line 1 mixer now, let's configure the event properties unfold the mixing batch event type attached to the mixer of line 1, and configure the event properties as follows max level basis detection mode historian priority 0 settings data reference asset property line 1 > mixer > level aggregation max start offset 0s stop offset 0s close after 1m preview enabled on good points only on recipe same as max level, with the following changes settings data reference asset property line 1 > mixer > current recipe aggregation first total energy (j) same as max level, with the following changes settings data reference asset property line 1 > mixer > energy usage aggregation integral average power basis detection mode calculation priority 1 inputs alias e data reference type eventtypeproperty event type property total energy (j) script tengo currentevent = local get("currentevent") dur s = times duration seconds(currentevent duration) if is equal(dur s, 0) { return } if e value == undefined { 	return } return ( e value / dur s) / 1000 batchid basis detection mode calculation priority 0 settings close after 1m preview enabled off script tengo // return a random batch number return format("batch line1 %04 f", rand float() 10000 0) total energy (kwh) basis detection mode calculation priority 1 inputs alias e data reference type eventtypeproperty event type property total energy (j) script tengo return e value / 3600000 0 now, for each of the 3 steps in the mixing batch (filling, mixing and emptying), attach the event type the the mixer asset as follows event type detection mode data reference parent filling step historian assetproperty line 1 > mixer > filling mixing batch mixing step historian assetproperty line 1 > mixer > mixing mixing batch emptying step historian assetproperty line 1 > mixer > emptying mixing batch for each event type, configure the following event property total energy (j) basis detection mode historian priority 0 settings data reference asset property line 1 > mixer > energy usage aggregation integral start offset 0s stop offset 0s close after 1m preview enabled on good points only on repeat this process for the mixer of line 2 with these steps done, factry historian will detect events in the background based on incoming data from the faketory dataset allow some time to pass, or use the docid\ wkilksy0w63s1cafwkur0 function to speed things up