OmronPID
Loading...
Searching...
No Matches
Signals | Public Member Functions | Properties
Safety Class Reference

The Safety class ensures the safe operation of the system. This class monitors the temperature and other parameters of the system to ensure that they remain within safe limits. If any parameter goes outside its safe range, the Safety class takes appropriate action to bring it back within range. The class also provides a number of properties that can be used to configure its behavior. More...

#include <safety.h>

Inheritance diagram for Safety:

Signals

void permitedMaxTempChanged (double maxtemp)
 Signal emitted when the permitted maximum temperature has been changed.
 
void MVUpperChanged (double MVupper)
 Signal emitted when the MV upper limit has been changed.
 
void MVupperReachedUpperLimit ()
 Signal emitted when the MV upper limit has reached its upper limit.
 
void NumberOfCheckChanged (int number)
 Signal emitted when the number of checks has been changed.
 
void checkNumberChanged (int number)
 Signal emitted when the check number has been changed.
 
void tempChangeThresholdChanged (double temp)
 Signal emitted when the temperature change threshold has been changed.
 
void dangerSignal (int type)
 Signal emitted when a danger is detected.
 
void dropSignal ()
 Signal emitted when temperature is droped.
 
void intervalMVCheckChanged (int interval)
 Signal emitted when the interval for the MV check has been changed.
 
void intervalTempChangeChanged (int interval)
 Signal emitted when the interval for the temperature change check has been changed.
 
void escapeTempCheckChange (int sign)
 Signal emitted when the temperature change check is cancelled.
 
void startTempChangeCheck (int checknumber)
 Signal emitted when the temperature change check is started.
 
void logMsg (QString msg)
 Signal emitted when a log message is generated.
 
void logMsgWithColor (QString msg, QColor color)
 Signal emitted when a log message with a specific color is generated.
 

Public Member Functions

 Safety (DataSummary *data)
 Constructs a new Safety object.
 
 ~Safety ()
 Destroys the Safety object.
 
double getTemperature () const
 Getter function for the current temperature.
 
double getPermitedMaxTemp () const
 Getter function for the permitted maximum temperature.
 
double getMVLower () const
 Getter function for the lower bound of the manipulated variable.
 
double getMVUpper () const
 Getter function for the upper bound of the manipulated variable.
 
double getMV () const
 Getter function for the current value of the manipulated variable.
 
int getNumberOfCheck () const
 Getter function for the number of temperature checks.
 
int getCheckNumber () const
 Getter function for the current check number.
 
int getIntervalMVCheck () const
 Getter function for the interval of the manipulated variable check.
 
int getIntervalTempChange () const
 Getter function for the interval of the temperature change check.
 
double getTempChangeThreshold () const
 Getter function for the threshold of temperature change.
 
double getIgnoreUpper () const
 Getter function for the upper bound of the ignored temperature range.
 
double getIgnoreLower () const
 Getter function for the lower bound of the ignored temperature range.
 
QPair< double, double > getIgnoreTempRange () const
 Getter function for the ignored temperature range.
 
QTimer * getTimerMVCheck () const
 Getter function for the timer object used for the manipulated variable check.
 
QTimer * getTimerTempChangeCheck () const
 Getter function for the timer object used for the temperature change check.
 
void setPermitedMaxTemp (double maxtemp)
 Sets the maximum permitted temperature.
 
void setMVUpper (double MVupper)
 Sets the upper limit of the manipulated variable (MV).
 
void setMV (double MV)
 Sets the value of the manipulated variable (MV).
 
void setNumberOfCheck (int number)
 Sets the number of check for the safety condition.
 
void setCheckNumber (int number)
 Sets the check number.
 
void setTempChangeThreshold (double temp)
 Sets the threshold of temperature change.
 
void setIgnoreUpper (double upper)
 Sets the upper limit for ignoring temperature changes.
 
void setIgnoreLower (double lower)
 Sets the lower limit for ignoring temperature changes.
 
void setIgnoreTempRange (double temp, double lower, double upper)
 Sets the temperature range for ignoring temperature changes.
 
void setDropThreshold (int dropThreshold)
 
void checkTempChange ()
 Checks whether the temperature has changed above the threshold value.
 
void checkTempDrop ()
 Check whether the temperature has droped the last temperature.
 
void setEnableTempChangeRange (bool enable)
 Enables or disables the temperature change range.
 
void setIntervalMVCheck (int interval)
 Sets the interval for checking the manipulated variable (MV).
 
void setIntervalTempChange (int inteerval)
 Sets the interval for checking the temperature change.
 
void setIsSTC (bool isSTC)
 Sets the enable to execute tempChangeCheck method in STC mode.
 
void start ()
 Starts the safety monitoring.
 
void stop ()
 Stops the safety monitoring.
 
bool isTimerMVCheckRunning () const
 Checks whether the timer for checking the manipulated variable (MV) is running.
 
bool isTimerTempChangeCheckRunning () const
 Checks whether the timer for checking the temperature change is running.
 

Properties

double permitedMaxTemp
 
double MVupper
 
int NumberOfCheck
 
int checkNumber
 
double tempChangeThreshold
 
int intervalMVCheck
 
int intervalTempChange
 

Detailed Description

The Safety class ensures the safe operation of the system. This class monitors the temperature and other parameters of the system to ensure that they remain within safe limits. If any parameter goes outside its safe range, the Safety class takes appropriate action to bring it back within range. The class also provides a number of properties that can be used to configure its behavior.

Constructor & Destructor Documentation

◆ Safety()

Safety::Safety ( DataSummary data)
explicit

Constructs a new Safety object.

Constructs a new Safety object.

Parameters
dataA pointer to the DataSummary object that contains the system's data.

This constructor initializes a new Safety object with the given DataSummary object pointer.

This constructor initializes a new Safety object with the given DataSummary object pointer. It also sets up the internal timers and connects the relevant signals and slots.

Member Function Documentation

◆ checkNumberChanged

void Safety::checkNumberChanged ( int  number)
signal

Signal emitted when the check number has been changed.

Parameters
numberThe new check number.

◆ checkTempChange()

void Safety::checkTempChange ( )

Checks whether the temperature has changed above the threshold value.

Check if the temperature has changed more than the threshold value. This function checks if the temperature has changed more than the threshold value during the specified time interval. If the temperature has changed less than the threshold value, it emits a danger signal and stops the temperature change check timer and MV check timer.

Note
This function must be called periodically by a QTimer object.

This function periodically checks if the temperature has changed more than the threshold value during the specified time interval. If the temperature has changed less than the threshold value, it emits a danger signal and stops the temperature change check timer and MV check timer. The function starts by acquiring the current temperature and checking if it's within the ignore range. If the temperature is within the ignore range, the function clears variables, stops the timer, and emits the escapeTempCheckChange signal with the argument 1, indicating that the temperature change check has been escaped. If the temperature is outside the ignore range, the function checks if the conditions for stopping the temperature change check have been met. The conditions are: if the check number is equal to or greater than the number of checks minus one, or if the MV is not in the upper limit, or if the temperature is within the ignore range. If any of these conditions is true, the function clears variables, stops the timer, and emits the escapeTempCheckChange signal with the argument 0 if the MV is not in the upper limit, or 1 if the MV is in the upper limit. If none of the stopping conditions is met, the function starts the check and pushes temperature data into the vTempChangeData_ vector. The function sets the timer and increments the check number. If the check number is less than the number of checks, the function returns. When the check is completed, the function calculates the differences between adjacent temperature values, calculates the moving average, and checks if it's below the threshold. If it's below the threshold, the function emits the dangerSignal with the argument 1, indicating a dangerous situation. The function then clears variables, stops the timer, and resets the check number.

◆ dangerSignal

void Safety::dangerSignal ( int  type)
signal

Signal emitted when a danger is detected.

