Continue dev -> train info from modbus
This commit is contained in:
parent
32a2e9bccd
commit
fbb173b6b5
Binary file not shown.
@ -25,74 +25,99 @@
|
|||||||
|
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#include "ZT1StatsZone.h"
|
#include "ZT1StatsZone.h"
|
||||||
|
|
||||||
|
|
||||||
CZT1StatsZone::CZT1StatsZone(QGraphicsItem *Parent)
|
CZT1StatsZone::CZT1StatsZone(QGraphicsItem *Parent)
|
||||||
{
|
{
|
||||||
setParentItem(Parent);
|
setParentItem(Parent);
|
||||||
|
|
||||||
|
mTrainCompositionText = 0;
|
||||||
|
|
||||||
|
mModbusEnabled = false;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned int CZT1StatsZone::Init(bool ModbusEnabled)
|
||||||
|
{
|
||||||
|
mModbusEnabled = ModbusEnabled;
|
||||||
|
int textpos = 12;
|
||||||
QFont font;
|
QFont font;
|
||||||
//font.setPixelSize(15);
|
|
||||||
font.setPointSize(15);
|
font.setPointSize(15);
|
||||||
|
|
||||||
mTrainSpeedText = new QGraphicsTextItem(this);
|
mTrainSpeedText = new QGraphicsTextItem(this);
|
||||||
mTrainSpeedText->setPos(0,12);
|
mTrainSpeedText->setPos(0,textpos);
|
||||||
// mTrainSpeedText->setPlainText("Vitesse du train: 0");
|
// mTrainSpeedText->setPlainText("Vitesse du train: 0");
|
||||||
mTrainSpeedText->setFont(font);
|
mTrainSpeedText->setFont(font);
|
||||||
|
|
||||||
|
textpos += 22;
|
||||||
mBogieCountText = new QGraphicsTextItem(this);
|
mBogieCountText = new QGraphicsTextItem(this);
|
||||||
mBogieCountText->setPos(0,34);
|
mBogieCountText->setPos(0,textpos);
|
||||||
// mBogieCountText->setPlainText("Compte Bogie: 0");
|
// mBogieCountText->setPlainText("Compte Bogie: 0");
|
||||||
mBogieCountText->setFont(font);
|
mBogieCountText->setFont(font);
|
||||||
|
|
||||||
|
textpos += 22;
|
||||||
mS1CountText = new QGraphicsTextItem(this);
|
mS1CountText = new QGraphicsTextItem(this);
|
||||||
mS1CountText->setPos(0,56);
|
mS1CountText->setPos(0,textpos);
|
||||||
// mS1CountText->setPlainText("Compte S1: 0");
|
// mS1CountText->setPlainText("Compte S1: 0");
|
||||||
mS1CountText->setFont(font);
|
mS1CountText->setFont(font);
|
||||||
|
|
||||||
|
textpos += 22;
|
||||||
mS2CountText = new QGraphicsTextItem(this);
|
mS2CountText = new QGraphicsTextItem(this);
|
||||||
mS2CountText->setPos(0,78);
|
mS2CountText->setPos(0,textpos);
|
||||||
// mS2CountText->setPlainText("Compte S2: 0");
|
// mS2CountText->setPlainText("Compte S2: 0");
|
||||||
mS2CountText->setFont(font);
|
mS2CountText->setFont(font);
|
||||||
|
|
||||||
|
textpos += 22;
|
||||||
mFNCountText = new QGraphicsTextItem(this);
|
mFNCountText = new QGraphicsTextItem(this);
|
||||||
mFNCountText->setPos(0,100);
|
mFNCountText->setPos(0,textpos);
|
||||||
// mFNCountText->setPlainText("Compte FN: 0");
|
// mFNCountText->setPlainText("Compte FN: 0");
|
||||||
mFNCountText->setFont(font);
|
mFNCountText->setFont(font);
|
||||||
|
|
||||||
|
textpos += 22;
|
||||||
mActualRankText = new QGraphicsTextItem(this);
|
mActualRankText = new QGraphicsTextItem(this);
|
||||||
mActualRankText->setPos(0,122);
|
mActualRankText->setPos(0,textpos);
|
||||||
// mActualRankText->setPlainText("Rang: 0");
|
// mActualRankText->setPlainText("Rang: 0");
|
||||||
mActualRankText->setFont(font);
|
mActualRankText->setFont(font);
|
||||||
|
|
||||||
|
textpos += 22;
|
||||||
mTrainTypeText = new QGraphicsTextItem(this);
|
mTrainTypeText = new QGraphicsTextItem(this);
|
||||||
mTrainTypeText->setPos(0,144);
|
mTrainTypeText->setPos(0,textpos);
|
||||||
// mTrainTypeText->setPlainText("Train Détecté: Aucun");
|
// mTrainTypeText->setPlainText("Train Détecté: Aucun");
|
||||||
mTrainTypeText->setFont(font);
|
mTrainTypeText->setFont(font);
|
||||||
|
|
||||||
|
if(mModbusEnabled == true)
|
||||||
|
{
|
||||||
|
textpos += 22;
|
||||||
|
mTrainCompositionText = new QGraphicsTextItem(this);
|
||||||
|
mTrainCompositionText->setPos(0,textpos);
|
||||||
|
mTrainCompositionText->setFont(font);
|
||||||
|
}
|
||||||
|
|
||||||
|
textpos += 22;
|
||||||
mPIValueText = new QGraphicsTextItem(this);
|
mPIValueText = new QGraphicsTextItem(this);
|
||||||
mPIValueText->setPos(0,166);
|
mPIValueText->setPos(0,textpos);
|
||||||
// mTrainTypeText->setPlainText("Train Détecté: Aucun");
|
// mTrainTypeText->setPlainText("Train Détecté: Aucun");
|
||||||
mPIValueText->setFont(font);
|
mPIValueText->setFont(font);
|
||||||
|
|
||||||
|
textpos += 22;
|
||||||
mPEValueText = new QGraphicsTextItem(this);
|
mPEValueText = new QGraphicsTextItem(this);
|
||||||
mPEValueText->setPos(0,188);
|
mPEValueText->setPos(0,textpos);
|
||||||
// mTrainTypeText->setPlainText("Train Détecté: Aucun");
|
// mTrainTypeText->setPlainText("Train Détecté: Aucun");
|
||||||
mPEValueText->setFont(font);
|
mPEValueText->setFont(font);
|
||||||
|
|
||||||
|
|
||||||
|
textpos += 22;
|
||||||
mLastActivationDateTime = new QGraphicsTextItem(this);
|
mLastActivationDateTime = new QGraphicsTextItem(this);
|
||||||
mLastActivationDateTime->setPos(0,210);
|
mLastActivationDateTime->setPos(0,textpos);
|
||||||
mLastActivationDateTime->setFont(font);
|
mLastActivationDateTime->setFont(font);
|
||||||
mLastActivationDateTime->setPlainText("Dernier passage : ");
|
mLastActivationDateTime->setPlainText("Dernier passage : ");
|
||||||
|
|
||||||
Reset();
|
Reset();
|
||||||
|
|
||||||
|
return RET_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int CZT1StatsZone::UpdateStats(CZT1ThreadData *DataPtr)
|
unsigned int CZT1StatsZone::UpdateStats(CZT1ThreadData *DataPtr)
|
||||||
@ -148,6 +173,8 @@ unsigned int CZT1StatsZone::UpdateStats(CZT1ThreadData *DataPtr)
|
|||||||
mTrainSpeedText->setPlainText(temp);
|
mTrainSpeedText->setPlainText(temp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(mModbusEnabled == false)
|
||||||
|
{
|
||||||
if(mTrainType != DataPtr->mTrainType)
|
if(mTrainType != DataPtr->mTrainType)
|
||||||
{
|
{
|
||||||
mTrainType = DataPtr->mTrainType;
|
mTrainType = DataPtr->mTrainType;
|
||||||
@ -156,6 +183,7 @@ unsigned int CZT1StatsZone::UpdateStats(CZT1ThreadData *DataPtr)
|
|||||||
temp += CZTData::GetTrainTypeString(mTrainType);
|
temp += CZTData::GetTrainTypeString(mTrainType);
|
||||||
mTrainTypeText->setPlainText(temp);
|
mTrainTypeText->setPlainText(temp);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if(mPIValue != DataPtr->mPGIntValue)
|
if(mPIValue != DataPtr->mPGIntValue)
|
||||||
{
|
{
|
||||||
mPIValue = DataPtr->mPGIntValue;
|
mPIValue = DataPtr->mPGIntValue;
|
||||||
@ -201,8 +229,43 @@ unsigned int CZT1StatsZone::Reset()
|
|||||||
mFNCountText->setPlainText("Compte FN: 0");
|
mFNCountText->setPlainText("Compte FN: 0");
|
||||||
mActualRankText->setPlainText("Rang: 0");
|
mActualRankText->setPlainText("Rang: 0");
|
||||||
mTrainTypeText->setPlainText("Train Détecté: Aucun");
|
mTrainTypeText->setPlainText("Train Détecté: Aucun");
|
||||||
|
if(mTrainCompositionText != 0)
|
||||||
|
{
|
||||||
|
mTrainCompositionText->setPlainText("Composition : Inconnue");
|
||||||
|
}
|
||||||
mPIValueText->setPlainText("Pneu Guidage Int.: ?");
|
mPIValueText->setPlainText("Pneu Guidage Int.: ?");
|
||||||
mPEValueText->setPlainText("Pneu Guidage Ext.: ?");
|
mPEValueText->setPlainText("Pneu Guidage Ext.: ?");
|
||||||
|
|
||||||
return RET_OK;
|
return RET_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
unsigned int CZT1StatsZone::SetTrainParameters(int TrainType, QList<qint16> TrainComposition)
|
||||||
|
{
|
||||||
|
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)));
|
||||||
|
}
|
||||||
|
|
||||||
|
if(TrainComposition.size() != 3)
|
||||||
|
{
|
||||||
|
//Invalid composition
|
||||||
|
mTrainCompositionText->setPlainText("Composition: Inconnue");
|
||||||
|
}
|
||||||
|
else if((TrainComposition[0] == 0) ||
|
||||||
|
(TrainComposition[1] == 0) ||
|
||||||
|
(TrainComposition[2] == 0))
|
||||||
|
{
|
||||||
|
//Composition invalide...
|
||||||
|
mTrainCompositionText->setPlainText("Composition: Inconnue");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mTrainCompositionText->setPlainText(QString("Composition : %1-%2-%3").arg(TrainComposition[0]).arg(TrainComposition[1]).arg(TrainComposition[2]));
|
||||||
|
}
|
||||||
|
|
||||||
|
return RET_OK;
|
||||||
|
}
|
||||||
|
|||||||
@ -31,6 +31,7 @@
|
|||||||
#include <QGraphicsWidget>
|
#include <QGraphicsWidget>
|
||||||
#include <QGraphicsTextItem>
|
#include <QGraphicsTextItem>
|
||||||
#include "ZTData.h"
|
#include "ZTData.h"
|
||||||
|
#include <QList>
|
||||||
|
|
||||||
class CZT1StatsZone : public QGraphicsWidget
|
class CZT1StatsZone : public QGraphicsWidget
|
||||||
{
|
{
|
||||||
@ -40,15 +41,18 @@ public:
|
|||||||
|
|
||||||
// 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 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 UpdateStats(CZT1ThreadData *DataPtr);
|
unsigned int UpdateStats(CZT1ThreadData *DataPtr);
|
||||||
|
unsigned int SetTrainParameters(int TrainType, QList<qint16> TrainComposition);
|
||||||
unsigned int Reset();
|
unsigned int Reset();
|
||||||
unsigned int SetLastActivationDateTime();
|
unsigned int SetLastActivationDateTime();
|
||||||
|
unsigned int Init(bool ModbusEnabled);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
unsigned int mBogieCount,mS1Count,mS2Count,mFNCount,mActualRank,mActualBogie,mTrainType;
|
unsigned int mBogieCount,mS1Count,mS2Count,mFNCount,mActualRank,mActualBogie,mTrainType;
|
||||||
float mTrainSpeed;
|
float mTrainSpeed;
|
||||||
int mPIValue, mPEValue;
|
int mPIValue, mPEValue;
|
||||||
|
bool mModbusEnabled;
|
||||||
|
|
||||||
QGraphicsTextItem *mTrainSpeedText, *mBogieCountText, *mS1CountText, *mS2CountText, *mFNCountText, *mActualRankText, *mActualBogieText, *mTrainTypeText, *mPIValueText, *mPEValueText, *mLastActivationDateTime;
|
QGraphicsTextItem *mTrainSpeedText, *mBogieCountText, *mS1CountText, *mS2CountText, *mFNCountText, *mActualRankText, *mActualBogieText, *mTrainTypeText, *mTrainCompositionText, *mPIValueText, *mPEValueText, *mLastActivationDateTime;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // ZT1STATSZONE_H
|
#endif // ZT1STATSZONE_H
|
||||||
|
|||||||
@ -341,6 +341,13 @@ unsigned int CZTPage::SetZT1Data(CZT1ThreadData *Data, bool ForceDisplay)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
unsigned int CZTPage::SetZT1TrainData(int TrainType, QList<qint16> TrainComposition)
|
||||||
|
{
|
||||||
|
//This is a low frequency stats update (only once for every train), so no timer filtering is necessary.
|
||||||
|
mZT1Stats->SetTrainParameters(TrainType,TrainComposition);
|
||||||
|
return RET_OK;
|
||||||
|
}
|
||||||
|
|
||||||
unsigned int CZTPage::SetZT2Data(CZT2ThreadData *Data)
|
unsigned int CZTPage::SetZT2Data(CZT2ThreadData *Data)
|
||||||
{
|
{
|
||||||
if(Data == 0)
|
if(Data == 0)
|
||||||
|
|||||||
@ -55,6 +55,8 @@ public:
|
|||||||
CZTPage(QGraphicsWidget *Parent = 0);
|
CZTPage(QGraphicsWidget *Parent = 0);
|
||||||
CPushButton *mToolsPushButton;
|
CPushButton *mToolsPushButton;
|
||||||
CPushButton *mZTLogPushButton;
|
CPushButton *mZTLogPushButton;
|
||||||
|
CZT1StatsZone *mZT1Stats;
|
||||||
|
CZT2StatsZone *mZT2Stats;
|
||||||
|
|
||||||
|
|
||||||
CZoneTest *mProgramHandle;
|
CZoneTest *mProgramHandle;
|
||||||
@ -67,6 +69,7 @@ public:
|
|||||||
unsigned int UpdateCDVDisplay(int CDVIndex = -1);
|
unsigned int UpdateCDVDisplay(int CDVIndex = -1);
|
||||||
unsigned int SetZTStatus(unsigned int NbPass, unsigned int NbTriggers, unsigned int ZT1Active, unsigned int ZT2Active);
|
unsigned int SetZTStatus(unsigned int NbPass, unsigned int NbTriggers, unsigned int ZT1Active, unsigned int ZT2Active);
|
||||||
unsigned int SetZT1Data(CZT1ThreadData *Data, bool ForceDisplay = false);
|
unsigned int SetZT1Data(CZT1ThreadData *Data, bool ForceDisplay = false);
|
||||||
|
unsigned int SetZT1TrainData(int TrainType, QList<qint16> TrainComposition);
|
||||||
unsigned int SetZT2Data(CZT2ThreadData *Data);
|
unsigned int SetZT2Data(CZT2ThreadData *Data);
|
||||||
unsigned int SetZT1ActivationState(bool ZT1Activated);
|
unsigned int SetZT1ActivationState(bool ZT1Activated);
|
||||||
unsigned int SetZT2ActivationSTate(bool ZT2Activated);
|
unsigned int SetZT2ActivationSTate(bool ZT2Activated);
|
||||||
@ -86,8 +89,7 @@ private:
|
|||||||
CStatusBar *mStatusBar;
|
CStatusBar *mStatusBar;
|
||||||
CZT1EquipmentWidget *mZT1EquipmentWidget;
|
CZT1EquipmentWidget *mZT1EquipmentWidget;
|
||||||
CZT2EquipmentWidget *mZT2EquipmentWidget;
|
CZT2EquipmentWidget *mZT2EquipmentWidget;
|
||||||
CZT1StatsZone *mZT1Stats;
|
|
||||||
CZT2StatsZone *mZT2Stats;
|
|
||||||
CEventsBar *mEventsBar;
|
CEventsBar *mEventsBar;
|
||||||
QElapsedTimer mZT1DisplayTimer;
|
QElapsedTimer mZT1DisplayTimer;
|
||||||
bool mIsZT2Present;
|
bool mIsZT2Present;
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
#include "EngLog.h"
|
#include "EngLog.h"
|
||||||
#include "ModbusCCDefs.h"
|
#include "ModbusCCDefs.h"
|
||||||
#include <QDateTime>
|
#include <QDateTime>
|
||||||
|
#include "ZTData.h"
|
||||||
|
|
||||||
CModbusCCMgr::CModbusCCMgr(CModbusRepository *Repo, int ModbusPort, int DevID) :
|
CModbusCCMgr::CModbusCCMgr(CModbusRepository *Repo, int ModbusPort, int DevID) :
|
||||||
CModbusBackend(Repo)
|
CModbusBackend(Repo)
|
||||||
@ -132,8 +132,6 @@ void CModbusCCMgr::RegistersDatabaseUpdated(quint16 StartAddress, quint16 Length
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
emit RepoHasChanged();
|
emit RepoHasChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -229,11 +227,27 @@ qint16 CModbusCCMgr::GetZT1TrainType()
|
|||||||
{
|
{
|
||||||
bool OK = false;
|
bool OK = false;
|
||||||
qint16 Reg = mModbusRepo->GetSingleReg(MODBUS_CC_ZT1_TRAIN_TYPE_REG_ADD,&OK);
|
qint16 Reg = mModbusRepo->GetSingleReg(MODBUS_CC_ZT1_TRAIN_TYPE_REG_ADD,&OK);
|
||||||
|
int Type = TRAIN_TYPE_UNKNOWN;
|
||||||
if(OK)
|
if(OK)
|
||||||
{
|
{
|
||||||
return Reg;
|
if(Reg == 63)
|
||||||
|
{
|
||||||
|
Type = TRAIN_TYPE_MR63;
|
||||||
}
|
}
|
||||||
return 0;
|
else if(Reg == 73)
|
||||||
|
{
|
||||||
|
Type = TRAIN_TYPE_MR73;
|
||||||
|
}
|
||||||
|
else if(Reg == 10)
|
||||||
|
{
|
||||||
|
Type = TRAIN_TYPE_MPM10;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Type = TRAIN_TYPE_UNKNOWN;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return Type;
|
||||||
}
|
}
|
||||||
|
|
||||||
qint16 CModbusCCMgr::GetZT2TrainType()
|
qint16 CModbusCCMgr::GetZT2TrainType()
|
||||||
|
|||||||
@ -54,16 +54,24 @@ CDuCollegeStation::CDuCollegeStation()
|
|||||||
mStationInputMasks.InputZT1PIMask = DUCOLLEGE_ZT1_PI_MASK;
|
mStationInputMasks.InputZT1PIMask = DUCOLLEGE_ZT1_PI_MASK;
|
||||||
mStationInputMasks.InputZT1PEMask = DUCOLLEGE_ZT1_PE_MASK;
|
mStationInputMasks.InputZT1PEMask = DUCOLLEGE_ZT1_PE_MASK;
|
||||||
mStationInputMasks.InputZT1FNMask = DUCOLLEGE_ZT1_FN_MASK;
|
mStationInputMasks.InputZT1FNMask = DUCOLLEGE_ZT1_FN_MASK;
|
||||||
|
mStationInputMasks.InputZT2S1Mask = DUCOLLEGE_ZT2_S1_MASK;
|
||||||
|
mStationInputMasks.InputZT2PIMask = DUCOLLEGE_ZT2_PI_MASK;
|
||||||
|
mStationInputMasks.InputZT2PEMask = DUCOLLEGE_ZT2_PE_MASK;
|
||||||
|
|
||||||
//External (ethernet) input module masks
|
//External (ethernet) input module masks
|
||||||
mStationInputMasks.InputZT1ITIMask = DUCOLLEGE_IN_ZT1_ITI_MASK;
|
mStationInputMasks.InputZT1ITIMask = DUCOLLEGE_IN_ZT1_ITI_MASK;
|
||||||
mStationInputMasks.InputZT1ANMask = DUCOLLEGE_IN_ZT1_AN_MASK;
|
mStationInputMasks.InputZT1ANMask = DUCOLLEGE_IN_ZT1_AN_MASK;
|
||||||
mStationInputMasks.InputZT1ARFMask = DUCOLLEGE_IN_ZT1_ARF_MASK;
|
mStationInputMasks.InputZT1ARFMask = DUCOLLEGE_IN_ZT1_ARF_MASK;
|
||||||
|
mStationInputMasks.InputZT2ITIMask = DUCOLLEGE_IN_ZT2_ITI_MASK;
|
||||||
|
mStationInputMasks.InputZT2ANMask = DUCOLLEGE_IN_ZT2_AN_MASK;
|
||||||
|
mStationInputMasks.InputZT2ARFMask = DUCOLLEGE_IN_ZT2_ARF_MASK;
|
||||||
mStationInputMasks.InputStationIDMask = DUCOLLEGE_IN_STATION_ID_MASK;
|
mStationInputMasks.InputStationIDMask = DUCOLLEGE_IN_STATION_ID_MASK;
|
||||||
|
|
||||||
//Logic input masks
|
//Logic input masks
|
||||||
mStationInputMasks.InputCDVZT1ApproachMask = DUCOLLEGE_IN_CDV_12B_MASK;
|
mStationInputMasks.InputCDVZT1ApproachMask = DUCOLLEGE_IN_CDV_12B_MASK;
|
||||||
mStationInputMasks.InputCDVZT1Mask = DUCOLLEGE_IN_CDV_13A_MASK;
|
mStationInputMasks.InputCDVZT1Mask = DUCOLLEGE_IN_CDV_13A_MASK;
|
||||||
|
mStationInputMasks.InputCDVZT2ApproachMask = 0;
|
||||||
|
mStationInputMasks.InputCDVZT2Mask = 0;
|
||||||
|
|
||||||
//Output masks
|
//Output masks
|
||||||
mStationOutputMasks.OutputVP1Mask = DUCOLLEGE_OUT_VP1_MASK;
|
mStationOutputMasks.OutputVP1Mask = DUCOLLEGE_OUT_VP1_MASK;
|
||||||
|
|||||||
@ -58,11 +58,11 @@
|
|||||||
#define DUCOLLEGE_IN_CDV_14B_MASK 0x00000080
|
#define DUCOLLEGE_IN_CDV_14B_MASK 0x00000080
|
||||||
#define DUCOLLEGE_IN_CDV_14C_MASK 0x00000100
|
#define DUCOLLEGE_IN_CDV_14C_MASK 0x00000100
|
||||||
#define DUCOLLEGE_IN_ZT1_ITI_MASK 0x00000200
|
#define DUCOLLEGE_IN_ZT1_ITI_MASK 0x00000200
|
||||||
//#define DUCOLLEGE_IN_ZT2_ITI_MASK 0x00000400
|
#define DUCOLLEGE_IN_ZT2_ITI_MASK 0x00000400
|
||||||
#define DUCOLLEGE_IN_ZT1_AN_MASK 0x00000800
|
#define DUCOLLEGE_IN_ZT1_AN_MASK 0x00000800
|
||||||
//#define DUCOLLEGE_IN_ZT2_AN_MASK 0x00001000
|
#define DUCOLLEGE_IN_ZT2_AN_MASK 0x00001000
|
||||||
#define DUCOLLEGE_IN_ZT1_ARF_MASK 0x00002000
|
#define DUCOLLEGE_IN_ZT1_ARF_MASK 0x00002000
|
||||||
//#define DUCOLLEGE_IN_ZT2_ARF_MASK 0x00004000
|
#define DUCOLLEGE_IN_ZT2_ARF_MASK 0x00004000
|
||||||
#define DUCOLLEGE_IN_STATION_ID_MASK 0x00078000
|
#define DUCOLLEGE_IN_STATION_ID_MASK 0x00078000
|
||||||
|
|
||||||
//External (ethernet) output module masks for DUCOLLEGE
|
//External (ethernet) output module masks for DUCOLLEGE
|
||||||
|
|||||||
@ -36,7 +36,7 @@
|
|||||||
#include "math.h"
|
#include "math.h"
|
||||||
#include "MaintenancePage.h"
|
#include "MaintenancePage.h"
|
||||||
#include "RamMonitor.h"
|
#include "RamMonitor.h"
|
||||||
#include "ModbusCCDefs.h"
|
//#include "ModbusCCDefs.h"
|
||||||
|
|
||||||
CZTStateMachine::CZTStateMachine(QObject *parent) :
|
CZTStateMachine::CZTStateMachine(QObject *parent) :
|
||||||
QObject(parent)
|
QObject(parent)
|
||||||
@ -56,7 +56,7 @@ CZTStateMachine::CZTStateMachine(QObject *parent) :
|
|||||||
mZtSimPtr = 0;
|
mZtSimPtr = 0;
|
||||||
mLogMgr = 0;
|
mLogMgr = 0;
|
||||||
mCalibrationPassagesCount = 0;
|
mCalibrationPassagesCount = 0;
|
||||||
mCCModbusRepo = 0;
|
mModbusCCMgr = 0;
|
||||||
//mExtIOInterface = 0;
|
//mExtIOInterface = 0;
|
||||||
|
|
||||||
mNbPassages = 0;
|
mNbPassages = 0;
|
||||||
@ -167,22 +167,12 @@ unsigned int CZTStateMachine::ZTStateMachine(unsigned int Event, unsigned int Su
|
|||||||
mCIZT2Active = ((mCurInputs & mZTInputMasks->InputZT2ITIMask) != 0);
|
mCIZT2Active = ((mCurInputs & mZTInputMasks->InputZT2ITIMask) != 0);
|
||||||
bool AN1State, AN2State;
|
bool AN1State, AN2State;
|
||||||
|
|
||||||
//If the mCCModbusRepo is not 0, then it has to be used (Modbus connection is used as CC interface)
|
//If the ModbusCCPtr pointer is not 0, then we are using Modbus and AN states will come from there.
|
||||||
if(mCCModbusRepo == 0)
|
if(mModbusCCMgr == 0)
|
||||||
{
|
{
|
||||||
AN1State = (mCurInputs & mZTInputMasks->InputZT1ANMask) != 0;
|
AN1State = (mCurInputs & mZTInputMasks->InputZT1ANMask) != 0;
|
||||||
AN2State = (mCurInputs &mZTInputMasks->InputZT2ANMask) != 0;
|
AN2State = (mCurInputs &mZTInputMasks->InputZT2ANMask) != 0;
|
||||||
}
|
}
|
||||||
// else
|
|
||||||
// {
|
|
||||||
// AN1State = (mCCModbusRepo->GetSingleReg(MODBUS_CC_AN_BASE_REG_ADD) & MODBUS_CC_AN1_FLAG_MASK) != 0;
|
|
||||||
// AN2State = (mCCModbusRepo->GetSingleReg(MODBUS_CC_AN_BASE_REG_ADD) & MODBUS_CC_AN2_FLAG_MASK) != 0;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// mTKGenerator->SetInputStates((mCurInputs & mZTInputMasks->InputZT1ANMask) != 0,
|
|
||||||
// mZTStationPtr->IsZT1AlarmAutoAcquireCDVOccupied(),
|
|
||||||
// (mCurInputs &mZTInputMasks->InputZT2ANMask) != 0,
|
|
||||||
// mZTStationPtr->IsZT2AlarmAutoAcquireCDVOccupied());
|
|
||||||
mTKGenerator->SetInputStates(AN1State,mZTStationPtr->IsZT1AlarmAutoAcquireCDVOccupied(),
|
mTKGenerator->SetInputStates(AN1State,mZTStationPtr->IsZT1AlarmAutoAcquireCDVOccupied(),
|
||||||
AN2State,mZTStationPtr->IsZT2AlarmAutoAcquireCDVOccupied());
|
AN2State,mZTStationPtr->IsZT2AlarmAutoAcquireCDVOccupied());
|
||||||
}
|
}
|
||||||
@ -356,6 +346,14 @@ unsigned int CZTStateMachine::ZT1StateMachine(unsigned int Event, unsigned int S
|
|||||||
mZTPagePTr->SetZT1ActivationState(true);
|
mZTPagePTr->SetZT1ActivationState(true);
|
||||||
|
|
||||||
mZTPagePTr->ResetZT1Stats();
|
mZTPagePTr->ResetZT1Stats();
|
||||||
|
if(mModbusCCMgr != 0)
|
||||||
|
{
|
||||||
|
//update train info received from the CC Modbus interface
|
||||||
|
mTrainTypeDetected = (unsigned)mModbusCCMgr->GetZT1TrainType();
|
||||||
|
mZT1TrainComposition = mModbusCCMgr->GetZT1TrainComposition();
|
||||||
|
mZTPagePTr->SetZT1TrainData(mTrainTypeDetected,mZT1TrainComposition);
|
||||||
|
}
|
||||||
|
|
||||||
InsertZT1LogItem();
|
InsertZT1LogItem();
|
||||||
|
|
||||||
mZT1WorkerThread->UpdateDetectionConfig(mZTDetectionConfig);
|
mZT1WorkerThread->UpdateDetectionConfig(mZTDetectionConfig);
|
||||||
@ -1332,9 +1330,9 @@ void CZTStateMachine::BindPointers(CStation *ptr,CInputModule *InputModule,COutp
|
|||||||
mTKGenerator = TKTransport;
|
mTKGenerator = TKTransport;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CZTStateMachine::BindCCRepoPtr(CModbusRepository *RepoPtr)
|
void CZTStateMachine::BindModbusCCMgrPtr(CModbusCCMgr *ModbusCCPtr)
|
||||||
{
|
{
|
||||||
mCCModbusRepo = RepoPtr;
|
mModbusCCMgr = ModbusCCPtr;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int CZTStateMachine::SetPGTreshold(qint32 PGTreshold)
|
unsigned int CZTStateMachine::SetPGTreshold(qint32 PGTreshold)
|
||||||
|
|||||||
@ -43,8 +43,9 @@
|
|||||||
#include "LogMgr.h"
|
#include "LogMgr.h"
|
||||||
#include "InputModule.h"
|
#include "InputModule.h"
|
||||||
#include "MixedModule.h"
|
#include "MixedModule.h"
|
||||||
#include "ModbusRepository.h"
|
//#include "ModbusRepository.h"
|
||||||
#include "TKTransportInterface.h"
|
#include "TKTransportInterface.h"
|
||||||
|
#include "ModbusCCMgr.h"
|
||||||
|
|
||||||
|
|
||||||
#define ZT_SM_DEFAULT_LOG_DELAY 10 //millilseconds
|
#define ZT_SM_DEFAULT_LOG_DELAY 10 //millilseconds
|
||||||
@ -105,7 +106,7 @@ public:
|
|||||||
~CZTStateMachine();
|
~CZTStateMachine();
|
||||||
unsigned int ZTStateMachine(unsigned int Event, unsigned int SubEvent = 0); //Exécution de la SM principale
|
unsigned int ZTStateMachine(unsigned int Event, unsigned int SubEvent = 0); //Exécution de la SM principale
|
||||||
void BindPointers(CStation *ptr,CInputModule *InputModule,COutputModule *OutputModule,CZTPage *ZTPagePTr,CPCIIOMgr *PCIIOPtr,CAbstractLazerProbe *PGIntProbePtr, CAbstractLazerProbe *PGExtProbePTr,CLogMgr *LogMgr,CTKTransportInterface *TKTransport,CZTSimulator *ZTSimPtr = 0,CAnalogInputModule *DataQInterface = 0); //Assignation de pointeurs
|
void BindPointers(CStation *ptr,CInputModule *InputModule,COutputModule *OutputModule,CZTPage *ZTPagePTr,CPCIIOMgr *PCIIOPtr,CAbstractLazerProbe *PGIntProbePtr, CAbstractLazerProbe *PGExtProbePTr,CLogMgr *LogMgr,CTKTransportInterface *TKTransport,CZTSimulator *ZTSimPtr = 0,CAnalogInputModule *DataQInterface = 0); //Assignation de pointeurs
|
||||||
void BindCCRepoPtr(CModbusRepository *RepoPtr);
|
void BindModbusCCMgrPtr(CModbusCCMgr *ModbusCCPtr);
|
||||||
|
|
||||||
CZTDetectionFunctionConfig *mZTDetectionConfig;
|
CZTDetectionFunctionConfig *mZTDetectionConfig;
|
||||||
CTKGenerator *mTKGenerator; //pointeur vers la classe qui gère les alarmes au PCC
|
CTKGenerator *mTKGenerator; //pointeur vers la classe qui gère les alarmes au PCC
|
||||||
@ -173,7 +174,8 @@ private:
|
|||||||
CStation *mZTStationPtr;
|
CStation *mZTStationPtr;
|
||||||
CAnalogInputModule *mSDFAnalogMonitorInterface;
|
CAnalogInputModule *mSDFAnalogMonitorInterface;
|
||||||
CInputModule *mInputModule;
|
CInputModule *mInputModule;
|
||||||
CModbusRepository *mCCModbusRepo;
|
// CModbusRepository *mCCModbusRepo;
|
||||||
|
CModbusCCMgr *mModbusCCMgr;
|
||||||
|
|
||||||
|
|
||||||
CPCIIOMgr *mPCIIOPtr;
|
CPCIIOMgr *mPCIIOPtr;
|
||||||
|
|||||||
@ -504,18 +504,20 @@ unsigned int CZoneTest::InitZT()
|
|||||||
mTKTransportInterface = (CTKTransportInterface*)TransportInterface;
|
mTKTransportInterface = (CTKTransportInterface*)TransportInterface;
|
||||||
connect(mModbusCCMgr,SIGNAL(RepoHasChanged()),TransportInterface,SLOT(ModbusCCUpdated()));
|
connect(mModbusCCMgr,SIGNAL(RepoHasChanged()),TransportInterface,SLOT(ModbusCCUpdated()));
|
||||||
|
|
||||||
mZTStateMachine->BindCCRepoPtr(mCCModbusRepository);
|
mZTStateMachine->BindModbusCCMgrPtr(mModbusCCMgr);
|
||||||
// connect(mModbusCCMgr,SIGNAL(RepoHasChanged()),mZTStateMachine,SLOT(ModbusCCANUpdate()));
|
// connect(mModbusCCMgr,SIGNAL(RepoHasChanged()),mZTStateMachine,SLOT(ModbusCCANUpdate()));
|
||||||
connect(mModbusCCMgr,SIGNAL(ModbusCCConnected()),panel.mZTMainPage,SLOT(ModbusCCConnected()));
|
connect(mModbusCCMgr,SIGNAL(ModbusCCConnected()),panel.mZTMainPage,SLOT(ModbusCCConnected()));
|
||||||
connect(mModbusCCMgr,SIGNAL(ModbusCCDisconnected()),panel.mZTMainPage,SLOT(ModbusCCDisconnected()));
|
connect(mModbusCCMgr,SIGNAL(ModbusCCDisconnected()),panel.mZTMainPage,SLOT(ModbusCCDisconnected()));
|
||||||
connect(mModbusCCMgr,SIGNAL(ModbusDateTimeReceived(QDateTime*)),this,SLOT(ModbusDateTimeUpdate(QDateTime*)));
|
connect(mModbusCCMgr,SIGNAL(ModbusDateTimeReceived(QDateTime*)),this,SLOT(ModbusDateTimeUpdate(QDateTime*)));
|
||||||
panel.mZTMainPage->ModbusCCDisconnected();
|
panel.mZTMainPage->ModbusCCDisconnected();
|
||||||
|
panel.mZTMainPage->mZT1Stats->Init(true);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
CDiscreteTKTransport *TransportInterface = new CDiscreteTKTransport;
|
CDiscreteTKTransport *TransportInterface = new CDiscreteTKTransport;
|
||||||
mTKTransportInterface = (CTKTransportInterface*)TransportInterface;
|
mTKTransportInterface = (CTKTransportInterface*)TransportInterface;
|
||||||
TransportInterface->BindPointers(mZTStation->GetOutputMasks(),mExtIOWorkerThread);
|
TransportInterface->BindPointers(mZTStation->GetOutputMasks(),mExtIOWorkerThread);
|
||||||
|
panel.mZTMainPage->mZT1Stats->Init(false);
|
||||||
}
|
}
|
||||||
connect(mTKTransportInterface,SIGNAL(TKOutputStatesChanged(bool,bool)),panel.mMaintenancePage,SLOT(TKOutputChanged(bool,bool)));
|
connect(mTKTransportInterface,SIGNAL(TKOutputStatesChanged(bool,bool)),panel.mMaintenancePage,SLOT(TKOutputChanged(bool,bool)));
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user