KiCad PCB EDA Suite
Loading...
Searching...
No Matches
spice_circuit_model.h
Go to the documentation of this file.
1/*
2 * This program source code file is part of KiCad, a free EDA CAD application.
3 *
4 * Copyright (C) 2016-2022 CERN
5 * Copyright (C) 2017-2023 KiCad Developers, see AUTHORS.txt for contributors.
6 *
7 * @author Maciej Suminski <[email protected]>
8 *
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License
11 * as published by the Free Software Foundation; either version 3
12 * of the License, or (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, you may find one here:
21 * https://www.gnu.org/licenses/gpl-3.0.html
22 * or you may search the http://www.gnu.org website for the version 3 license,
23 * or you may write to the Free Software Foundation, Inc.,
24 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
25 */
26
27#ifndef SPICE_CIRCUIT_MODEL_H
28#define SPICE_CIRCUIT_MODEL_H
29
31#include <vector>
32
33#include "sim_types.h"
34#include "spice_simulator.h"
35#include "spice_value.h"
36
37
39{
40 wxString m_source;
44};
45
46
48{
49 bool m_Poles;
50 bool m_Zeros;
51};
52
55{
56public:
58 NETLIST_EXPORTER_SPICE( aSchematic )
59 {}
60
62
71 SIM_TRACE_TYPE VectorToSignal( const std::string& aVector, wxString& aSignal ) const;
72
73 bool GetNetlist( const wxString& aCommand, unsigned aOptions, OUTPUTFORMATTER* aFormatter,
74 REPORTER& aReporter )
75 {
76 return SPICE_CIRCUIT_MODEL::DoWriteNetlist( aCommand, aOptions, *aFormatter, aReporter );
77 }
78
82 wxString GetSchTextSimCommand();
83
90 bool ParseDCCommand( const wxString& aCmd, SPICE_DC_PARAMS* aSource1,
91 SPICE_DC_PARAMS* aSource2 );
92
93 bool ParsePZCommand( const wxString& aCmd, wxString* transferFunction, wxString* input,
94 wxString* inputRef, wxString* output, wxString* outputRef,
95 SPICE_PZ_ANALYSES* analyses );
96
97 bool ParseNoiseCommand( const wxString& aCmd, wxString* aOutput, wxString* aRef,
98 wxString* aSource, wxString* aScale, SPICE_VALUE* aPts,
99 SPICE_VALUE* aFStart, SPICE_VALUE* aFStop, bool* aSaveAll );
100
104 static bool IsSimCommand( const wxString& aCmd )
105 {
106 return CommandToSimType( aCmd ) != ST_UNKNOWN;
107 }
108
112 static SIM_TYPE CommandToSimType( const wxString& aCmd );
113
114protected:
115 void WriteDirectives( const wxString& aSimCommand, unsigned aSimOptions,
116 OUTPUTFORMATTER& aFormatter ) const override;
117};
118
119#endif /* SPICE_CIRCUIT_MODEL_H */
bool DoWriteNetlist(const wxString &aSimCommand, unsigned aSimOptions, OUTPUTFORMATTER &aFormatter, REPORTER &aReporter)
Write the netlist in aFormatter.
An interface used to output 8 bit text in a convenient way.
Definition: richio.h:322
A pure virtual class used to derive REPORTER objects from.
Definition: reporter.h:72
Special netlist exporter flavor that allows one to override simulation commands.
bool ParsePZCommand(const wxString &aCmd, wxString *transferFunction, wxString *input, wxString *inputRef, wxString *output, wxString *outputRef, SPICE_PZ_ANALYSES *analyses)
static bool IsSimCommand(const wxString &aCmd)
Determine if a directive is a simulation command.
bool ParseDCCommand(const wxString &aCmd, SPICE_DC_PARAMS *aSource1, SPICE_DC_PARAMS *aSource2)
Parse a two-source .dc command directive into its symbols.
static SIM_TYPE CommandToSimType(const wxString &aCmd)
Return simulation type basing on a simulation command directive.
bool ParseNoiseCommand(const wxString &aCmd, wxString *aOutput, wxString *aRef, wxString *aSource, wxString *aScale, SPICE_VALUE *aPts, SPICE_VALUE *aFStart, SPICE_VALUE *aFStop, bool *aSaveAll)
void WriteDirectives(const wxString &aSimCommand, unsigned aSimOptions, OUTPUTFORMATTER &aFormatter) const override
bool GetNetlist(const wxString &aCommand, unsigned aOptions, OUTPUTFORMATTER *aFormatter, REPORTER &aReporter)
SPICE_CIRCUIT_MODEL(SCHEMATIC_IFACE *aSchematic)
wxString GetSchTextSimCommand()
Return simulation command directives placed in schematic sheets (if any).
SIM_TRACE_TYPE VectorToSignal(const std::string &aVector, wxString &aSignal) const
Return name of Spice dataset for a specific trace.
Helper class to recognize Spice formatted values.
Definition: spice_value.h:56
SIM_TRACE_TYPE
Definition: sim_types.h:50
SIM_TYPE
< Possible simulation types
Definition: sim_types.h:32
@ ST_UNKNOWN
Definition: sim_types.h:33
SPICE_VALUE m_vincrement