Parameters
typeThe type of danger detected.

◆ dropSignal

void Safety::dropSignal ( )
signal

Signal emitted when temperature is droped.

Parameters
tempDrop

◆ escapeTempCheckChange

void Safety::escapeTempCheckChange ( int  sign)
signal

Signal emitted when the temperature change check is cancelled.

Parameters
signThe signal that cancelled the temperature change check.

◆ getCheckNumber()

int Safety::getCheckNumber ( ) const

Getter function for the current check number.

Returns
The current check number.

◆ getIgnoreLower()

double Safety::getIgnoreLower ( ) const

Getter function for the lower bound of the ignored temperature range.

Returns
The lower bound of the ignored temperature range.

◆ getIgnoreTempRange()

QPair< double, double > Safety::getIgnoreTempRange ( ) const

Getter function for the ignored temperature range.

Returns
The ignored temperature range.

◆ getIgnoreUpper()

double Safety::getIgnoreUpper ( ) const

Getter function for the upper bound of the ignored temperature range.

Returns
The upper bound of the ignored temperature range.

◆ getIntervalMVCheck()

int Safety::getIntervalMVCheck ( ) const

Getter function for the interval of the manipulated variable check.

Returns
The interval of the manipulated variable check.

◆ getIntervalTempChange()

int Safety::getIntervalTempChange ( ) const

Getter function for the interval of the temperature change check.

Returns
The interval of the temperature change check.

◆ getMV()

double Safety::getMV ( ) const

Getter function for the current value of the manipulated variable.

Returns
The current value of the manipulated variable.

◆ getMVLower()

double Safety::getMVLower ( ) const

Getter function for the lower bound of the manipulated variable.

Returns
The upper bound of the manipulated variable.

◆ getMVUpper()

double Safety::getMVUpper ( ) const

Getter function for the upper bound of the manipulated variable.

Returns
The upper bound of the manipulated variable.

◆ getNumberOfCheck()

int Safety::getNumberOfCheck ( ) const

Getter function for the number of temperature checks.

Returns
The number of temperature checks.

◆ getPermitedMaxTemp()

double Safety::getPermitedMaxTemp ( ) const

Getter function for the permitted maximum temperature.

Returns
The permitted maximum temperature.

◆ getTempChangeThreshold()

double Safety::getTempChangeThreshold ( ) const

Getter function for the threshold of temperature change.

Returns
The threshold of temperature change.

◆ getTemperature()

double Safety::getTemperature ( ) const

Getter function for the current temperature.

Returns
The current temperature.

◆ getTimerMVCheck()

QTimer * Safety::getTimerMVCheck ( ) const

Getter function for the timer object used for the manipulated variable check.

Returns
The timer object used for the manipulated variable check.

◆ getTimerTempChangeCheck()

QTimer * Safety::getTimerTempChangeCheck ( ) const

Getter function for the timer object used for the temperature change check.

Returns
The timer object used for the temperature change check.

◆ intervalMVCheckChanged

void Safety::intervalMVCheckChanged ( int  interval)
signal

Signal emitted when the interval for the MV check has been changed.

Parameters
intervalThe new interval for the MV check.

◆ intervalTempChangeChanged

void Safety::intervalTempChangeChanged ( int  interval)
signal

Signal emitted when the interval for the temperature change check has been changed.

Parameters
intervalThe new interval for the temperature change check.

◆ isTimerMVCheckRunning()

bool Safety::isTimerMVCheckRunning ( ) const

Checks whether the timer for checking the manipulated variable (MV) is running.

Returns
Boolean indicating whether the timer for checking the manipulated variable (MV) is running.

◆ isTimerTempChangeCheckRunning()

bool Safety::isTimerTempChangeCheckRunning ( ) const

Checks whether the timer for checking the temperature change is running.

Returns
Boolean indicating whether the timer for checking the temperature change is running.

◆ logMsg

void Safety::logMsg ( QString  msg)
signal

Signal emitted when a log message is generated.

