OmronPID
Loading...
Searching...
No Matches
Public Slots | Public Member Functions
MainWindow Class Reference

The MainWindow class represents the main window of the application. More...

#include <mainwindow.h>

Inheritance diagram for MainWindow:

Public Slots

void makePlot ()
 makePlot Slot function to generate plot
 
void updateTemperature (double temperature)
 updateTemperature Slot function to update the temperature display
 
void updateMV (double MV)
 updateMV Slot function to update the MV display (MV means output power)
 
void updateSV (double SV)
 updateSV Slot function to update the set value (SV) display
 
void updateMVupper (double MVupper)
 updateMVupper Slot function to update the upper limit of the MV display
 
void updateMVlower (double MVlower)
 updateMVlower Slot function to update the lower limit of MV display
 
void updatePID_P (double PID_P)
 updatePID_I Slot function to update the PID controller's integral (I) gain value display
 
void updatePID_I (double PID_I)
 updatePID_I Slot function to update the PID controller's integral (I) gain value display
 
void updatePID_D (double PID_D)
 updatePID_D Slot function to update the PID controller's derivative (D) gain value display
 
void updateStatus ()
 updateStatus Slot function to update the status display
 
void finishSendAT (int atFlag)
 finishSendAT Slot function to handle the completion of sending AT command to device
 
void finishSendSV (double SV)
 finishSendSV Slot function to handle the completion of sending the set value (SV) to the device
 
void catchLogMsg (const QString &msg)
 catchLogMsg Slot function to catch a log message emitted by a thread and add it to the application log window
 
void catchLogMsgWithColor (const QString &msg, QColor color)
 catchLogMsg Slot function to catch a log message emitted by a thread and add it to the application log window
 
void connectDevice ()
 connectDevice Slot function to handle device connection
 
void connectFailed ()
 connectFailed Slot function to handle device connection failure
 
void catchDanger (int type)
 catchDanger Slot function to handle a dangerous situation detected by the Safety class
 
void updateCheckNumber (int checkNumber)
 updateCheckNumber Slot function to update the number of temperature checks that have been performed
 
void cathcEscapeTempCheckChange (int sign)
 cathcEscapeTempCheckChange Slot function to handle changes in the escape temperature check checkbox
 
void catchStartTempChangeCheck (int checknumber)
 catchStartTempChangeCheck Slot function to handle the start of a temperature change check
 

Public Member Functions

 MainWindow (QWidget *parent=0)
 Constructor for MainWindow class.
 
 ~MainWindow ()
 Destructor for MainWindow class.
 
void LogMsg (QString str, bool newLine=true)
 Logs a message to the GUI log.
 
void findSeriesPortDevices ()
 Finds all available serial port devices.
 

Detailed Description

The MainWindow class represents the main window of the application.

Constructor & Destructor Documentation

◆ MainWindow()

MainWindow::MainWindow ( QWidget *  parent = 0)
explicit

Constructor for MainWindow class.

Constructor for the MainWindow class.

Parameters
parentThe parent QWidget.
Parameters
parentThe parent QWidget.

◆ ~MainWindow()

MainWindow::~MainWindow ( )

Destructor for MainWindow class.

MainWindow::~MainWindow.

Member Function Documentation

◆ catchDanger

void MainWindow::catchDanger ( int  type)
slot

catchDanger Slot function to handle a dangerous situation detected by the Safety class

Handles the detection of a danger signal.

Parameters
typeThe type of danger detected

This function is called when a danger signal is detected based on the type parameter:

  • If type is 0, it indicates that the maximum allowed temperature has been exceeded.
  • If type is 1, it indicates that even though the MV output is at the maximum, the temperature change is less than the threshold.
  • If type is 2, it indicates that the temperature has dropped below the threshold.
  • If type is 3, it indicates that the temperature continued to drop for some intervals.
  • If type is any other value, it indicates a general danger signal.

This function displays a log message describing the detected danger signal. It also updates the UI to indicate the emergency stop, displaying the current date and time in the message field and applying styling to highlight it. Finally, it calls the Quit() function to perform the necessary actions for an emergency stop.

Parameters
typeThe type of danger signal that was detected.

◆ catchLogMsg

void MainWindow::catchLogMsg ( const QString &  msg)
slot

catchLogMsg Slot function to catch a log message emitted by a thread and add it to the application log window

Receives a log message and passes it to the LogMsg function.

Parameters
msgThe log message to add

This function is a slot that is connected to the log message signal. It receives a log message and passes it to the LogMsg function to be displayed in the log text area.

Parameters
msgThe log message.

◆ catchLogMsgWithColor

void MainWindow::catchLogMsgWithColor ( const QString &  msg,
QColor  color 
)
slot

catchLogMsg Slot function to catch a log message emitted by a thread and add it to the application log window

Receives a log message with a specified color and passes it to the LogMsg function.

Parameters
msgThe log message to add
colorThe color of message to display

This function is a slot that is connected to the log message with color signal. It receives a log message along with a color and passes it to the LogMsg function to be displayed in the log text area with the specified color.

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

◆ catchStartTempChangeCheck

void MainWindow::catchStartTempChangeCheck ( int  checknumber)
slot

catchStartTempChangeCheck Slot function to handle the start of a temperature change check

Handles the start of TempChangeCheck mode.

Parameters
checknumberThe number of the check being started

This function is called when the system starts the TempChangeCheck mode based on the checknumber parameter. If checknumber is 0, it indicates that the current MV has reached the MV upper threshold, and the TempChangeCheck mode is initiated. Otherwise, it indicates that the system is in TempChangeCheck mode with the specified number of checks.

This function updates the UI to display the appropriate color, and it displays a log message indicating the start of TempChangeCheck mode.

Parameters
checknumberThe number of checks in the TempChangeCheck mode.

◆ cathcEscapeTempCheckChange

void MainWindow::cathcEscapeTempCheckChange ( int  sign)
slot

cathcEscapeTempCheckChange Slot function to handle changes in the escape temperature check checkbox

Handles the escape from TempChangeCheck mode.

Parameters
signThe sign of the change (1 for checked, -1 for unchecked)

This function is called when the system escapes from the TempChangeCheck mode based on the sign parameter:

  • If sign is 0, it indicates that the current MV has decreased below the MVupper threshold.
  • If sign is 1, it indicates that the current temperature is within the ignore range.
  • If sign is any other value, it indicates a general escape from TempChangeCheck mode.

This function updates the UI to display the appropriate color, and it displays a log message indicating the reason for the escape from TempChangeCheck mode.

Parameters
signThe sign indicating the reason for the escape from TempChangeCheck mode.

◆ connectDevice

void MainWindow::connectDevice ( )
slot

connectDevice Slot function to handle device connection

Connects to the Omron temperature control device.

This function is called when the device is successfully connected. It updates the UI to reflect the connection status, displays a log message indicating the connection, and performs necessary UI updates and settings.

◆ connectFailed

void MainWindow::connectFailed ( )
slot

connectFailed Slot function to handle device connection failure

Handles the failure to connect to the Omron temperature control device.

This function is called when the connection to the device fails. It updates the UI to reflect the connection status, displays a log message indicating the failure, and re-enables the COM port selection.

◆ finishSendAT

void MainWindow::finishSendAT ( int  atFlag)
slot

finishSendAT Slot function to handle the completion of sending AT command to device

Handles the completion of the AT (Automatic Tuning) command.

Parameters
atFlagThe flag indicating whether the command was sent successfully

This function is called when the AT command is sent to the temperature control device and the command execution is completed. The atFlag parameter indicates the result of the AT command:

  • If atFlag is 1, the AT command was set to 100% and the Set Point is disabled.
  • If atFlag is 2, the AT command was set to 40% and the Set Point is disabled.
  • If atFlag is any other value, the AT command is set to none and the Set Point is enabled. This function updates the UI elements accordingly and displays a log message indicating the result of the AT command.
Parameters
atFlagThe result of the AT command.

◆ finishSendSV

void MainWindow::finishSendSV ( double  SV)
slot

finishSendSV Slot function to handle the completion of sending the set value (SV) to the device

Handles the completion of setting the target temperature (SV).

Parameters
SVThe set value that was sent

This function is called when the target temperature (SV) is set and the command execution is completed. The SV parameter represents the value of the target temperature. This function displays a log message indicating the target temperature that was set.

Parameters
SVThe value of the target temperature that was set.

◆ LogMsg()

void MainWindow::LogMsg ( QString  str,
bool  newLine = true 
)

Logs a message to the GUI log.

Appends a log message to the log text area.

Parameters
strThe message to be logged.
newLineWhether or not to add a new line after the message.
Parameters
strThe log message to be added.
newLineFlag indicating whether to start a new line (default: true).

◆ makePlot

void MainWindow::makePlot ( )
slot

makePlot Slot function to generate plot

Generates a plot.

This function is called to generate a plot based on the current temperature and set temperature. It retrieves the current date and time, retrieves the temperature values, and calls the "fillDataAndPlot" function to update the plot data.

◆ updateCheckNumber

void MainWindow::updateCheckNumber ( int  checkNumber)
slot

updateCheckNumber Slot function to update the number of temperature checks that have been performed

Updates the check number for temperature change.

Parameters
checkNumberThe number of checks performed

This function is a slot that is connected to the check number update signal. It displays a log message indicating the current number of temperature checks being performed.

Parameters
checkNumberThe current number of temperature checks.

◆ updateMV

void MainWindow::updateMV ( double  MV)
slot

updateMV Slot function to update the MV display (MV means output power)

Updates the displayed manipulated variable (MV) value.

Parameters
MVThe new measured value to display.

This function is a slot that is connected to the MV update signal. It updates the displayed MV value in the user interface with the provided MV value.

Parameters
MVThe new MV value to be displayed.

◆ updateMVlower

void MainWindow::updateMVlower ( double  MVlower)
slot

updateMVlower Slot function to update the lower limit of MV display

Updates the lower range of the manipulated variable (MV).

Parameters
MVlowerThe new lower limit to display

This function is a slot that is connected to the MV lower range update signal. It updates the lower range of the MV in the user interface with the provided MV lower value.

Parameters
MVlowerThe new lower range of the MV.

◆ updateMVupper

void MainWindow::updateMVupper ( double  MVupper)
slot

updateMVupper Slot function to update the upper limit of the MV display

Updates the upper range of the manipulated variable (MV) and the corresponding plot range.

Parameters
MVupperThe new upper limit to display

This function is a slot that is connected to the MV upper range update signal. It updates the upper range of the MV in the user interface and adjusts the plot range accordingly.

Parameters
MVupperThe new upper range of the MV.

◆ updatePID_D

void MainWindow::updatePID_D ( double  PID_D)
slot

updatePID_D Slot function to update the PID controller's derivative (D) gain value display

Updates the displayed derivative gain (D) value of the PID controller.

Parameters
PID_DThe new D gain value to display void updatePID_D(double PID_D);

This function is a slot that is connected to the PID D value update signal. It updates the displayed D value in the user interface with the provided PID D value.

Parameters
PID_DThe new PID D value to be displayed.

◆ updatePID_I

void MainWindow::updatePID_I ( double  PID_I)
slot

updatePID_I Slot function to update the PID controller's integral (I) gain value display

Updates the displayed integral gain (I) value of the PID controller.

Parameters
PID_IThe new I gain value to display

This function is a slot that is connected to the PID I value update signal. It updates the displayed I value in the user interface with the provided PID I value.

Parameters
PID_IThe new PID I value to be displayed.

◆ updatePID_P

void MainWindow::updatePID_P ( double  PID_P)
slot

updatePID_I Slot function to update the PID controller's integral (I) gain value display

Updates the displayed proportional gain (P) value of the PID controller.

Parameters
PID_IThe new I gain value to display

This function is a slot that is connected to the PID P value update signal. It updates the displayed P value in the user interface with the provided PID P value.

Parameters
PID_PThe new PID P value to be displayed.

◆ updateStatus

void MainWindow::updateStatus ( )
slot

updateStatus Slot function to update the status display

Updates the status display with the current data update timestamp.

This function is a slot that is connected to the status update signal. It updates the status display with the current data update timestamp.

◆ updateSV

void MainWindow::updateSV ( double  SV)
slot

updateSV Slot function to update the set value (SV) display

Updates the displayed set value (SV).

Parameters
SVThe new set value to display

This function is a slot that is connected to the SV update signal. It updates the displayed SV value in the user interface with the provided SV value.

Parameters
SVThe new SV value to be displayed.

◆ updateTemperature

void MainWindow::updateTemperature ( double  temperature)
slot

updateTemperature Slot function to update the temperature display

Updates the displayed temperature value.

Parameters
temperatureThe new temperature value to display

This function is a slot that is connected to the temperature update signal. It updates the displayed temperature value in the user interface with the provided temperature value.

Parameters
temperatureThe new temperature value to be displayed.

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