Développement Modbus CC (suite)
- Implémentation des stats de ZT1 et ZT2 (compo et type de train) provenant de Modbus CC. - Implémentation de l'inhibition ZT1 et ZT2 par la CC via Modbus. - Dégradation des données Modbus lors de la perte du Watchdog SACL.
This commit is contained in:
parent
69ca721ef7
commit
0efe9b3e8d
@ -71,7 +71,7 @@ ENGLOG=3
|
||||
#STATION=HONORE_BEAUGRAND
|
||||
#STATION=ANGRIGNON
|
||||
#STATION=HENRI_BOURASSA
|
||||
#STATION=COTE_VERTU
|
||||
STATION=COTE_VERTU
|
||||
#STATION=BERRI_UQAM
|
||||
#STATION=LONGUEIL
|
||||
#STATION=SAINT_MICHEL
|
||||
@ -79,4 +79,4 @@ ENGLOG=3
|
||||
#STATION=MONTMORENCY
|
||||
#STATION=MONTMORENCY_10_12
|
||||
#STATION=MONTMORENCY_10_22
|
||||
STATION=DU_COLLEGE
|
||||
#STATION=DU_COLLEGE
|
||||
|
||||
@ -228,7 +228,7 @@ unsigned int CZT1StatsZone::Reset()
|
||||
mS2CountText->setPlainText("Compte S2: 0");
|
||||
mFNCountText->setPlainText("Compte FN: 0");
|
||||
mActualRankText->setPlainText("Rang: 0");
|
||||
mTrainTypeText->setPlainText("Train Détecté: Aucun");
|
||||
mTrainTypeText->setPlainText("Type de train: Inconnu");
|
||||
if(mTrainCompositionText != 0)
|
||||
{
|
||||
mTrainCompositionText->setPlainText("Composition : Inconnue");
|
||||
@ -244,10 +244,7 @@ unsigned int CZT1StatsZone::SetTrainParameters(int TrainType, QList<qint16> Trai
|
||||
if(mTrainType != (unsigned)TrainType)
|
||||
{
|
||||
mTrainType = TrainType;
|
||||
// temp.clear();
|
||||
// temp = "Train détecté: ";
|
||||
// temp += CZTData::GetTrainTypeString(mTrainType);
|
||||
mTrainTypeText->setPlainText(QString("Train détecté : %1").arg(CZTData::GetTrainTypeString(mTrainType)));
|
||||
mTrainTypeText->setPlainText(QString("Type de train : %1").arg(CZTData::GetTrainTypeString(mTrainType)));
|
||||
}
|
||||
|
||||
if(TrainComposition.size() != 3)
|
||||
@ -264,7 +261,6 @@ unsigned int CZT1StatsZone::SetTrainParameters(int TrainType, QList<qint16> Trai
|
||||
}
|
||||
else
|
||||
{
|
||||
int toto = TrainComposition[0];
|
||||
mTrainCompositionText->setPlainText(QString("Composition : %1-%2-%3").arg((int)TrainComposition[0],3,10,QChar('0')).arg(TrainComposition[1],3,10,QChar('0')).arg(TrainComposition[2],3,10,QChar('0')));
|
||||
}
|
||||
|
||||
|
||||
@ -35,33 +35,57 @@
|
||||
CZT2StatsZone::CZT2StatsZone(QGraphicsItem *Parent)
|
||||
{
|
||||
setParentItem(Parent);
|
||||
mTrainCompoText = mTrainTypeText = 0;
|
||||
mTrainType = TRAIN_TYPE_UNKNOWN;
|
||||
}
|
||||
|
||||
QFont font;
|
||||
//font.setPixelSize(15);
|
||||
font.setPointSize(15);
|
||||
unsigned int CZT2StatsZone::Init(bool ModbusEnabled)
|
||||
{
|
||||
mModbusEnabled = ModbusEnabled;
|
||||
|
||||
mBogieCountText = new QGraphicsTextItem(this);
|
||||
mBogieCountText->setPos(0,12);
|
||||
// mBogieCountText->setPlainText("Compte Bogie: 0");
|
||||
mBogieCountText->setFont(font);
|
||||
|
||||
mS1CountText = new QGraphicsTextItem(this);
|
||||
mS1CountText->setPos(0,34);
|
||||
// mS1CountText->setPlainText("Compte S1: 0");
|
||||
mS1CountText->setFont(font);
|
||||
QFont font;
|
||||
font.setPointSize(15);
|
||||
int TextPos = 22;
|
||||
|
||||
mActualRankText = new QGraphicsTextItem(this);
|
||||
mActualRankText->setPos(0,56);
|
||||
// mActualRankText->setPlainText("Rang: 0");
|
||||
mActualRankText->setFont(font);
|
||||
mBogieCountText = new QGraphicsTextItem(this);
|
||||
mBogieCountText->setPos(0,TextPos);
|
||||
mBogieCountText->setFont(font);
|
||||
|
||||
mLastActivationDateTime = new QGraphicsTextItem(this);
|
||||
mLastActivationDateTime->setPos(0,78);
|
||||
mLastActivationDateTime->setFont(font);
|
||||
mLastActivationDateTime->setPlainText("Dernier passage : ");
|
||||
TextPos += 22;
|
||||
mS1CountText = new QGraphicsTextItem(this);
|
||||
mS1CountText->setPos(0,TextPos);
|
||||
mS1CountText->setFont(font);
|
||||
|
||||
Reset();
|
||||
TextPos += 22;
|
||||
mActualRankText = new QGraphicsTextItem(this);
|
||||
mActualRankText->setPos(0,TextPos);
|
||||
mActualRankText->setFont(font);
|
||||
|
||||
if(ModbusEnabled)
|
||||
{
|
||||
TextPos += 22;
|
||||
mTrainCompoText = new QGraphicsTextItem(this);
|
||||
mTrainCompoText->setPos(0,TextPos);
|
||||
mTrainCompoText->setFont(font);
|
||||
|
||||
TextPos += 22;
|
||||
mTrainTypeText = new QGraphicsTextItem(this);
|
||||
mTrainTypeText->setPos(0,TextPos);
|
||||
mTrainTypeText->setFont(font);
|
||||
}
|
||||
|
||||
TextPos += 22;
|
||||
mLastActivationDateTime = new QGraphicsTextItem(this);
|
||||
mLastActivationDateTime->setPos(0,TextPos);
|
||||
mLastActivationDateTime->setFont(font);
|
||||
mLastActivationDateTime->setPlainText("Dernier passage : ");
|
||||
|
||||
|
||||
|
||||
Reset();
|
||||
|
||||
return RET_OK;
|
||||
}
|
||||
|
||||
unsigned int CZT2StatsZone::SetLastActivationDateTime()
|
||||
@ -113,7 +137,43 @@ unsigned int CZT2StatsZone::Reset()
|
||||
mBogieCountText->setPlainText("Compte Bogie: 0");
|
||||
mS1CountText->setPlainText("Compte S1: 0");
|
||||
mActualRankText->setPlainText("Rang: 0");
|
||||
if(mTrainTypeText != 0)
|
||||
{
|
||||
mTrainTypeText->setPlainText("Type de train: Inconnu");
|
||||
}
|
||||
if(mTrainCompoText != 0)
|
||||
{
|
||||
mTrainCompoText->setPlainText("Composition du train: Inconnue");
|
||||
}
|
||||
|
||||
|
||||
return RET_OK;
|
||||
}
|
||||
|
||||
unsigned int CZT2StatsZone::SetTrainParameters(int TrainType, QList<qint16> TrainComposition)
|
||||
{
|
||||
if(mTrainType != (unsigned)TrainType)
|
||||
{
|
||||
mTrainType = TrainType;
|
||||
mTrainTypeText->setPlainText(QString("Type de train : %1").arg(CZTData::GetTrainTypeString(mTrainType)));
|
||||
}
|
||||
|
||||
if(TrainComposition.size() != 3)
|
||||
{
|
||||
//Invalid composition
|
||||
mTrainCompoText->setPlainText("Composition: Inconnue");
|
||||
}
|
||||
else if((TrainComposition[0] == 0) ||
|
||||
(TrainComposition[1] == 0) ||
|
||||
(TrainComposition[2] == 0))
|
||||
{
|
||||
//Composition invalide...
|
||||
mTrainCompoText->setPlainText("Composition: Inconnue");
|
||||
}
|
||||
else
|
||||
{
|
||||
mTrainCompoText->setPlainText(QString("Composition : %1-%2-%3").arg((int)TrainComposition[0],3,10,QChar('0')).arg(TrainComposition[1],3,10,QChar('0')).arg(TrainComposition[2],3,10,QChar('0')));
|
||||
}
|
||||
|
||||
return RET_OK;
|
||||
}
|
||||
|
||||
@ -39,15 +39,18 @@ public:
|
||||
CZT2StatsZone(QGraphicsItem *Parent);
|
||||
|
||||
// unsigned int UpdateStats(unsigned int BogieCount, unsigned int S1Count, unsigned int S2Count, unsigned int FNCount, unsigned int Rank, unsigned int Bogie, unsigned int TrainType, float TrainSpeed);
|
||||
unsigned int Init(bool ModbusEnabled);
|
||||
unsigned int UpdateStats(CZT2ThreadData *DataPtr);
|
||||
unsigned int Reset();
|
||||
unsigned int SetLastActivationDateTime();
|
||||
unsigned int SetTrainParameters(int TrainType, QList<qint16> TrainComposition);
|
||||
|
||||
private:
|
||||
unsigned int mBogieCount,mS1Count,mActualRank;
|
||||
unsigned int mBogieCount,mS1Count,mActualRank, mTrainType;
|
||||
int mPIValue, mPEValue;
|
||||
bool mModbusEnabled;
|
||||
|
||||
QGraphicsTextItem *mBogieCountText, *mS1CountText,*mActualRankText, *mLastActivationDateTime;
|
||||
QGraphicsTextItem *mBogieCountText, *mS1CountText,*mActualRankText, *mLastActivationDateTime, *mTrainCompoText, *mTrainTypeText;
|
||||
};
|
||||
|
||||
#endif // ZT2STATSZONE_H
|
||||
|
||||
@ -358,6 +358,13 @@ unsigned int CZTPage::SetZT2Data(CZT2ThreadData *Data)
|
||||
return RET_OK;
|
||||
}
|
||||
|
||||
unsigned int CZTPage::SetZT2TrainData(int TrainType, QList<qint16> TrainComposition)
|
||||
{
|
||||
//This is a low frequency stats update (only once for every train), so no timer filtering is necessary.
|
||||
mZT2Stats->SetTrainParameters(TrainType,TrainComposition);
|
||||
return RET_OK;
|
||||
}
|
||||
|
||||
unsigned int CZTPage::SetZT1ActivationState(bool ZT1Activated)
|
||||
{
|
||||
if(ZT1Activated)
|
||||
|
||||
@ -71,6 +71,7 @@ public:
|
||||
unsigned int SetZT1Data(CZT1ThreadData *Data, bool ForceDisplay = false);
|
||||
unsigned int SetZT1TrainData(int TrainType, QList<qint16> TrainComposition);
|
||||
unsigned int SetZT2Data(CZT2ThreadData *Data);
|
||||
unsigned int SetZT2TrainData(int TrainType, QList<qint16> TrainComposition);
|
||||
unsigned int SetZT1ActivationState(bool ZT1Activated);
|
||||
unsigned int SetZT2ActivationSTate(bool ZT2Activated);
|
||||
unsigned int ResetZT1Stats();
|
||||
|
||||
@ -70,6 +70,7 @@ void CModbusCCMgr::ConnectionLost()
|
||||
mZTWatchdogTimer->stop();
|
||||
mCCWatchdogTimer->stop();
|
||||
emit ModbusCCDisconnected();
|
||||
ResetCCRepository();
|
||||
CZTLog::instance()->AddLogString(QString("Connection Modbus (Ethernet) avec la CC rompue."),true);
|
||||
}
|
||||
|
||||
@ -97,39 +98,42 @@ void CModbusCCMgr::RegistersDatabaseUpdated(quint16 StartAddress, quint16 Length
|
||||
}
|
||||
}
|
||||
|
||||
qint16 NTPWrite = mModbusRepo->GetSingleReg(MODBUS_CC_CLK_UPDATE_BASE_REG_ADD);
|
||||
if(NTPWrite == 1)
|
||||
if(mCCLinkState == true) //Ignore incoming data if the link is not healty (Watchdog).
|
||||
{
|
||||
//Update date & time...
|
||||
bool OK;
|
||||
QList<qint16> DateTime = mModbusRepo->GetRegs(MODUBS_CC_CLK_SEC_BASE_REG_ADD,4,&OK);
|
||||
if(OK)
|
||||
qint16 NTPWrite = mModbusRepo->GetSingleReg(MODBUS_CC_CLK_UPDATE_BASE_REG_ADD);
|
||||
if(NTPWrite == 1)
|
||||
{
|
||||
qint8 Secs, Minutes, Hours, Month, Day;
|
||||
Secs = (qint8)(DateTime.at(0) >> 8);
|
||||
Minutes = (qint8)(DateTime.at(1) & 0x00FF);
|
||||
Hours = (qint8)(DateTime.at(1) >> 8);
|
||||
Day = (qint8)(DateTime.at(2) & 0x00FF);
|
||||
Month = (qint8)(DateTime.at(2) >> 8);
|
||||
qint16 Year = DateTime.at(3);
|
||||
|
||||
QDateTime NetworkTime;
|
||||
NetworkTime.setTimeSpec(Qt::UTC);
|
||||
NetworkTime.setDate(QDate(Year,Month,Day));
|
||||
NetworkTime.setTime(QTime(Hours,Minutes,Secs));
|
||||
// QDateTime MyTime = NetworkTime.toLocalTime();
|
||||
|
||||
if(mLastDateTime != 0)
|
||||
//Update date & time...
|
||||
bool OK;
|
||||
QList<qint16> DateTime = mModbusRepo->GetRegs(MODUBS_CC_CLK_SEC_BASE_REG_ADD,4,&OK);
|
||||
if(OK)
|
||||
{
|
||||
delete mLastDateTime;
|
||||
qint8 Secs, Minutes, Hours, Month, Day;
|
||||
Secs = (qint8)(DateTime.at(0) >> 8);
|
||||
Minutes = (qint8)(DateTime.at(1) & 0x00FF);
|
||||
Hours = (qint8)(DateTime.at(1) >> 8);
|
||||
Day = (qint8)(DateTime.at(2) & 0x00FF);
|
||||
Month = (qint8)(DateTime.at(2) >> 8);
|
||||
qint16 Year = DateTime.at(3);
|
||||
|
||||
QDateTime NetworkTime;
|
||||
NetworkTime.setTimeSpec(Qt::UTC);
|
||||
NetworkTime.setDate(QDate(Year,Month,Day));
|
||||
NetworkTime.setTime(QTime(Hours,Minutes,Secs));
|
||||
// QDateTime MyTime = NetworkTime.toLocalTime();
|
||||
|
||||
if(mLastDateTime != 0)
|
||||
{
|
||||
delete mLastDateTime;
|
||||
}
|
||||
mLastDateTime = new QDateTime(NetworkTime.toLocalTime());
|
||||
emit ModbusDateTimeReceived(mLastDateTime);
|
||||
|
||||
qDebug("Date & Heure reçue du SACL: %s",mLastDateTime->toString("yyyy-MM-dd hh:mm:ss").toAscii().data());
|
||||
mModbusRepo->WriteSingleReg(MODBUS_CC_CLK_UPDATE_BASE_REG_ADD,0);
|
||||
}
|
||||
mLastDateTime = new QDateTime(NetworkTime.toLocalTime());
|
||||
emit ModbusDateTimeReceived(mLastDateTime);
|
||||
|
||||
qDebug("Date & Heure reçue du SACL: %s",mLastDateTime->toString("yyyy-MM-dd hh:mm:ss").toAscii().data());
|
||||
mModbusRepo->WriteSingleReg(MODBUS_CC_CLK_UPDATE_BASE_REG_ADD,0);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
emit RepoHasChanged();
|
||||
@ -144,6 +148,7 @@ void CModbusCCMgr::ModbusRequestException(quint8 ExceptionCode, quint8 FctCode)
|
||||
void CModbusCCMgr::ModbusCCWatchdogTimeout()
|
||||
{
|
||||
CZTLog::instance()->AddLogString("Perte du lien de communication avec la CC: Watchdog CC Expiré",true);
|
||||
ResetCCRepository();
|
||||
mCCLinkState = false;
|
||||
}
|
||||
|
||||
@ -161,9 +166,36 @@ void CModbusCCMgr::ModbusZTWatchdogTimeout()
|
||||
}
|
||||
}
|
||||
|
||||
int CModbusCCMgr::ResetCCRepository()
|
||||
{
|
||||
//Clear read registers
|
||||
mModbusRepo->WriteSingleReg(MODBUS_CC_WATCHDOG_BASE_REG_ADD,0);
|
||||
mModbusRepo->WriteSingleReg(MODBUS_CC_AN_BASE_REG_ADD,0);
|
||||
mModbusRepo->WriteSingleReg(MODBUS_CC_ZT1_TRAIN_TYPE_REG_ADD, MODBUS_CC_TRAIN_TYPE_INVALID_SACL_OFFLINE);
|
||||
mModbusRepo->WriteSingleReg(MODBUS_CC_ZT2_TRAIN_TYPE_REG_ADD, MODBUS_CC_TRAIN_TYPE_INVALID_SACL_OFFLINE);
|
||||
QList<qint16> ResetValues;
|
||||
ResetValues << 0 << 0 << 0 //Train compo ZT1
|
||||
<< 0 << 0 << 0 //Train compo ZT2
|
||||
<< 0 << 0 << 0 << 0 << 0; //Date & Time update registers
|
||||
|
||||
mModbusRepo->WriteMultipleRegs(MODBUS_CC_ZT1_TRAIN_ID_1_REG_ADD,ResetValues);
|
||||
|
||||
//Do not clear the TK (write) regisers, they will clear themselves when needed.
|
||||
|
||||
|
||||
|
||||
return RET_OK;
|
||||
}
|
||||
|
||||
bool CModbusCCMgr::GetZT1InhibitionFlag()
|
||||
{
|
||||
bool OK = false;
|
||||
|
||||
if(mCCLinkState == false)//Ignore registers data if link is with SACL is not healthy
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
qint16 Reg = mModbusRepo->GetSingleReg(MODBUS_CC_AN_BASE_REG_ADD,&OK);
|
||||
|
||||
if(OK)
|
||||
@ -180,6 +212,12 @@ bool CModbusCCMgr::GetZT1InhibitionFlag()
|
||||
bool CModbusCCMgr::GetZT2InhibitionFlag()
|
||||
{
|
||||
bool OK = false;
|
||||
|
||||
if(mCCLinkState == false)//Ignore registers data if link is with SACL is not healthy
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
qint16 Reg = mModbusRepo->GetSingleReg(MODBUS_CC_AN_BASE_REG_ADD,&OK);
|
||||
|
||||
if(OK)
|
||||
@ -200,7 +238,7 @@ QList<qint16> CModbusCCMgr::GetZT1TrainComposition()
|
||||
QList<qint16> Compo;
|
||||
Compo = mModbusRepo->GetRegs(MODBUS_CC_ZT1_TRAIN_ID_1_REG_ADD,3,&OK);
|
||||
|
||||
if(OK == false)
|
||||
if(OK == false || mCCLinkState == false) //Ignore registers data if link is with SACL is not healthy
|
||||
{
|
||||
Compo << 0 << 0 << 0;
|
||||
}
|
||||
@ -214,7 +252,7 @@ QList<qint16> CModbusCCMgr::GetZT2TrainComposition()
|
||||
QList<qint16> Compo;
|
||||
Compo = mModbusRepo->GetRegs(MODBUS_CC_ZT2_TRAIN_ID_1_REG_ADD,3,&OK);
|
||||
|
||||
if(OK == false)
|
||||
if(OK == false || mCCLinkState == false)//Ignore registers data if link is with SACL is not healthy
|
||||
{
|
||||
Compo << 0 << 0 << 0;
|
||||
}
|
||||
@ -230,28 +268,36 @@ qint16 CModbusCCMgr::GetZT1TrainType()
|
||||
int Type = TRAIN_TYPE_UNKNOWN;
|
||||
if(OK)
|
||||
{
|
||||
if(Reg == 63)
|
||||
if(Reg == MODBUS_CC_TRAIN_TYPE_MR63)
|
||||
{
|
||||
Type = TRAIN_TYPE_MR63;
|
||||
}
|
||||
else if(Reg == 73)
|
||||
else if(Reg == MODBUS_CC_TRAIN_TYPE_MR73)
|
||||
{
|
||||
Type = TRAIN_TYPE_MR73;
|
||||
}
|
||||
else if(Reg == 10)
|
||||
else if(Reg == MODBUS_CC_TRAIN_TYPE_MPM10)
|
||||
{
|
||||
Type = TRAIN_TYPE_MPM10;
|
||||
}
|
||||
else if(Reg == 0)
|
||||
else if(Reg == MODBUS_CC_TRAIN_TYPE_MAINTENANCE)
|
||||
{
|
||||
Type = TRAIN_TYPE_MAINTENANCE_VEHICLE;
|
||||
}
|
||||
else if(Reg == MODBUS_CC_TRAIN_TYPE_INVALID_SACL_OFFLINE)
|
||||
{
|
||||
Type = TRAIN_TYPE_UNKNOWN;
|
||||
}
|
||||
else
|
||||
{
|
||||
CEngLog::instance()->AddLogString(QString("MODBUS: Réception d'un type de train ZT1 invalide du SACL [%1]").arg(Reg));
|
||||
Type = TRAIN_TYPE_UNKNOWN;
|
||||
}
|
||||
}
|
||||
if(mCCLinkState == false)//Ignore registers data if link is with SACL is not healthy
|
||||
{
|
||||
Type = TRAIN_TYPE_UNKNOWN;
|
||||
}
|
||||
return Type;
|
||||
}
|
||||
|
||||
@ -262,27 +308,36 @@ qint16 CModbusCCMgr::GetZT2TrainType()
|
||||
int Type = TRAIN_TYPE_UNKNOWN;
|
||||
if(OK)
|
||||
{
|
||||
if(Reg == 63)
|
||||
if(Reg == MODBUS_CC_TRAIN_TYPE_MR63)
|
||||
{
|
||||
Type = TRAIN_TYPE_MR63;
|
||||
}
|
||||
else if(Reg == 73)
|
||||
else if(Reg == MODBUS_CC_TRAIN_TYPE_MR73)
|
||||
{
|
||||
Type = TRAIN_TYPE_MR73;
|
||||
}
|
||||
else if(Reg == 10)
|
||||
else if(Reg == MODBUS_CC_TRAIN_TYPE_MPM10)
|
||||
{
|
||||
Type = TRAIN_TYPE_MPM10;
|
||||
}
|
||||
else if(Reg == 0)
|
||||
else if(Reg == MODBUS_CC_TRAIN_TYPE_MAINTENANCE)
|
||||
{
|
||||
Type = TRAIN_TYPE_MAINTENANCE_VEHICLE;
|
||||
}
|
||||
else if(Reg == MODBUS_CC_TRAIN_TYPE_INVALID_SACL_OFFLINE)
|
||||
{
|
||||
Type = TRAIN_TYPE_UNKNOWN;
|
||||
}
|
||||
else
|
||||
{
|
||||
CEngLog::instance()->AddLogString(QString("MODBUS: Réception d'un type de train ZT2 invalide du SACL [%1]").arg(Reg));
|
||||
Type = TRAIN_TYPE_UNKNOWN;
|
||||
}
|
||||
}
|
||||
|
||||
if(mCCLinkState == false) //Ignore registers data if link is with SACL is not healthy
|
||||
{
|
||||
Type = TRAIN_TYPE_UNKNOWN;
|
||||
}
|
||||
return Type;
|
||||
}
|
||||
|
||||
@ -7,6 +7,21 @@
|
||||
#include "ModbusRepository.h"
|
||||
#include <QTimer>
|
||||
|
||||
enum eModbusCCTrainTypes
|
||||
{
|
||||
MODBUS_CC_TRAIN_TYPE_MR63 = 63,
|
||||
MODBUS_CC_TRAIN_TYPE_MR73 = 73,
|
||||
MODBUS_CC_TRAIN_TYPE_MPM10 = 10,
|
||||
MODBUS_CC_TRAIN_TYPE_MAINTENANCE = 0,
|
||||
MODBUS_CC_TRAIN_TYPE_INVALID_ATS_OFFLINE = 98,
|
||||
MODBUS_CC_TRAIN_TYPE_INVALID_SERVICE_REBOOT = 97,
|
||||
MODBUS_CC_TRAIN_TYPE_INVALID_NOT_UPDATED = 99,
|
||||
MODBUS_CC_TRAIN_TYPE_INVALID_SACL_OFFLINE = 96,
|
||||
|
||||
MODBUS_CC_TRAIN_TYPE_MAX_VALUE
|
||||
};
|
||||
|
||||
|
||||
class CModbusCCMgr : public CModbusBackend
|
||||
{
|
||||
Q_OBJECT
|
||||
@ -41,6 +56,8 @@ private:
|
||||
bool mCCLinkState;
|
||||
QDateTime *mLastDateTime;
|
||||
|
||||
int ResetCCRepository();
|
||||
|
||||
signals:
|
||||
void RepoHasChanged();
|
||||
void ModbusCCConnected();
|
||||
|
||||
@ -703,5 +703,5 @@ void CModbusTKTransport::ModbusCCUpdated()
|
||||
qint16 ClearReg = mModbusRepo->GetSingleReg(MODBUS_CC_AN_BASE_REG_ADD);
|
||||
mZT1Clear = (ClearReg & (MODBUS_CC_FCYCLE_ZT1_FLAG_MASK)) != 0;
|
||||
mZT2Clear = (ClearReg & (MODBUS_CC_FCYCLE_ZT2_FLAG_MASK)) != 0;
|
||||
qDebug("ZT1Clr = %d",mZT1Clear);
|
||||
// qDebug("ZT1Clr = %d",mZT1Clear);
|
||||
}
|
||||
|
||||
@ -346,8 +346,15 @@ unsigned int CZTStateMachine::ZT1StateMachine(unsigned int Event, unsigned int S
|
||||
if(mModbusCCMgr->GetZT1InhibitionFlag() == true) //Check if the CC wants us to analyze the passage
|
||||
{
|
||||
abort = true;
|
||||
CZTLog::instance()->AddLogString("Passage de train inhibé par le SACL");
|
||||
CZTLog::instance()->AddLogString("Passage de train inhibé par le SACL",true);
|
||||
mZT1State = ZT1_WAIT_FOR_SUBSEQUENT_LIBERATION; //Wait for the train to leave the ZT
|
||||
if(mModbusCCMgr != 0)
|
||||
{
|
||||
//update train info received from the CC Modbus interface
|
||||
mTrainTypeDetected = (unsigned)mModbusCCMgr->GetZT1TrainType();
|
||||
mZT1TrainComposition = mModbusCCMgr->GetZT1TrainComposition();
|
||||
mZTPagePTr->SetZT1TrainData(mTrainTypeDetected,mZT1TrainComposition);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1107,6 +1114,13 @@ unsigned int CZTStateMachine::ZT2StateMachine(unsigned int Event, unsigned int S
|
||||
mZT2ActiveStatus = SB_ZT_ACTIVE_STATUS;
|
||||
mZTPagePTr->SetZTStatus(mNbPassages,mNbTriggers,mZT1ActiveStatus,mZT2ActiveStatus);
|
||||
mZTPagePTr->ResetZT2Stats();
|
||||
if(mModbusCCMgr != 0)
|
||||
{
|
||||
//update train info received from the CC Modbus interface
|
||||
mZT2TrainType = (unsigned)mModbusCCMgr->GetZT2TrainType();
|
||||
mZT2TrainComposition = mModbusCCMgr->GetZT2TrainComposition();
|
||||
mZTPagePTr->SetZT2TrainData(mZT2TrainType,mZT2TrainComposition);
|
||||
}
|
||||
InsertZT2LogItem();
|
||||
mZT2WorkerThread->UpdateDetectionConfig(mZTDetectionConfig);
|
||||
mTKGenerator->UpdateDetectionConfig(mZTDetectionConfig);
|
||||
|
||||
@ -204,7 +204,7 @@ private:
|
||||
|
||||
unsigned int mNbPassages; //Nombre de passages
|
||||
unsigned int mNbTriggers; //Nombre de déclenchements
|
||||
unsigned int mTrainTypeDetected; //Type de train
|
||||
unsigned int mTrainTypeDetected, mZT2TrainType; //Type de train
|
||||
unsigned int mCalibrationPassagesCount; //Nombre de passages lors de la calibration
|
||||
unsigned int mPGNbTotalPassages; //Nombre de passages requis lors de la calibration
|
||||
unsigned int mZT1ActiveStatus; //état de la ZT1 (Active ou pas)
|
||||
|
||||
@ -511,6 +511,7 @@ unsigned int CZoneTest::InitZT()
|
||||
connect(mModbusCCMgr,SIGNAL(ModbusDateTimeReceived(QDateTime*)),this,SLOT(ModbusDateTimeUpdate(QDateTime*)));
|
||||
panel.mZTMainPage->ModbusCCDisconnected();
|
||||
panel.mZTMainPage->mZT1Stats->Init(true);
|
||||
panel.mZTMainPage->mZT2Stats->Init(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -518,6 +519,7 @@ unsigned int CZoneTest::InitZT()
|
||||
mTKTransportInterface = (CTKTransportInterface*)TransportInterface;
|
||||
TransportInterface->BindPointers(mZTStation->GetOutputMasks(),mExtIOWorkerThread);
|
||||
panel.mZTMainPage->mZT1Stats->Init(false);
|
||||
panel.mZTMainPage->mZT2Stats->Init(false);
|
||||
}
|
||||
connect(mTKTransportInterface,SIGNAL(TKOutputStatesChanged(bool,bool)),panel.mMaintenancePage,SLOT(TKOutputChanged(bool,bool)));
|
||||
|
||||
@ -1263,7 +1265,6 @@ void CZoneTest::ApplicationQuit(bool PowerButton)
|
||||
{
|
||||
qDebug("ExtIOThread wait = false");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void CZoneTest::ACPISocketConnected()
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user