Parameters
msgThe log message.

◆ logMsgWithColor

void Safety::logMsgWithColor ( QString  msg,
QColor  color 
)
signal

Signal emitted when a log message with a specific color is generated.

Parameters
msgThe log message.
colorThe color of the log message.

◆ MVUpperChanged

void Safety::MVUpperChanged ( double  MVupper)
signal

Signal emitted when the MV upper limit has been changed.

Parameters
MVupperThe new MV upper limit.

◆ NumberOfCheckChanged

void Safety::NumberOfCheckChanged ( int  number)
signal

Signal emitted when the number of checks has been changed.

Parameters
numberThe new number of checks.

◆ permitedMaxTempChanged

void Safety::permitedMaxTempChanged ( double  maxtemp)
signal

Signal emitted when the permitted maximum temperature has been changed.

Parameters
maxtempThe new permitted maximum temperature.

◆ setCheckNumber()

void Safety::setCheckNumber ( int  number)

Sets the check number.

Parameters
numberCheck number.

◆ setEnableTempChangeRange()

void Safety::setEnableTempChangeRange ( bool  enable)

Enables or disables the temperature change range.

Parameters
enableBoolean indicating whether the temperature change range is enabled.

◆ setIgnoreLower()

void Safety::setIgnoreLower ( double  lower)

Sets the lower limit for ignoring temperature changes.

Parameters
lowerLower limit for ignoring temperature changes.

◆ setIgnoreTempRange()

void Safety::setIgnoreTempRange ( double  temp,
double  lower,
double  upper 
)

Sets the temperature range for ignoring temperature changes.

Parameters
tempTemperature value for ignoring temperature changes.
lowerLower limit of the temperature range for ignoring temperature changes.
upperUpper limit of the temperature range for ignoring temperature changes.

◆ setIgnoreUpper()

void Safety::setIgnoreUpper ( double  upper)

Sets the upper limit for ignoring temperature changes.

Parameters
upperUpper limit for ignoring temperature changes.

◆ setIntervalMVCheck()

void Safety::setIntervalMVCheck ( int  interval)

Sets the interval for checking the manipulated variable (MV).

Parameters
intervalInterval for checking the manipulated variable (MV).

◆ setIntervalTempChange()

void Safety::setIntervalTempChange ( int  inteerval)

Sets the interval for checking the temperature change.

Parameters
inteervalInterval for checking the temperature change.

◆ setIsSTC()

void Safety::setIsSTC ( bool  isSTC)

Sets the enable to execute tempChangeCheck method in STC mode.

Parameters
enableto execute tempChangeCheck method in STC mode

◆ setMV()

void Safety::setMV ( double  MV)

Sets the value of the manipulated variable (MV).

Parameters
MVValue of the manipulated variable (MV).

◆ setMVUpper()

void Safety::setMVUpper ( double  MVupper)

Sets the upper limit of the manipulated variable (MV).

Parameters
MVupperUpper limit of the manipulated variable (MV).

◆ setNumberOfCheck()

void Safety::setNumberOfCheck ( int  number)

Sets the number of check for the safety condition.

Parameters
numberNumber of check.

◆ setPermitedMaxTemp()

void Safety::setPermitedMaxTemp ( double  maxtemp)

Sets the maximum permitted temperature.

Parameters
maxtempMaximum permitted temperature.

◆ setTempChangeThreshold()

void Safety::setTempChangeThreshold ( double  temp)

Sets the threshold of temperature change.

Parameters
tempThreshold of temperature change.

◆ startTempChangeCheck

void Safety::startTempChangeCheck ( int  checknumber)
signal

Signal emitted when the temperature change check is started.

Parameters
checknumberThe check number for the temperature change check.

◆ tempChangeThresholdChanged

void Safety::tempChangeThresholdChanged ( double  temp)
signal

Signal emitted when the temperature change threshold has been changed.

Parameters
tempThe new temperature change threshold.

The documentation for this class was generated from the following files: