⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 prcgnucap.cpp

📁 gspiceui电子CAD仿真程序.用于电路参数模拟仿真
💻 CPP
📖 第 1 页 / 共 3 页
字号:
//*****************************************************************************//                               PrcGnuCap.cpp                                *//                              ---------------                               *//  Started     : 01/09/2003                                                  *//  Last Update : 12/07/2005                                                  *//  Copyright   : (C) 2003 by M.S.Waters                                      *//  Email       : M.Waters@bom.gov.au                                         *//*****************************************************************************//*****************************************************************************//                                                                            *//    This program is free software; you can redistribute it and/or modify    *//    it under the terms of the GNU General Public License as published by    *//    the Free Software Foundation; either version 2 of the License, or       *//    (at your option) any later version.                                     *//                                                                            *//*****************************************************************************#include "PrcGnuCap.hpp"//*****************************************************************************// Constructor.PrcGnuCap::PrcGnuCap( void ) : PrcSimrBase( ){  // Set the simulator binary file name if it can be found  bSetBinary( wxT("gnucap") );  m_osInput.Empty( );}//*****************************************************************************// Destructor.PrcGnuCap::~PrcGnuCap( ){}//*****************************************************************************// Parse a OPTIONS command and put the data in a simulation object.//// Argument List://   rosCmd - The command line to be parsed//   roSim  - The simulation object//// Return Values://   TRUE  - Success//   FALSE - Failurebool  PrcGnuCap::bParseCmdOPT( wxString & rosCmd, Simulation & roSim ){  return( FALSE );}//*****************************************************************************// Parse a GENERATOR command and put the data in a simulation object.//// Argument List://   rosCmd - The command line to be parsed//   roSim  - The simulation object//// Return Values://   TRUE  - Success//   FALSE - Failurebool  PrcGnuCap::bParseCmdGEN( wxString & rosCmd, Simulation & roSim ){  return( FALSE );}//*****************************************************************************// Parse a OP command and put the data in a simulation object.// Eg.s: .OP 27.0//       .OP 27.0 60.0 BY 1.0//       .OP 27.0 60.0 TI 1.1//// Argument List://   rosCmd - The command line to be parsed//   roSim  - The simulation object//// Return Values://   TRUE  - Success//   FALSE - Failurebool  PrcGnuCap::bParseCmdOP( wxString & rosCmd, Simulation & roSim ){  wxStringTokenizer  ostk1;  wxString  os1;  bool      bRtn=TRUE;  double    df1;  // Basic argument checks  ostk1.SetString( rosCmd );  if( ostk1.CountTokens( ) < 2 )              return( FALSE );  // Check command type  os1 = ostk1.GetNextToken( );  if( os1.Upper( ) != wxT(".OP") )            return( FALSE );  // Extract the start temperature  os1 = ostk1.GetNextToken( );  if( ! ConvertType::bStrToFlt( os1, &df1 ) ) bRtn = FALSE;  if( ! roSim.bSetSwpStart( (float) df1 ) )   bRtn = FALSE;  if( ! ostk1.HasMoreTokens( ) )  {    if( ! roSim.bSetSwpStop( (float) df1 ) )  bRtn = FALSE;    if( ! roSim.bSetSwpStep( 1.0 ) )          bRtn = FALSE;    return( TRUE );  }  // Extract the stop temperature  if( ostk1.CountTokens( ) != 3 )             bRtn = FALSE;  os1 = ostk1.GetNextToken( );  if( ! ConvertType::bStrToFlt( os1, &df1 ) ) bRtn = FALSE;  if( ! roSim.bSetSwpStop( (float) df1 ) )    bRtn = FALSE;  // Extract the sweep type: linear or log  os1 = ostk1.GetNextToken( );  os1.MakeUpper( );  if(      os1 == wxT("BY") ) roSim.bSetSwpScale( 0 );  else if( os1 == wxT("TI") ) roSim.bSetSwpScale( 1 );  else                                        bRtn = FALSE;  // Extract the step size  os1 = ostk1.GetNextToken( );  if( ! ConvertType::bStrToFlt( os1, &df1 ) ) bRtn = FALSE;  if( ! roSim.bSetSwpStep( (float) df1 ) )    bRtn = FALSE;  return( bRtn );}//*****************************************************************************// Parse a DC command and put the data in a simulation object.// Eg.s: .DC Vin 0.00 100.00m BY 10.00m TE 27.00//       .DC Vin 0.00 100.00m TI 1.01 TE 27.00//       .DC Vin 0.00 100.00m DE 100 TE 27.00//// Argument List://   rosCmd - The command line to be parsed//   roSim  - The simulation object//// Return Values://   TRUE  - Success//   FALSE - Failurebool  PrcGnuCap::bParseCmdDC( wxString & rosCmd, Simulation & roSim ){  wxStringTokenizer  ostk1;  wxString  os1;  bool      bRtn=TRUE;  double    df1;  long      li1;  // Basic argument checks  ostk1.SetString( rosCmd );  if( ostk1.CountTokens( ) != 8 )               return( FALSE );  // Check command type  os1 = ostk1.GetNextToken( );  if( os1.Upper( ) != wxT(".DC") )              return( FALSE );  // Extract the sweep source label  os1 = ostk1.GetNextToken( );  os1 = roSim.rosGetCpnt( os1 );  if( os1.IsEmpty( ) )                          bRtn = FALSE;  if( roSim.bSetSrcCpnt( os1 ) )                bRtn = FALSE;  // Extract the start voltage  os1 = ostk1.GetNextToken( );  if( ! ConvertType::bStrToFlt( os1, &df1 ) )   bRtn = FALSE;  if( ! roSim.bSetSwpStart( (float) df1 ) )     bRtn = FALSE;  // Extract the stop voltage  os1 = ostk1.GetNextToken( );  if( ! ConvertType::bStrToFlt( os1, &df1 ) )   bRtn = FALSE;  if( ! roSim.bSetSwpStop( (float) df1 ) )      bRtn = FALSE;  // Extract the sweep type: linear, log or steps per decade  os1 = ostk1.GetNextToken( );  os1.MakeUpper( );  if(      os1 == wxT("BY") ) roSim.bSetSwpScale( 0 );  else if( os1 == wxT("TI") ) roSim.bSetSwpScale( 1 );  else if( os1 == wxT("DE") ) roSim.bSetSwpScale( 2 );  else                                          bRtn = FALSE;  // Extract the step size/count  os1 = ostk1.GetNextToken( );  if( roSim.iGetSwpScale( ) < 2 )  {    if( ! ConvertType::bStrToFlt( os1, &df1 ) ) bRtn = FALSE;    if( ! roSim.bSetSwpStep( (float) df1 ) )    bRtn = FALSE;  }  else  {    if( ! ConvertType::bStrToInt( os1, &li1 ) ) bRtn = FALSE;    if( ! roSim.bSetSwpStep( (float) li1 ) )    bRtn = FALSE;  }  // Extract the analysis temperature  os1 = ostk1.GetNextToken( );  if( os1.Upper( ) == wxT("TE") )  {    os1 = ostk1.GetNextToken( );    if( ! ConvertType::bStrToFlt( os1, &df1 ) ) bRtn = FALSE;    if( ! roSim.bSetTempC( (float) df1 ) )      bRtn = FALSE;  }  return( bRtn );}//*****************************************************************************// Parse a AC command and put the data in a simulation object.// Eg.s: .AC 0.00 100.00K BY 10.00K TE 27.00//       .AC 0.00 100.00K TI 1.01 TE 30.00//       .AC 0.00 100.00K DE 1 TE 30.00//       .AC 0.00 100.00K OC 10 TE 30.00//// Argument List://   rosCmd - The command line to be parsed//   roSim  - The simulation object//// Return Values://   TRUE  - Success//   FALSE - Failurebool  PrcGnuCap::bParseCmdAC( wxString & rosCmd, Simulation & roSim ){  wxStringTokenizer  ostk1;  wxString  os1;  bool      bRtn=TRUE;  double    df1;  long      li1;  // Basic argument checks  ostk1.SetString( rosCmd );  if( ostk1.CountTokens( ) != 7 )               return( FALSE );  // Check command type  os1 = ostk1.GetNextToken( );  if( os1.Upper( ) != wxT(".AC") )              return( FALSE );  // Extract the start frequency  os1 = ostk1.GetNextToken( );  if( ! ConvertType::bStrToFlt( os1, &df1 ) )   bRtn = FALSE;  if( ! roSim.bSetSwpStart( (float) df1 ) )     bRtn = FALSE;  // Extract the stop frequency  os1 = ostk1.GetNextToken( );  if( ! ConvertType::bStrToFlt( os1, &df1 ) )   bRtn = FALSE;  if( ! roSim.bSetSwpStop( (float) df1 ) )      bRtn = FALSE;  // Extract the sweep type: linear, log or steps per decade  os1 = ostk1.GetNextToken( );  os1.MakeUpper( );  if(      os1 == wxT("BY") ) roSim.bSetSwpScale( 0 );  else if( os1 == wxT("TI") ) roSim.bSetSwpScale( 1 );  else if( os1 == wxT("DE") ) roSim.bSetSwpScale( 2 );  else if( os1 == wxT("OC") ) roSim.bSetSwpScale( 3 );  else                                          bRtn = FALSE;  // Extract the step size/count  os1 = ostk1.GetNextToken( );  if( roSim.iGetSwpScale( ) < 2 )  {    if( ! ConvertType::bStrToFlt( os1, &df1 ) ) bRtn = FALSE;    if( ! roSim.bSetSwpStep( (float) df1 ) )    bRtn = FALSE;  }  else  {    if( ! ConvertType::bStrToInt( os1, &li1 ) ) bRtn = FALSE;    if( ! roSim.bSetSwpStep( (float) li1 ) )    bRtn = FALSE;  }  // Extract the analysis temperature  os1 = ostk1.GetNextToken( );  if( os1.Upper( ) == wxT("TE") )  {    os1 = ostk1.GetNextToken( );    if( ! ConvertType::bStrToFlt( os1, &df1 ) ) bRtn = FALSE;    if( ! roSim.bSetTempC( (float) df1 ) )      bRtn = FALSE;  }  return( bRtn );}//*****************************************************************************// Parse a TRANSIENT command and put the data in a simulation object.// Eg.s: .TR 0.00 100.00m 10.00m TE 27.00 COLD//       .TR 0.00 100.00m 10.00m TE 27.00 UIC//// Argument List://   rosCmd - The command line to be parsed//   roSim  - The simulation object//// Return Values://   TRUE  - Success//   FALSE - Failurebool  PrcGnuCap::bParseCmdTR( wxString & rosCmd, Simulation & roSim ){  wxStringTokenizer  ostk1;  wxString  os1;  bool      bRtn=TRUE;  double    df1;  // Basic argument checks  ostk1.SetString( rosCmd );  if( ostk1.CountTokens( ) != 7 )               return( FALSE );  // Check command type  os1 = ostk1.GetNextToken( );  if( os1.Upper( ) != wxT(".TR") )              return( FALSE );  // Extract the start time  os1 = ostk1.GetNextToken( );  if( ! ConvertType::bStrToFlt( os1, &df1 ) )   bRtn = FALSE;  if( ! roSim.bSetSwpStart( (float) df1 ) )     bRtn = FALSE;  // Extract the stop time  os1 = ostk1.GetNextToken( );  if( ! ConvertType::bStrToFlt( os1, &df1 ) )   bRtn = FALSE;  if( ! roSim.bSetSwpStop( (float) df1 ) )      bRtn = FALSE;  // Extract the step size  os1 = ostk1.GetNextToken( );  if( ! ConvertType::bStrToFlt( os1, &df1 ) )   bRtn = FALSE;  if( ! roSim.bSetSwpStep( (float) df1 ) )      bRtn = FALSE;  // Extract the analysis temperature  os1 = ostk1.GetNextToken( );  if( os1.Upper( ) == wxT("TE") )  {    os1 = ostk1.GetNextToken( );    if( ! ConvertType::bStrToFlt( os1, &df1 ) ) bRtn = FALSE;    if( ! roSim.bSetTempC( (float) df1 ) )      bRtn = FALSE;  }  // Extract the sweep type: linear, log or steps per decade  os1 = ostk1.GetNextToken( );  os1.MakeUpper( );  if(      os1 == wxT("COLD") ) roSim.bSetSwpScale( 0 );  else if( os1 == wxT("UIC") )  roSim.bSetSwpScale( 1 );  else                                          bRtn = FALSE;  return( bRtn );}//*****************************************************************************// Parse a FOURIER command and put the data in a simulation object.//// Argument List://   rosCmd - The command line to be parsed//   roSim  - The simulation object//// Return Values://   TRUE  - Success//   FALSE - Failurebool  PrcGnuCap::bParseCmdFO( wxString & rosCmd, Simulation & roSim ){  return( FALSE );}//*****************************************************************************// Parse a PRINT command and put the data in a simulation object.//// Argument List://   rosCmd - The command line to be parsed//   roSim  - The simulation object//// Return Values://   TRUE  - Success//   FALSE - Failurebool  PrcGnuCap::bParseCmdPR( wxString & rosCmd, Simulation & roSim ){  wxStringTokenizer  ostk1;  wxString  os1;  bool      bRtn=TRUE;  size_t    szt1, szt2;  // Basic argument checks  ostk1.SetString( rosCmd );  if( ostk1.CountTokens( ) < 3 )   return( FALSE );  // Check command type  os1 = ostk1.GetNextToken( ).Left( 3 );  if( os1.Upper( ) != wxT(".PR") ) return( FALSE );  // Extract the analysis type  os1 = ostk1.GetNextToken( ).Left( 2 );  os1.MakeUpper( );  if(      os1 == wxT("OP") ) roSim.bSetAnaType( Simulation::eANA_OP );  else if( os1 == wxT("DC") ) roSim.bSetAnaType( Simulation::eANA_DC );  else if( os1 == wxT("AC") ) roSim.bSetAnaType( Simulation::eANA_AC );  else if( os1 == wxT("TR") ) roSim.bSetAnaType( Simulation::eANA_TR );  else if( os1 == wxT("FO") ) roSim.bSetAnaType( Simulation::eANA_FO );  else return( FALSE );

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -