EgtMachKernel :

- aggiunta gestione livello di debug in LOG*.
This commit is contained in:
Dario Sassi
2019-04-01 06:16:03 +00:00
parent 9cd9068b7b
commit e4613162c5
24 changed files with 120 additions and 96 deletions
+26 -4
View File
@@ -25,6 +25,7 @@
#include "/EgtDev/Include/EGkStringUtils3d.h"
#include "/EgtDev/Include/EMkToolConst.h"
#include "/EgtDev/Include/EMkOperationConst.h"
#include "/EgtDev/Include/EgtPerfCounter.h"
#include "/EgtDev/Include/EgtNumUtils.h"
using namespace std ;
@@ -44,6 +45,7 @@ Simulator::Simulator( void)
m_pMchMgr = nullptr ;
m_pGeomDB = nullptr ;
m_pMachine = nullptr ;
m_pPerfCnt = nullptr ;
m_dStep = MID_STEP ;
m_nUiStatus = MCH_UISIM_NULL ;
m_nOpId = GDB_ID_NULL ;
@@ -73,6 +75,11 @@ Simulator::~Simulator( void)
GoHome() ;
// rimuovo tavola variabili globali
m_pMachine->LuaResetGlobVar( GLOB_VAR) ;
// rimuovo performance counter
if ( m_pPerfCnt != nullptr) {
delete m_pPerfCnt ;
m_pPerfCnt = nullptr ;
}
}
//----------------------------------------------------------------------------
@@ -86,6 +93,7 @@ Simulator::Init( MachMgr* pMchMgr)
m_pMchMgr = pMchMgr ;
m_pGeomDB = m_pMchMgr->GetGeomDB() ;
m_pMachine = m_pMchMgr->GetCurrMachine() ;
m_pPerfCnt = new PerformanceCounter ;
return true ;
}
@@ -136,6 +144,10 @@ Simulator::Start( bool bFirst)
if ( ! FindAndManageOperationStart( true, bFirst, nStatus))
bOk = false ;
// Reset timer
if ( m_pPerfCnt != nullptr)
m_pPerfCnt->Start() ;
return bOk ;
}
@@ -192,6 +204,14 @@ Simulator::Move( int& nStatus)
return false ;
}
// Recupero tempo impiegato (calcolo + visualizzazione precedenti)
if ( m_pPerfCnt != nullptr && ExeGetDebugLevel() >= 5) {
double dElapsed = m_pPerfCnt->Stop() ;
string sOut = "Elapsed=" + ToString( dElapsed, 0) ;
LOG_DBG_INFO( GetEMkLogger(), sOut.c_str())
m_pPerfCnt->Start() ;
}
// Se arrivato alla fine dell'interpolazione
if ( m_dCoeff > COEFF_LIM) {
// recupero una nuova entità
@@ -888,7 +908,7 @@ Simulator::ManageSingleMove( int& nStatus, double& dMove)
double dPrevCoeff = m_dCoeff ;
double dDist = sqrt( dSqDist) ;
if ( dDist > EPS_SMALL) {
int nStep = int( max( dDist / ( ( nMoveType == 0 ? 4 : 1) * m_dStep), 1.)) ;
int nStep = int( max( dDist / ( ( nMoveType == 0 ? 2 : 1) * m_dStep), 1.)) ;
m_dCoeff += 1. / nStep ;
if ( m_dCoeff > 1)
m_dCoeff = 1 ;
@@ -1055,9 +1075,11 @@ Simulator::ExecLineVmill( int nVmId, const Point3d& ptHi, const Vector3d& vtHi,
ptHiL += m_dVmTdOffs * vtHiL + m_dVmAdOffs * vtAiL ;
ptHfL += m_dVmTdOffs * vtHfL + m_dVmAdOffs * vtAfL ;
// Log per debug
//string sOut = "Pi=(" + ToString( ptHiL) + ") Vi=(" + ToString( vtHiL) + ") Ai=(" + ToString( vtAiL) +
// ") Pf=(" + ToString( ptHfL) + ") Vf=(" + ToString( vtHfL) + ") Af=(" + ToString( vtAfL) + ")" ;
//LOG_INFO( GetEMkLogger(), sOut.c_str())
if ( ExeGetDebugLevel() >= 10) {
string sOut = "Pi=(" + ToString( ptHiL) + ") Vi=(" + ToString( vtHiL) + ") Ai=(" + ToString( vtAiL) +
") Pf=(" + ToString( ptHfL) + ") Vf=(" + ToString( vtHfL) + ") Af=(" + ToString( vtAfL) + ")" ;
LOG_DBG_INFO( GetEMkLogger(), sOut.c_str())
}
// Eseguo
return pVZM->MillingStep( ptHiL, vtHiL, vtAiL, ptHfL, vtHfL, vtAfL) ;
}