KiCad PCB EDA Suite
dialog_sim_settings.cpp
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-2021 CERN
5  * Copyright (C) 2016-2021 KiCad Developers, see AUTHORS.txt for contributors.
6  * @author Maciej Suminski <[email protected]>
7  *
8  * This program is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU General Public License
10  * as published by the Free Software Foundation; either version 3
11  * of the License, or (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program; if not, you may find one here:
20  * https://www.gnu.org/licenses/gpl-3.0.html
21  * or you may search the http://www.gnu.org website for the version 3 license,
22  * or you may write to the Free Software Foundation, Inc.,
23  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
24  */
25 
26 #include "dialog_sim_settings.h"
28 #include <sim/ngspice.h>
29 
30 #include <confirm.h>
31 
32 #include <wx/tokenzr.h>
33 
34 #include <vector>
35 #include <utility>
36 
38 //so there are a few tabs missing (e.g. pole-zero, distortion, sensitivity)
39 
40 // Helper function to shorten conditions
41 static bool empty( const wxTextEntryBase* aCtrl )
42 {
43  return aCtrl->GetValue().IsEmpty();
44 }
45 
46 
47 static void setStringSelection( wxChoice* aCtrl, const wxString& aStr )
48 {
49  aCtrl->SetSelection( aCtrl->FindString( aStr ) );
50 }
51 
52 
53 static wxString getStringSelection( const wxChoice* aCtrl )
54 {
55  return aCtrl->GetString( aCtrl->GetSelection() );
56 }
57 
58 
60  std::shared_ptr<SPICE_SIMULATOR_SETTINGS>& aSettings ) :
61  DIALOG_SIM_SETTINGS_BASE( aParent ),
62  m_exporter( nullptr ),
63  m_settings( aSettings ),
64  m_spiceEmptyValidator( true )
65 {
66  m_posIntValidator.SetMin( 1 );
67 
68  m_acPointsNumber->SetValidator( m_posIntValidator );
69  m_acFreqStart->SetValidator( m_spiceValidator );
70  m_acFreqStop->SetValidator( m_spiceValidator );
71 
72  m_dcStart1->SetValidator( m_spiceValidator );
73  m_dcStop1->SetValidator( m_spiceValidator );
74  m_dcIncr1->SetValidator( m_spiceValidator );
75 
76  m_dcStart2->SetValidator( m_spiceValidator );
77  m_dcStop2->SetValidator( m_spiceValidator );
78  m_dcIncr2->SetValidator( m_spiceValidator );
79 
80  m_noisePointsNumber->SetValidator( m_posIntValidator );
81  m_noiseFreqStart->SetValidator( m_spiceValidator );
82  m_noiseFreqStop->SetValidator( m_spiceValidator );
83 
84  m_transStep->SetValidator( m_spiceValidator );
85  m_transFinal->SetValidator( m_spiceValidator );
86  m_transInitial->SetValidator( m_spiceEmptyValidator );
87 
89 
90  // Hide pages that aren't fully implemented yet
91  // wxPanel::Hide() isn't enough on some platforms
92  m_simPages->RemovePage( m_simPages->FindPage( m_pgDistortion ) );
93  m_simPages->RemovePage( m_simPages->FindPage( m_pgNoise ) );
94  m_simPages->RemovePage( m_simPages->FindPage( m_pgPoleZero ) );
95  m_simPages->RemovePage( m_simPages->FindPage( m_pgSensitivity ) );
96  m_simPages->RemovePage( m_simPages->FindPage( m_pgTransferFunction ) );
97 
98  if( !dynamic_cast<NGSPICE_SIMULATOR_SETTINGS*>( aSettings.get() ) )
99  m_compatibilityMode->Show( false );
100 
101  m_sdbSizerOK->SetDefault();
103 }
104 
105 wxString DIALOG_SIM_SETTINGS::evaluateDCControls( wxChoice* aDcSource, wxTextCtrl* aDcStart,
106  wxTextCtrl* aDcStop, wxTextCtrl* aDcIncr )
107 {
108  wxString dcSource = aDcSource->GetString( aDcSource->GetSelection() );
109  wxWindow* ctrlWithError = nullptr;
110 
111  if( dcSource.IsEmpty() )
112  {
113  DisplayError( this, _( "You need to select DC source" ) );
114  ctrlWithError = aDcSource;
115  }
117  // hence try..catch below
118  else if( !aDcStart->Validate() )
119  ctrlWithError = aDcStart;
120  else if( !aDcStop->Validate() )
121  ctrlWithError = aDcStop;
122  else if( !aDcIncr->Validate() )
123  ctrlWithError = aDcIncr;
124 
125  if( ctrlWithError )
126  {
127  ctrlWithError->SetFocus();
128  return wxEmptyString;
129  }
130 
131  try
132  {
133  // pick device name from exporter when something different than temperature is selected
134  if( dcSource.Cmp( wxT( "TEMP" ) ) )
135  dcSource = m_exporter->GetSpiceDevice( dcSource );
136 
137  return wxString::Format( wxT( "%s %s %s %s" ), dcSource,
138  SPICE_VALUE( aDcStart->GetValue() ).ToSpiceString(),
139  SPICE_VALUE( aDcStop->GetValue() ).ToSpiceString(),
140  SPICE_VALUE( aDcIncr->GetValue() ).ToSpiceString() );
141  }
142  catch( std::exception& e )
143  {
144  DisplayError( this, e.what() );
145  return wxEmptyString;
146  }
147  catch( const KI_PARAM_ERROR& e )
148  {
149  DisplayError( this, e.What() );
150  return wxEmptyString;
151  }
152  catch( ... )
153  {
154  return wxEmptyString;
155  }
156 }
157 
158 
160 {
161  if( !wxDialog::TransferDataFromWindow() )
162  return false;
163 
164  // The simulator dependent settings always get transferred.
165  NGSPICE_SIMULATOR_SETTINGS* ngspiceSettings =
166  dynamic_cast<NGSPICE_SIMULATOR_SETTINGS*>( m_settings.get() );
167 
168  if( ngspiceSettings )
169  {
170  switch( m_compatibilityModeChoice->GetSelection() )
171  {
172  case 0: ngspiceSettings->SetModelMode( NGSPICE_MODEL_MODE::USER_CONFIG ); break;
173  case 1: ngspiceSettings->SetModelMode( NGSPICE_MODEL_MODE::NGSPICE ); break;
174  case 2: ngspiceSettings->SetModelMode( NGSPICE_MODEL_MODE::PSPICE ); break;
175  case 3: ngspiceSettings->SetModelMode( NGSPICE_MODEL_MODE::LTSPICE ); break;
176  case 4: ngspiceSettings->SetModelMode( NGSPICE_MODEL_MODE::LT_PSPICE ); break;
177  case 5: ngspiceSettings->SetModelMode( NGSPICE_MODEL_MODE::HSPICE ); break;
178  }
179  }
180 
181  wxString previousSimCommand = m_simCommand;
182  wxWindow* page = m_simPages->GetCurrentPage();
183 
184  if( page == m_pgAC ) // AC analysis
185  {
186  if( !m_pgAC->Validate() )
187  return false;
188 
189  m_simCommand.Printf( wxT( ".ac %s %s %s %s" ),
190  scaleToString( m_acScale->GetSelection() ),
191  m_acPointsNumber->GetValue(),
192  SPICE_VALUE( m_acFreqStart->GetValue() ).ToSpiceString(),
193  SPICE_VALUE( m_acFreqStop->GetValue() ).ToSpiceString() );
194  }
195  else if( page == m_pgDC ) // DC transfer analysis
196  {
197  wxString simCmd = wxString( wxT( ".dc " ) );
198 
200 
201  if( src1.IsEmpty() )
202  return false;
203  else
204  simCmd += src1;
205 
206  if( m_dcEnable2->IsChecked() )
207  {
209 
210  if( src2.IsEmpty() )
211  return false;
212  else
213  simCmd += wxT( " " ) + src2;
214 
215  if( m_dcSource1->GetStringSelection() == m_dcSource2->GetStringSelection() )
216  {
217  DisplayError( this, _( "Source 1 and Source 2 must be different" ) );
218  return false;
219  }
220  }
221 
222  m_simCommand = simCmd;
223  }
224  else if( page == m_pgNoise ) // Noise analysis
225  {
226  const std::map<wxString, int>& netMap = m_exporter->GetNetIndexMap();
227 
230  {
231  return false;
232  }
233 
234  wxString ref;
235 
236  if( !empty( m_noiseRef ) )
237  ref = wxString::Format( wxT( ", %d" ), netMap.at( m_noiseRef->GetValue() ) );
238 
239  wxString noiseSource = m_exporter->GetSpiceDevice( m_noiseSrc->GetValue() );
240 
241  // Add voltage source prefix if needed
242  if( noiseSource[0] != 'v' && noiseSource[0] != 'V' )
243  noiseSource += 'v' + noiseSource;
244 
245  m_simCommand.Printf( wxT( ".noise v(%d%s) %s %s %s %s %s" ),
246  netMap.at( m_noiseMeas->GetValue() ), ref,
247  noiseSource, scaleToString( m_noiseScale->GetSelection() ),
248  m_noisePointsNumber->GetValue(),
249  SPICE_VALUE( m_noiseFreqStart->GetValue() ).ToSpiceString(),
250  SPICE_VALUE( m_noiseFreqStop->GetValue() ).ToSpiceString() );
251  }
252  else if( page == m_pgOP ) // DC operating point analysis
253  {
254  m_simCommand = wxString( wxT( ".op" ) );
255  }
256  else if( page == m_pgTransient ) // Transient analysis
257  {
258  if( !m_pgTransient->Validate() )
259  return false;
260 
261  wxString initial;
262 
263  if( !empty( m_transInitial ) )
264  initial = SPICE_VALUE( m_transInitial->GetValue() ).ToSpiceString();
265 
266  m_simCommand.Printf( wxT( ".tran %s %s %s" ),
267  SPICE_VALUE( m_transStep->GetValue() ).ToSpiceString(),
268  SPICE_VALUE( m_transFinal->GetValue() ).ToSpiceString(),
269  initial );
270  }
271  else if( page == m_pgCustom ) // Custom directives
272  {
273  m_simCommand = m_customTxt->GetValue();
274  }
275  else
276  {
277  wxString extendedMsg;
278 
279  if( m_simCommand.IsEmpty() )
280  {
281  KIDIALOG dlg( this, _( "No valid simulation is configured." ), _( "Warning" ),
282  wxOK | wxCANCEL | wxICON_EXCLAMATION | wxCENTER );
283 
284  dlg.SetExtendedMessage( _( "A valid simulation can be configured by selecting a "
285  "simulation tab, setting the simulation parameters and "
286  "clicking the OK button with the tab selected." ) );
287  dlg.SetOKCancelLabels(
288  wxMessageDialog::ButtonLabel( _( "Exit Without Valid Simulation" ) ),
289  wxMessageDialog::ButtonLabel( _( "Configure Valid Simulation" ) ) );
290  dlg.DoNotShowCheckbox( __FILE__, __LINE__ );
291 
292  if( dlg.ShowModal() == wxID_OK )
293  return true;
294  }
295 
296  return false;
297  }
298 
299  if( previousSimCommand != m_simCommand )
300  m_simCommand.Trim();
301 
303 
304  m_settings->SetFixPassiveVals( m_netlistOpts & NET_ADJUST_PASSIVE_VALS );
305  m_settings->SetFixIncludePaths( m_netlistOpts & NET_ADJUST_INCLUDE_PATHS );
306 
307  return true;
308 }
309 
310 
312 {
314  if( empty( m_customTxt ) )
315  loadDirectives();
316 
317  m_fixPassiveVals->SetValue( m_settings->GetFixPassiveVals() );
318  m_fixIncludePaths->SetValue( m_settings->GetFixIncludePaths() );
320 
321  NGSPICE_SIMULATOR_SETTINGS* ngspiceSettings =
322  dynamic_cast<NGSPICE_SIMULATOR_SETTINGS*>( m_settings.get() );
323 
324  if( ngspiceSettings )
325  {
326  switch( ngspiceSettings->GetModelMode() )
327  {
328  case NGSPICE_MODEL_MODE::USER_CONFIG: m_compatibilityModeChoice->SetSelection( 0 ); break;
329  case NGSPICE_MODEL_MODE::NGSPICE: m_compatibilityModeChoice->SetSelection( 1 ); break;
330  case NGSPICE_MODEL_MODE::PSPICE: m_compatibilityModeChoice->SetSelection( 2 ); break;
331  case NGSPICE_MODEL_MODE::LTSPICE: m_compatibilityModeChoice->SetSelection( 3 ); break;
332  case NGSPICE_MODEL_MODE::LT_PSPICE: m_compatibilityModeChoice->SetSelection( 4 ); break;
333  case NGSPICE_MODEL_MODE::HSPICE: m_compatibilityModeChoice->SetSelection( 5 ); break;
334  default:
335  wxFAIL_MSG( wxString::Format( wxT( "Unknown NGSPICE_MODEL_MODE %d." ),
336  ngspiceSettings->GetModelMode() ) );
337  break;
338  }
339  }
340 
341  if( !m_dcSource1->GetCount() )
342  {
343  wxChar type1 = getStringSelection( m_dcSourceType1 ).Upper().GetChar( 0 );
344  updateDCSources( type1, m_dcSource1 );
345  }
346 
347  if( !m_dcSource2->GetCount() )
348  {
349  wxChar type2 = getStringSelection( m_dcSourceType2 ).Upper().GetChar( 0 );
350  updateDCSources( type2, m_dcSource2 );
351  }
352 
353  if( m_simCommand.IsEmpty() && !empty( m_customTxt ) )
354  return parseCommand( m_customTxt->GetValue() );
355 
356  return true;
357 }
358 
359 
361 {
362  // Fill out comboboxes that allows one to select nets
363  // Map comoboxes to their current values
364  std::map<wxComboBox*, wxString> cmbNet = {
365  { m_noiseMeas, m_noiseMeas->GetStringSelection() },
366  { m_noiseRef, m_noiseRef->GetStringSelection() }
367  };
368 
369  for( auto c : cmbNet )
370  c.first->Clear();
371 
372  for( const auto& net : m_exporter->GetNetIndexMap() )
373  {
374  for( auto c : cmbNet )
375  c.first->Append( net.first );
376  }
377 
378  // Try to restore the previous selection, if possible
379  for( auto c : cmbNet )
380  {
381  int idx = c.first->FindString( c.second );
382 
383  if( idx != wxNOT_FOUND )
384  c.first->SetSelection( idx );
385  }
386 
387  return DIALOG_SIM_SETTINGS_BASE::ShowModal();
388 }
389 
390 
391 void DIALOG_SIM_SETTINGS::updateDCSources( wxChar aType, wxChoice* aSource )
392 {
393  wxString prevSelection;
394 
395  if( !aSource->IsEmpty() )
396  prevSelection = aSource->GetString( aSource->GetSelection() );
397 
398  std::set<wxString> sourcesList;
399  bool enableSrcSelection = true;
400 
401  if( aType != 'T' )
402  {
403  for( const auto& item : m_exporter->GetSpiceItems() )
404  {
405  if( item.m_primitive == aType && !item.m_refName.IsEmpty() )
406  sourcesList.insert( item.m_refName );
407  }
408 
409  if( aSource == m_dcSource2 && !m_dcEnable2->IsChecked() )
410  enableSrcSelection = false;
411  }
412  else
413  {
414  prevSelection = wxT( "TEMP" );
415  sourcesList.insert( prevSelection );
416  enableSrcSelection = false;
417  }
418 
419  aSource->Enable( enableSrcSelection );
420 
421  aSource->Clear();
422 
423  for( const wxString& src : sourcesList )
424  aSource->Append( src );
425 
426  // Try to restore the previous selection, if possible
427  aSource->SetStringSelection( prevSelection );
428 }
429 
430 
431 bool DIALOG_SIM_SETTINGS::parseCommand( const wxString& aCommand )
432 {
433  if( aCommand.IsEmpty() )
434  return false;
435 
436  wxStringTokenizer tokenizer( aCommand, wxT( " " ) );
437  wxString tkn = tokenizer.GetNextToken().Lower();
438 
439  try
440  {
441  if( tkn == wxT( ".ac" ) )
442  {
443  m_simPages->SetSelection( m_simPages->FindPage( m_pgAC ) );
444 
445  tkn = tokenizer.GetNextToken().Lower();
446 
447  if( tkn == wxT( "dec" ) )
448  m_acScale->SetSelection( 0 );
449  if( tkn == wxT( "oct" ) )
450  m_acScale->SetSelection( 1 );
451  if( tkn == wxT( "lin" ) )
452  m_acScale->SetSelection( 2 );
453  else
454  return false;
455 
456  // If the fields below are empty, it will be caught by the exception handler
457  m_acPointsNumber->SetValue( tokenizer.GetNextToken() );
458  m_acFreqStart->SetValue( SPICE_VALUE( tokenizer.GetNextToken() ).ToSpiceString() );
459  m_acFreqStop->SetValue( SPICE_VALUE( tokenizer.GetNextToken() ).ToSpiceString() );
460  }
461  else if( tkn == wxT( ".dc" ) )
462  {
463  SPICE_DC_PARAMS src1, src2;
464  src2.m_vincrement = SPICE_VALUE( -1 );
465 
466  if( !m_exporter->ParseDCCommand( aCommand, &src1, &src2 ) )
467  return false;
468 
469  m_simPages->SetSelection( m_simPages->FindPage( m_pgDC ) );
470 
471  if( src1.m_source.IsSameAs( wxT( "TEMP" ), false ) )
472  setStringSelection( m_dcSourceType1, wxT( "TEMP" ) );
473  else
474  setStringSelection( m_dcSourceType1, src1.m_source.GetChar( 0 ) );
475 
476  updateDCSources( src1.m_source.GetChar( 0 ), m_dcSource1 );
477  m_dcSource1->SetStringSelection( src1.m_source );
478  m_dcStart1->SetValue( src1.m_vstart.ToSpiceString() );
479  m_dcStop1->SetValue( src1.m_vend.ToSpiceString() );
480  m_dcIncr1->SetValue( src1.m_vincrement.ToSpiceString() );
481 
482  if( src2.m_vincrement.ToDouble() != -1 )
483  {
484  if( src2.m_source.IsSameAs( wxT( "TEMP" ), false ) )
485  setStringSelection( m_dcSourceType2, wxT( "TEMP" ) );
486  else
487  setStringSelection( m_dcSourceType2, src2.m_source.GetChar( 0 ) );
488 
489  updateDCSources( src2.m_source.GetChar( 0 ), m_dcSource2 );
490  m_dcSource2->SetStringSelection( src2.m_source );
491  m_dcStart2->SetValue( src2.m_vstart.ToSpiceString() );
492  m_dcStop2->SetValue( src2.m_vend.ToSpiceString() );
493  m_dcIncr2->SetValue( src2.m_vincrement.ToSpiceString() );
494 
495  m_dcEnable2->SetValue( true );
496  }
497 
499  }
500  else if( tkn == wxT( ".tran" ) )
501  {
502  m_simPages->SetSelection( m_simPages->FindPage( m_pgTransient ) );
503 
504  // If the fields below are empty, it will be caught by the exception handler
505  m_transStep->SetValue( SPICE_VALUE( tokenizer.GetNextToken() ).ToSpiceString() );
506  m_transFinal->SetValue( SPICE_VALUE( tokenizer.GetNextToken() ).ToSpiceString() );
507 
508  // Initial time is an optional field
509  tkn = tokenizer.GetNextToken();
510 
511  if( !tkn.IsEmpty() )
512  m_transInitial->SetValue( SPICE_VALUE( tkn ).ToSpiceString() );
513  }
514  else if( tkn == wxT( ".op" ) )
515  {
516  m_simPages->SetSelection( m_simPages->FindPage( m_pgOP ) );
517  }
518  else if( !empty( m_customTxt ) ) // Custom directives
519  {
520  m_simPages->SetSelection( m_simPages->FindPage( m_pgCustom ) );
521  }
522  }
523  catch( ... )
524  {
525  // Nothing really bad has happened
526  return false;
527  }
528 
529  return true;
530 }
531 
532 
533 void DIALOG_SIM_SETTINGS::onSwapDCSources( wxCommandEvent& event )
534 {
535  std::vector<std::pair<wxTextEntry*, wxTextEntry*>> textCtrl = { { m_dcStart1, m_dcStart2 },
536  { m_dcStop1, m_dcStop2 },
537  { m_dcIncr1, m_dcIncr2 } };
538 
539  for( auto& couple : textCtrl )
540  {
541  wxString tmp = couple.first->GetValue();
542  couple.first->SetValue( couple.second->GetValue() );
543  couple.second->SetValue( tmp );
544  }
545 
546  int src1 = m_dcSource1->GetSelection();
547  int src2 = m_dcSource2->GetSelection();
548 
549  int sel = m_dcSourceType1->GetSelection();
550  m_dcSourceType1->SetSelection( m_dcSourceType2->GetSelection() );
551  m_dcSourceType2->SetSelection( sel );
552 
553  wxChar type1 = getStringSelection( m_dcSourceType1 ).Upper().GetChar( 0 );
554  updateDCSources( type1, m_dcSource1 );
555  wxChar type2 = getStringSelection( m_dcSourceType2 ).Upper().GetChar( 0 );
556  updateDCSources( type2, m_dcSource2 );
557 
558  m_dcSource1->SetSelection( src2 );
559  m_dcSource2->SetSelection( src1 );
560 
563 }
564 
565 
566 void DIALOG_SIM_SETTINGS::onDCEnableSecondSource( wxCommandEvent& event )
567 {
568  bool is2ndSrcEnabled = m_dcEnable2->IsChecked();
569  wxChar type = getStringSelection( m_dcSourceType2 ).Upper().GetChar( 0 );
570 
571  m_dcSourceType2->Enable( is2ndSrcEnabled );
572  m_dcSource2->Enable( is2ndSrcEnabled && type != 'T' );
573  m_dcStart2->Enable( is2ndSrcEnabled );
574  m_dcStop2->Enable( is2ndSrcEnabled );
575  m_dcIncr2->Enable( is2ndSrcEnabled );
576 }
577 
578 
579 void DIALOG_SIM_SETTINGS::updateDCUnits( wxChar aType, wxChoice* aSource,
580  wxStaticText* aStartValUnit, wxStaticText* aEndValUnit,
581  wxStaticText* aStepUnit )
582 {
583  wxString unit;
584 
585  switch( aType )
586  {
587  case 'V': unit = _( "Volts" ); break;
588  case 'I': unit = _( "Amperes" ); break;
589  case 'R': unit = _( "Ohms" ); break;
590  case 'T': unit = wxT( "\u00B0C" ); break;
591  }
592 
593  aStartValUnit->SetLabel( unit );
594  aEndValUnit->SetLabel( unit );
595  aStepUnit->SetLabel( unit );
596 
597  m_pgDC->Refresh();
598 }
599 
600 
602 {
603  if( m_exporter )
604  m_customTxt->SetValue( m_exporter->GetSheetSimCommand() );
605 }
606 
607 
609 {
611 
612  if( !m_fixPassiveVals->IsChecked() )
614 
615  if( !m_fixIncludePaths->IsChecked() )
617 }
void DisplayError(wxWindow *aParent, const wxString &aText, int aDisplayTime)
Display an error or warning message box with aMessage.
Definition: confirm.cpp:279
wxString ToSpiceString() const
Return string value in Spice format (e.g.
void DoNotShowCheckbox(wxString file, int line)
Checks the 'do not show again' setting for the dialog.
Definition: confirm.cpp:55
std::shared_ptr< SPICE_SIMULATOR_SETTINGS > m_settings
Helper class to create more flexible dialogs, including 'do not show again' checkbox handling.
Definition: confirm.h:45
This file is part of the common library.
double ToDouble() const
SPICE_VALIDATOR m_spiceEmptyValidator
wxString evaluateDCControls(wxChoice *aDcSource, wxTextCtrl *aDcStart, wxTextCtrl *aDcStop, wxTextCtrl *aDcIncr)
Read values from one DC sweep source to form a part of simulation command.
static wxString scaleToString(int aOption)
Class DIALOG_SIM_SETTINGS_BASE.
void onSwapDCSources(wxCommandEvent &event) override
const std::map< wxString, int > & GetNetIndexMap() const
Return a map of circuit nodes to net names.
SPICE_VALIDATOR m_spiceValidator
wxString GetSheetSimCommand()
Return simulation command directives placed in schematic sheets (if any).
DIALOG_SIM_SETTINGS(wxWindow *aParent, std::shared_ptr< SPICE_SIMULATOR_SETTINGS > &aSettings)
void updateDCSources(wxChar aType, wxChoice *aSource)
Update DC sweep source with symbols from schematic.
< Helper class to handle Spice way of expressing values (e.g. 10.5 Meg) Helper class to recognize Spi...
Definition: spice_value.h:34
const std::list< SPICE_ITEM > & GetSpiceItems() const
Return list of items representing schematic components in the Spice world.
wxString GetSpiceDevice(const wxString &aSymbol) const
Return name of Spice device corresponding to a schematic symbol.
bool parseCommand(const wxString &aCommand)
Parse a Spice directive.
#define _(s)
static wxString getStringSelection(const wxChoice *aCtrl)
static void setStringSelection(wxChoice *aCtrl, const wxString &aStr)
bool ParseDCCommand(const wxString &aCmd, SPICE_DC_PARAMS *aSource1, SPICE_DC_PARAMS *aSource2)
Parse a two-source .dc command directive into its symbols.
bool TransferDataFromWindow() override
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, const CPTREE &aTree)
Output a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:200
NGSPICE_MODEL_MODE GetModelMode() const
const wxString What() const
Definition: ki_exception.h:57
NETLIST_EXPORTER_PSPICE_SIM * m_exporter
bool SetOKCancelLabels(const ButtonLabel &ok, const ButtonLabel &cancel) override
Shows the 'do not show again' checkbox.
Definition: confirm.h:56
Container for Ngspice simulator settings.
bool TransferDataToWindow() override
wxIntegerValidator< int > m_posIntValidator
static bool empty(const wxTextEntryBase *aCtrl)
void updateDCUnits(wxChar aType, wxChoice *aSource, wxStaticText *aStartValUnit, wxStaticText *aEndValUnit, wxStaticText *aStepUnit)
Update units on labels depending on selected source.
int ShowModal() override
Definition: confirm.cpp:99
void SetModelMode(NGSPICE_MODEL_MODE aMode)
void onDCEnableSecondSource(wxCommandEvent &event) override
Hold a translatable error message and may be used when throwing exceptions containing a translated er...
Definition: ki_exception.h:44