11#include <QtSerialBus/QModbusRtuSerialMaster>
14#include <QModbusTcpClient>
72 void request(QModbusPdu::FunctionCode code, QByteArray cmd);
190 void read(QModbusDataUnit::RegisterType type, quint16 adress,
int size);
214 void setSV(
double SV);
220 void setMV(
double MV);
256 QModbusRtuSerialMaster*
getOmron()
const;
280 double getMV()
const;
286 double getSV()
const;
336 QTimer* getTimerUpdate()
const;
421 void logMsg(QString
string,
bool newline =
true);
462 QMainWindow* mainwindow_{
nullptr};
463 QStatusBar* statusBar_{
nullptr};
464 QModbusRtuSerialMaster* omron_{
nullptr};
465 QList<QSerialPortInfo> infos_;
466 QModbusTcpClient* modbusDevice_{
nullptr};
467 QModbusReply* modbusReply_{
nullptr};
468 QTimer* timerUpdate_{
nullptr};
469 QTimer* connectTimer_{
nullptr};
472 QSerialPort* serialPort_{
nullptr};
475 int intervalUpdate_{3000};
476 int intervalConectionCheck_{10000};
477 bool modbusReady_{
false};
478 bool isSerialPortRemoved_{
false};
479 double temperature_{};
484 double tempDecimal_{0.1};
504 void sendRequestSV(
double SV);
511 void sendRequestAT(
int afFlag);
518 void waitForMsec(
int msec);
539 void checkConnection();
The E5CC_Address nested class defines an enum class Type for ModBus addresses used for communication ...
Definition: communication.h:46
Type
The Type enum class defines the ModBus addresses for communication with the E5CC temperature controll...
Definition: communication.h:52
The Communication class provides an interface for communicating with he E5CC temperature controller v...
Definition: communication.h:19
void executeSendRequestSV(double SV)
Sends a request to set the set value (SV) of the E5CC temperature controller.
Definition: communication.h:148
double getMV() const
Gets the set value.
Definition: communication.cpp:377
void SVSendFinish(double SV)
Emitted when a set value (SV) command is sent to the Omron device and the send is finished.
QList< QSerialPortInfo > getSerialPortDevices() const
Returns a list of QSerialPortInfo objects containing information about available serial port devices.
Definition: communication.cpp:374
void read(QModbusDataUnit::RegisterType type, quint16 adress, int size)
Sends a Modbus request with the specified function code and command data.
Definition: communication.cpp:67
void TemperatureUpdated(double temperature)
This signal is emitted when the temperature value is updated.
double getPID_D() const
Returns the Difference value of the PID control for the temperature controller.
Definition: communication.cpp:383
void intervalUpdateChanged(int interval)
Emitted when the interval for updating values is changed.
void setIntervalConectionCheck(int interval)
Sets the interval in milliseconds for checking the Modbus connection status.
Definition: communication.cpp:369
void setTemperature(double temperature)
Sets the current temperature.
Definition: communication.cpp:362
void askPID(QString PID)
Sends a request to get the specified PID parameter from the E5CC temperature controller.
Definition: communication.cpp:269
void askMVlower()
Sends a request to get the output lower limit from the E5CC temperature controller.
Definition: communication.cpp:252
double getSV() const
Gets the current output power value.
Definition: communication.cpp:378
void setIntervalUpdate(int interval)
Sets the interval in milliseconds for updating the temperature and output power values.
Definition: communication.cpp:368
void PID_DUpdated(double PID_D)
Emitted when the derivative (D) gain value of the PID controller is updated.
void OmronIDChanged()
Emitted when the Omron device ID is changed.
void ATSendFinish(int atFlag)
Emitted when an AT command is sent to the Omron device and the send is finished.
void setMV(double MV)
Sets the current output power.
Definition: communication.cpp:364
void changeMVlowerValue(double MVlower)
Changes the value of the output lower limit of the E5CC temperature controller.
Definition: communication.cpp:309
QModbusRtuSerialMaster * getOmron() const
Returns a pointer to the QModbusRtuSerialMaster object used for communication with the Omron PLC.
Definition: communication.cpp:373
double getPID_I() const
Returns the Integration value of the PID control for the temperature controller.
Definition: communication.cpp:382
QString formatHex(int value, int digit)
Formats an integer value to a hexadecimal string with the specified number of digits.
Definition: communication.cpp:149
void deviceConnect()
Emitted when a connection to the Omron device is established.
double getTemperature() const
Gets the current temperature value.
Definition: communication.cpp:376
void MVlowerUpdated(double MVlower)
This signal is emitted when the output lower value is updated.
void connectTimeout()
Emitted when a connection attempt to the Omron device times out.
void logMsg(QString string, bool newline=true)
Emitted when a log message is generated.
void executeStop()
Executes the Stop command on the ModBus device.
Definition: communication.h:142
void request(QModbusPdu::FunctionCode code, QByteArray cmd)
Sends a Modbus request to the Omron device.
Definition: communication.cpp:38
void setSerialPortName(QString portName)
Sets the name of the serial port to use for Modbus communication.
Definition: communication.cpp:361
QString formatE5CCAddress(E5CC_Address::Type address, int width=4)
Formats an E5CC register address as a hexadecimal string with the specified width.
Definition: communication.cpp:157
void setOmronID(int omronID)
Sets the Omron ID for Modbus communication.
Definition: communication.cpp:367
void executeSendRequestAT(int atFlag)
Sends a request to set the AT flag of the E5CC temperature controller.
Definition: communication.h:154
~Communication()
Destructs a Communication object.
Definition: communication.cpp:25
void askMVupper()
Sends a request to get the output upper limit from the E5CC temperature controller.
Definition: communication.cpp:246
void askMV()
Sends a request to get the output power from the E5CC temperature controller.
Definition: communication.cpp:240
void PID_PUpdated(double PID_P)
Emitted when the proportional (P) gain value of the PID controller is updated.
double getMVlower() const
Gets the output lower value.
Definition: communication.cpp:380
void MVUpdated(double MV)
This signal is emitted when the output power value is updated.
void SVUpdated(double SV)
This signal is emitted when the set value is updated.
double getMVupper() const
Gets the output upper value.
Definition: communication.cpp:379
int getIntervalConectionCheck() const
Returns the interval time in seconds at which the connection to the Omron temperature controller is c...
Definition: communication.cpp:386
void statusUpdate()
Emitted when the status of the controller is updated.
void failedConnect()
Emitted when a connection to the Omron device fails.
bool isTimerUpdateRunning() const
Checks if the update timer is currently running.
Definition: communication.cpp:358
void askSV()
Sends a request to get the set value from the E5CC temperature controller.
Definition: communication.cpp:234
int getIntervalUpdate() const
Returns the interval time in seconds at which the temperature and control data are updated.
Definition: communication.cpp:385
double getPID_P() const
Returns the Proportional value of the PID control for the temperature controller.
Definition: communication.cpp:381
timing
The timing enumeration defines various timing intervals in milliseconds.
Definition: communication.h:342
@ timeUp
Definition: communication.h:346
@ timeOut
Definition: communication.h:347
@ clockUpdate
Definition: communication.h:345
@ getTempTimer
Definition: communication.h:344
@ modbus
Definition: communication.h:343
void PID_IUpdated(double PID_I)
Emitted when the integral (I) gain value of the PID controller is updated.
void executeConnection()
Executes the connection to the ModBus device.
Definition: communication.h:132
void serialPortRemove(QString str)
Emitted when a serial port is removed from the system.
void setMVupper(double MVupper)
Sets the upper limit for the output power.
Definition: communication.cpp:365
void MVupperUpdated(double MVupper)
This signal is emitted when the output upper value is updated.
void askTemperature()
Sends a request to get the temperature from the E5CC temperature controller.
Definition: communication.cpp:228
void setMVlower(double MVlower)
Sets the lower limit for the output power.
Definition: communication.cpp:366
QString getPortName() const
Returns the name of the currently set serial port.
Definition: communication.cpp:375
void executeRun()
Executes the Run command on the ModBus device.
Definition: communication.h:137
void changeMVupperValue(double MVupper)
Changes the value of the output upper limit of the E5CC temperature controller.
Definition: communication.cpp:320
void setSV(double SV)
Sets the set value for temperature.
Definition: communication.cpp:363
void intervalConectionCheckChanged(int interval)
Emitted when the interval for checking the connection is changed.
void changeSVValue(double SV)
Changes the set value (SV) of the E5CC temperature controller. This function calculates the integer v...
Definition: communication.cpp:331
int getOmronID() const
Returns the ID of the Omron temperature controller connected to the system.
Definition: communication.cpp:384
This file contains the declaration of the MainWindow class and its associated methods.