KiCad PCB EDA Suite
Loading...
Searching...
No Matches
SIMULATOR_FRAME_UI Class Reference

The SIMULATOR_FRAME_UI holds the main user-interface for running simulations. More...

#include <simulator_frame_ui.h>

Inheritance diagram for SIMULATOR_FRAME_UI:
SIMULATOR_FRAME_UI_BASE

Public Member Functions

 SIMULATOR_FRAME_UI (SIMULATOR_FRAME *aSimulatorFrame, SCH_EDIT_FRAME *aSchematicFrame)
 
 ~SIMULATOR_FRAME_UI ()
 
SIM_TABNewSimTab (const wxString &aSimCommand)
 Create a new simulation tab for a given simulation type.
 
std::vector< wxString > SimPlotVectors () const
 
std::vector< wxString > Signals () const
 
const std::map< int, wxString > & UserDefinedSignals ()
 
void SetUserDefinedSignals (const std::map< int, wxString > &aSignals)
 
void AddTrace (const wxString &aName, SIM_TRACE_TYPE aType)
 Add a new trace to the current plot.
 
SPICE_VALUE_FORMAT GetCursorFormat (int aCursorId, int aValueCol) const
 Get/Set the number of significant digits and the range for formatting a cursor value.
 
void SetCursorFormat (int aCursorId, int aValueCol, const SPICE_VALUE_FORMAT &aFormat)
 
void AddTuner (const SCH_SHEET_PATH &aSheetPath, SCH_SYMBOL *aSymbol)
 Add a tuner for a symbol.
 
void RemoveTuner (TUNER_SLIDER *aTuner)
 Remove an existing tuner.
 
void UpdateTunerValue (const SCH_SHEET_PATH &aSheetPath, const KIID &aSymbol, const wxString &aRef, const wxString &aValue)
 Safely update a field of the associated symbol without dereferencing the symbol.
 
void AddMeasurement (const wxString &aCmd)
 Add a measurement to the measurements grid.
 
void DeleteMeasurement (int aRow)
 Delete a row from the measurements grid.
 
SPICE_VALUE_FORMAT GetMeasureFormat (int aRow) const
 Get/Set the format of a value in the measurements grid.
 
void SetMeasureFormat (int aRow, const SPICE_VALUE_FORMAT &aFormat)
 
void UpdateMeasurement (int aRow)
 Update a measurement in the measurements grid.
 
void DoFourier (const wxString &aSignal, const wxString &aFundamental)
 
const SPICE_CIRCUIT_MODELGetExporter () const
 Return the netlist exporter object used for simulations.
 
bool DarkModePlots () const
 
void ToggleDarkModePlots ()
 
void ShowChangedLanguage ()
 
void InitWorkbook ()
 Load the currently active workbook stored in the project settings.
 
bool LoadWorkbook (const wxString &aPath)
 Load plot, signal, cursor, measurement, etc.
 
bool SaveWorkbook (const wxString &aPath)
 Save plot, signal, cursor, measurement, etc.
 
void LoadSettings (EESCHEMA_SETTINGS *aCfg)
 
void SaveSettings (EESCHEMA_SETTINGS *aCfg)
 
void ApplyPreferences (const SIM_PREFERENCES &aPrefs)
 Called when settings are changed via the common Preferences dialog.
 
void SetSubWindowsSashSize ()
 
SIM_TABGetCurrentSimTab () const
 Return the currently opened plot panel (or NULL if there is none).
 
SIM_TABGetSimTab (SIM_TYPE aType) const
 
int GetSimTabIndex (SIM_TAB *aPlot) const
 
void OnPlotSettingsChanged ()
 
void OnSimUpdate ()
 
void OnSimReport (const wxString &aMsg)
 
void OnSimRefresh (bool aFinal)
 
void OnModify ()
 
void m_splitterLeftRightOnIdle (wxIdleEvent &)
 
void m_splitterPlotAndConsoleOnIdle (wxIdleEvent &)
 
void m_splitterSignalsOnIdle (wxIdleEvent &)
 
void m_splitterCursorsOnIdle (wxIdleEvent &)
 
void m_splitterMeasurementsOnIdle (wxIdleEvent &)
 

Public Attributes

int m_SuppressGridEvents
 

Protected Attributes

wxSplitterWindow * m_splitterLeftRight
 
wxPanel * m_panelLeft
 
wxBoxSizer * m_sizer11
 
wxSplitterWindow * m_splitterPlotAndConsole
 
wxPanel * m_plotPanel
 
wxBoxSizer * m_sizerPlot
 
wxAuiNotebook * m_plotNotebook
 
wxPanel * m_panelConsole
 
wxBoxSizer * m_sizerConsole
 
wxTextCtrl * m_simConsole
 
wxPanel * m_sidePanel
 
wxBoxSizer * m_sideSizer
 
wxSplitterWindow * m_splitterSignals
 
wxPanel * m_panelSignals
 
wxSearchCtrl * m_filter
 
WX_GRIDm_signalsGrid
 
wxPanel * m_panelCMT
 
wxSplitterWindow * m_splitterCursors
 
wxPanel * m_panelCursors
 
WX_GRIDm_cursorsGrid
 
wxPanel * m_panelMT
 
wxSplitterWindow * m_splitterMeasurements
 
wxPanel * m_panelMeasurements
 
WX_GRIDm_measurementsGrid
 
wxPanel * m_panelTuners
 
wxBoxSizer * m_sizerTuners
 

Private Member Functions

wxString vectorNameFromSignalName (SIM_PLOT_TAB *aPlotTab, const wxString &aSignalName, int *aTraceType)
 Get the simulator output vector name for a given signal name and type.
 
void updateTrace (const wxString &aVectorName, int aTraceType, SIM_PLOT_TAB *aPlotTab, std::vector< double > *aDataX=nullptr, bool aClearData=false)
 Update a trace in a particular SIM_PLOT_TAB.
 
void rebuildSignalsList ()
 Rebuild the list of signals available from the netlist.
 
void rebuildSignalsGrid (wxString aFilter)
 Rebuild the filtered list of signals in the signals grid.
 
void updateSignalsGrid ()
 Update the values in the signals grid.
 
void updatePlotCursors ()
 Update the cursor values (in the grid) and graphics (in the plot window).
 
void applyUserDefinedSignals ()
 Apply user-defined signals to the SPICE session.
 
void rebuildMeasurementsGrid ()
 Rebuild the measurements grid for the current plot.
 
void updateMeasurementsFromGrid ()
 
void applyTuners ()
 Apply component values specified using tuner sliders to the current netlist.
 
SIM_TRACE_TYPE getXAxisType (SIM_TYPE aType) const
 Return X axis for a given simulation type.
 
wxString getNoiseSource () const
 
void parseTraceParams (SIM_PLOT_TAB *aPlotTab, TRACE *aTrace, const wxString &aSignalName, const wxString &aParams)
 
std::shared_ptr< SPICE_SIMULATORsimulator () const
 
std::shared_ptr< SPICE_CIRCUIT_MODELcircuitModel () const
 
void onPlotClose (wxAuiNotebookEvent &event) override
 
void onPlotClosed (wxAuiNotebookEvent &event) override
 
void onPlotChanging (wxAuiNotebookEvent &event) override
 
void onPlotChanged (wxAuiNotebookEvent &event) override
 
void onPlotDragged (wxAuiNotebookEvent &event) override
 
void OnFilterText (wxCommandEvent &aEvent) override
 
void OnFilterMouseMoved (wxMouseEvent &aEvent) override
 
void onSignalsGridCellChanged (wxGridEvent &aEvent) override
 
void onCursorsGridCellChanged (wxGridEvent &aEvent) override
 
void onMeasurementsGridCellChanged (wxGridEvent &aEvent) override
 
void OnUpdateUI (wxUpdateUIEvent &event) override
 
bool loadLegacyWorkbook (const wxString &aPath)
 
bool loadJsonWorkbook (const wxString &aPath)
 
void onPlotCursorUpdate (wxCommandEvent &aEvent)
 

Private Attributes

SIMULATOR_FRAMEm_simulatorFrame
 
SCH_EDIT_FRAMEm_schematicFrame
 
std::vector< wxString > m_signals
 
std::map< int, wxString > m_userDefinedSignals
 
std::list< TUNER_SLIDER * > m_tuners
 SPICE expressions need quoted versions of the netnames since KiCad allows '-' and '/' in netnames.
 
std::map< wxString, wxString > m_quotedNetnames
 
SPICE_VALUE_FORMAT m_cursorFormats [3][2]
 
int m_splitterLeftRightSashPosition
 
int m_splitterPlotAndConsoleSashPosition
 
int m_splitterSignalsSashPosition
 
int m_splitterCursorsSashPosition
 
int m_splitterTuneValuesSashPosition
 
bool m_darkMode
 
unsigned int m_plotNumber
 
wxTimer m_refreshTimer
 
SIM_PREFERENCES m_preferences
 

Detailed Description

The SIMULATOR_FRAME_UI holds the main user-interface for running simulations.

It contains a workbook with multiple tabs, each tab holding a SIM_PLOT_TAB, a specific simulation command (.TRAN, .AC, etc.), and simulation settings (save all currents, etc.).

Each plot can have multiple TRACEs. While internally each TRACE can have multiple cursors, the GUI supports only two cursors (and a differential cursor) for each plot.

TRACEs are identified by a signal (V(OUT), I(R2), etc.) and a type (SPT_VOLTAGE, SPT_AC_PHASE, etc.).

The simulator outputs simple signals in a vector of the same name. Complex signals (such as V(OUT) / V(IN)) are stored in vectors of the format "user%d".

Definition at line 70 of file simulator_frame_ui.h.

Constructor & Destructor Documentation

◆ SIMULATOR_FRAME_UI()

◆ ~SIMULATOR_FRAME_UI()

SIMULATOR_FRAME_UI::~SIMULATOR_FRAME_UI ( )

Member Function Documentation

◆ AddMeasurement()

void SIMULATOR_FRAME_UI::AddMeasurement ( const wxString &  aCmd)

◆ AddTrace()

void SIMULATOR_FRAME_UI::AddTrace ( const wxString &  aName,
SIM_TRACE_TYPE  aType 
)

Add a new trace to the current plot.

Parameters
aNameis the device/net name.
aTypedescribes the type of trace.

Definition at line 1556 of file simulator_frame_ui.cpp.

References _, SPICE_CIRCUIT_MODEL::CommandToSimType(), GetCurrentSimTab(), SIM_TAB::IsPlottable(), SIMULATOR_FRAME_UI_BASE::m_simConsole, OnModify(), SPT_AC_GAIN, SPT_AC_PHASE, ST_AC, ST_SP, ST_UNKNOWN, updateSignalsGrid(), and updateTrace().

Referenced by SIMULATOR_FRAME::AddCurrentTrace(), and SIMULATOR_FRAME::AddVoltageTrace().

◆ AddTuner()

◆ ApplyPreferences()

void SIMULATOR_FRAME_UI::ApplyPreferences ( const SIM_PREFERENCES aPrefs)

Called when settings are changed via the common Preferences dialog.

Definition at line 653 of file simulator_frame_ui.cpp.

References SIMULATOR_FRAME_UI_BASE::m_plotNotebook, and m_preferences.

Referenced by SIMULATOR_FRAME::CommonSettingsChanged().

◆ applyTuners()

◆ applyUserDefinedSignals()

void SIMULATOR_FRAME_UI::applyUserDefinedSignals ( )
private

Apply user-defined signals to the SPICE session.

Definition at line 1842 of file simulator_frame_ui.cpp.

References m_quotedNetnames, m_userDefinedSignals, and simulator().

Referenced by OnSimRefresh(), and SetUserDefinedSignals().

◆ circuitModel()

std::shared_ptr< SPICE_CIRCUIT_MODEL > SIMULATOR_FRAME_UI::circuitModel ( ) const
private

◆ DarkModePlots()

bool SIMULATOR_FRAME_UI::DarkModePlots ( ) const
inline

Definition at line 164 of file simulator_frame_ui.h.

References m_darkMode.

Referenced by SIMULATOR_FRAME::setupUIConditions().

◆ DeleteMeasurement()

void SIMULATOR_FRAME_UI::DeleteMeasurement ( int  aRow)

Delete a row from the measurements grid.

Definition at line 1224 of file simulator_frame_ui.cpp.

References SIMULATOR_FRAME_UI_BASE::m_measurementsGrid.

Referenced by MEASUREMENTS_GRID_TRICKS::doPopupSelection().

◆ DoFourier()

void SIMULATOR_FRAME_UI::DoFourier ( const wxString &  aSignal,
const wxString &  aFundamental 
)

Definition at line 1540 of file simulator_frame_ui.cpp.

References simulator().

Referenced by SIGNALS_GRID_TRICKS::doPopupSelection().

◆ GetCurrentSimTab()

◆ GetCursorFormat()

SPICE_VALUE_FORMAT SIMULATOR_FRAME_UI::GetCursorFormat ( int  aCursorId,
int  aValueCol 
) const
inline

Get/Set the number of significant digits and the range for formatting a cursor value.

Parameters
aValueCol0 indicates the X value column; 1 the Y value.

Definition at line 102 of file simulator_frame_ui.h.

References m_cursorFormats.

Referenced by CURSORS_GRID_TRICKS::doPopupSelection().

◆ GetExporter()

const SPICE_CIRCUIT_MODEL * SIMULATOR_FRAME_UI::GetExporter ( ) const

Return the netlist exporter object used for simulations.

Definition at line 1550 of file simulator_frame_ui.cpp.

References circuitModel().

Referenced by AddTuner(), applyTuners(), and TUNER_SLIDER::TUNER_SLIDER().

◆ GetMeasureFormat()

SPICE_VALUE_FORMAT SIMULATOR_FRAME_UI::GetMeasureFormat ( int  aRow) const

Get/Set the format of a value in the measurements grid.

Definition at line 1210 of file simulator_frame_ui.cpp.

References COL_MEASUREMENT_FORMAT, SPICE_VALUE_FORMAT::FromString(), and SIMULATOR_FRAME_UI_BASE::m_measurementsGrid.

Referenced by MEASUREMENTS_GRID_TRICKS::doPopupSelection(), and UpdateMeasurement().

◆ getNoiseSource()

wxString SIMULATOR_FRAME_UI::getNoiseSource ( ) const
private

Definition at line 2341 of file simulator_frame_ui.cpp.

References circuitModel(), GetCurrentSimTab(), and scale.

Referenced by vectorNameFromSignalName().

◆ GetSimTab()

SIM_TAB * SIMULATOR_FRAME_UI::GetSimTab ( SIM_TYPE  aType) const
inline

◆ GetSimTabIndex()

int SIMULATOR_FRAME_UI::GetSimTabIndex ( SIM_TAB aPlot) const
inline

◆ getXAxisType()

SIM_TRACE_TYPE SIMULATOR_FRAME_UI::getXAxisType ( SIM_TYPE  aType) const
private

Return X axis for a given simulation type.

Todo:
SPT_LOG_FREQUENCY

Definition at line 2325 of file simulator_frame_ui.cpp.

References SPT_LIN_FREQUENCY, SPT_SWEEP, SPT_TIME, SPT_UNKNOWN, ST_AC, ST_DC, ST_FFT, ST_NOISE, ST_SP, and ST_TRAN.

Referenced by updateTrace().

◆ InitWorkbook()

void SIMULATOR_FRAME_UI::InitWorkbook ( )

Load the currently active workbook stored in the project settings.

If there is none, generate a filename for the currently active workbook and store it in the project settings.

Definition at line 668 of file simulator_frame_ui.cpp.

References circuitModel(), PROJECT::GetProjectPath(), SIMULATOR_FRAME::LoadSimulator(), LoadWorkbook(), SIMULATOR_FRAME_UI_BASE::m_filter, m_schematicFrame, m_simulatorFrame, NewSimTab(), NETLIST_EXPORTER_SPICE::OPTION_DEFAULT_FLAGS, KIWAY_HOLDER::Prj(), rebuildSignalsGrid(), rebuildSignalsList(), SIM_TAB::SetSimOptions(), and simulator().

◆ loadJsonWorkbook()

◆ loadLegacyWorkbook()

◆ LoadSettings()

◆ LoadWorkbook()

◆ m_splitterCursorsOnIdle()

void SIMULATOR_FRAME_UI_BASE::m_splitterCursorsOnIdle ( wxIdleEvent &  )
inlineinherited

◆ m_splitterLeftRightOnIdle()

void SIMULATOR_FRAME_UI_BASE::m_splitterLeftRightOnIdle ( wxIdleEvent &  )
inlineinherited

◆ m_splitterMeasurementsOnIdle()

void SIMULATOR_FRAME_UI_BASE::m_splitterMeasurementsOnIdle ( wxIdleEvent &  )
inlineinherited

◆ m_splitterPlotAndConsoleOnIdle()

void SIMULATOR_FRAME_UI_BASE::m_splitterPlotAndConsoleOnIdle ( wxIdleEvent &  )
inlineinherited

◆ m_splitterSignalsOnIdle()

void SIMULATOR_FRAME_UI_BASE::m_splitterSignalsOnIdle ( wxIdleEvent &  )
inlineinherited

◆ NewSimTab()

SIM_TAB * SIMULATOR_FRAME_UI::NewSimTab ( const wxString &  aSimCommand)

Create a new simulation tab for a given simulation type.

Parameters
aSimCommandis requested simulation command.

Definition at line 985 of file simulator_frame_ui.cpp.

References _, SIM_PLOT_TAB::ApplyPreferences(), SPICE_CIRCUIT_MODEL::CommandToSimType(), SIM_TAB::IsPlottable(), SIMULATOR_FRAME_UI_BASE::m_plotNotebook, m_plotNumber, m_preferences, and simulator().

Referenced by InitWorkbook(), loadJsonWorkbook(), loadLegacyWorkbook(), and SIMULATOR_FRAME::NewSimTab().

◆ onCursorsGridCellChanged()

void SIMULATOR_FRAME_UI::onCursorsGridCellChanged ( wxGridEvent &  aEvent)
overrideprivatevirtual

◆ OnFilterMouseMoved()

void SIMULATOR_FRAME_UI::OnFilterMouseMoved ( wxMouseEvent &  aEvent)
overrideprivatevirtual

Reimplemented from SIMULATOR_FRAME_UI_BASE.

Definition at line 1016 of file simulator_frame_ui.cpp.

References SIMULATOR_FRAME_UI_BASE::m_filter.

◆ OnFilterText()

void SIMULATOR_FRAME_UI::OnFilterText ( wxCommandEvent &  aEvent)
overrideprivatevirtual

Reimplemented from SIMULATOR_FRAME_UI_BASE.

Definition at line 1010 of file simulator_frame_ui.cpp.

References SIMULATOR_FRAME_UI_BASE::m_filter, and rebuildSignalsGrid().

◆ onMeasurementsGridCellChanged()

void SIMULATOR_FRAME_UI::onMeasurementsGridCellChanged ( wxGridEvent &  aEvent)
overrideprivatevirtual

◆ OnModify()

◆ onPlotChanged()

void SIMULATOR_FRAME_UI::onPlotChanged ( wxAuiNotebookEvent &  event)
overrideprivatevirtual

Reimplemented from SIMULATOR_FRAME_UI_BASE.

Definition at line 2452 of file simulator_frame_ui.cpp.

References GetCurrentSimTab(), OnPlotSettingsChanged(), and simulator().

◆ onPlotChanging()

void SIMULATOR_FRAME_UI::onPlotChanging ( wxAuiNotebookEvent &  event)
overrideprivatevirtual

◆ onPlotClose()

void SIMULATOR_FRAME_UI::onPlotClose ( wxAuiNotebookEvent &  event)
overrideprivatevirtual

Reimplemented from SIMULATOR_FRAME_UI_BASE.

Definition at line 2384 of file simulator_frame_ui.cpp.

References OnModify().

◆ onPlotClosed()

◆ onPlotCursorUpdate()

void SIMULATOR_FRAME_UI::onPlotCursorUpdate ( wxCommandEvent &  aEvent)
private

Definition at line 2658 of file simulator_frame_ui.cpp.

References OnModify(), and updatePlotCursors().

Referenced by SetCursorFormat(), and SIMULATOR_FRAME_UI().

◆ onPlotDragged()

void SIMULATOR_FRAME_UI::onPlotDragged ( wxAuiNotebookEvent &  event)
overrideprivatevirtual

Reimplemented from SIMULATOR_FRAME_UI_BASE.

Definition at line 2486 of file simulator_frame_ui.cpp.

◆ OnPlotSettingsChanged()

◆ onSignalsGridCellChanged()

◆ OnSimRefresh()

◆ OnSimReport()

void SIMULATOR_FRAME_UI::OnSimReport ( const wxString &  aMsg)

◆ OnSimUpdate()

◆ OnUpdateUI()

void SIMULATOR_FRAME_UI::OnUpdateUI ( wxUpdateUIEvent &  event)
overrideprivatevirtual

Reimplemented from SIMULATOR_FRAME_UI_BASE.

Definition at line 1278 of file simulator_frame_ui.cpp.

References GetCurrentSimTab(), and OnModify().

◆ parseTraceParams()

void SIMULATOR_FRAME_UI::parseTraceParams ( SIM_PLOT_TAB aPlotTab,
TRACE aTrace,
const wxString &  aSignalName,
const wxString &  aParams 
)
private

◆ rebuildMeasurementsGrid()

void SIMULATOR_FRAME_UI::rebuildMeasurementsGrid ( )
private

◆ rebuildSignalsGrid()

◆ rebuildSignalsList()

◆ RemoveTuner()

void SIMULATOR_FRAME_UI::RemoveTuner ( TUNER_SLIDER aTuner)

Remove an existing tuner.

Definition at line 1488 of file simulator_frame_ui.cpp.

References SIMULATOR_FRAME_UI_BASE::m_panelTuners, m_tuners, and OnModify().

Referenced by TUNER_SLIDER::onClose().

◆ SaveSettings()

◆ SaveWorkbook()

◆ SetCursorFormat()

void SIMULATOR_FRAME_UI::SetCursorFormat ( int  aCursorId,
int  aValueCol,
const SPICE_VALUE_FORMAT aFormat 
)
inline

Definition at line 107 of file simulator_frame_ui.h.

References dummy, m_cursorFormats, and onPlotCursorUpdate().

Referenced by CURSORS_GRID_TRICKS::doPopupSelection().

◆ SetMeasureFormat()

void SIMULATOR_FRAME_UI::SetMeasureFormat ( int  aRow,
const SPICE_VALUE_FORMAT aFormat 
)

◆ SetSubWindowsSashSize()

◆ SetUserDefinedSignals()

◆ ShowChangedLanguage()

◆ Signals()

std::vector< wxString > SIMULATOR_FRAME_UI::Signals ( ) const

Definition at line 2697 of file simulator_frame_ui.cpp.

References m_signals, m_userDefinedSignals, and sortSignals().

Referenced by SIMULATOR_FRAME::Signals().

◆ SimPlotVectors()

std::vector< wxString > SIMULATOR_FRAME_UI::SimPlotVectors ( ) const

Definition at line 2686 of file simulator_frame_ui.cpp.

References simulator().

Referenced by SIMULATOR_FRAME::SimPlotVectors().

◆ simulator()

◆ ToggleDarkModePlots()

◆ UpdateMeasurement()

void SIMULATOR_FRAME_UI::UpdateMeasurement ( int  aRow)

Update a measurement in the measurements grid.

The user measurement looks something like: MAX V(out)

We need to send ngspice a "MEAS" command with the analysis type, an output variable name, and the signal name. For our example above, this looks something like: MEAS TRAN meas_result_0 MAX V(out)

This is also a good time to harvest the signal name prefix so we know what units to show on the result. For instance, for: MAX P(out) we want to show: 15W

Definition at line 1305 of file simulator_frame_ui.cpp.

References COL_MEASUREMENT, COL_MEASUREMENT_VALUE, GetCurrentSimTab(), GetMeasureFormat(), SIM_TAB::GetSimType(), SIMULATOR_FRAME_UI_BASE::m_measurementsGrid, m_simulatorFrame, SetMeasureFormat(), SIMULATOR_FRAME::SimFinished(), simulator(), ST_AC, ST_DC, ST_DISTO, ST_FFT, ST_NOISE, ST_OP, ST_PZ, ST_SENS, ST_SP, ST_TF, ST_TRAN, text, SPICE_VALUE::ToString(), updateMeasurementsFromGrid(), and SPICE_VALUE_FORMAT::UpdateUnits().

Referenced by AddMeasurement(), MEASUREMENTS_GRID_TRICKS::doPopupSelection(), onMeasurementsGridCellChanged(), OnPlotSettingsChanged(), and OnSimRefresh().

◆ updateMeasurementsFromGrid()

void SIMULATOR_FRAME_UI::updateMeasurementsFromGrid ( )
private

◆ updatePlotCursors()

◆ updateSignalsGrid()

◆ updateTrace()

void SIMULATOR_FRAME_UI::updateTrace ( const wxString &  aVectorName,
int  aTraceType,
SIM_PLOT_TAB aPlotTab,
std::vector< double > *  aDataX = nullptr,
bool  aClearData = false 
)
private

Update a trace in a particular SIM_PLOT_TAB.

If the panel does not contain the given trace, then add it.

Parameters
aVectorNameis the SPICE vector name, such as "I(Net-C1-Pad1)".
aTraceTypedescribes the type of plot.
aPlotTabis the tab that should receive the update.

Definition at line 1676 of file simulator_frame_ui.cpp.

References circuitModel(), SPICE_CIRCUIT_MODEL::CommandToSimType(), SIM_PLOT_TAB::GetOrAddTrace(), SIM_TAB::GetSimCommand(), getXAxisType(), SIM_TAB::IsPlottable(), KiROUND(), SPICE_DC_PARAMS::m_source, SPICE_DC_PARAMS::m_vend, SPICE_DC_PARAMS::m_vincrement, SPICE_DC_PARAMS::m_vstart, SIM_PLOT_TAB::SetTraceData(), simulator(), SPT_AC_GAIN, SPT_AC_PHASE, SPT_POWER, SPT_SP_AMP, SPT_Y_AXIS_MASK, ST_AC, ST_DC, ST_FFT, ST_NOISE, ST_SP, ST_TRAN, and SPICE_VALUE::ToDouble().

