simulation.hpp
来自「gspiceui电子CAD仿真程序.用于电路参数模拟仿真」· HPP 代码 · 共 193 行
HPP
193 行
//*****************************************************************************// Simulation.hpp *// ---------------- *// *// Description : A class to contain the values required to define a *// particular simulation. *// Started : 23/09/2003 *// Last Update : 07/06/2005 *// Copyright : (C) 2003 by MSWaters *// 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. *// *//*****************************************************************************#ifndef SIMULATION_HPP#define SIMULATION_HPP// System Includes#include <cfloat>// wxWindows Includes#include <wx/wx.h>#include <wx/filename.h>// Application Includes#include "ConvertType.hpp"#include "NetList.hpp"// Local Constant Declarations//*****************************************************************************class Simulation : public NetList{ public: // The various simulator engine types enum eSimrType { eSIMR_NONE, // Used if a simulation engine has not yet been selected eSIMR_GNUCAP, // GNU-Cap eSIMR_NGSPICE, // NG-Spice eSIMR_FST = eSIMR_NONE, eSIMR_LST = eSIMR_NGSPICE }; // The various parameters which may be determined by analysis enum eParType { ePAR_VLT = 0, // Node or component voltage ePAR_CUR, // Node or component current ePAR_PWR, // Node or component power ePAR_RES, // Input and output resistance ePAR_FST = ePAR_VLT, ePAR_LST = ePAR_RES }; // The various sub-parameters which may be determined (AC analysis only) enum eCpxType { eCPX_MAG = 0, // Magnitude of the complex node or component parameter eCPX_PHASE, // Phase of the complex node or component parameter eCPX_REAL, // Real part of the complex node or component parameter eCPX_IMAG, // Imaginary part of the complex node or component parameter eCPX_MAGDB, // Convert to magnitude to Decibels eCPX_FST = eCPX_MAG, eCPX_LST = eCPX_MAGDB }; // The various analyses types which may be performed enum eAnaType { eANA_OP = 0, // Quiescent operating point analysis eANA_DC, // DC analysis eANA_AC, // AC analysis eANA_TR, // Transient analysis eANA_FO, // Fourier analysis eANA_DI, // Distortion analysis eANA_NO, // Noise analysis eANA_PZ, // Pole-zero analysis eANA_SE, // Sensitivity analysis eANA_TF, // Transfer function analysis eANA_NONE, // Analysis type not set eANA_FST = eANA_OP, eANA_LST = eANA_NONE }; private: // The sweep scale specifier enum eSwpType { eSWP_START = 0, // Sweep start point eSWP_STOP, // Sweep stop point eSWP_STEP, // Sweep step size eSWP_SCALE, // Sweep step scale type eSWP_SIZE = eSWP_SCALE+1 // Size of array to hold the sweep parameters }; // Attributes to define the simulation eSimrType m_eSimrType; // Simulator engine type eAnaType m_eAnaType; // Analysis type bool m_bPar[ ePAR_LST+1 ]; // Output parameters bool m_bCpx[ eCPX_LST+1 ]; // Output complex parts (AC analysis only) float m_fSwp[ eSWP_SIZE ]; // Array to hold sweep parameter values float m_fTempC; // Analysis temperature in Celcius wxArrayString m_oasTstNodes; // Array to hold test node names wxArrayString m_oasTstCpnts; // Array to hold test component names wxArrayString m_oasSimCmds; // Array to hold simulation commands wxString m_osSrcCpnt[ 2 ]; // String to hold source component // Error message generated by bIsValid( ) wxString m_osErrMsg; // Function to extract information from the circuit description bool bExtractSimrType( void ); bool bExtractSimCmds ( void ); bool bExtractSrcCpnt ( void ); public: Simulation( void ); ~Simulation( ); bool bClear( void ); bool bIsValid( void ); bool bLoadFile( const wxChar * psFName=NULL ); bool bSaveFile( const wxChar * psFName=NULL ); bool bSetSimrType( eSimrType eSimr ); bool bSetAnaType ( eAnaType eAna ); bool bSetOutPar ( eParType ePar, bool bState ); bool bSetOutCpx ( eCpxType eCpx, bool bState ); bool bSetSwpStart( float fStart ); bool bSetSwpStop ( float fStop ); bool bSetSwpStep ( float fStep ); bool bSetSwpScale( int iScale ); bool bSetTempC ( float fTempC ); eSimrType eGetSimrType( void ) { return( m_eSimrType ); } eAnaType eGetAnaType( void ) { return( m_eAnaType ); } bool bGetOutPar( eParType ePar ) { return( m_bPar[ ePar ] ); } bool bGetOutCpx( eCpxType eCpx ) { return( m_bCpx[ eCpx ] ); } float fGetSwpStart( void ) { return( m_fSwp[ eSWP_START ] ); } float fGetSwpStop ( void ) { return( m_fSwp[ eSWP_STOP ] ); } float fGetSwpStep ( void ) { return( m_fSwp[ eSWP_STEP ] ); } int iGetSwpScale( void ) { return( (int) m_fSwp[ eSWP_SCALE ] ); } float fGetTempC ( void ) { return( m_fTempC ); } const wxString & rosGetSwpStart( void ); const wxString & rosGetSwpStop ( void ); const wxString & rosGetSwpStep ( void ); const wxString & rosGetTempC ( void ); bool bAddTstNode( const wxString & rosNode ); bool bAddTstCpnt( const wxString & rosCpnt ); bool bAddSimCmd ( const wxString & rosCmd ); bool bSetSrcCpnt( const wxString & rosSrc ); const wxArrayString & roasGetTstNodes( void ) { return( m_oasTstNodes ); } const wxArrayString & roasGetTstCpnts( void ) { return( m_oasTstCpnts ); } const wxArrayString & roasGetSimCmds ( void ) { return( m_oasSimCmds ); } const wxString & rosGetSrcCpnt ( void ) { return( m_osSrcCpnt[ 0 ] ); } void ClrTstNodes( void ) { m_oasTstNodes.Empty( ); } void ClrTstCpnts( void ) { m_oasTstCpnts.Empty( ); } void ClrSimCmds ( void ) { m_oasSimCmds .Empty( ); } void ClrSrcCpnt ( void ); const wxString & rosGetErrMsg( void ) { return( m_osErrMsg ); }};//*****************************************************************************#endif // SIMULATION_HPP
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?