51 if( i.e_value == aValue )
62 m_results[
S2R].e_value = std::numeric_limits<double>::max();
64 for( i = 0; i < aSize; i++ )
89 for( i = 0; i < aSize; i++ )
91 for( j = 0; j < aSize; j++ )
101 s.append(
" ) + ( " );
115 std::string s =
"( ";
117 s.append(
" ) | ( " );
128 std::cout<<
"4R Time = "<<combine4_timer.
msecs()<<
" mSec"<<std::endl;
148 uint32_t combi2R = 0;
160 m_cmb_lut[combi2R].e_value = i.e_value + j.e_value;
163 m_cmb_lut[combi2R].e_name = s.append( j.e_name);
166 m_cmb_lut[combi2R].e_value = i.e_value * j.e_value /
167 ( i.e_value + j.e_value );
170 m_cmb_lut[combi2R].e_name = s.append( j.e_name );
193 for( j = 0; j < aSize; j++ )
236 uint32_t no_of_2Rcombi = 0;
257 if( ( std::count( s.begin(), s.end(),
'+' ) == 2 )
258 || ( std::count( s.begin(), s.end(),
'|' ) == 2 ) )
260 s.erase( s.find(
"(" ), 1 );
261 s.erase( s.find(
")" ), 1 );
276 if( ( std::count( s.begin(), s.end(),
'+' ) == 3 )
277 || ( std::count( s.begin(), s.end(),
'|' ) == 3 ) )
279 s.erase( s.find(
"(" ), 1 );
280 s.erase( s.find(
")" ), 1 );
281 s.erase( s.find(
"(" ), 1 );
282 s.erase( s.find(
")" ), 1 );
292 double error, err3 = 0;
312 error = ( reqr / error - 1 ) * 100;
316 if( std::abs( error ) < 0.01 )
317 es.Printf(
"<%.2f", 0.01 );
319 es.Printf(
"%+.2f",error);
331 err3 = ( reqr / err3 - 1 ) * 100;
335 if( std::abs( err3 ) < 0.01 )
336 es.Printf(
"<%.2f", 0.01 );
338 es.Printf(
"%+.2f",err3);
351 fs =
_(
"Not worth using" );
363 error = ( reqr / error - 1 ) * 100;
366 es.Printf(
"%+.2f",error );
374 fs =
_(
"Not worth using" );
384 if( event.GetEventObject() ==
m_e1 )
386 else if( event.GetEventObject() ==
m_e3 )
388 else if( event.GetEventObject() ==
m_e12 )
void OnESeriesSelection(wxCommandEvent &event) override
Radio Buttons to select the E-serie for the resistor calculator.
wxTextCtrl * m_ESeries_Sol4R
void ConvertMarkdown2Html(const wxString &aMarkdownInput, wxString &aHtmlOutput)
double msecs(bool aSinceLast=false)
void Calculate(void)
called on calculate button to execute all the 2R, 3R and 4R calculations
void combine3(uint32_t aSize)
Check if there is a better 3 R solution than previous one using only two components.
void Exclude(double aValue)
If any value of the selected E-serie not available, it can be entered as an exclude value.
void NewCalc(void)
initialize next calculation and erase results from previous calculation
wxTextCtrl * m_ESeriesError2R
A small class to help profiling.
std::array< r_data, S4R+1 > m_results
wxTextCtrl * m_ResExclude1
wxHtmlWindow * m_panelESeriesHelp
Contains structures for storage of regulator data.
wxTextCtrl * m_ESeriesError4R
void SetSeries(uint32_t aSeries)
Interface for CheckBox, RadioButton, RequriedResistor and calculated Results.
Helper dialog and control classes.
void SetRequiredValue(double aValue)
std::array< r_data, MAX_CMB > m_cmb_lut
void OnCalculateESeries(wxCommandEvent &event) override
Called on calculate button and executes all E-series calculations.
double DoubleFromString(const wxString &TextValue)
void combine4(uint32_t aSize)
Check if there is a better four component solution.
wxTextCtrl * m_ResRequired
wxTextCtrl * m_ESeries_Sol3R
std::array< r_data, S4R+1 > get_rslt(void)
wxTextCtrl * m_ResExclude2
void simple_solution(uint32_t aSize)
Search for closest two component solution.
wxTextCtrl * m_ESeries_Sol2R
uint32_t combine2(void)
Build all 2R combinations from the selected E-serie values.
wxTextCtrl * m_ESeriesError3R
std::vector< std::vector< r_data > > luts