Referenced by AddTrace(), onSignalsGridCellChanged(), and OnSimRefresh().

◆ UpdateTunerValue()

void SIMULATOR_FRAME_UI::UpdateTunerValue ( const SCH_SHEET_PATH aSheetPath,
const KIID aSymbol,
const wxString &  aRef,
const wxString &  aValue 
)

Safely update a field of the associated symbol without dereferencing the symbol.

Parameters
aSymbolid of the symbol needing updating
aIdid of the symbol field
aValuenew value of the symbol field

Definition at line 1454 of file simulator_frame_ui.cpp.

References _, SIM_LIB_MGR::CreateModel(), DisplayErrorMessage(), SCH_SYMBOL::GetFields(), SCH_SHEET_PATH::GetItem(), SIM_MODEL::GetTunerParam(), SIM_MODEL::PARAM::info, m_schematicFrame, SIM_MODEL::PARAM::INFO::name, SCH_EDIT_FRAME::OnModify(), KIWAY_HOLDER::Prj(), SIM_MODEL::SetParamValue(), SCH_EDIT_FRAME::UpdateItem(), and SIM_MODEL::WriteFields().

Referenced by TUNER_SLIDER::onSave().

◆ UserDefinedSignals()

const std::map< int, wxString > & SIMULATOR_FRAME_UI::UserDefinedSignals ( )
inline

Definition at line 87 of file simulator_frame_ui.h.

References m_userDefinedSignals.

Referenced by SIMULATOR_FRAME::UserDefinedSignals().

◆ vectorNameFromSignalName()

wxString SIMULATOR_FRAME_UI::vectorNameFromSignalName ( SIM_PLOT_TAB aPlotTab,
const wxString &  aSignalName,
int *  aTraceType 
)
private

Get the simulator output vector name for a given signal name and type.

For user-defined signals we display the user-oriented signal name such as "V(out)-V(in)", but the simulator vector we actually have to plot will be "user0" or some-such.

Definition at line 1041 of file simulator_frame_ui.cpp.

References _, getNoiseSource(), SIM_TAB::GetSimType(), m_userDefinedSignals, name, SPT_AC_GAIN, SPT_AC_PHASE, SPT_CURRENT, SPT_POWER, SPT_SP_AMP, SPT_VOLTAGE, ST_NOISE, and vectorNameFromSignalId().

Referenced by loadJsonWorkbook(), loadLegacyWorkbook(), onSignalsGridCellChanged(), OnSimRefresh(), rebuildSignalsGrid(), SetUserDefinedSignals(), and updateSignalsGrid().

Member Data Documentation

◆ m_cursorFormats

SPICE_VALUE_FORMAT SIMULATOR_FRAME_UI::m_cursorFormats[3][2]
private

◆ m_cursorsGrid

◆ m_darkMode

bool SIMULATOR_FRAME_UI::m_darkMode
private

◆ m_filter

◆ m_measurementsGrid

◆ m_panelCMT

wxPanel* SIMULATOR_FRAME_UI_BASE::m_panelCMT
protectedinherited

◆ m_panelConsole

wxPanel* SIMULATOR_FRAME_UI_BASE::m_panelConsole
protectedinherited

◆ m_panelCursors

wxPanel* SIMULATOR_FRAME_UI_BASE::m_panelCursors
protectedinherited

◆ m_panelLeft

wxPanel* SIMULATOR_FRAME_UI_BASE::m_panelLeft
protectedinherited

◆ m_panelMeasurements

wxPanel* SIMULATOR_FRAME_UI_BASE::m_panelMeasurements
protectedinherited

◆ m_panelMT

wxPanel* SIMULATOR_FRAME_UI_BASE::m_panelMT
protectedinherited

◆ m_panelSignals

wxPanel* SIMULATOR_FRAME_UI_BASE::m_panelSignals
protectedinherited

◆ m_panelTuners

wxPanel* SIMULATOR_FRAME_UI_BASE::m_panelTuners
protectedinherited

◆ m_plotNotebook

◆ m_plotNumber

unsigned int SIMULATOR_FRAME_UI::m_plotNumber
private

Definition at line 349 of file simulator_frame_ui.h.

Referenced by NewSimTab().

◆ m_plotPanel

wxPanel* SIMULATOR_FRAME_UI_BASE::m_plotPanel
protectedinherited

◆ m_preferences

SIM_PREFERENCES SIMULATOR_FRAME_UI::m_preferences
private

Definition at line 351 of file simulator_frame_ui.h.

Referenced by ApplyPreferences(), LoadSettings(), and NewSimTab().

◆ m_quotedNetnames

std::map<wxString, wxString> SIMULATOR_FRAME_UI::m_quotedNetnames
private

Definition at line 338 of file simulator_frame_ui.h.

Referenced by applyUserDefinedSignals(), and rebuildSignalsList().

◆ m_refreshTimer

wxTimer SIMULATOR_FRAME_UI::m_refreshTimer
private

Definition at line 350 of file simulator_frame_ui.h.

Referenced by OnSimRefresh(), OnSimUpdate(), and SIMULATOR_FRAME_UI().

◆ m_schematicFrame

SCH_EDIT_FRAME* SIMULATOR_FRAME_UI::m_schematicFrame
private

◆ m_sidePanel

wxPanel* SIMULATOR_FRAME_UI_BASE::m_sidePanel
protectedinherited

◆ m_sideSizer

wxBoxSizer* SIMULATOR_FRAME_UI_BASE::m_sideSizer
protectedinherited

◆ m_signals

std::vector<wxString> SIMULATOR_FRAME_UI::m_signals
private

◆ m_signalsGrid

◆ m_simConsole

wxTextCtrl* SIMULATOR_FRAME_UI_BASE::m_simConsole
protectedinherited

◆ m_simulatorFrame

◆ m_sizer11

wxBoxSizer* SIMULATOR_FRAME_UI_BASE::m_sizer11
protectedinherited

◆ m_sizerConsole

wxBoxSizer* SIMULATOR_FRAME_UI_BASE::m_sizerConsole
protectedinherited

◆ m_sizerPlot

wxBoxSizer* SIMULATOR_FRAME_UI_BASE::m_sizerPlot
protectedinherited

◆ m_sizerTuners

wxBoxSizer* SIMULATOR_FRAME_UI_BASE::m_sizerTuners
protectedinherited

◆ m_splitterCursors

wxSplitterWindow* SIMULATOR_FRAME_UI_BASE::m_splitterCursors
protectedinherited

◆ m_splitterCursorsSashPosition

int SIMULATOR_FRAME_UI::m_splitterCursorsSashPosition
private

Definition at line 346 of file simulator_frame_ui.h.

Referenced by LoadSettings(), and SetSubWindowsSashSize().

◆ m_splitterLeftRight

wxSplitterWindow* SIMULATOR_FRAME_UI_BASE::m_splitterLeftRight
protectedinherited

◆ m_splitterLeftRightSashPosition

int SIMULATOR_FRAME_UI::m_splitterLeftRightSashPosition
private

Definition at line 343 of file simulator_frame_ui.h.

Referenced by LoadSettings(), and SetSubWindowsSashSize().

◆ m_splitterMeasurements

wxSplitterWindow* SIMULATOR_FRAME_UI_BASE::m_splitterMeasurements
protectedinherited

◆ m_splitterPlotAndConsole

wxSplitterWindow* SIMULATOR_FRAME_UI_BASE::m_splitterPlotAndConsole
protectedinherited

◆ m_splitterPlotAndConsoleSashPosition

int SIMULATOR_FRAME_UI::m_splitterPlotAndConsoleSashPosition
private

Definition at line 344 of file simulator_frame_ui.h.

Referenced by LoadSettings(), and SetSubWindowsSashSize().

◆ m_splitterSignals

wxSplitterWindow* SIMULATOR_FRAME_UI_BASE::m_splitterSignals
protectedinherited

◆ m_splitterSignalsSashPosition

int SIMULATOR_FRAME_UI::m_splitterSignalsSashPosition
private

Definition at line 345 of file simulator_frame_ui.h.

Referenced by LoadSettings(), and SetSubWindowsSashSize().

◆ m_splitterTuneValuesSashPosition

int SIMULATOR_FRAME_UI::m_splitterTuneValuesSashPosition
private

Definition at line 347 of file simulator_frame_ui.h.

Referenced by LoadSettings(), and SetSubWindowsSashSize().

◆ m_SuppressGridEvents

◆ m_tuners

std::list<TUNER_SLIDER*> SIMULATOR_FRAME_UI::m_tuners
private

SPICE expressions need quoted versions of the netnames since KiCad allows '-' and '/' in netnames.

Definition at line 334 of file simulator_frame_ui.h.

Referenced by AddTuner(), applyTuners(), RemoveTuner(), and ShowChangedLanguage().

◆ m_userDefinedSignals


The documentation for this class was generated from the following files: