A Pressure Gauge Monitoring and Response Example

To begin with we need a component to monitor the output of the pressure gauge and call that component “PressureGaugeMonitor”. Within the component we define several public fields to monitor the data output from the pressure gauge. The pressure input will be monitored in the Update loop and compared against the min, max and optimal values. When the pressure input goes out of range various bools are set true and passed to SILVIA who can respond in many ways. We will discuss the responses further but first let’s look at the code in our PressureGaugeMonitor component that will trigger the response/s.


using CognitiveCode.Silvia.Api; using System;
using System.Collections; using UnityEngine;

public class PressureGaugeMonitor : MonoBehaviour {
//External reference to SILVIA Core public SilviaCore Core;
//Vat ID
public int vatID;
//values for pressure monitoring


public float pressureInput; 
public float minPressure; 
public float optimumPressure; 
public float maxPressure;
//alerting that pressure is below minimum 
public bool initAlertCountdown = false; public float countdownDuration = 10f; public float alertTimer;
public bool alertHasTriggered;
//alarm tripped when maximum pressure is exceeded public bool alarmHasTripped;

void Update () {
if (pressureInput == optimumPressure) {
if (initAlertCountdown) { initAlertCountdown = false; }
} else if (pressureInput < minPressure) { if (!initAlertCountdown) {
initAlertCountdown = true; alertTimer = 0f;
} else if (initAlertCountdown) { alertTimer += Time.deltaTime;
if (alertTimer >= countdownDuration) {
MinimumPressureAlertTriggered ();
}
}
} else if (pressureInput > maxPressure) { MaximumPressureAlarmTripped ();
}
}

public void MinimumPressureAlertTriggered () { alertHasTriggered = true;
//SILVIA command and control here
//Construct VatID to pair with Alert Text string vatIdInfo = “Vat ” + vatID.ToString();
//Set SILVIA Core Variable with Vat Pressure Info and Alert Text string alertText = “The Minimum Pressure of ” +
pressureInput.ToString() + “ has been reached in ” + vatIdInfo; Core.SetVariable(“$pressure_alert”, alertText);
//Jump to minimum_pressure in the alerts Behavior Group, 100% chance Core.ApiBrain().SetJump(“alerts”, “pressure_alert”, 1.0f);
//The Behavior will then speak the content of “$pressure_alert”
}

public void MaximumPressureAlarmTripped () { alertHasTriggered = true;
//SILVIA command and control here
//Construct VatID to pair with Alert Text string vatIdInfo = “Vat ” + vatID.ToString();
//Set SILVIA Core Variable with Vat Pressure Info and Alert Text string alertText = “The Maximum Pressure of ” +
pressureInput.ToString() + “ has been reached in ” + vatIdInfo; Core.SetVariable(“$pressure_alert”, alertText);
//Jump to maximum_pressure in the alerts Behavior Group, 100% chance Core.ApiBrain().SetJump(“alerts”, “pressure_alert”, 1.0f);
//The Behavior will then speak the content of “$pressure_alert”
}
}

When a Pressure Warning is detected by the PressureGaugeMonitor, it sets Variables in the SILVIA Core which can then be spoken in Exuders to alert personnel and log the alert.

To continue with this scenario the pressure has fallen below minimum for longer than the countdown duration and triggered an alert. SILVIA informs the instrumentation control room technician verbally that “The pressure in Vat [vatID] has dropped below minimum”. As well, given that the domain knowledge and concept bindings have been set up, SILVIA can analyze the scenario by perhaps checking other instrument values. SILVIA can understand the relationships of the Vat system, the pressure pump, the heating element, the vat temperature, the pressure release valve as well as that individual vat’s relation to the larger industrial or laboratory system it is a part of. The concept bindings would be set up rudimentarily as in the following table.

In the PressureGaugeMonitor component we have set up a trigger to handle the fall below minimum pressure. The response may simply be a speakable warning or a more in depth analysis of the domain knowledge concept bindings may reveal possible causes of the pressure drop such as pressure pump failure or faulty pressure release valve, and what each part controls or connects to. It may be that the heating element needs to boost its temperature to heat the vat. Let’s assume SILVIA has determined that the issue has been caused by the disparity between the heating element output and the vat temperature. In this case SILVIA is required to inform the technician with a speakable warning including the cause and the solution which needs verifying by the technician to be implemented. This could be set up with more in-depth Behaviors.