ZT2 Inhibit
Implementation de l'inhibition Modbus de la ZT2
This commit is contained in:
parent
0efe9b3e8d
commit
36a735db06
@ -152,7 +152,7 @@ unsigned int CZT2StatsZone::Reset()
|
|||||||
|
|
||||||
unsigned int CZT2StatsZone::SetTrainParameters(int TrainType, QList<qint16> TrainComposition)
|
unsigned int CZT2StatsZone::SetTrainParameters(int TrainType, QList<qint16> TrainComposition)
|
||||||
{
|
{
|
||||||
if(mTrainType != (unsigned)TrainType)
|
// if(mTrainType != (unsigned)TrainType)
|
||||||
{
|
{
|
||||||
mTrainType = TrainType;
|
mTrainType = TrainType;
|
||||||
mTrainTypeText->setPlainText(QString("Type de train : %1").arg(CZTData::GetTrainTypeString(mTrainType)));
|
mTrainTypeText->setPlainText(QString("Type de train : %1").arg(CZTData::GetTrainTypeString(mTrainType)));
|
||||||
|
|||||||
@ -197,8 +197,8 @@ int CModbusBackend::AnalyzeModbusRequest(CModbusTransaction Transaction)
|
|||||||
//Write register data
|
//Write register data
|
||||||
mModbusRepo->WriteHRData(StartAdress,NbRegisters,data);
|
mModbusRepo->WriteHRData(StartAdress,NbRegisters,data);
|
||||||
|
|
||||||
// qDebug("Slave Rx Write Multiple Registers. Address: %d, Nb Reg: %d",StartAdress, NbRegisters);
|
qDebug("Slave Rx Write Multiple Registers. Address: %d, Nb Reg: %d",StartAdress, NbRegisters);
|
||||||
// qDebug("Data: %s",data.toHex().data());
|
qDebug("Data: %s",data.toHex().data());
|
||||||
|
|
||||||
data = Transaction.mPDU.mData.left(4); //The response corresponds to the Start Adress and Nb of Regs. Which is the first 4 bytes of the initial request.
|
data = Transaction.mPDU.mData.left(4); //The response corresponds to the Start Adress and Nb of Regs. Which is the first 4 bytes of the initial request.
|
||||||
SendModbusResponse(Transaction, data);
|
SendModbusResponse(Transaction, data);
|
||||||
|
|||||||
@ -29,6 +29,8 @@ CModbusCCMgr::CModbusCCMgr(CModbusRepository *Repo, int ModbusPort, int DevID) :
|
|||||||
mCCWatchdogState = 0;
|
mCCWatchdogState = 0;
|
||||||
mCCLinkState = false;
|
mCCLinkState = false;
|
||||||
mLastDateTime = 0;
|
mLastDateTime = 0;
|
||||||
|
|
||||||
|
ResetCCRepository();
|
||||||
}
|
}
|
||||||
|
|
||||||
CModbusCCMgr::~CModbusCCMgr()
|
CModbusCCMgr::~CModbusCCMgr()
|
||||||
|
|||||||
@ -346,7 +346,7 @@ unsigned int CZTStateMachine::ZT1StateMachine(unsigned int Event, unsigned int S
|
|||||||
if(mModbusCCMgr->GetZT1InhibitionFlag() == true) //Check if the CC wants us to analyze the passage
|
if(mModbusCCMgr->GetZT1InhibitionFlag() == true) //Check if the CC wants us to analyze the passage
|
||||||
{
|
{
|
||||||
abort = true;
|
abort = true;
|
||||||
CZTLog::instance()->AddLogString("Passage de train inhibé par le SACL",true);
|
CZTLog::instance()->AddLogString("Passage de train ZT1 inhibé par le SACL",true);
|
||||||
mZT1State = ZT1_WAIT_FOR_SUBSEQUENT_LIBERATION; //Wait for the train to leave the ZT
|
mZT1State = ZT1_WAIT_FOR_SUBSEQUENT_LIBERATION; //Wait for the train to leave the ZT
|
||||||
if(mModbusCCMgr != 0)
|
if(mModbusCCMgr != 0)
|
||||||
{
|
{
|
||||||
@ -1106,7 +1106,27 @@ unsigned int CZTStateMachine::ZT2StateMachine(unsigned int Event, unsigned int S
|
|||||||
{
|
{
|
||||||
mZT2State = ZT2_WAIT_FOR_CI_STATE;
|
mZT2State = ZT2_WAIT_FOR_CI_STATE;
|
||||||
}
|
}
|
||||||
else if(mZTStationPtr->IsZT2ApproachCDVOccupied())
|
else if(mZTStationPtr->IsZT2ApproachCDVOccupied()) //À certaines stations, la ZT2 doit être activée à l'occupation du CDV d'approche.
|
||||||
|
{
|
||||||
|
bool abort = false;
|
||||||
|
|
||||||
|
if(mModbusCCMgr != 0)
|
||||||
|
{
|
||||||
|
if(mModbusCCMgr->GetZT2InhibitionFlag() == true) //Check if the CC wants us to analyze the passage
|
||||||
|
{
|
||||||
|
abort = true;
|
||||||
|
CZTLog::instance()->AddLogString("Passage de train ZT2 inhibé par le SACL",true);
|
||||||
|
mZT2State = ZT2_WAIT_FOR_CDV_LIBERATION_STATE; //Wait for the train to leave the ZT
|
||||||
|
|
||||||
|
//update train info received from the CC Modbus interface
|
||||||
|
mZT2TrainType = (unsigned)mModbusCCMgr->GetZT2TrainType();
|
||||||
|
mZT2TrainComposition = mModbusCCMgr->GetZT2TrainComposition();
|
||||||
|
mZTPagePTr->SetZT2TrainData(mZT2TrainType,mZT2TrainComposition);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if(abort == false)
|
||||||
{
|
{
|
||||||
DestroyZT2Log();
|
DestroyZT2Log();
|
||||||
mEventsRefTimer.start();
|
mEventsRefTimer.start();
|
||||||
@ -1131,6 +1151,7 @@ unsigned int CZTStateMachine::ZT2StateMachine(unsigned int Event, unsigned int S
|
|||||||
|
|
||||||
CZTLog::instance()->ClearBufferString();
|
CZTLog::instance()->ClearBufferString();
|
||||||
CZTLog::instance()->AddBufferString("ZT2 activée",true);
|
CZTLog::instance()->AddBufferString("ZT2 activée",true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user