EgtMachKernel 2.6k3 :

- modifiche per simulazione multi-processo.
This commit is contained in:
Dario Sassi
2024-11-11 00:44:31 +01:00
parent 77a61447c6
commit 33701162bf
4 changed files with 71 additions and 62 deletions
+18 -11
View File
@@ -229,8 +229,8 @@ SimulatorMP::Start( bool bFirst)
bOk = false ;
// Verifico la disposizione iniziale della macchinata
m_nOpInd = 0 ;
m_nOpId = m_pMchMgr->GetFirstActiveOperation() ;
m_nOpInd = 1 ;
if ( m_pMchMgr->GetOperationType( m_nOpId) != OPER_DISP)
bOk = false ;
@@ -245,6 +245,7 @@ SimulatorMP::Start( bool bFirst)
// Se appena entrati in simulazione
if ( m_nStatus == SIS_INITIALIZED) {
m_vOperId.clear() ;
if ( ! OnInit())
bOk = false ;
m_nStatus = SIS_READYTOSTART ;
@@ -775,11 +776,15 @@ SimulatorMP::FindAndManageOperationStart( bool bStart, bool bFirst, int& nChange
// recupero la nuova operazione
if ( nChangeTool == 0) {
if ( bStart) {
m_nOpId = m_pMchMgr->GetFirstActiveOperation() ;
//m_nOpId = m_pMchMgr->GetFirstActiveOperation() ;
m_nOpInd = 0 ;
m_nOpId = ( m_nOpInd < int( m_vOperId.size()) ? m_vOperId[m_nOpInd] : GDB_ID_NULL) ;
}
else {
// m_nOpId = m_pMchMgr->GetNextActiveOperation( m_nOpId) ;
++ m_nOpInd ;
m_nOpId = ( m_nOpInd < int( m_vOperId.size()) ? m_vOperId[m_nOpInd] : GDB_ID_NULL) ;
}
else
m_nOpId = m_pMchMgr->GetNextActiveOperation( m_nOpId) ;
}
// ciclo sulle successive operazioni
while ( m_nOpId != GDB_ID_NULL) {
@@ -796,7 +801,6 @@ SimulatorMP::FindAndManageOperationStart( bool bStart, bool bFirst, int& nChange
}
if ( nChangeTool != 0)
return true ;
++ m_nOpInd ;
// imposto la lavorazione come corrente
m_pMchMgr->SetCurrMachining( m_nOpId) ;
// recupero punti di minimo e massimo ingombro
@@ -833,7 +837,7 @@ SimulatorMP::FindAndManageOperationStart( bool bStart, bool bFirst, int& nChange
// se con movimenti autonomi
if ( ! bEmpty) {
// richiamo gestione evento appena prima di inizio disposizione
if ( ! OnDispositionStarting( m_nOpId, m_nOpInd, nPhase, sTable, ptOri1, false, bSomeByHand)) {
if ( ! OnDispositionStarting( m_nOpId, m_nOpInd - 1, nPhase, sTable, ptOri1, false, bSomeByHand)) {
nStatus = CalcStatusOnError( ERR_NONE) ;
return false ;
}
@@ -847,7 +851,6 @@ SimulatorMP::FindAndManageOperationStart( bool bStart, bool bFirst, int& nChange
return false ;
}
}
++ m_nOpInd ;
// richiamo gestione evento inizio disposizione
if ( ! OnDispositionStart( m_nOpId, m_nOpInd, nPhase, sTable, ptOri1, false, bSomeByHand)) {
nStatus = CalcStatusOnError( ERR_NONE) ;
@@ -861,13 +864,12 @@ SimulatorMP::FindAndManageOperationStart( bool bStart, bool bFirst, int& nChange
// altrimenti disposizione passiva
else {
// richiamo gestione evento appena prima di inizio disposizione
if ( ! OnDispositionStarting( m_nOpId, m_nOpInd, nPhase, sTable, ptOri1, true, bSomeByHand)) {
if ( ! OnDispositionStarting( m_nOpId, m_nOpInd - 1, nPhase, sTable, ptOri1, true, bSomeByHand)) {
nStatus = CalcStatusOnError( ERR_NONE) ;
return false ;
}
// cambio fase
m_pMchMgr->SetCurrPhase( nPhase, ( nPhase == 1)) ;
++ m_nOpInd ;
// richiamo gestione evento inizio e fine disposizione
if ( ! OnDispositionStart( m_nOpId, m_nOpInd, nPhase, sTable, ptOri1, true, bSomeByHand) ||
! OnDispositionEnd()) {
@@ -882,7 +884,9 @@ SimulatorMP::FindAndManageOperationStart( bool bStart, bool bFirst, int& nChange
}
}
// passo alla operazione successiva
m_nOpId = m_pMchMgr->GetNextActiveOperation( m_nOpId) ;
++ m_nOpInd ;
m_nOpId = ( m_nOpInd < int( m_vOperId.size()) ? m_vOperId[m_nOpInd] : GDB_ID_NULL) ;
//m_nOpId = m_pMchMgr->GetNextActiveOperation( m_nOpId) ;
}
return true ;
}
@@ -1708,7 +1712,10 @@ bool
SimulatorMP::OnInit( void)
{
// chiamo la funzione di ingresso nella simulazione
return CallFunction( ON_SIMUL_INIT) ;
bool bOk = CallFunction( ON_SIMUL_INIT) ;
// recupero i dati di ritorno
bOk = m_pMachine->LuaGetGlobVar( GLOB_VAR + GVAR_OPERID, m_vOperId) && bOk ;
return bOk ;
}
//----------------------------------------------------------------------------