46 m_symbol( aSymbol->m_Uuid ),
47 m_sheetPath( aSheetPath ),
48 m_ref( aSymbol->GetRef( &aSheetPath ) ),
56 long style = GetWindowStyleFlag();
57 style &= ~wxBORDER_MASK;
58 style |= wxBORDER_SIMPLE;
59 SetWindowStyleFlag( style );
67 m_name->SetLabel( wxString::Format(
_(
"Tune %s" ),
m_ref ) );
84 throw KI_PARAM_ERROR( wxString::Format(
_(
"%s has simulation model of type '%s %s'; "
85 "only RLC passives be tuned" ),
123 m_name->SetLabel( wxString::Format(
_(
"Tune %s" ),
m_ref ) );
131 if( btn != event.GetEventObject() )
151 else if( aVal <
m_min )
200 wxQueueEvent(
m_frame,
new wxCommandEvent( EVT_SIM_UPDATE ) );
214 static std::vector<double> e24 = { 1.0, 1.1, 1.2, 1.3, 1.5, 1.6, 1.8, 2.0, 2.2, 2.4, 2.7, 3.0,
215 3.3, 3.6, 3.9, 4.3, 4.7, 5.1, 5.6, 6.2, 6.8, 7.5, 8.2, 9.1 };
217 static std::vector<double> e192 = { 1.00, 1.01, 1.02, 1.04, 1.05, 1.06, 1.07, 1.09, 1.10, 1.11,
218 1.13, 1.14, 1.15, 1.17, 1.18, 1.20, 1.21, 1.23, 1.24, 1.26,
219 1.27, 1.29, 1.30, 1.32, 1.33, 1.35, 1.37, 1.38, 1.40, 1.42,
220 1.43, 1.45, 1.47, 1.49, 1.50, 1.52, 1.54, 1.56, 1.58, 1.60,
221 1.62, 1.64, 1.65, 1.67, 1.69, 1.72, 1.74, 1.76, 1.78, 1.80,
222 1.82, 1.84, 1.87, 1.89, 1.91, 1.93, 1.96, 1.98, 2.00, 2.03,
223 2.05, 2.08, 2.10, 2.13, 2.15, 2.18, 2.21, 2.23, 2.26, 2.29,
224 2.32, 2.34, 2.37, 2.40, 2.43, 2.46, 2.49, 2.52, 2.55, 2.58,
225 2.61, 2.64, 2.67, 2.71, 2.74, 2.77, 2.80, 2.84, 2.87, 2.91,
226 2.94, 2.98, 3.01, 3.05, 3.09, 3.12, 3.16, 3.20, 3.24, 3.28,
227 3.32, 3.36, 3.40, 3.44, 3.48, 3.52, 3.57, 3.61, 3.65, 3.70,
228 3.74, 3.79, 3.83, 3.88, 3.92, 3.97, 4.02, 4.07, 4.12, 4.17,
229 4.22, 4.27, 4.32, 4.37, 4.42, 4.48, 4.53, 4.59, 4.64, 4.70,
230 4.75, 4.81, 4.87, 4.93, 4.99, 5.05, 5.11, 5.17, 5.23, 5.30,
231 5.36, 5.42, 5.49, 5.56, 5.62, 5.69, 5.76, 5.83, 5.90, 5.97,
232 6.04, 6.12, 6.19, 6.26, 6.34, 6.42, 6.49, 6.57, 6.65, 6.73,
233 6.81, 6.90, 6.98, 7.06, 7.15, 7.23, 7.32, 7.41, 7.50, 7.59,
234 7.68, 7.77, 7.87, 7.96, 8.06, 8.16, 8.25, 8.35, 8.45, 8.56,
235 8.66, 8.76, 8.87, 8.98, 9.09, 9.20, 9.31, 9.42, 9.53, 9.65,
245 if(
e_24 || e_extended )
247 std::vector<double> table;
248 table.reserve( 192 + 24 + 1 );
254 for(
size_t ii = 0; ii < e192.size(); ii += step )
255 table.push_back( e192[ii] );
259 table.insert( table.end(), e24.begin(), e24.end() );
261 table.push_back( 10.0 );
263 std::sort( table.begin(), table.end() );
266 for(
double decade : { 1.0, 10.0, 100.0 } )
268 for(
size_t ii = 0; ii < table.size() - 1; ++ii )
270 if( value < ( table[ii] + table[ii+1] ) * decade / 2 )
277 if( e_extended && decade != 100.0 )
280 m_valueText->SetValue( wxString::Format( wxT(
"%.*f%s" ),
290 wxString valueStr = wxString::Format( wxT(
"%.3f" ), value );
wxBitmapBundle KiBitmapBundle(BITMAPS aBitmap)
constexpr BOX2I KiROUND(const BOX2D &aBoxD)
Hold a translatable error message and may be used when throwing exceptions containing a translated er...
const SPICE_ITEM * FindItem(const wxString &aRefName) const
Find and return the item corresponding to aRefName.
Handle access to a stack of flattened SCH_SHEET objects by way of a path for creating a flattened sch...
The SIMULATOR_FRAME_UI holds the main user-interface for running simulations.
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 RemoveTuner(TUNER_SLIDER *aTuner)
Remove an existing tuner.
const SPICE_CIRCUIT_MODEL * GetExporter() const
Return the netlist exporter object used for simulations.
virtual const PARAM * GetTunerParam() const
DEVICE_INFO GetDeviceInfo() const
static std::string ToSpice(const std::string &aString)
Helper class to recognize Spice formatted values.
double ToNormalizedDouble(wxString *aPrefix)
static void StripZeros(wxString &aString)
wxString ToOrigString() const
Return either a normal string or Spice format string, depending on the original value format.
STD_BITMAP_BUTTON * m_closeBtn
BITMAP_BUTTON * m_separator
void onESeries(wxCommandEvent &event) override
bool SetMin(const SPICE_VALUE &aVal)
void onValueTextEnter(wxCommandEvent &event) override
void onMinKillFocus(wxFocusEvent &event) override
void onValueKillFocus(wxFocusEvent &event) override
bool SetValue(const SPICE_VALUE &aVal)
void onSave(wxCommandEvent &event) override
TUNER_SLIDER(SIMULATOR_FRAME_UI *aPanel, wxWindow *aParent, const SCH_SHEET_PATH &aSheetPath, SCH_SYMBOL *aSymbol)
wxString GetSymbolRef() const
void onMaxTextEnter(wxCommandEvent &event) override
void updateComponentValue()
bool SetMax(const SPICE_VALUE &aVal)
void onMaxKillFocus(wxFocusEvent &event) override
void onSliderScroll(wxScrollEvent &event) override
SCH_SHEET_PATH m_sheetPath
void onMinTextEnter(wxCommandEvent &event) override
void onClose(wxCommandEvent &event) override
SIMULATOR_FRAME_UI * m_frame
void onSliderChanged(wxScrollEvent &event) override
void ShowChangedLanguage()
void remove_duplicates(_Container &__c)
Deletes all duplicate values from __c.