Files
EgtMachKernel/MachMgrSimulation.cpp
T
Dario Sassi 9d1b2d8d60 EgtMachKernel 1.6x10 :
- aggiunta GetAllHeadsNames
- aggiunto nome asse a SimGetAxisInfoPos.
2017-01-30 08:06:33 +00:00

120 lines
3.2 KiB
C++

//----------------------------------------------------------------------------
// EgalTech 2015-2015
//----------------------------------------------------------------------------
// File : MachMgrSimulation.cpp Data : 20.10.15 Versione : 1.6j2
// Contenuto : Implementazione gestione simulazione della classe MachMgr.
//
//
//
// Modifiche : 20.10.15 DS Creazione modulo.
//
//
//----------------------------------------------------------------------------
//--------------------------- Include ----------------------------------------
#include "stdafx.h"
#include "DllMain.h"
#include "MachMgr.h"
#include "MachConst.h"
#include "Simulator.h"
using namespace std ;
//----------------------------------------------------------------------------
bool
MachMgr::SimStart( void)
{
// alloco simulatore
if ( m_pSimul != nullptr)
delete m_pSimul ;
m_pSimul = new( std::nothrow) Simulator ;
if ( m_pSimul == nullptr)
return false ;
// lo inizializzo
if ( ! m_pSimul->Init( this))
return false ;
// lo avvio
return m_pSimul->Start() ;
}
//----------------------------------------------------------------------------
bool
MachMgr::SimMove( int& nStatus)
{
// verifico simulatore
if ( m_pSimul == nullptr) {
nStatus = MCH_SIM_ERR ;
return false ;
}
// eseguo movimento
return m_pSimul->Move( nStatus) ;
}
//----------------------------------------------------------------------------
bool
MachMgr::SimGetAxisInfoPos( int nI, string& sName, string& sToken, bool& bLinear, double& dVal)
{
// verifico simulatore
if ( m_pSimul == nullptr)
return false ;
// recupero dati
return m_pSimul->GetAxisInfoPos( nI, sName, sToken, bLinear, dVal) ;
}
//----------------------------------------------------------------------------
bool
MachMgr::SimGetToolInfo( string& sName, double& dSpeed)
{
// verifico simulatore
if ( m_pSimul == nullptr)
return false ;
// recupero quote
return m_pSimul->GetToolInfo( sName, dSpeed) ;
}
//----------------------------------------------------------------------------
bool
MachMgr::SimGetMoveInfo( int& nGmove, double& dFeed)
{
// verifico simulatore
if ( m_pSimul == nullptr)
return false ;
// recupero quote
return m_pSimul->GetMoveInfo( nGmove, dFeed) ;
}
//----------------------------------------------------------------------------
bool
MachMgr::SimSetStep( double dStep)
{
// verifico simulatore
if ( m_pSimul == nullptr)
return false ;
// imposto lo step di riferimento
return m_pSimul->SetStep( dStep) ;
}
//----------------------------------------------------------------------------
bool
MachMgr::SimGoHome( void)
{
// verifico simulatore
if ( m_pSimul == nullptr)
return false ;
// eseguo movimento in home
return m_pSimul->GoHome() ;
}
//----------------------------------------------------------------------------
bool
MachMgr::SimStop( void)
{
// verifico simulatore
if ( m_pSimul == nullptr)
return true ;
// lo cancello (il distruttore provvede ovviamente a fermarlo)
delete m_pSimul ;
m_pSimul = nullptr ;
return true ;
}