2016-08-11 12:41:30 +00:00
|
|
|
/*
|
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
|
|
*
|
|
|
|
* Copyright (C) 2016 CERN
|
2017-10-06 18:07:43 +00:00
|
|
|
* Copyright (C) 2017 KiCad Developers, see AUTHORS.txt for contributors.
|
|
|
|
*
|
2016-08-11 12:41:30 +00:00
|
|
|
* @author Maciej Suminski <maciej.suminski@cern.ch>
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
2016-08-11 12:41:43 +00:00
|
|
|
* as published by the Free Software Foundation; either version 3
|
2016-08-11 12:41:30 +00:00
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, you may find one here:
|
2016-08-11 12:41:43 +00:00
|
|
|
* https://www.gnu.org/licenses/gpl-3.0.html
|
|
|
|
* or you may search the http://www.gnu.org website for the version 3 license,
|
2016-08-11 12:41:30 +00:00
|
|
|
* or you may write to the Free Software Foundation, Inc.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef NETLIST_EXPORTER_PSPICE_SIM_H
|
|
|
|
#define NETLIST_EXPORTER_PSPICE_SIM_H
|
|
|
|
|
|
|
|
#include <netlist_exporters/netlist_exporter_pspice.h>
|
2016-08-11 12:41:52 +00:00
|
|
|
#include <vector>
|
|
|
|
|
2016-08-11 12:41:34 +00:00
|
|
|
#include "sim_types.h"
|
2016-08-11 12:41:30 +00:00
|
|
|
|
2018-07-08 12:12:38 +00:00
|
|
|
/// Special netlist exporter flavor that allows one to override simulation commands
|
2016-08-11 12:41:30 +00:00
|
|
|
class NETLIST_EXPORTER_PSPICE_SIM : public NETLIST_EXPORTER_PSPICE
|
|
|
|
{
|
|
|
|
public:
|
2017-11-19 10:37:27 +00:00
|
|
|
NETLIST_EXPORTER_PSPICE_SIM( NETLIST_OBJECT_LIST* aMasterList, PROJECT* aProject = nullptr ) :
|
|
|
|
NETLIST_EXPORTER_PSPICE( aMasterList, aProject )
|
2016-08-11 12:41:30 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2016-08-11 12:41:52 +00:00
|
|
|
/**
|
|
|
|
* @brief Returns name of Spice dataset for a specific plot.
|
|
|
|
* @param aName is name of the measured net or device
|
|
|
|
* @param aType describes the type of expected plot
|
|
|
|
* @param aParam is an optional parameter for devices, if absent it will return current (only
|
|
|
|
* for passive devices).
|
|
|
|
* @return Empty string if query is invalid, otherwise a plot name that
|
|
|
|
* can be requested from the simulator.
|
|
|
|
*/
|
|
|
|
wxString GetSpiceVector( const wxString& aName, SIM_PLOT_TYPE aType,
|
|
|
|
const wxString& aParam = wxEmptyString ) const;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Returns a list of currents that can be probed in a Spice primitive.
|
|
|
|
*/
|
|
|
|
static const std::vector<wxString>& GetCurrents( SPICE_PRIMITIVE aPrimitive );
|
|
|
|
|
2016-08-11 12:42:17 +00:00
|
|
|
/**
|
|
|
|
* @brief Overrides the simulation command directive.
|
|
|
|
*/
|
2016-08-11 12:41:30 +00:00
|
|
|
void SetSimCommand( const wxString& aCmd )
|
|
|
|
{
|
|
|
|
m_simCommand = aCmd;
|
|
|
|
}
|
|
|
|
|
2016-08-11 12:42:17 +00:00
|
|
|
/**
|
|
|
|
* @brief Returns the simulation command directive.
|
|
|
|
*/
|
2016-08-11 12:41:30 +00:00
|
|
|
const wxString& GetSimCommand() const
|
|
|
|
{
|
|
|
|
return m_simCommand;
|
|
|
|
}
|
|
|
|
|
2016-08-11 12:42:17 +00:00
|
|
|
/**
|
|
|
|
* @brief Clears the simulation command directive.
|
|
|
|
*/
|
2016-08-11 12:41:30 +00:00
|
|
|
void ClearSimCommand()
|
|
|
|
{
|
|
|
|
m_simCommand.Clear();
|
|
|
|
}
|
|
|
|
|
2016-08-11 12:42:17 +00:00
|
|
|
/**
|
|
|
|
* @brief Returns simulation type basing on the simulation command directives.
|
|
|
|
* Simulation directives set using SetSimCommand() have priority over the ones placed in
|
|
|
|
* schematic sheets.
|
|
|
|
*/
|
2016-08-11 12:41:34 +00:00
|
|
|
SIM_TYPE GetSimType();
|
|
|
|
|
2016-08-11 12:42:17 +00:00
|
|
|
/**
|
|
|
|
* @brief Returns simulation command directives placed in schematic sheets (if any).
|
|
|
|
*/
|
2016-08-11 12:41:30 +00:00
|
|
|
wxString GetSheetSimCommand();
|
|
|
|
|
2016-08-11 12:42:17 +00:00
|
|
|
/**
|
|
|
|
* @brief Determines if a directive is a simulation command.
|
|
|
|
*/
|
2016-08-11 12:41:34 +00:00
|
|
|
static bool IsSimCommand( const wxString& aCmd )
|
|
|
|
{
|
|
|
|
return CommandToSimType( aCmd ) != ST_UNKNOWN;
|
|
|
|
}
|
|
|
|
|
2016-08-11 12:42:17 +00:00
|
|
|
/**
|
|
|
|
* @brief Returns simulation type basing on a simulation command directive.
|
|
|
|
*/
|
2016-08-11 12:41:34 +00:00
|
|
|
static SIM_TYPE CommandToSimType( const wxString& aCmd );
|
|
|
|
|
2016-08-11 12:41:30 +00:00
|
|
|
protected:
|
|
|
|
void writeDirectives( OUTPUTFORMATTER* aFormatter, unsigned aCtl ) const override;
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
2016-08-11 12:42:17 +00:00
|
|
|
///> Custom simulation command (has priority over the schematic sheet simulation commands)
|
2016-08-11 12:41:30 +00:00
|
|
|
wxString m_simCommand;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* NETLIST_EXPORTER_PSPICE_SIM_H */
|