From fcfa86a27bb20b9ed230301241b25888505e2459 Mon Sep 17 00:00:00 2001 From: jfmartel Date: Wed, 7 Feb 2018 11:44:52 -0500 Subject: [PATCH] Ajout des infos Modbus aux fichiers de passage MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit -Modification des fichiers de passage pour inclure les infos supplémentaires obtenus par Modbus (type et composition du train) --- Configuration/ZT.cfg | 4 +- Configuration/ZTSettings.ztc | Bin 36 -> 36 bytes sources/GlobalDefine.h | 2 +- sources/GuiElements/LogsListPage.cpp | 33 ++++-- sources/Modbus/ModbusCCMgr.cpp | 11 ++ sources/Modbus/ModbusCCMgr.h | 4 +- sources/Simulator/SimulationScenario.cpp | 140 +++++++++++------------ sources/TrainLogFileMgr.cpp | 35 ++++-- sources/ZTData.cpp | 91 ++++++++++++++- sources/ZTData.h | 25 +++- sources/ZTStateMachine.cpp | 17 +++ sources/Zonetest.cpp | 8 +- 12 files changed, 272 insertions(+), 98 deletions(-) diff --git a/Configuration/ZT.cfg b/Configuration/ZT.cfg index 9410eb6..fca2464 100644 --- a/Configuration/ZT.cfg +++ b/Configuration/ZT.cfg @@ -76,11 +76,11 @@ ENGLOG=3 #STATION=ANGRIGNON #STATION=HENRI_BOURASSA #STATION=COTE_VERTU -#STATION=BERRI_UQAM +STATION=BERRI_UQAM #STATION=LONGUEIL #STATION=SAINT_MICHEL #STATION=SNOWDON_L5 #STATION=MONTMORENCY #STATION=MONTMORENCY_10_12 #STATION=MONTMORENCY_10_22 -STATION=DU_COLLEGE +#STATION=DU_COLLEGE diff --git a/Configuration/ZTSettings.ztc b/Configuration/ZTSettings.ztc index 28147c4416279c938e57975fb57055203fbec5da..33db5e28cdcc6a107f6d6dcad7545b6242c998d4 100644 GIT binary patch delta 8 PcmY#UnV`tLf*~CM2$TX0 delta 8 PcmY#UnV`tLk|7-c2$up4 diff --git a/sources/GlobalDefine.h b/sources/GlobalDefine.h index d73abaa..459db40 100644 --- a/sources/GlobalDefine.h +++ b/sources/GlobalDefine.h @@ -52,7 +52,7 @@ #define DEFAULT_PASSWORD "zonetest" #define BASE_FILE_MAGICNBR 0xDEADBEEF -#define TRAINLOG_FILE_MAGICNBR BASE_FILE_MAGICNBR + 1 +#define TRAINLOG_FILE_MAGICNBR BASE_FILE_MAGICNBR + 15 //Misc definitions diff --git a/sources/GuiElements/LogsListPage.cpp b/sources/GuiElements/LogsListPage.cpp index 22ce276..fd2906a 100644 --- a/sources/GuiElements/LogsListPage.cpp +++ b/sources/GuiElements/LogsListPage.cpp @@ -519,13 +519,32 @@ void CLogsListPage::ShowItemSummary(CLogElement *Element) } - Summary.sprintf("Statistiques du passage:\n\nDate: %s\nHeure: %s\nTrain : %s\nNombre d'éléments: %d\nVitesse moyenne : %f mph\nPassage problématique: %s\n\nDéclenchements: \n", - ZT1LogElement->mPassageDateTime.toString("yyyy/MM/dd").toAscii().data(), - ZT1LogElement->mPassageDateTime.toString("hh:mm:ss").toAscii().data(), - CZTData::GetTrainTypeString(ZT1LogElement->mTrainType), - ZT1LogElement->mNbElements, - MeanSpeed, - Problem.toUtf8().data()); + QString Composition("Inconnue"); + if(ZT1LogElement->mFlags.mTrainCompo1 != 0) //if compo is valid, this will be != 0... + { + Composition = QString("%1 - %2 - %3").arg(ZT1LogElement->mFlags.mTrainCompo1).arg(ZT1LogElement->mFlags.mTrainCompo2).arg(ZT1LogElement->mFlags.mTrainCompo3); + } + QString TrainType = CZTData::GetTrainTypeString(ZT1LogElement->mTrainType); + if(ZT1LogElement->mFlags.mModbusTrainType != MODBUS_CC_TRAIN_TYPE_INVALID_NOT_UPDATED) + { + TrainType = CZTData::GetModbusTrainTypeString(ZT1LogElement->mFlags.mModbusTrainType); + } + +// Summary.sprintf("Statistiques du passage:\n\nDate: %s\nHeure: %s\nTrain : %s\nNombre d'éléments: %d\nVitesse moyenne : %f mph\nPassage problématique: %s\n\nDéclenchements: \n", +// ZT1LogElement->mPassageDateTime.toString("yyyy/MM/dd").toAscii().data(), +// ZT1LogElement->mPassageDateTime.toString("hh:mm:ss").toAscii().data(), +// CZTData::GetTrainTypeString(ZT1LogElement->mTrainType), +// ZT1LogElement->mNbElements, +// MeanSpeed, +// Problem.toUtf8().data()); + + Summary = QString("Statistiques du passage:\n\nDate: %1\nHeure: %2\nTrain : %3\nNombre d'éléments: %4\nComposition : %5\nPassage problématique: %6\n\nDéclenchements: \n")\ + .arg(ZT1LogElement->mPassageDateTime.toString("yyyy/MM/dd"))\ + .arg(ZT1LogElement->mPassageDateTime.toString("hh:mm:ss"))\ + .arg(TrainType)\ + .arg(ZT1LogElement->mNbElements)\ + .arg(Composition)\ + .arg(Problem.toUtf8().data()); if(ZT1LogElement->mZTDetections.size() > 0) { diff --git a/sources/Modbus/ModbusCCMgr.cpp b/sources/Modbus/ModbusCCMgr.cpp index a942747..a7e6215 100644 --- a/sources/Modbus/ModbusCCMgr.cpp +++ b/sources/Modbus/ModbusCCMgr.cpp @@ -453,6 +453,17 @@ qint16 CModbusCCMgr::GetZT1TrainType() return Type; } +qint16 CModbusCCMgr::GetZT1RawTrainType() +{ + bool OK = false; + return mModbusRepo->GetSingleReg(MODBUS_CC_ZT1_TRAIN_TYPE_REG_ADD,&OK); +} +qint16 CModbusCCMgr::GetZT2RawTrainType() +{ + bool OK = false; + return mModbusRepo->GetSingleReg(MODBUS_CC_ZT2_TRAIN_TYPE_REG_ADD,&OK); +} + qint16 CModbusCCMgr::GetZT2TrainType() { bool OK = false; diff --git a/sources/Modbus/ModbusCCMgr.h b/sources/Modbus/ModbusCCMgr.h index 56ffe60..2658236 100644 --- a/sources/Modbus/ModbusCCMgr.h +++ b/sources/Modbus/ModbusCCMgr.h @@ -67,7 +67,9 @@ public: bool GetZT2InhibitionFlag(); //Retourne l'état de l'inhibition de ZT2 int ClearZT2InhibitionFlag(); //Désactive l'inhibition ZT2 qint16 GetZT1TrainType(); //Retourne le type de train actuel ZT1 - qint16 GetZT2TrainType(); //Retourne le type de train actuel ZT1 + qint16 GetZT2TrainType(); //Retourne le type de train actuel ZT2 + qint16 GetZT1RawTrainType(); //Retourne le type de train + qint16 GetZT2RawTrainType(); //Retourne le type de train int SetZTWatchdogEnabled(bool Enabled); //Permet de désactiver le Watchdog de la ZT (pour le mode entretien) int SetActivatedITI(int ITI); //Fixe l'itinéraire ZT1 cheminé par le train pour en informer la CC diff --git a/sources/Simulator/SimulationScenario.cpp b/sources/Simulator/SimulationScenario.cpp index 3ca1879..77d0dd3 100644 --- a/sources/Simulator/SimulationScenario.cpp +++ b/sources/Simulator/SimulationScenario.cpp @@ -104,104 +104,104 @@ unsigned int CSimulationScenario::CreateScenario() -//// //ZT2 +// //ZT2 -// InsertNewStep(STEP_ACTION_REGISTER_ZT2_ITI,300); -// InsertNewStep(STEP_ACTION_OCCUPY_ZT2,300); + InsertNewStep(STEP_ACTION_REGISTER_ZT2_ITI,300); + InsertNewStep(STEP_ACTION_OCCUPY_ZT2,300); -// for(int bogie = 1; bogie <= 18; bogie++) -// { -// InsertNewStep(STEP_ACTION_ACTIVATE_ZT2_S1,SENSOR_DELAY); -// InsertNewStep(STEP_ACTION_DEACTIVATE_ZT2_S1,BOGIE_DELAY); + for(int bogie = 1; bogie <= 18; bogie++) + { + InsertNewStep(STEP_ACTION_ACTIVATE_ZT2_S1,SENSOR_DELAY); + InsertNewStep(STEP_ACTION_DEACTIVATE_ZT2_S1,BOGIE_DELAY); -// // if(bogie == 5 || bogie == 2) -// { -// // InsertNewStep(STEP_ACTION_ACTIVATE_ZT2_PPE,5); -// // InsertNewStep(STEP_ACTION_DEACTIVATE_ZT2_PPE,1); + // if(bogie == 5 || bogie == 2) + { + // InsertNewStep(STEP_ACTION_ACTIVATE_ZT2_PPE,5); + // InsertNewStep(STEP_ACTION_DEACTIVATE_ZT2_PPE,1); -// } + } -// // if(bogie == 3 || bogie == 10) -// { -//// InsertNewStep(STEP_ACTION_ACTIVATE_ZT2_PPI,3); -//// InsertNewStep(STEP_ACTION_DEACTIVATE_ZT2_PPI,1); + // if(bogie == 3 || bogie == 10) + { +// InsertNewStep(STEP_ACTION_ACTIVATE_ZT2_PPI,3); +// InsertNewStep(STEP_ACTION_DEACTIVATE_ZT2_PPI,1); -// } + } -// //if(bogie != 3) -// { -// InsertNewStep(STEP_ACTION_ACTIVATE_ZT2_S1,SENSOR_DELAY); -// InsertNewStep(STEP_ACTION_DEACTIVATE_ZT2_S1,BOGIE_DELAY); -// } + //if(bogie != 3) + { + InsertNewStep(STEP_ACTION_ACTIVATE_ZT2_S1,SENSOR_DELAY); + InsertNewStep(STEP_ACTION_DEACTIVATE_ZT2_S1,BOGIE_DELAY); + } -// } + } -// InsertNewStep(STEP_ACTION_DESTROY_ZT2_ITI,800); -// InsertNewStep(STEP_ACTION_FREE_ZT2,800); + InsertNewStep(STEP_ACTION_DESTROY_ZT2_ITI,800); + InsertNewStep(STEP_ACTION_FREE_ZT2,800); //// MR - InsertNewStep(STEP_ACTION_REGISTER_ZT1_ITI,300); - InsertNewStep(STEP_ACTION_OCCUPY_ZT1_APPROACH,300); - InsertNewStep(STEP_ACTION_OCCUPY_ZT1,300); +// InsertNewStep(STEP_ACTION_REGISTER_ZT1_ITI,300); +// InsertNewStep(STEP_ACTION_OCCUPY_ZT1_APPROACH,300); +// InsertNewStep(STEP_ACTION_OCCUPY_ZT1,300); - for(int bogie = 1; bogie <= 12; bogie++) - { - // if(bogie != 5 && bogie != 7) - InsertNewStep(STEP_ACTION_ACTIVATE_PGI,0); - InsertNewStep(STEP_ACTION_ACTIVATE_PGE,0); -//V00 DETECTION - if(bogie != 9) - { - InsertNewStep(STEP_ACTION_ACTIVATE_S1,SENSOR_DELAY); - } - InsertNewStep(STEP_ACTION_DEACTIVATE_S1,BOGIE_DELAY); - InsertNewStep(STEP_ACTION_DEACTIVATE_PGI,0); - InsertNewStep(STEP_ACTION_DEACTIVATE_PGE,0); +// for(int bogie = 1; bogie <= 12; bogie++) +// { +// // if(bogie != 5 && bogie != 7) +// InsertNewStep(STEP_ACTION_ACTIVATE_PGI,0); +// InsertNewStep(STEP_ACTION_ACTIVATE_PGE,0); +////V00 DETECTION +// if(bogie != 9) +// { +// InsertNewStep(STEP_ACTION_ACTIVATE_S1,SENSOR_DELAY); +// } +// InsertNewStep(STEP_ACTION_DEACTIVATE_S1,BOGIE_DELAY); +// InsertNewStep(STEP_ACTION_DEACTIVATE_PGI,0); +// InsertNewStep(STEP_ACTION_DEACTIVATE_PGE,0); -//FN DETECTION - if(bogie != 5 && bogie != 8 && bogie != 3) - InsertNewStep(STEP_ACTION_ACTIVATE_FN,0); +////FN DETECTION +// if(bogie != 5 && bogie != 8 && bogie != 3) +// InsertNewStep(STEP_ACTION_ACTIVATE_FN,0); - InsertNewStep(STEP_ACTION_ACTIVATE_S1,SENSOR_DELAY); - InsertNewStep(STEP_ACTION_ACTIVATE_S2,SENSOR_DELAY); - InsertNewStep(STEP_ACTION_DEACTIVATE_S1,BOGIE_DELAY); +// InsertNewStep(STEP_ACTION_ACTIVATE_S1,SENSOR_DELAY); +// InsertNewStep(STEP_ACTION_ACTIVATE_S2,SENSOR_DELAY); +// InsertNewStep(STEP_ACTION_DEACTIVATE_S1,BOGIE_DELAY); -//PPI DETECTION -// if(bogie == 6 || bogie == 9) -// InsertNewStep(STEP_ACTION_ACTIVATE_PPI,0); +////PPI DETECTION +//// if(bogie == 6 || bogie == 9) +//// InsertNewStep(STEP_ACTION_ACTIVATE_PPI,0); -//FN DETECTION - if(bogie != 5 && bogie != 8 && bogie != 3) - InsertNewStep(STEP_ACTION_DEACTIVATE_FN,0); +////FN DETECTION +// if(bogie != 5 && bogie != 8 && bogie != 3) +// InsertNewStep(STEP_ACTION_DEACTIVATE_FN,0); -// InsertNewStep(STEP_ACTION_ACTIVATE_S2,SENSOR_DELAY); - InsertNewStep(STEP_ACTION_DEACTIVATE_S2,BOGIE_DELAY); +//// InsertNewStep(STEP_ACTION_ACTIVATE_S2,SENSOR_DELAY); +// InsertNewStep(STEP_ACTION_DEACTIVATE_S2,BOGIE_DELAY); -//PPI DETECTION -// if(bogie == 6 || bogie == 9) -// InsertNewStep(STEP_ACTION_DEACTIVATE_PPI,0); +////PPI DETECTION +//// if(bogie == 6 || bogie == 9) +//// InsertNewStep(STEP_ACTION_DEACTIVATE_PPI,0); - // if(bogie != 2 && bogie != 11) - InsertNewStep(STEP_ACTION_ACTIVATE_PGI,0); - // if(bogie != 2 && bogie != 11) - InsertNewStep(STEP_ACTION_ACTIVATE_PGE,0); - InsertNewStep(STEP_ACTION_ACTIVATE_S2,SENSOR_DELAY); - InsertNewStep(STEP_ACTION_DEACTIVATE_S2,BOGIE_DELAY); - InsertNewStep(STEP_ACTION_DEACTIVATE_PGI,0); - InsertNewStep(STEP_ACTION_DEACTIVATE_PGE,0); +// // if(bogie != 2 && bogie != 11) +// InsertNewStep(STEP_ACTION_ACTIVATE_PGI,0); +// // if(bogie != 2 && bogie != 11) +// InsertNewStep(STEP_ACTION_ACTIVATE_PGE,0); +// InsertNewStep(STEP_ACTION_ACTIVATE_S2,SENSOR_DELAY); +// InsertNewStep(STEP_ACTION_DEACTIVATE_S2,BOGIE_DELAY); +// InsertNewStep(STEP_ACTION_DEACTIVATE_PGI,0); +// InsertNewStep(STEP_ACTION_DEACTIVATE_PGE,0); - } +// } - InsertNewStep(STEP_ACTION_DESTROY_ZT1_ITI,800); +// InsertNewStep(STEP_ACTION_DESTROY_ZT1_ITI,800); - InsertNewStep(STEP_ACTION_FREE_ZT1,800); +// InsertNewStep(STEP_ACTION_FREE_ZT1,800); - InsertNewStep(STEP_ACTION_FREE_ZT1_APPROACH,800); +// InsertNewStep(STEP_ACTION_FREE_ZT1_APPROACH,800); return RET_OK; } diff --git a/sources/TrainLogFileMgr.cpp b/sources/TrainLogFileMgr.cpp index d9bb07f..ff75723 100644 --- a/sources/TrainLogFileMgr.cpp +++ b/sources/TrainLogFileMgr.cpp @@ -57,7 +57,7 @@ unsigned int CTrainLogFileMgr::SaveTrainLog(QString LogFilePathName, CZT1Log *ZT QDataStream * OutputStream = new QDataStream(BinaryLogFile); - quint32 MagicNbr = BASE_FILE_MAGICNBR+1; + quint32 MagicNbr = TRAINLOG_FILE_MAGICNBR; quint32 NbLogEntry = 0,NbDetections = 0; quint32 LogType = ZT1_LOG_TYPE; @@ -68,6 +68,7 @@ unsigned int CTrainLogFileMgr::SaveTrainLog(QString LogFilePathName, CZT1Log *ZT quint64 ThreadDataStartTime = 0, ThreadDataEndTime = 0; qreal MeanSpeed = 0; QDateTime DateTime; + const quint32 OutilZTReservedFlags[10] = {0xBAADCAFE,0xBAADCAFE,0xBAADCAFE,0xBAADCAFE,0xBAADCAFE,0xBAADCAFE,0xBAADCAFE,0xBAADCAFE,0xBAADCAFE,0xBAADCAFE}; //Compute some stats @@ -125,11 +126,20 @@ unsigned int CTrainLogFileMgr::SaveTrainLog(QString LogFilePathName, CZT1Log *ZT - *OutputStream << MagicNbr << LogType << NbLogEntry << NbDetections; + *OutputStream << MagicNbr; + for(int i = 0; i < 10; i++) + { + *OutputStream << OutilZTReservedFlags[i]; + } + + *OutputStream << LogType << NbLogEntry << NbDetections; *OutputStream << StationName; *OutputStream << ZT1Log->mZT1Flags; + + + *OutputStream << TrainType << NbElements << ThreadDataStartTime << ThreadDataEndTime << MeanSpeed << DateTime; @@ -183,7 +193,7 @@ unsigned int CTrainLogFileMgr::SaveTrainLog(QString LogFilePathName,CZT2Log *ZT2 QDataStream * OutputStream = new QDataStream(BinaryLogFile); - quint32 MagicNbr = BASE_FILE_MAGICNBR+1; + quint32 MagicNbr = TRAINLOG_FILE_MAGICNBR; quint32 NbLogEntry,NbDetections; quint32 LogType = ZT2_LOG_TYPE; @@ -191,7 +201,7 @@ unsigned int CTrainLogFileMgr::SaveTrainLog(QString LogFilePathName,CZT2Log *ZT2 NbDetections = ZT2DetectionsLog->size(); quint32 NbElements = 0; QDateTime DateTime = ZT2Log->mZT2LogData.at(0)->mDateTime; - + const quint32 OutilZTReservedFlags[10] = {0xBAADCAFE,0xBAADCAFE,0xBAADCAFE,0xBAADCAFE,0xBAADCAFE,0xBAADCAFE,0xBAADCAFE,0xBAADCAFE,0xBAADCAFE,0xBAADCAFE}; //Get some stats for(int j = 0; j < ZT2Log->mZT2LogData.size(); j++) @@ -208,11 +218,18 @@ unsigned int CTrainLogFileMgr::SaveTrainLog(QString LogFilePathName,CZT2Log *ZT2 - *OutputStream << MagicNbr << LogType << NbLogEntry << NbDetections; + *OutputStream << MagicNbr; + for(int i = 0; i < 10; i++) + { + *OutputStream << OutilZTReservedFlags[i]; + } + *OutputStream << LogType << NbLogEntry << NbDetections; *OutputStream << StationName; *OutputStream << ZT2Log->mZT2Flags; + + *OutputStream << NbElements << DateTime; //write detections @@ -263,7 +280,7 @@ CLogElement* CTrainLogFileMgr::OpenTrainLog(QString LogFilePathName,unsigned int quint32 MagicNbr,NbLogEntry,NbDetections,LogType; *InputStream >> MagicNbr; - if(MagicNbr != BASE_FILE_MAGICNBR+1) + if(MagicNbr != TRAINLOG_FILE_MAGICNBR) { CEngLog::instance()->AddLogString(QString().sprintf("Fichier de passage invalide (Magic number) %s",LogFilePathName.toAscii().data()),3); @@ -274,6 +291,9 @@ CLogElement* CTrainLogFileMgr::OpenTrainLog(QString LogFilePathName,unsigned int Retvalue = RET_ERROR; return 0; } + quint32 OutilZTFlags; + for(int i = 0; i < 10; i++) + *InputStream >> OutilZTFlags; *InputStream >> LogType; @@ -291,11 +311,11 @@ CLogElement* CTrainLogFileMgr::OpenTrainLog(QString LogFilePathName,unsigned int PassageLog->mLogFileName = LogFilePathName; + *InputStream >> NbLogEntry; *InputStream >> NbDetections; *InputStream >> PassageLog->mStationName; *InputStream >> PassageLog->mFlags; - *InputStream >> PassageLog->mTrainType; *InputStream >> PassageLog->mNbElements; *InputStream >> PassageLog->mThreadDataStartTime; @@ -354,6 +374,7 @@ CLogElement* CTrainLogFileMgr::OpenTrainLog(QString LogFilePathName,unsigned int *InputStream >> NbDetections; *InputStream >> PassageLog->mStationName; *InputStream >> PassageLog->mFlags; + *InputStream >> NbElements; *InputStream >> DateTime; diff --git a/sources/ZTData.cpp b/sources/ZTData.cpp index c2b1ccc..36c7ca4 100644 --- a/sources/ZTData.cpp +++ b/sources/ZTData.cpp @@ -27,6 +27,7 @@ /* ************************************************************************** */ #include "ZTData.h" +#include "ModbusCCMgr.h" const char * CZTData::TrainTypeString[] = {"Inconnu","MR63/73", "MPM10", "MR63", "MR73", "Véhicule Travaux"}; CZTData::CZTData() @@ -82,6 +83,41 @@ const char* CZTData::GetTrainTypeString(unsigned int TrainType) return TrainTypeString[TrainType]; } +const char* CZTData::GetModbusTrainTypeString(unsigned int TrainType) +{ + switch(TrainType) + { + case MODBUS_CC_TRAIN_TYPE_MR63: + { + return "MR63"; + break; + } + case MODBUS_CC_TRAIN_TYPE_MR73: + { + return "MR73"; + break; + } + case MODBUS_CC_TRAIN_TYPE_MPM10: + { + return "MPM10"; + break; + } + case MODBUS_CC_TRAIN_TYPE_MAINTENANCE: + { + return "Vehicule Travaux"; + break; + } + case MODBUS_CC_TRAIN_TYPE_INVALID_ATS_OFFLINE: + case MODBUS_CC_TRAIN_TYPE_INVALID_SERVICE_REBOOT: + case MODBUS_CC_TRAIN_TYPE_INVALID_NOT_UPDATED: + case MODBUS_CC_TRAIN_TYPE_INVALID_SACL_OFFLINE: + default: + { + return "Inconnu"; + break; + } + } +} CZT1LogData::CZT1LogData(CZT1ThreadData *ThreadData): mZT1ThreadData(ThreadData) @@ -129,7 +165,20 @@ QDataStream &operator<<(QDataStream &out, const CZT1FlagsData &source) << source.mPGCalibrationON << source.mPGTresholdValue << source.mAnalogTracePresent - << source.mIsProblematicPassage; + << source.mIsProblematicPassage + << source.mTrainCompo1 + << source.mTrainCompo2 + << source.mTrainCompo3 + << source.mModbusTrainType + << source.mUnusedFlag12 + << source.mUnusedFlag13 + << source.mUnusedFlag14 + << source.mUnusedFlag15 + << source.mUnusedFlag16 + << source.mUnusedFlag17 + << source.mUnusedFlag18 + << source.mUnusedFlag19 + << source.mUnusedFlag20; //do not save mPEQ1Type @@ -143,8 +192,20 @@ QDataStream &operator>>(QDataStream &in, CZT1FlagsData &dest) >> dest.mPGCalibrationON >> dest.mPGTresholdValue >> dest.mAnalogTracePresent - >> dest.mIsProblematicPassage; - + >> dest.mIsProblematicPassage + >> dest.mTrainCompo1 + >> dest.mTrainCompo2 + >> dest.mTrainCompo3 + >> dest.mModbusTrainType + >> dest.mUnusedFlag12 + >> dest.mUnusedFlag13 + >> dest.mUnusedFlag14 + >> dest.mUnusedFlag15 + >> dest.mUnusedFlag16 + >> dest.mUnusedFlag17 + >> dest.mUnusedFlag18 + >> dest.mUnusedFlag19 + >> dest.mUnusedFlag20; //do not restore mPEQ1Type return in; @@ -152,14 +213,34 @@ QDataStream &operator>>(QDataStream &in, CZT1FlagsData &dest) QDataStream &operator<<(QDataStream &out, const CZT2FlagsData &source) { - out << source.mIsProblematicPassage; + out << source.mIsProblematicPassage + << source.mTrainCompo1 + << source.mTrainCompo2 + << source.mTrainCompo3 + << source.mModbusTrainType + << source.mUnusedFlag6 + << source.mUnusedFlag7 + << source.mUnusedFlag8 + << source.mUnusedFlag9 + << source.mUnusedFlag10; + return out; } QDataStream &operator>>(QDataStream &in, CZT2FlagsData &dest) { - in >> dest.mIsProblematicPassage; + in >> dest.mIsProblematicPassage + >> dest.mTrainCompo1 + >> dest.mTrainCompo2 + >> dest.mTrainCompo3 + >> dest.mModbusTrainType + >> dest.mUnusedFlag6 + >> dest.mUnusedFlag7 + >> dest.mUnusedFlag8 + >> dest.mUnusedFlag9 + >> dest.mUnusedFlag10; + return in; } diff --git a/sources/ZTData.h b/sources/ZTData.h index 086117e..8813750 100644 --- a/sources/ZTData.h +++ b/sources/ZTData.h @@ -167,6 +167,8 @@ public: static const char *TrainTypeString[]; static const char *GetTrainTypeString(unsigned int TrainType); + static const char *GetModbusTrainTypeString(unsigned int TrainType); + }; //This class contains data from the ZT1 analysis thread @@ -198,7 +200,6 @@ public: void operator=(CZT1ThreadData& a); }; - class CZT1FlagsData { public: @@ -209,6 +210,19 @@ public: qint32 mAnalogTracePresent; qint32 mIsProblematicPassage; //This flag will be set if problems have been detected but not sent to PCC due to PURE comitee rules. qint32 mPEQ1Type; //Not saved in passage files... + qint32 mTrainCompo1; + qint32 mTrainCompo2; + qint32 mTrainCompo3; + qint32 mModbusTrainType; + qint32 mUnusedFlag12; + qint32 mUnusedFlag13; + qint32 mUnusedFlag14; + qint32 mUnusedFlag15; + qint32 mUnusedFlag16; + qint32 mUnusedFlag17; + qint32 mUnusedFlag18; + qint32 mUnusedFlag19; + qint32 mUnusedFlag20; }; QDataStream &operator<<(QDataStream &out, const CZT1FlagsData &source); QDataStream &operator>>(QDataStream &in, CZT1FlagsData &dest); @@ -217,6 +231,15 @@ class CZT2FlagsData { public: qint32 mIsProblematicPassage; //This flag will be set if problems have been detected but not sent to PCC due to PURE comitee rules. + qint32 mTrainCompo1; + qint32 mTrainCompo2; + qint32 mTrainCompo3; + qint32 mModbusTrainType; + qint32 mUnusedFlag6; + qint32 mUnusedFlag7; + qint32 mUnusedFlag8; + qint32 mUnusedFlag9; + qint32 mUnusedFlag10; }; QDataStream &operator<<(QDataStream &out, const CZT2FlagsData &source); QDataStream &operator>>(QDataStream &in, CZT2FlagsData &dest); diff --git a/sources/ZTStateMachine.cpp b/sources/ZTStateMachine.cpp index 53ec714..49984c9 100644 --- a/sources/ZTStateMachine.cpp +++ b/sources/ZTStateMachine.cpp @@ -382,6 +382,10 @@ unsigned int CZTStateMachine::ZT1StateMachine(unsigned int Event, unsigned int S //update train info received from the CC Modbus interface mTrainTypeDetected = (unsigned)mModbusCCMgr->GetZT1TrainType(); mZT1TrainComposition = mModbusCCMgr->GetZT1TrainComposition(); + mZT1Log.mZT1Flags.mTrainCompo1 = (qint32)mZT1TrainComposition.at(0); + mZT1Log.mZT1Flags.mTrainCompo2 = (qint32)mZT1TrainComposition.at(1); + mZT1Log.mZT1Flags.mTrainCompo3 = (qint32)mZT1TrainComposition.at(2); + mZT1Log.mZT1Flags.mModbusTrainType = mModbusCCMgr->GetZT1RawTrainType(); mZTPagePTr->SetZT1TrainData(mTrainTypeDetected,mZT1TrainComposition); } @@ -1162,8 +1166,13 @@ unsigned int CZTStateMachine::ZT2StateMachine(unsigned int Event, unsigned int S //update train info received from the CC Modbus interface mZT2TrainType = (unsigned)mModbusCCMgr->GetZT2TrainType(); mZT2TrainComposition = mModbusCCMgr->GetZT2TrainComposition(); + mZT2Log.mZT2Flags.mTrainCompo1 = (qint32)mZT2TrainComposition.at(0); + mZT2Log.mZT2Flags.mTrainCompo2 = (qint32)mZT2TrainComposition.at(1); + mZT2Log.mZT2Flags.mTrainCompo3 = (qint32)mZT2TrainComposition.at(2); + mZT2Log.mZT2Flags.mModbusTrainType = mModbusCCMgr->GetZT2RawTrainType(); mZTPagePTr->SetZT2TrainData(mZT2TrainType,mZT2TrainComposition); } + InsertZT2LogItem(); mZT2WorkerThread->UpdateDetectionConfig(mZTDetectionConfig); mTKGenerator->UpdateDetectionConfig(mZTDetectionConfig); @@ -1529,6 +1538,10 @@ unsigned int CZTStateMachine::DestroyZT1Log() mZT1Log.mZT1Flags.mPGTresholdValue = 0; mZT1Log.mZT1Flags.mAnalogTracePresent = (mSDFAnalogMonitorInterface != 0); mZT1Log.mZT1Flags.mIsProblematicPassage = 0; + mZT1Log.mZT1Flags.mTrainCompo1 = 0; + mZT1Log.mZT1Flags.mTrainCompo2 = 0; + mZT1Log.mZT1Flags.mTrainCompo3 = 0; + mZT1Log.mZT1Flags.mModbusTrainType = MODBUS_CC_TRAIN_TYPE_INVALID_NOT_UPDATED; mZT1PEQType = PEQ1_UNKNOWN_TYPE; @@ -1579,6 +1592,10 @@ unsigned int CZTStateMachine::DestroyZT2Log() delete mZT2Log.mZT2LogData.at(i); } mZT2Log.mZT2LogData.clear(); + mZT2Log.mZT2Flags.mModbusTrainType = MODBUS_CC_TRAIN_TYPE_INVALID_NOT_UPDATED; + mZT2Log.mZT2Flags.mTrainCompo1 = 0; + mZT2Log.mZT2Flags.mTrainCompo2 = 0; + mZT2Log.mZT2Flags.mTrainCompo3 = 0; for(int i = 0; i < mZT2DetectionsLog.size(); i++) { diff --git a/sources/Zonetest.cpp b/sources/Zonetest.cpp index 537e73b..e9a137e 100644 --- a/sources/Zonetest.cpp +++ b/sources/Zonetest.cpp @@ -725,10 +725,10 @@ unsigned int CZoneTest::InitStation() { StationName = "LONGUEIL"; } - else if((key & MONTMORENCY_IN_STATION_ID_MASK) == MONTMORENCY_STATION_KEY) - { - StationName = "MONTMORENCY"; - } +// else if((key & MONTMORENCY_IN_STATION_ID_MASK) == MONTMORENCY_STATION_KEY) +// { +// StationName = "MONTMORENCY"; +// } else if((key & MONTMORENCY1012_IN_STATION_ID_MASK) == MONTMORENCY1012_STATION_KEY) { StationName = "MONTMORENCY_10_12";