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 <maciej.suminski@cern.ch>
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( "TEMP" ) )
135  dcSource = m_exporter->GetSpiceDevice( dcSource );
136 
137  return wxString::Format( "%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( ".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( ".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 += " " + src2;
214 
215  if( m_dcSource1->GetSelection() == m_dcSource2->GetSelection() )
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( ", %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( ".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( ".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( ".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( "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::vector<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 )
406  sourcesList.push_back( item.m_refName );
407  }
408 
409  std::sort( sourcesList.begin(), sourcesList.end(),
410  [](wxString& a, wxString& b) -> bool
411  {
412  return a.Len() < b.Len() || b.Cmp( a ) > 0;
413  } );
414 
415  if( aSource == m_dcSource2 && !m_dcEnable2->IsChecked() )
416  enableSrcSelection = false;
417  }
418  else
419  {
420  prevSelection = wxT( "TEMP" );
421  sourcesList.push_back( prevSelection );
422  enableSrcSelection = false;
423  }
424 
425  aSource->Enable( enableSrcSelection );
426 
427  aSource->Clear();
428 
429  for( auto& src : sourcesList )
430  aSource->Append( src );
431 
432  // Try to restore the previous selection, if possible
433  aSource->SetStringSelection( prevSelection );
434 }
435 
436 
437 bool DIALOG_SIM_SETTINGS::parseCommand( const wxString& aCommand )
438 {
439  if( aCommand.IsEmpty() )
440  return false;
441 
442  wxStringTokenizer tokenizer( aCommand, " " );
443  wxString tkn = tokenizer.GetNextToken().Lower();
444 
445  try
446  {
447  if( tkn == ".ac" )
448  {
449  m_simPages->SetSelection( m_simPages->FindPage( m_pgAC ) );
450 
451  tkn = tokenizer.GetNextToken().Lower();
452 
453  if( tkn == "dec" )
454  m_acScale->SetSelection( 0 );
455  if( tkn == "oct" )
456  m_acScale->SetSelection( 1 );
457  if( tkn == "lin" )
458  m_acScale->SetSelection( 2 );
459  else
460  return false;
461 
462  // If the fields below are empty, it will be caught by the exception handler
463  m_acPointsNumber->SetValue( tokenizer.GetNextToken() );
464  m_acFreqStart->SetValue( SPICE_VALUE( tokenizer.GetNextToken() ).ToSpiceString() );
465  m_acFreqStop->SetValue( SPICE_VALUE( tokenizer.GetNextToken() ).ToSpiceString() );
466  }
467  else if( tkn == ".dc" )
468  {
469  SPICE_DC_PARAMS src1, src2;
470  src2.m_vincrement = SPICE_VALUE( -1 );
471 
472  if( !m_exporter->ParseDCCommand( aCommand, &src1, &src2 ) )
473  return false;
474 
475  m_simPages->SetSelection( m_simPages->FindPage( m_pgDC ) );
476 
477  if( src1.m_source.IsSameAs( wxT( "TEMP" ), false ) )
478  setStringSelection( m_dcSourceType1, wxT( "TEMP" ) );
479  else
480  setStringSelection( m_dcSourceType1, src1.m_source.GetChar( 0 ) );
481 
482  updateDCSources( src1.m_source.GetChar( 0 ), m_dcSource1 );
483  m_dcSource1->SetStringSelection( src1.m_source );
484  m_dcStart1->SetValue( src1.m_vstart.ToSpiceString() );
485  m_dcStop1->SetValue( src1.m_vend.ToSpiceString() );
486  m_dcIncr1->SetValue( src1.m_vincrement.ToSpiceString() );
487 
488  if( src2.m_vincrement.ToDouble() != -1 )
489  {
490  if( src2.m_source.IsSameAs( wxT( "TEMP" ), false ) )
491  setStringSelection( m_dcSourceType2, wxT( "TEMP" ) );
492  else
493  setStringSelection( m_dcSourceType2, src2.m_source.GetChar( 0 ) );
494 
495  updateDCSources( src2.m_source.GetChar( 0 ), m_dcSource2 );
496  m_dcSource2->SetStringSelection( src2.m_source );
497  m_dcStart2->SetValue( src2.m_vstart.ToSpiceString() );
498  m_dcStop2->SetValue( src2.m_vend.ToSpiceString() );
499  m_dcIncr2->SetValue( src2.m_vincrement.ToSpiceString() );
500 
501  m_dcEnable2->SetValue( true );
502  }
503 
505  }
506  else if( tkn == ".tran" )
507  {
508  m_simPages->SetSelection( m_simPages->FindPage( m_pgTransient ) );
509 
510  // If the fields below are empty, it will be caught by the exception handler
511  m_transStep->SetValue( SPICE_VALUE( tokenizer.GetNextToken() ).ToSpiceString() );
512  m_transFinal->SetValue( SPICE_VALUE( tokenizer.GetNextToken() ).ToSpiceString() );
513 
514  // Initial time is an optional field
515  tkn = tokenizer.GetNextToken();
516 
517  if( !tkn.IsEmpty() )
518  m_transInitial->SetValue( SPICE_VALUE( tkn ).ToSpiceString() );
519  }
520  else if( tkn == ".op" )
521  {
522  m_simPages->SetSelection( m_simPages->FindPage( m_pgOP ) );
523  }
524  else if( !empty( m_customTxt ) ) // Custom directives
525  {
526  m_simPages->SetSelection( m_simPages->FindPage( m_pgCustom ) );
527  }
528  }
529  catch( ... )
530  {
531  // Nothing really bad has happened
532  return false;
533  }
534 
535  return true;
536 }
537 
538 
539 void DIALOG_SIM_SETTINGS::onSwapDCSources( wxCommandEvent& event )
540 {
541  std::vector<std::pair<wxTextEntry*, wxTextEntry*>> textCtrl = { { m_dcStart1, m_dcStart2 },
542  { m_dcStop1, m_dcStop2 },
543  { m_dcIncr1, m_dcIncr2 } };
544 
545  for( auto& couple : textCtrl )
546  {
547  wxString tmp = couple.first->GetValue();
548  couple.first->SetValue( couple.second->GetValue() );
549  couple.second->SetValue( tmp );
550  }
551 
552  int src1 = m_dcSource1->GetSelection();
553  int src2 = m_dcSource2->GetSelection();
554 
555  int sel = m_dcSourceType1->GetSelection();
556  m_dcSourceType1->SetSelection( m_dcSourceType2->GetSelection() );
557  m_dcSourceType2->SetSelection( sel );
558 
559  wxChar type1 = getStringSelection( m_dcSourceType1 ).Upper().GetChar( 0 );
560  updateDCSources( type1, m_dcSource1 );
561  wxChar type2 = getStringSelection( m_dcSourceType2 ).Upper().GetChar( 0 );
562  updateDCSources( type2, m_dcSource2 );
563 
564  m_dcSource1->SetSelection( src2 );
565  m_dcSource2->SetSelection( src1 );
566 
569 }
570 
571 
572 void DIALOG_SIM_SETTINGS::onDCEnableSecondSource( wxCommandEvent& event )
573 {
574  bool is2ndSrcEnabled = m_dcEnable2->IsChecked();
575  wxChar type = getStringSelection( m_dcSourceType2 ).Upper().GetChar( 0 );
576 
577  m_dcSourceType2->Enable( is2ndSrcEnabled );
578  m_dcSource2->Enable( is2ndSrcEnabled && type != 'T' );
579  m_dcStart2->Enable( is2ndSrcEnabled );
580  m_dcStop2->Enable( is2ndSrcEnabled );
581  m_dcIncr2->Enable( is2ndSrcEnabled );
582 }
583 
584 
585 void DIALOG_SIM_SETTINGS::updateDCUnits( wxChar aType, wxChoice* aSource,
586  wxStaticText* aStartValUnit, wxStaticText* aEndValUnit,
587  wxStaticText* aStepUnit )
588 {
589  wxString unit;
590 
591  switch( aType )
592  {
593  case 'V': unit = _( "Volts" ); break;
594  case 'I': unit = _( "Amperes" ); break;
595  case 'R': unit = _( "Ohms" ); break;
596  case 'T': unit = wxT( "\u00B0C" ); break;
597  }
598 
599  aStartValUnit->SetLabel( unit );
600  aEndValUnit->SetLabel( unit );
601  aStepUnit->SetLabel( unit );
602 
603  m_pgDC->Refresh();
604 }
605 
606 
608 {
609  if( m_exporter )
610  m_customTxt->SetValue( m_exporter->GetSheetSimCommand() );
611 }
612 
613 
615 {
617 
618  if( !m_fixPassiveVals->IsChecked() )
620 
621  if( !m_fixIncludePaths->IsChecked() )
623 }
void DisplayError(wxWindow *aParent, const wxString &aText, int aDisplayTime)
Display an error or warning message box with aMessage.
Definition: confirm.cpp:271
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