//************************************************************************************************** // PrcNgSpice.cpp * // ---------------- * // Started : 2004-05-07 * // Last Update : 2016-07-24 * // Copyright : (C) 2004-2016 MSWaters * //************************************************************************************************** //************************************************************************************************** // * // 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 3 of the License, or (at your option) any later version. * // * //************************************************************************************************** #include "PrcNgSpice.hpp" //************************************************************************************************** // Constructor. PrcNgSpice::PrcNgSpice( void ) : PrcSimEngBase( ) { // Set the simulation engine type m_eSimEng = eSIMR_NGSPICE; // Set the simulator binary file name if it can be found bSetBinFile( BIN_NGSPICE ); } //************************************************************************************************** // Destructor. PrcNgSpice::~PrcNgSpice( ) { } //************************************************************************************************** // Match a component to a set of node labels. // // Component voltages cannot be specified using the component label in the NG-Spice print statement. // The two node labels connected to the component must be specified. When parsing the print // statement the component label must be derived from the node labels. This may not work where // components are connected in parallel. The nodes are specified in the form "," // eg. "1,2". // // Argument List : // roSimn - The simulation object // rosToNodes - The nodes to match, also used to return the component label // // Return Values : // true - Success (a component with the specified nodes was found) // false - Failure bool PrcNgSpice::bMatchCpnt( SimnNgSpice & roSimn, wxString & rosToNodes ) { wxArrayString osaNodes; Component tCpnt; wxString os1; size_t sz1; // Argument validity checks if( rosToNodes.IsEmpty( ) ) return( false ); if( roSimn.m_oaCpnts.GetCount( ) <= 0 ) return( false ); if( rosToNodes.Freq( wxT(',') ) != 1 ) return( false ); // Extract the node labels osaNodes.Add( rosToNodes.BeforeFirst( wxT(',') ) ); osaNodes.Add( rosToNodes.AfterLast( wxT(',') ) ); // Attempt to match the nodes with a component for( sz1=0; sz1 80 ) osCmdWIDTH << wxT(".WIDTH OUT=") << i1; } return( osCmdWIDTH ); } //************************************************************************************************** // This function is a generic results file formatter which works in most circumstance. // // Return Values : // true - Success // false - Failure bool PrcNgSpice::bFmtGeneral( void ) { wxString os1; size_t sz1, sz2; // This function requires the results file to be open if( ! m_oFileResults.IsOpened( ) ) return( false ); // Find the beginning of the data area (ie. the first line starting with "Index") for( sz1=0; sz1 0 ) m_oFileResults.RemoveLine( 1 ); // Delete lines other than data lines for( sz1=1; sz1