Changements reliés au Modbus CC
-Possibilité d'émettre des rangs invalide en mode entretien (compilation spéciale seulement avec #define COMPILE_MODBUS_TEST_MODE). -Correction de la valeur du flag de mise à jour de l'heure. -Implémentation du flag d'itinéraire principal/secondaire dans la trame Modbus -Possibilité d'inhiber le watchdog Modbus à partir du mode entretien.
This commit is contained in:
parent
945f4ccb6b
commit
a4df2627b3
@ -71,12 +71,12 @@ ENGLOG=3
|
||||
#STATION=HONORE_BEAUGRAND
|
||||
#STATION=ANGRIGNON
|
||||
#STATION=HENRI_BOURASSA
|
||||
STATION=COTE_VERTU
|
||||
#STATION=COTE_VERTU
|
||||
#STATION=BERRI_UQAM
|
||||
#STATION=LONGUEIL
|
||||
#STATION=SAINT_MICHEL
|
||||
#STATION=SNOWDON_L5
|
||||
#STATION=MONTMORENCY
|
||||
STATION=MONTMORENCY
|
||||
#STATION=MONTMORENCY_10_12
|
||||
#STATION=MONTMORENCY_10_22
|
||||
#STATION=DU_COLLEGE
|
||||
|
||||
@ -69,6 +69,7 @@
|
||||
#define USE_NETWORKING
|
||||
#define TCP_SERVER_PORT 1234
|
||||
#define CUSTOM_KERNEL_INSTALLED //Custom kernel with modified serial.c to disable hardware FIFO.
|
||||
#define COMPILE_MODBUS_TEST_MODE //Utilisé seulement pour les tests d'intégration Modbus.
|
||||
|
||||
|
||||
//Debug defs
|
||||
|
||||
@ -39,12 +39,14 @@
|
||||
#include <QMessageBox>
|
||||
#include "ZTLog.h"
|
||||
#include "ZTData.h"
|
||||
#include "ZTconfigmgr.h"
|
||||
|
||||
|
||||
CMaintenancePage::CMaintenancePage(QGraphicsWidget *Parent)
|
||||
{
|
||||
Q_UNUSED(Parent)
|
||||
|
||||
bool IsModbusEnabled = CZTConfigMgr::instance()->GetModbusCCEnabled();
|
||||
|
||||
mProgramHandle = 0;
|
||||
|
||||
@ -82,19 +84,19 @@ CMaintenancePage::CMaintenancePage(QGraphicsWidget *Parent)
|
||||
|
||||
mGenerateAlarmBtn = new CTextButtonWidget("Envoyer Alarme",0,30);
|
||||
mGenerateAlarmBtn->setParentItem(this);
|
||||
mGenerateAlarmBtn->setPos(540,170);
|
||||
mGenerateAlarmBtn->setPos(540,160);
|
||||
connect(mGenerateAlarmBtn,SIGNAL(TxtButtonClicked(CTextButtonWidget*)),this,SLOT(ButtonClicked(CTextButtonWidget*)));
|
||||
|
||||
mClearAlarmButton = new CTextButtonWidget("Acquitter Alarme",0,30);
|
||||
mClearAlarmButton->setParentItem(this);
|
||||
mClearAlarmButton->setPos(540,210);
|
||||
mClearAlarmButton->setPos(540,200);
|
||||
mClearAlarmButton->hide();
|
||||
connect(mClearAlarmButton,SIGNAL(TxtButtonClicked(CTextButtonWidget*)),this,SLOT(ButtonClicked(CTextButtonWidget*)));
|
||||
|
||||
QGraphicsProxyWidget *Proxy = new QGraphicsProxyWidget(this);
|
||||
mAlarmTypeList = new QComboBox();
|
||||
Proxy->setWidget(mAlarmTypeList);
|
||||
Proxy->setPos(100,200);
|
||||
Proxy->setPos(100,190);
|
||||
QStringList AlarmTypes;
|
||||
AlarmTypes << "Erreur de comptage ZT1"
|
||||
<< "Détection Frotteur Négatif"
|
||||
@ -112,17 +114,17 @@ CMaintenancePage::CMaintenancePage(QGraphicsWidget *Parent)
|
||||
connect(mAlarmTypeList,SIGNAL(currentIndexChanged(int)),this,SLOT(AlarmTypeSelectionChanged(int)));
|
||||
Proxy->setZValue(2);
|
||||
mAlarmDescription = new QGraphicsTextItem(this);
|
||||
mAlarmDescription->setPos(100,170);
|
||||
mAlarmDescription->setPos(100,160);
|
||||
mAlarmDescription->setPlainText("Type d'alarme");
|
||||
|
||||
|
||||
Proxy = new QGraphicsProxyWidget(this);
|
||||
mAlarmRankSpinBox = new QSpinBox();
|
||||
Proxy->setWidget(mAlarmRankSpinBox);
|
||||
Proxy->setPos(420,200);
|
||||
Proxy->setPos(420,190);
|
||||
mAlarmRankSpinBox->resize(100,30);
|
||||
mRankDescription = new QGraphicsTextItem(this);
|
||||
mRankDescription->setPos(420,170);
|
||||
mRankDescription->setPos(420,160);
|
||||
mRankDescription->setPlainText("Rang");
|
||||
|
||||
QPen FramePen;
|
||||
@ -241,18 +243,32 @@ void CMaintenancePage::AlarmTypeSelectionChanged(int index)
|
||||
case DETECTION_ZT2_PPI_DETECTION:
|
||||
case DETECTION_ZT2_PPE_DETECTION:
|
||||
{
|
||||
#ifdef COMPILE_MODBUS_TEST_MODE
|
||||
mAlarmRankSpinBox->setValue(1);
|
||||
mAlarmRankSpinBox->setMinimum(0);
|
||||
mAlarmRankSpinBox->setMaximum(99);
|
||||
mRankDescription->setPlainText("Rang");
|
||||
#else
|
||||
mAlarmRankSpinBox->setValue(1);
|
||||
mAlarmRankSpinBox->setMinimum(1);
|
||||
mAlarmRankSpinBox->setMaximum(36);
|
||||
mRankDescription->setPlainText("Rang");
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
case DETECTION_FN_DETECTION:
|
||||
{
|
||||
#ifdef COMPILE_MODBUS_TEST_MODE
|
||||
mAlarmRankSpinBox->setValue(1);
|
||||
mAlarmRankSpinBox->setMinimum(0);
|
||||
mAlarmRankSpinBox->setMaximum(99);
|
||||
mRankDescription->setPlainText("Bogie");
|
||||
#else
|
||||
mAlarmRankSpinBox->setValue(1);
|
||||
mAlarmRankSpinBox->setMinimum(1);
|
||||
mAlarmRankSpinBox->setMaximum(18);
|
||||
mRankDescription->setPlainText("Bogie");
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
case DETECTION_MAGNETIC_SENSOR_COUNT:
|
||||
|
||||
@ -41,6 +41,7 @@
|
||||
#define ZT1_ALARM_ITI_FLAG_MASK 0x8000
|
||||
#define ZT2_V02_ALARM_FLAG_MASK 0x0004
|
||||
#define ZT2_PEQ2_ALARM_FLAG_MASK 0x0008
|
||||
#define ZT_ACTIVATED_ITI_FLAG_MASK 0x8000
|
||||
|
||||
//Flags definitions for HR2027
|
||||
#define ZT_WATCHDOG_ON_VALUE 0x8000
|
||||
@ -92,6 +93,7 @@
|
||||
#define MODBUS_CC_FCYCLE_ZT2_FLAG_MASK 0x0002
|
||||
#define MODBUS_CC_INHIBIT_ZT1_FLAG_MASK 0x0004
|
||||
#define MODBUS_CC_INHIBIT_ZT2_FLAG_MASK 0x0008
|
||||
#define MODBUS_CC_CLK_UPDATE_FLAG_MASK 0x8000
|
||||
|
||||
#define MODBUS_CC_DATA_BASE_REG_ADD 2028
|
||||
#define MODBUS_CC_TABLE_DATA_SIZE 15 //Taille de la table en lecture = 15 registres (2028 à 2042)
|
||||
|
||||
@ -11,6 +11,7 @@ CModbusCCMgr::CModbusCCMgr(CModbusRepository *Repo, int ModbusPort, int DevID) :
|
||||
mModbusServer = new QTcpServer();
|
||||
mDeviceID = DevID;
|
||||
mModbusPort = ModbusPort;
|
||||
mZTWatchdogEnabled = true;
|
||||
|
||||
connect(mModbusServer,SIGNAL(newConnection()),this,SLOT(NewModbusConnection()));
|
||||
mModbusMode = MODBUS_SLAVE_MODE;
|
||||
@ -131,7 +132,7 @@ void CModbusCCMgr::RegistersDatabaseUpdated(quint16 StartAddress, quint16 Length
|
||||
if(mCCLinkState == true) //Ignore incoming data if the link is not healty (Watchdog).
|
||||
{
|
||||
qint16 NTPWrite = mModbusRepo->GetSingleReg(MODBUS_CC_CLK_UPDATE_BASE_REG_ADD);
|
||||
if(NTPWrite == 1)
|
||||
if((NTPWrite & MODBUS_CC_CLK_UPDATE_FLAG_MASK) != 0)
|
||||
{
|
||||
//Update date & time...
|
||||
bool OK;
|
||||
@ -185,6 +186,8 @@ void CModbusCCMgr::ModbusCCWatchdogTimeout()
|
||||
void CModbusCCMgr::ModbusZTWatchdogTimeout()
|
||||
{
|
||||
|
||||
if(mZTWatchdogEnabled)
|
||||
{
|
||||
quint16 WD = mZTWatchdog;
|
||||
// qDebug("WD = 0x%x",WD);
|
||||
mModbusRepo->WriteSingleReg(MODBUS_ZT_WATCHDOG_REG_ADD,WD);
|
||||
@ -196,6 +199,7 @@ void CModbusCCMgr::ModbusZTWatchdogTimeout()
|
||||
{
|
||||
mZTWatchdog = ZT_WATCHDOG_ON_VALUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int CModbusCCMgr::ResetCCRepository()
|
||||
@ -401,3 +405,32 @@ qint16 CModbusCCMgr::GetZT2TrainType()
|
||||
}
|
||||
return Type;
|
||||
}
|
||||
|
||||
int CModbusCCMgr::SetZTWatchdogEnabled(bool Enabled)
|
||||
{
|
||||
mZTWatchdogEnabled = Enabled;
|
||||
return RET_OK;
|
||||
}
|
||||
|
||||
int CModbusCCMgr::SetActivatedITI(int ITI)
|
||||
{
|
||||
bool OK = false;
|
||||
quint16 Reg = mModbusRepo->GetSingleReg(MODBUS_MISC_DATA_BASE_REG_ADD,&OK);
|
||||
if(OK == true)
|
||||
{
|
||||
if(ITI == ZT_SECONDARY_ITI)
|
||||
{
|
||||
Reg |= ZT_ACTIVATED_ITI_FLAG_MASK;
|
||||
}
|
||||
else
|
||||
{
|
||||
Reg &= ~ZT_ACTIVATED_ITI_FLAG_MASK;
|
||||
}
|
||||
|
||||
return mModbusRepo->WriteSingleReg(MODBUS_MISC_DATA_BASE_REG_ADD,Reg);
|
||||
}
|
||||
else
|
||||
{
|
||||
return RET_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
@ -49,6 +49,8 @@ public:
|
||||
int ClearZT2InhibitionFlag();
|
||||
qint16 GetZT1TrainType();
|
||||
qint16 GetZT2TrainType();
|
||||
int SetZTWatchdogEnabled(bool Enabled);
|
||||
int SetActivatedITI(int ITI);
|
||||
|
||||
private:
|
||||
QTcpServer *mModbusServer;
|
||||
@ -58,6 +60,7 @@ private:
|
||||
qint16 mCCWatchdogState;
|
||||
bool mCCLinkState;
|
||||
QDateTime *mLastDateTime;
|
||||
bool mZTWatchdogEnabled;
|
||||
|
||||
int ResetCCRepository();
|
||||
|
||||
|
||||
@ -93,6 +93,11 @@ bool CStation::IsZT1CDVOccupied()
|
||||
return false;
|
||||
}
|
||||
|
||||
int CStation::GetCurrentITI()
|
||||
{
|
||||
return ZT_PRIMARY_ITI; //Dans les stations avec un seul itinéraire, toujours renvoyer l'itinérarie principal.
|
||||
}
|
||||
|
||||
bool CStation::IsZT1AnalysisFinished()
|
||||
{
|
||||
//Normally, the ZT1 analysis ends when the train quits the ZT1 CDV.
|
||||
|
||||
@ -224,6 +224,7 @@ public:
|
||||
virtual bool IsZT1ApproachCDVOccupied();
|
||||
virtual bool IsZT1AnalysisFinished();
|
||||
virtual bool IsZT1CDVOccupied();
|
||||
virtual int GetCurrentITI();
|
||||
bool IsZT1SubsequentCDVOccupied();
|
||||
bool IsZT2CDVOccupied();
|
||||
bool StationHasZT2();
|
||||
|
||||
@ -148,6 +148,23 @@ unsigned int CMontmorencyStation::UpdateStationMasks(unsigned int ExtInputData)
|
||||
return RET_OK;
|
||||
}
|
||||
|
||||
int CMontmorencyStation::GetCurrentITI()
|
||||
{
|
||||
if(mCurZT1Itinerary == MONTMORENCY_ZT1_NO_ITINERARY || mCurZT1Itinerary == MONTMORENCY_ZT1_10_12_ITINERARY)
|
||||
{
|
||||
return ZT_PRIMARY_ITI;
|
||||
}
|
||||
else if(mCurZT1Itinerary == MONTMORENCY_ZT1_10_22_ITINERARY)
|
||||
{
|
||||
return ZT_SECONDARY_ITI;
|
||||
}
|
||||
else
|
||||
{
|
||||
qDebug("Invalid mCurZT1Itinerary in CMontmorencyStation. Weird stuff!");
|
||||
return ZT_PRIMARY_ITI;
|
||||
}
|
||||
}
|
||||
|
||||
unsigned int CMontmorencyStation::BuildStationCDVList()
|
||||
{
|
||||
CCDV *NewCDV;
|
||||
|
||||
@ -113,6 +113,7 @@ public:
|
||||
CMontmorencyStation();
|
||||
virtual GenericInputMasks_t *GetInputMasks(void);
|
||||
virtual unsigned int UpdateStationMasks(unsigned int ExtInputData);
|
||||
virtual int GetCurrentITI();
|
||||
|
||||
|
||||
private:
|
||||
|
||||
@ -56,6 +56,13 @@ enum eSwitchCVDPosition
|
||||
SWITCH_CDV_UNKNOWN_POSITION
|
||||
};
|
||||
|
||||
enum eZTITI
|
||||
{
|
||||
ZT_PRIMARY_ITI, // Itinéraire 10/12 ou en voie normale
|
||||
ZT_SECONDARY_ITI, // Itinéraire 10/22 ou autre changement de voie (quai banalisé)
|
||||
ZT_MAX_ITI
|
||||
};
|
||||
|
||||
enum eCDVType
|
||||
{
|
||||
CDV_NORMAL_TYPE,
|
||||
|
||||
@ -346,8 +346,11 @@ unsigned int CZTStateMachine::ZT1StateMachine(unsigned int Event, unsigned int S
|
||||
else if(mZTStationPtr->IsZT1CDVOccupied())
|
||||
{
|
||||
bool abort = false;
|
||||
|
||||
if(mModbusCCMgr != 0)
|
||||
{
|
||||
mModbusCCMgr->SetActivatedITI(mZTStationPtr->GetCurrentITI());
|
||||
|
||||
if(mModbusCCMgr->GetZT1InhibitionFlag() == true) //Check if the CC wants us to analyze the passage
|
||||
{
|
||||
abort = true;
|
||||
@ -364,7 +367,6 @@ unsigned int CZTStateMachine::ZT1StateMachine(unsigned int Event, unsigned int S
|
||||
mProgramPtr->SetZT1InhibitionState(true);
|
||||
}
|
||||
}
|
||||
|
||||
if(abort == false)
|
||||
{
|
||||
mZT1ActiveStatus = SB_ZT_ACTIVE_STATUS;
|
||||
|
||||
@ -110,7 +110,7 @@ public:
|
||||
|
||||
CZTDetectionFunctionConfig *mZTDetectionConfig;
|
||||
CTKGenerator *mTKGenerator; //pointeur vers la classe qui gère les alarmes au PCC
|
||||
//CInterfaceCC *mTKGenerator; //pointeur vers la classe qui gère les alarmes au PCC
|
||||
|
||||
void SetZT2Presence(bool Presence);
|
||||
|
||||
void SetAutoExportZT1CSV(bool Export){mAutoExportZT1CSV = Export;}
|
||||
|
||||
@ -487,6 +487,8 @@ unsigned int CZoneTest::InitZT()
|
||||
{
|
||||
int ModbusPort = CZTConfigMgr::instance()->GetModbusCCPort();
|
||||
int DevID = CZTConfigMgr::instance()->GetModbusCCDevID();
|
||||
mWatchdogEnabled=false;
|
||||
|
||||
if(DevID >= 255)
|
||||
{
|
||||
mWelcomePagePtr->InsertTextBoxString(QString("Valeur DevID Modbus CC invalide (%1)").arg(DevID));
|
||||
@ -994,7 +996,14 @@ bool CZoneTest::EnterMaintenanceModeRequest()
|
||||
|
||||
void CZoneTest::ExitMaintenanceModeRequest()
|
||||
{
|
||||
if(CZTConfigMgr::instance()->GetModbusCCEnabled() == true)
|
||||
{
|
||||
mModbusCCMgr->SetZTWatchdogEnabled(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
mWatchdogEnabled = true;
|
||||
}
|
||||
mZTStateMachine->QuitMaintenanceMode();
|
||||
mEventMgr->RemoveSingleEvent(EVENT_MAINTENANCE);
|
||||
}
|
||||
@ -1012,9 +1021,15 @@ unsigned int CZoneTest::SendTKToPCC(int DetectionID, int Rank)
|
||||
//THIS IS NOT FOR CPU WATCHDOG BUT FOR EXTERNAL WATCHDOG "VIGIE" INSIDE THE T.A.
|
||||
void CZoneTest::SetWatchdogEnabled(bool Enabled)
|
||||
{
|
||||
if(CZTConfigMgr::instance()->GetModbusCCEnabled() == true)
|
||||
{
|
||||
mModbusCCMgr->SetZTWatchdogEnabled(Enabled);
|
||||
}
|
||||
else
|
||||
{
|
||||
mWatchdogEnabled = Enabled;
|
||||
mExtIOWorkerThread->ClearOutputFlags(mZTStation->GetOutputMasks()->OutputWatchdogMask);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
void CZoneTest::CloseMaintenancePageRequest()
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user