📄 simulation.cpp
字号:
// TRUE - Success// FALSE - Failurebool Simulation::bSetAnaType( eAnaType eAna ){ if( eAna<eANA_FST || eAna>eANA_LST ) return( FALSE ); m_eAnaType = eAna; return( TRUE );}//*****************************************************************************// Enable or disable the derivation of an analysis parameter.//// Arguments:// ePar - The parameter to set// bState - Indicate whether the parameter is to be derived or not // (TRUE - derive parameter, FALSE - don't derive parameter)//// Return Values:// TRUE - Success// FALSE - Failurebool Simulation::bSetOutPar( eParType ePar, bool bState ){ if( ePar<ePAR_FST || ePar>ePAR_LST ) return( FALSE ); m_bPar[ ePar ] = bState; return( TRUE );}//*****************************************************************************// Enable or disable the derivation of a part of a complex analysis parameter.//// Arguments:// eCpx - The complex part to set// bState - Indicate whether the parameter is to be derived or not // (TRUE - derive parameter, FALSE - don't derive parameter)//// Return Values:// TRUE - Success// FALSE - Failurebool Simulation::bSetOutCpx( eCpxType eCpx, bool bState ){ if( eCpx<eCPX_FST || eCpx>eCPX_LST ) return( FALSE ); m_bCpx[ eCpx ] = bState; return( TRUE );}//*****************************************************************************// Set the sweep start point.//// Argument List:// fStart - The sweep starting point//// Return Values:// TRUE - Success// FALSE - Failurebool Simulation::bSetSwpStart( float fStart ){ if( fStart<-FLT_MAX || fStart>FLT_MAX ) return( FALSE ); m_fSwp[ eSWP_START ] = fStart; return( TRUE );}//*****************************************************************************// Set the simulation stop point.//// Argument List:// fStop - The sweep end point//// Return Values:// TRUE - Success// FALSE - Failurebool Simulation::bSetSwpStop( float fStop ){ if( fStop<-FLT_MAX || fStop>FLT_MAX ) return( FALSE ); m_fSwp[ eSWP_STOP ] = fStop; return( TRUE );}//*****************************************************************************// Set the sweep step size.//// Argument List:// fStep - The sweep step size//// Return Values:// TRUE - Success// FALSE - Failurebool Simulation::bSetSwpStep( float fStep ){ if( fStep<-FLT_MAX || fStep>FLT_MAX ) return( FALSE ); m_fSwp[ eSWP_STEP ] = fStep; return( TRUE );}//*****************************************************************************// Set the sweep scale type.//// Argument List:// iScale - The sweep step scale type//// Return Values:// TRUE - Success// FALSE - Failurebool Simulation::bSetSwpScale( int iScale ){ if( iScale<0 || iScale>3 ) return( FALSE ); m_fSwp[ eSWP_SCALE ] = (float) iScale; return( TRUE );}//*****************************************************************************// Set the analysis temperature in degrees Celcius.//// Argument List:// fTempC - The temperature in degrees Celcius//// Return Values:// TRUE - Success// FALSE - Failurebool Simulation::bSetTempC( float fTempC ){ if( fTempC<-100.0 || fTempC>250.0 ) return( FALSE ); m_fTempC = fTempC; return( TRUE );}//*****************************************************************************// Get the simulation start point as a string.//// Return Values:// Success - The string value// Failure - An empty stringconst wxString & Simulation::rosGetSwpStart( void ){ static wxString osStart; double f1; f1 = (double) m_fSwp[ eSWP_START ]; if( ! ConvertType::bFltToStrEng( f1, osStart ) ) osStart.Empty( ); return( osStart );}//*****************************************************************************// Get the simulation stop point as a string.//// Return Values:// Success - The string value// Failure - An empty stringconst wxString & Simulation::rosGetSwpStop( void ){ static wxString osStop; double f1; f1 = (double) m_fSwp[ eSWP_STOP ]; if( ! ConvertType::bFltToStrEng( f1, osStop ) ) osStop.Empty( ); return( osStop );}//*****************************************************************************// Get the simulation step point as a string.//// Return Values:// Success - The string value// Failure - An empty stringconst wxString & Simulation::rosGetSwpStep( void ){ static wxString osStep; double f1; f1 = (double) m_fSwp[ eSWP_STEP ]; if( ! ConvertType::bFltToStrEng( f1, osStep ) ) osStep.Empty( ); return( osStep );}//*****************************************************************************// Get the simulation temperature as a string.//// Return Values:// Success - The string value// Failure - An empty stringconst wxString & Simulation::rosGetTempC( void ){ static wxString osTempC; double f1; f1 = (double) m_fTempC; if( ! ConvertType::bFltToStrEng( f1, osTempC ) ) osTempC.Empty( ); return( osTempC );}//*****************************************************************************// Add a node to the list of test points.//// Arguments:// rosNode - The node to be add to the list of test points//// Return Values:// TRUE - Success// FALSE - Failurebool Simulation::bAddTstNode( const wxString & rosNode ){ if( rosNode.IsEmpty( ) ) return( FALSE ); if( m_oasTstNodes.Index( rosNode ) != wxNOT_FOUND ) return( TRUE ); m_oasTstNodes.Add( rosNode ); m_oasTstNodes.Sort( &iCompare ); return( TRUE );}//*****************************************************************************// Add a component to the list of test points.//// Arguments:// rosCpnt - The component to be add to the list of test points//// Return Values:// TRUE - Success// FALSE - Failurebool Simulation::bAddTstCpnt( const wxString & rosCpnt ){ if( rosCpnt.IsEmpty( ) ) return( FALSE ); if( m_oasTstCpnts.Index( rosCpnt ) != wxNOT_FOUND ) return( TRUE ); m_oasTstCpnts.Add( rosCpnt ); m_oasTstCpnts.Sort( &iCompare ); return( TRUE );}//*****************************************************************************// Add a command to the list of simulator commands.//// Arguments:// rosCpnt - The component to be add to the list of test points//// Return Values:// TRUE - Success// FALSE - Failurebool Simulation::bAddSimCmd( const wxString & rosCmd ){ if( rosCmd.IsEmpty( ) ) return( FALSE ); m_oasSimCmds.Add( rosCmd ); return( TRUE );}//*****************************************************************************// Set the value of the source (eg. voltage or current) string.//// Arguments:// rosSrc - The source string//// Return Values:// TRUE - Success// FALSE - Failurebool Simulation::bSetSrcCpnt( const wxString & rosSrc ){ wxString os1; size_t szt1; // Validate a few things before proceeding ClrSrcCpnt( ); if( m_oasCpnts.IsEmpty( ) ) return( FALSE ); if( rosSrc .IsEmpty( ) ) return( TRUE ); // Check that the source component exists os1 = rosSrc.BeforeFirst( wxT(' ') ); for( szt1=0; szt1<m_oasCpnts.GetCount( ); szt1++ ) if( os1 == m_oasCpnts[ szt1 ].BeforeFirst( wxT(' ') ) ) break; if( szt1 >= m_oasCpnts.GetCount( ) ) return( FALSE ); // Set the source component m_osSrcCpnt[ 0 ] = rosSrc; m_osSrcCpnt[ 1 ] = m_oasCpnts[ szt1 ]; m_oasCpnts[ szt1 ] = rosSrc; return( TRUE );}//*****************************************************************************// Reset the value of the source string to its original value.void Simulation::ClrSrcCpnt( void ){ wxString os1; size_t szt1; // Check if the source component is already clear if( m_osSrcCpnt[ 0 ].IsEmpty( ) ) return; if( m_oasCpnts .IsEmpty( ) ) return; // Find the component used as a source and reset it to it's original value os1 = m_osSrcCpnt[0].BeforeFirst( wxT(' ') ); m_osSrcCpnt[0].Empty( ); for( szt1=0; szt1<m_oasCpnts.GetCount( ); szt1++ ) { // Search for the source component if( os1 == m_oasCpnts[ szt1 ].BeforeFirst( wxT(' ') ) ) { // Reset the component to its original value m_oasCpnts[ szt1 ] = m_osSrcCpnt[ 1 ]; break; } } m_osSrcCpnt[ 0 ].Empty( ); m_osSrcCpnt[ 1 ].Empty( );}//*****************************************************************************
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -