KiCad PCB EDA Suite
PANEL_CABLE_SIZE Class Reference

#include <panel_cable_size.h>

Inheritance diagram for PANEL_CABLE_SIZE:
PANEL_CABLE_SIZE_BASE CALCULATOR_PANEL

Public Member Functions

 PANEL_CABLE_SIZE (wxWindow *parent, wxWindowID id=wxID_ANY, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxTAB_TRAVERSAL, const wxString &name=wxEmptyString)
 
 ~PANEL_CABLE_SIZE ()
 
void LoadSettings (PCB_CALCULATOR_SETTINGS *aCfg) override
 Load the settings into the panel. More...
 
void SaveSettings (PCB_CALCULATOR_SETTINGS *aCfg) override
 Save the settings from the panel. More...
 
void ThemeChanged () override
 Update UI elements of the panel when the theme changes to ensure the images and fonts/colors are appropriate for the new theme. More...
 
void OnCableSizeChange (wxCommandEvent &aEvent) override
 
void OnConductorResistivityChange (wxCommandEvent &aEvent) override
 
void OnConductorResistivity_Button (wxCommandEvent &aEvent) override
 
void OnConductorThermCoefChange (wxCommandEvent &aEvent) override
 
void OnConductorThermCoefChange_Button (wxCommandEvent &aEvent) override
 
void OnUpdateUnit (wxCommandEvent &aEvent) override
 
void OnDiameterChange (wxCommandEvent &aEvent) override
 
void OnAreaChange (wxCommandEvent &aEvent) override
 
void OnLinResistanceChange (wxCommandEvent &aEvent) override
 
void OnFrequencyChange (wxCommandEvent &aEvent) override
 
void OnAmpacityChange (wxCommandEvent &aEvent) override
 
void OnConductorTempChange (wxCommandEvent &aEvent) override
 
void OnCurrentChange (wxCommandEvent &aEvent) override
 
void OnLengthChange (wxCommandEvent &aEvent) override
 
void OnResistanceDcChange (wxCommandEvent &aEvent) override
 
void OnVDropChange (wxCommandEvent &aEvent) override
 
void OnPowerChange (wxCommandEvent &aEvent) override
 

Protected Attributes

wxStaticText * m_staticText162
 
wxChoice * m_sizeChoice
 
wxStaticText * m_staticText16
 
wxTextCtrl * m_diameterCtrl
 
UNIT_SELECTOR_LENm_diameterUnit
 
wxStaticText * m_staticText161
 
wxTextCtrl * m_areaCtrl
 
wxStaticText * m_staticText1641
 
wxStaticText * m_staticText18
 
wxTextCtrl * m_textCtrlConductorResistivity
 
wxButton * m_button_ResistivityConductor
 
wxStaticText * m_staticText16412
 
wxStaticText * m_staticText182
 
wxTextCtrl * m_textCtrlConductorThermCoef
 
wxButton * m_button_Temp_Coef_Conductor
 
wxStaticText * m_staticText16411
 
wxTextCtrl * m_linResistanceCtrl
 
UNIT_SELECTOR_LINEAR_RESISTANCEm_linResistanceUnit
 
wxStaticText * m_staticText164
 
wxTextCtrl * m_frequencyCtrl
 
UNIT_SELECTOR_FREQUENCYm_frequencyUnit
 
wxStaticText * m_staticText1642
 
wxTextCtrl * m_AmpacityCtrl
 
wxStaticText * m_staticText16421
 
wxStaticText * m_staticText17
 
wxTextCtrl * m_conductorTempCtrl
 
wxStaticText * m_staticText181
 
wxStaticText * m_staticText163
 
wxTextCtrl * m_currentCtrl
 
wxStaticText * m_staticText
 
wxStaticText * m_staticText1612
 
wxTextCtrl * m_lengthCtrl
 
UNIT_SELECTOR_LEN_CABLEm_lengthUnit
 
wxStaticText * m_staticText16121
 
wxTextCtrl * m_resistanceDcCtrl
 
wxStaticText * m_staticText161211
 
wxStaticText * m_staticText161212
 
wxTextCtrl * m_vDropCtrl
 
UNIT_SELECTOR_VOLTAGEm_vDropUnit
 
wxStaticText * m_staticText1612122
 
wxTextCtrl * m_powerCtrl
 
UNIT_SELECTOR_POWERm_powerUnit
 

Private Member Functions

void updateAll (double aRadius)
 
void updateApplication ()
 
void printAll ()
 

Private Attributes

std::vector< CABLE_SIZE_ENTRYm_entries
 
bool m_updatingUI
 
bool m_updatingDiameter
 
bool m_updatingArea
 
bool m_updatingConductorMaterialResitivity
 
bool m_updatingLinResistance
 
bool m_updatingFrequency
 
bool m_updatingAmpacity
 
bool m_updatingCurrent
 
bool m_updatingLength
 
bool m_updatingResistanceDc
 
bool m_updatingRVdrop
 
bool m_updatingPower
 
bool m_imperial
 
double m_conductorMaterialResitivity
 
double m_conductorMaterialResitivityRef
 
double m_conductorMaterialThermalCoef
 
double m_diameter
 
double m_conductorTemperature
 
double m_current
 
double m_length
 
double m_area
 
double m_linearResistance
 
double m_maxFrequency
 
double m_resistanceDc
 
double m_voltageDrop
 
double m_dissipatedPower
 
double m_ampacity
 

Detailed Description

Definition at line 37 of file panel_cable_size.h.

Constructor & Destructor Documentation

◆ PANEL_CABLE_SIZE()

PANEL_CABLE_SIZE::PANEL_CABLE_SIZE ( wxWindow *  parent,
wxWindowID  id = wxID_ANY,
const wxPoint &  pos = wxDefaultPosition,
const wxSize &  size = wxDefaultSize,
long  style = wxTAB_TRAVERSAL,
const wxString &  name = wxEmptyString 
)

Definition at line 42 of file panel_cable_size.cpp.

43 :
44 PANEL_CABLE_SIZE_BASE( parent, id, pos, size, style, name )
45{
46 m_entries.clear();
47 m_entries.emplace_back( CABLE_SIZE_ENTRY( _( "AWG0000" ), 0.005842 ) );
48 m_entries.emplace_back( CABLE_SIZE_ENTRY( _( "AWG000" ), 0.00520192 ) );
49 m_entries.emplace_back( CABLE_SIZE_ENTRY( _( "AWG00" ), 0.00463296 ) );
50 m_entries.emplace_back( CABLE_SIZE_ENTRY( _( "AWG0" ), 0.00412623 ) );
51 m_entries.emplace_back( CABLE_SIZE_ENTRY( _( "AWG1" ), 0.00367411 ) );
52 m_entries.emplace_back( CABLE_SIZE_ENTRY( _( "AWG2" ), 0.00327152 ) );
53 m_entries.emplace_back( CABLE_SIZE_ENTRY( _( "AWG3" ), 0.00291338 ) );
54 m_entries.emplace_back( CABLE_SIZE_ENTRY( _( "AWG4" ), 0.00259461 ) );
55 m_entries.emplace_back( CABLE_SIZE_ENTRY( _( "AWG5" ), 0.00231013 ) );
56 m_entries.emplace_back( CABLE_SIZE_ENTRY( _( "AWG6" ), 0.00205740 ) );
57 m_entries.emplace_back( CABLE_SIZE_ENTRY( _( "AWG7" ), 0.00183261 ) );
58 m_entries.emplace_back( CABLE_SIZE_ENTRY( _( "AWG8" ), 0.00163195 ) );
59 m_entries.emplace_back( CABLE_SIZE_ENTRY( _( "AWG9" ), 0.00145288 ) );
60 m_entries.emplace_back( CABLE_SIZE_ENTRY( _( "AWG10" ), 0.00129413 ) );
61 m_entries.emplace_back( CABLE_SIZE_ENTRY( _( "AWG11" ), 0.00115189 ) );
62 m_entries.emplace_back( CABLE_SIZE_ENTRY( _( "AWG12" ), 0.00102616 ) );
63 m_entries.emplace_back( CABLE_SIZE_ENTRY( _( "AWG13" ), 0.0009144 ) );
64 m_entries.emplace_back( CABLE_SIZE_ENTRY( _( "AWG14" ), 0.00081407 ) );
65 m_entries.emplace_back( CABLE_SIZE_ENTRY( _( "AWG15" ), 0.00072517 ) );
66 m_entries.emplace_back( CABLE_SIZE_ENTRY( _( "AWG16" ), 0.00064516 ) );
67 m_entries.emplace_back( CABLE_SIZE_ENTRY( _( "AWG17" ), 0.00057531 ) );
68 m_entries.emplace_back( CABLE_SIZE_ENTRY( _( "AWG18" ), 0.00051181 ) );
69 m_entries.emplace_back( CABLE_SIZE_ENTRY( _( "AWG19" ), 0.00045593 ) );
70 m_entries.emplace_back( CABLE_SIZE_ENTRY( _( "AWG20" ), 0.0004046 ) );
71 m_entries.emplace_back( CABLE_SIZE_ENTRY( _( "AWG21" ), 0.00036195 ) );
72 m_entries.emplace_back( CABLE_SIZE_ENTRY( _( "AWG22" ), 0.00032258 ) );
73 m_entries.emplace_back( CABLE_SIZE_ENTRY( _( "AWG23" ), 0.00028702 ) );
74 m_entries.emplace_back( CABLE_SIZE_ENTRY( _( "AWG24" ), 0.00025527 ) );
75 m_entries.emplace_back( CABLE_SIZE_ENTRY( _( "AWG25" ), 0.00022773 ) );
76 m_entries.emplace_back( CABLE_SIZE_ENTRY( _( "AWG26" ), 0.00020193 ) );
77 m_entries.emplace_back( CABLE_SIZE_ENTRY( _( "AWG27" ), 0.00018034 ) );
78 m_entries.emplace_back( CABLE_SIZE_ENTRY( _( "AWG28" ), 0.00016002 ) );
79 m_entries.emplace_back( CABLE_SIZE_ENTRY( _( "AWG29" ), 0.00014351 ) );
80 m_entries.emplace_back( CABLE_SIZE_ENTRY( _( "AWG30" ), 0.000127 ) );
81
82 for( CABLE_SIZE_ENTRY entry : m_entries )
83 {
84 m_sizeChoice->Append( entry.m_Name );
85 }
86
87 m_staticText16412->SetLabel( wxT( "Ω⋅m" ) );
88 m_staticText181->SetLabel( wxT( "°C" ) );
89 m_staticText161211->SetLabel( wxT( "Ω" ) );
90 m_staticText1641->SetLabel( wxT( "mm²" ) );
91
92 // Needed on wxWidgets 3.0 to ensure sizers are correctly set
93 GetSizer()->SetSizeHints( this );
94
95 // Set internal state flags:
96 m_updatingUI = false;
97 m_updatingDiameter = false;
98 m_updatingArea = false;
100 m_updatingFrequency = false;
101 m_updatingAmpacity = false;
102 m_updatingCurrent = false;
103 m_updatingLength = false;
105 m_updatingRVdrop = false;
106 m_updatingPower = false;
108
109 m_imperial = false;
110
111 // Initialize variables to a reasonable value
112 // Stored in normalized units
113
114 m_diameter = 0.001;
116 m_current = 1.0;
117 m_length = 1.0;
118 m_conductorMaterialResitivity = 1.72e-8; //Initialized for copper
119 m_conductorMaterialResitivityRef = 1.72e-8; //Initialized for copper at 20 deg C
121
122 updateAll( m_diameter / 2 );
123}
const char * name
Definition: DXF_plotter.cpp:56
PANEL_CABLE_SIZE_BASE(wxWindow *parent, wxWindowID id=wxID_ANY, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxSize(-1,-1), long style=wxTAB_TRAVERSAL, const wxString &name=wxEmptyString)
wxStaticText * m_staticText161211
wxStaticText * m_staticText16412
void updateAll(double aRadius)
double m_conductorMaterialThermalCoef
bool m_updatingConductorMaterialResitivity
double m_conductorMaterialResitivity
double m_conductorMaterialResitivityRef
double m_conductorTemperature
std::vector< CABLE_SIZE_ENTRY > m_entries
#define _(s)

References _, m_conductorMaterialResitivity, m_conductorMaterialResitivityRef, m_conductorMaterialThermalCoef, m_conductorTemperature, m_current, m_diameter, m_entries, m_imperial, m_length, PANEL_CABLE_SIZE_BASE::m_sizeChoice, PANEL_CABLE_SIZE_BASE::m_staticText161211, PANEL_CABLE_SIZE_BASE::m_staticText1641, PANEL_CABLE_SIZE_BASE::m_staticText16412, PANEL_CABLE_SIZE_BASE::m_staticText181, m_updatingAmpacity, m_updatingArea, m_updatingConductorMaterialResitivity, m_updatingCurrent, m_updatingDiameter, m_updatingFrequency, m_updatingLength, m_updatingLinResistance, m_updatingPower, m_updatingResistanceDc, m_updatingRVdrop, m_updatingUI, and updateAll().

◆ ~PANEL_CABLE_SIZE()

PANEL_CABLE_SIZE::~PANEL_CABLE_SIZE ( )

Definition at line 132 of file panel_cable_size.cpp.

133{
134}

Member Function Documentation

◆ LoadSettings()

void PANEL_CABLE_SIZE::LoadSettings ( PCB_CALCULATOR_SETTINGS aCfg)
overridevirtual

Load the settings into the panel.

Parameters
aCfgis the settings structure to load from

Implements CALCULATOR_PANEL.

Definition at line 150 of file panel_cable_size.cpp.

151{
152 m_diameterUnit->SetSelection( aCfg->m_cableSize.diameterUnit );
153 m_linResistanceUnit->SetSelection( aCfg->m_cableSize.linResUnit );
154 m_frequencyUnit->SetSelection( aCfg->m_cableSize.frequencyUnit );
155 m_lengthUnit->SetSelection( aCfg->m_cableSize.lengthUnit );
159
160 wxString value = wxString( "" ) << m_conductorMaterialResitivity;
161
162 if( m_textCtrlConductorResistivity->IsEmpty() || value == "nan" )
163 {
164 //Initialize m_textCtrl to fill UI space
165 //Working variable initialized earlier
166 m_textCtrlConductorResistivity->SetValue( "1.72e-8" );
167 m_conductorTempCtrl->SetValue( "20" );
168 }
169
170 if( m_textCtrlConductorThermCoef->IsEmpty() )
171 {
172 //Initialize m_textCtrl to fill UI space
173 //Working variable initialized earlier
174 m_textCtrlConductorThermCoef->SetValue( "3.93e-3" );
175 }
176}
UNIT_SELECTOR_LEN_CABLE * m_lengthUnit
UNIT_SELECTOR_FREQUENCY * m_frequencyUnit
wxTextCtrl * m_textCtrlConductorResistivity
UNIT_SELECTOR_LEN * m_diameterUnit
UNIT_SELECTOR_LINEAR_RESISTANCE * m_linResistanceUnit
wxTextCtrl * m_textCtrlConductorThermCoef

References PCB_CALCULATOR_SETTINGS::CABLE_SIZE::conductorMaterialResitivity, PCB_CALCULATOR_SETTINGS::CABLE_SIZE::conductorTemperature, PCB_CALCULATOR_SETTINGS::CABLE_SIZE::conductorThermalCoef, PCB_CALCULATOR_SETTINGS::CABLE_SIZE::diameterUnit, PCB_CALCULATOR_SETTINGS::CABLE_SIZE::frequencyUnit, PCB_CALCULATOR_SETTINGS::CABLE_SIZE::lengthUnit, PCB_CALCULATOR_SETTINGS::CABLE_SIZE::linResUnit, PCB_CALCULATOR_SETTINGS::m_cableSize, m_conductorMaterialResitivity, PANEL_CABLE_SIZE_BASE::m_conductorTempCtrl, PANEL_CABLE_SIZE_BASE::m_diameterUnit, PANEL_CABLE_SIZE_BASE::m_frequencyUnit, PANEL_CABLE_SIZE_BASE::m_lengthUnit, PANEL_CABLE_SIZE_BASE::m_linResistanceUnit, PANEL_CABLE_SIZE_BASE::m_textCtrlConductorResistivity, and PANEL_CABLE_SIZE_BASE::m_textCtrlConductorThermCoef.

◆ OnAmpacityChange()

void PANEL_CABLE_SIZE::OnAmpacityChange ( wxCommandEvent &  aEvent)
overridevirtual

Reimplemented from PANEL_CABLE_SIZE_BASE.

Definition at line 314 of file panel_cable_size.cpp.

315{
316 if( !m_updatingUI )
317 {
318 m_updatingAmpacity = true;
319 double value;
320
321 if( m_AmpacityCtrl->GetValue().ToDouble( &value ) )
322 {
323 // Based on the 700 circular mils per amp rule of the thumb
324 // The long number is the sq m to circular mils conversion
325 updateAll( sqrt( value * 700 / 1973525241.77 / M_PI ) );
326 m_sizeChoice->SetSelection( -1 );
327 }
328 m_updatingAmpacity = false;
329 }
330}

References PANEL_CABLE_SIZE_BASE::m_AmpacityCtrl, PANEL_CABLE_SIZE_BASE::m_sizeChoice, m_updatingAmpacity, m_updatingUI, and updateAll().

◆ OnAreaChange()

void PANEL_CABLE_SIZE::OnAreaChange ( wxCommandEvent &  aEvent)
overridevirtual

Reimplemented from PANEL_CABLE_SIZE_BASE.

Definition at line 279 of file panel_cable_size.cpp.

280{
281 if( !m_updatingUI )
282 {
283 m_updatingArea = true;
284 double value;
285
286 if( m_areaCtrl->GetValue().ToDouble( &value ) )
287 {
288 updateAll( sqrt( value / M_PI / M2_to_MM2 ) );
289 m_sizeChoice->SetSelection( -1 );
290 }
291 m_updatingArea = false;
292 }
293}
#define M2_to_MM2

References M2_to_MM2, PANEL_CABLE_SIZE_BASE::m_areaCtrl, PANEL_CABLE_SIZE_BASE::m_sizeChoice, m_updatingArea, m_updatingUI, and updateAll().

◆ OnCableSizeChange()

void PANEL_CABLE_SIZE::OnCableSizeChange ( wxCommandEvent &  aEvent)
overridevirtual

Reimplemented from PANEL_CABLE_SIZE_BASE.

Definition at line 178 of file panel_cable_size.cpp.

179{
180 if( !m_updatingUI )
181 {
182 double value;
183 int index = m_sizeChoice->GetSelection();
184
185 if( ( index >= 0 ) && ( index < m_entries.size() ) )
186 {
187 value = m_entries.at( index ).m_Radius;
188 updateAll( value );
189 }
190 }
191}

References m_entries, PANEL_CABLE_SIZE_BASE::m_sizeChoice, m_updatingUI, and updateAll().

◆ OnConductorResistivity_Button()

void PANEL_CABLE_SIZE::OnConductorResistivity_Button ( wxCommandEvent &  aEvent)
overridevirtual

Reimplemented from PANEL_CABLE_SIZE_BASE.

Definition at line 206 of file panel_cable_size.cpp.

207{
208 wxArrayString list = StandardCableConductorList();
209
210 // Shows a list of current Specific resistance list (rho) and select a value
211 wxString value = wxGetSingleChoice( wxEmptyString,
212 _( "Electrical Resistivity in Ohm*m at 20 deg C" ), list )
213 .BeforeFirst( ' ' );
214
215 if( !value.IsEmpty() )
216 m_textCtrlConductorResistivity->ChangeValue( value );
217
219}
void OnConductorResistivityChange(wxCommandEvent &aEvent) override
wxArrayString StandardCableConductorList()

References _, PANEL_CABLE_SIZE_BASE::m_textCtrlConductorResistivity, OnConductorResistivityChange(), and StandardCableConductorList().

◆ OnConductorResistivityChange()

void PANEL_CABLE_SIZE::OnConductorResistivityChange ( wxCommandEvent &  aEvent)
overridevirtual

◆ OnConductorTempChange()

void PANEL_CABLE_SIZE::OnConductorTempChange ( wxCommandEvent &  aEvent)
overridevirtual

Reimplemented from PANEL_CABLE_SIZE_BASE.

Definition at line 332 of file panel_cable_size.cpp.

333{
334 if( !m_updatingUI )
335 {
336 double value;
337
338 if( m_conductorTempCtrl->GetValue().ToDouble( &value ) )
339 {
341 updateAll( m_diameter / 2 );
342 }
343 }
344}

References PANEL_CABLE_SIZE_BASE::m_conductorTempCtrl, m_conductorTemperature, m_diameter, m_updatingUI, and updateAll().

◆ OnConductorThermCoefChange()

void PANEL_CABLE_SIZE::OnConductorThermCoefChange ( wxCommandEvent &  aEvent)
overridevirtual

◆ OnConductorThermCoefChange_Button()

void PANEL_CABLE_SIZE::OnConductorThermCoefChange_Button ( wxCommandEvent &  aEvent)
overridevirtual

Reimplemented from PANEL_CABLE_SIZE_BASE.

Definition at line 231 of file panel_cable_size.cpp.

232{
233 wxArrayString list = StandardCableTempCoefList();
234
235 // Shows a list of current Specific resistance list (rho) and select a value
236 wxString value = wxGetSingleChoice( wxEmptyString, _( "Temperature coefficient" ), list )
237 .BeforeFirst( ' ' );
238
239 if( !value.IsEmpty() )
240 m_textCtrlConductorThermCoef->ChangeValue( value );
242}
void OnConductorThermCoefChange(wxCommandEvent &aEvent) override
wxArrayString StandardCableTempCoefList()

References _, PANEL_CABLE_SIZE_BASE::m_textCtrlConductorThermCoef, OnConductorThermCoefChange(), and StandardCableTempCoefList().

◆ OnCurrentChange()

void PANEL_CABLE_SIZE::OnCurrentChange ( wxCommandEvent &  aEvent)
overridevirtual

Reimplemented from PANEL_CABLE_SIZE_BASE.

Definition at line 347 of file panel_cable_size.cpp.

348{
349 if( !m_updatingUI )
350 {
351 double value;
352 m_updatingCurrent = true;
353
354 if( m_currentCtrl->GetValue().ToDouble( &value ) )
355 {
356 m_current = value;
358 }
359 m_updatingCurrent = false;
360 }
361}

References m_current, PANEL_CABLE_SIZE_BASE::m_currentCtrl, m_updatingCurrent, m_updatingUI, and updateApplication().

◆ OnDiameterChange()

void PANEL_CABLE_SIZE::OnDiameterChange ( wxCommandEvent &  aEvent)
overridevirtual

Reimplemented from PANEL_CABLE_SIZE_BASE.

Definition at line 244 of file panel_cable_size.cpp.

245{
246 if( !m_updatingUI )
247 {
248 m_updatingDiameter = true;
249 double value;
250
251 if( m_diameterCtrl->GetValue().ToDouble( &value ) )
252 {
253 updateAll( value / 2 * m_diameterUnit->GetUnitScale() );
254 m_sizeChoice->SetSelection( -1 );
255 }
256 m_updatingDiameter = false;
257 }
258}
double GetUnitScale() override
Function GetUnitScale.

References UNIT_SELECTOR_LEN::GetUnitScale(), PANEL_CABLE_SIZE_BASE::m_diameterCtrl, PANEL_CABLE_SIZE_BASE::m_diameterUnit, PANEL_CABLE_SIZE_BASE::m_sizeChoice, m_updatingDiameter, m_updatingUI, and updateAll().

◆ OnFrequencyChange()

void PANEL_CABLE_SIZE::OnFrequencyChange ( wxCommandEvent &  aEvent)
overridevirtual

Reimplemented from PANEL_CABLE_SIZE_BASE.

Definition at line 296 of file panel_cable_size.cpp.

297{
298 if( !m_updatingUI )
299 {
300 m_updatingFrequency = true;
301 double value;
302
303 if( m_frequencyCtrl->GetValue().ToDouble( &value ) )
304 {
307 m_sizeChoice->SetSelection( -1 );
308 }
309 m_updatingFrequency = false;
310 }
311}
double GetUnitScale() override
Function GetUnitScale.
#define RELATIVE_PERMEABILITY
#define VACCUM_PERMEABILITY

References UNIT_SELECTOR_FREQUENCY::GetUnitScale(), m_conductorMaterialResitivity, PANEL_CABLE_SIZE_BASE::m_frequencyCtrl, PANEL_CABLE_SIZE_BASE::m_frequencyUnit, PANEL_CABLE_SIZE_BASE::m_sizeChoice, m_updatingFrequency, m_updatingUI, RELATIVE_PERMEABILITY, updateAll(), and VACCUM_PERMEABILITY.

◆ OnLengthChange()

void PANEL_CABLE_SIZE::OnLengthChange ( wxCommandEvent &  aEvent)
overridevirtual

Reimplemented from PANEL_CABLE_SIZE_BASE.

Definition at line 364 of file panel_cable_size.cpp.

365{
366 if( !m_updatingUI )
367 {
368 double value;
369 m_updatingLength = true;
370
371 if( m_lengthCtrl->GetValue().ToDouble( &value ) )
372 {
375 }
376 m_updatingLength = false;
377 }
378}
double GetUnitScale() override
Function GetUnitScale.

References UNIT_SELECTOR_LEN_CABLE::GetUnitScale(), m_length, PANEL_CABLE_SIZE_BASE::m_lengthCtrl, PANEL_CABLE_SIZE_BASE::m_lengthUnit, m_updatingLength, m_updatingUI, and updateApplication().

◆ OnLinResistanceChange()

void PANEL_CABLE_SIZE::OnLinResistanceChange ( wxCommandEvent &  aEvent)
overridevirtual

Reimplemented from PANEL_CABLE_SIZE_BASE.

Definition at line 261 of file panel_cable_size.cpp.

262{
263 if( !m_updatingUI )
264 {
266 double value;
267
268 if( m_linResistanceCtrl->GetValue().ToDouble( &value ) )
269 {
271 / ( value * m_linResistanceUnit->GetUnitScale() ) / M_PI ) );
272 m_sizeChoice->SetSelection( -1 );
273 }
275 }
276}
double GetUnitScale() override
Function GetUnitScale.

References UNIT_SELECTOR_LINEAR_RESISTANCE::GetUnitScale(), m_conductorMaterialResitivity, PANEL_CABLE_SIZE_BASE::m_linResistanceCtrl, PANEL_CABLE_SIZE_BASE::m_linResistanceUnit, PANEL_CABLE_SIZE_BASE::m_sizeChoice, m_updatingLinResistance, m_updatingUI, and updateAll().

◆ OnPowerChange()

void PANEL_CABLE_SIZE::OnPowerChange ( wxCommandEvent &  aEvent)
overridevirtual

Reimplemented from PANEL_CABLE_SIZE_BASE.

Definition at line 416 of file panel_cable_size.cpp.

417{
418 if( !m_updatingUI )
419 {
420 double value;
421 m_updatingPower = true;
422
423 if( m_powerCtrl->GetValue().ToDouble( &value ) )
424 {
426 * m_length * m_current * m_current / M_PI ) );
427 m_sizeChoice->SetSelection( -1 );
428 }
429 m_updatingPower = false;
430 }
431}
UNIT_SELECTOR_POWER * m_powerUnit
double GetUnitScale() override
Function GetUnitScale.

References UNIT_SELECTOR_POWER::GetUnitScale(), m_conductorMaterialResitivity, m_current, m_length, PANEL_CABLE_SIZE_BASE::m_powerCtrl, PANEL_CABLE_SIZE_BASE::m_powerUnit, PANEL_CABLE_SIZE_BASE::m_sizeChoice, m_updatingPower, m_updatingUI, and updateAll().

◆ OnResistanceDcChange()

void PANEL_CABLE_SIZE::OnResistanceDcChange ( wxCommandEvent &  aEvent)
overridevirtual

Reimplemented from PANEL_CABLE_SIZE_BASE.

Definition at line 381 of file panel_cable_size.cpp.

382{
383 if( !m_updatingUI )
384 {
385 double value;
387
388 if( m_resistanceDcCtrl->GetValue().ToDouble( &value ) )
389 {
390 updateAll( sqrt( m_conductorMaterialResitivity / value * m_length / M_PI ) );
391 m_sizeChoice->SetSelection( -1 );
392 }
394 }
395}

References m_conductorMaterialResitivity, m_length, PANEL_CABLE_SIZE_BASE::m_resistanceDcCtrl, PANEL_CABLE_SIZE_BASE::m_sizeChoice, m_updatingResistanceDc, m_updatingUI, and updateAll().

◆ OnUpdateUnit()

void PANEL_CABLE_SIZE::OnUpdateUnit ( wxCommandEvent &  aEvent)
overridevirtual

Reimplemented from PANEL_CABLE_SIZE_BASE.

Definition at line 126 of file panel_cable_size.cpp.

127{
128 printAll();
129}

References printAll().

◆ OnVDropChange()

void PANEL_CABLE_SIZE::OnVDropChange ( wxCommandEvent &  aEvent)
overridevirtual

Reimplemented from PANEL_CABLE_SIZE_BASE.

Definition at line 398 of file panel_cable_size.cpp.

399{
400 if( !m_updatingUI )
401 {
402 double value;
403 m_updatingRVdrop = true;
404
405 if( m_vDropCtrl->GetValue().ToDouble( &value ) )
406 {
408 * m_length * m_current / M_PI ) );
409 m_sizeChoice->SetSelection( -1 );
410 }
411 m_updatingRVdrop = false;
412 }
413}
UNIT_SELECTOR_VOLTAGE * m_vDropUnit
double GetUnitScale() override
Function GetUnitScale.

References UNIT_SELECTOR_VOLTAGE::GetUnitScale(), m_conductorMaterialResitivity, m_current, m_length, PANEL_CABLE_SIZE_BASE::m_sizeChoice, m_updatingRVdrop, m_updatingUI, PANEL_CABLE_SIZE_BASE::m_vDropCtrl, PANEL_CABLE_SIZE_BASE::m_vDropUnit, and updateAll().

◆ printAll()

void PANEL_CABLE_SIZE::printAll ( )
private

Definition at line 434 of file panel_cable_size.cpp.

435{
436 m_updatingUI = true;
437
438 wxString value;
439 wxString tooltipString;
440
441 if( !m_updatingDiameter )
442 {
443 value = wxString( "" ) << m_diameter / m_diameterUnit->GetUnitScale();
444 m_diameterCtrl->SetValue( value );
445 }
446
447 if( !m_updatingArea )
448 {
449 value = wxString( "" ) << m_area * M2_to_MM2;
450 m_areaCtrl->SetValue( value );
451 }
452
453 if( !m_updatingAmpacity )
454 {
455 value = wxString( "" ) << m_ampacity;
456 m_AmpacityCtrl->SetValue( value );
457 }
458
460 {
461 value = wxString( "" ) << m_maxFrequency / m_frequencyUnit->GetUnitScale();
462 m_frequencyCtrl->SetValue( value );
463 }
464
466 {
467 value = wxString( "" ) << m_linearResistance / m_linResistanceUnit->GetUnitScale();
468 m_linResistanceCtrl->SetValue( value );
469 }
470
471 if( !m_updatingLength )
472 {
473 value = wxString( "" ) << m_length / m_lengthUnit->GetUnitScale();
474 m_lengthCtrl->SetValue( value );
475 }
476
478 {
479 //This is not really to update m_textCtrlConductorResistivity since we do not override user's input
480 //rather than update its tooltip
481 //value = wxString( "" ) << m_conductorMaterialResitivity;
482 value = wxString( "" ) << m_conductorMaterialResitivityRef;
483 m_textCtrlConductorResistivity->SetValue( value );
484 tooltipString = wxString( "Resistivity for " )
485 << m_conductorTemperature << wxString( " deg C is" )
486 << m_conductorMaterialResitivity << wxString( " Ohm*m" );
487 m_textCtrlConductorResistivity->SetToolTip( tooltipString );
488 }
489
490 if( !m_updatingCurrent )
491 {
492 value = wxString( "" ) << m_current;
493 m_currentCtrl->SetValue( value );
494 }
495
497 {
498 value = wxString( "" ) << m_resistanceDc;
499 m_resistanceDcCtrl->SetValue( value );
500 }
501
502 if( !m_updatingRVdrop )
503 {
504 value = wxString( "" ) << m_voltageDrop * m_vDropUnit->GetUnitScale();
505 m_vDropCtrl->SetValue( value );
506 }
507
508 if( !m_updatingPower )
509 {
510 value = wxString( "" ) << m_dissipatedPower * m_powerUnit->GetUnitScale();
511 m_powerCtrl->SetValue( value );
512 }
513
514 m_updatingUI = false;
515}

References UNIT_SELECTOR_LEN::GetUnitScale(), UNIT_SELECTOR_FREQUENCY::GetUnitScale(), UNIT_SELECTOR_LINEAR_RESISTANCE::GetUnitScale(), UNIT_SELECTOR_LEN_CABLE::GetUnitScale(), UNIT_SELECTOR_VOLTAGE::GetUnitScale(), UNIT_SELECTOR_POWER::GetUnitScale(), M2_to_MM2, m_ampacity, PANEL_CABLE_SIZE_BASE::m_AmpacityCtrl, m_area, PANEL_CABLE_SIZE_BASE::m_areaCtrl, m_conductorMaterialResitivity, m_conductorMaterialResitivityRef, m_conductorTemperature, m_current, PANEL_CABLE_SIZE_BASE::m_currentCtrl, m_diameter, PANEL_CABLE_SIZE_BASE::m_diameterCtrl, PANEL_CABLE_SIZE_BASE::m_diameterUnit, m_dissipatedPower, PANEL_CABLE_SIZE_BASE::m_frequencyCtrl, PANEL_CABLE_SIZE_BASE::m_frequencyUnit, m_length, PANEL_CABLE_SIZE_BASE::m_lengthCtrl, PANEL_CABLE_SIZE_BASE::m_lengthUnit, m_linearResistance, PANEL_CABLE_SIZE_BASE::m_linResistanceCtrl, PANEL_CABLE_SIZE_BASE::m_linResistanceUnit, m_maxFrequency, PANEL_CABLE_SIZE_BASE::m_powerCtrl, PANEL_CABLE_SIZE_BASE::m_powerUnit, m_resistanceDc, PANEL_CABLE_SIZE_BASE::m_resistanceDcCtrl, PANEL_CABLE_SIZE_BASE::m_textCtrlConductorResistivity, m_updatingAmpacity, m_updatingArea, m_updatingConductorMaterialResitivity, m_updatingCurrent, m_updatingDiameter, m_updatingFrequency, m_updatingLength, m_updatingLinResistance, m_updatingPower, m_updatingResistanceDc, m_updatingRVdrop, m_updatingUI, PANEL_CABLE_SIZE_BASE::m_vDropCtrl, PANEL_CABLE_SIZE_BASE::m_vDropUnit, and m_voltageDrop.

Referenced by OnUpdateUnit(), updateAll(), and updateApplication().

◆ SaveSettings()

void PANEL_CABLE_SIZE::SaveSettings ( PCB_CALCULATOR_SETTINGS aCfg)
overridevirtual

◆ ThemeChanged()

void PANEL_CABLE_SIZE::ThemeChanged ( )
inlineoverridevirtual

Update UI elements of the panel when the theme changes to ensure the images and fonts/colors are appropriate for the new theme.

Implements CALCULATOR_PANEL.

Definition at line 48 of file panel_cable_size.h.

48{};

◆ updateAll()

void PANEL_CABLE_SIZE::updateAll ( double  aRadius)
private

Definition at line 518 of file panel_cable_size.cpp.

519{
520 // Update wire properties
521 m_diameter = aRadius * 2;
522 m_area = M_PI * aRadius * aRadius;
527 // max frequency is when skin depth = radius
529 / ( M_PI * aRadius * aRadius * VACCUM_PERMEABILITY * RELATIVE_PERMEABILITY );
530
531 // Based on the 700 circular mils per amp rule of the thumb
532 // The long number is the sq m to circular mils conversion
533 m_ampacity = ( m_area * 1973525241.77 ) / 700;
534
535 // Update application-specific values
539
540 printAll();
541}

References m_ampacity, m_area, m_conductorMaterialResitivity, m_conductorMaterialResitivityRef, m_conductorMaterialThermalCoef, m_conductorTemperature, m_current, m_diameter, m_dissipatedPower, m_length, m_linearResistance, m_maxFrequency, m_resistanceDc, m_voltageDrop, printAll(), RELATIVE_PERMEABILITY, and VACCUM_PERMEABILITY.

Referenced by OnAmpacityChange(), OnAreaChange(), OnCableSizeChange(), OnConductorResistivityChange(), OnConductorTempChange(), OnConductorThermCoefChange(), OnDiameterChange(), OnFrequencyChange(), OnLinResistanceChange(), OnPowerChange(), OnResistanceDcChange(), OnVDropChange(), and PANEL_CABLE_SIZE().

◆ updateApplication()

void PANEL_CABLE_SIZE::updateApplication ( )
private

Member Data Documentation

◆ m_ampacity

double PANEL_CABLE_SIZE::m_ampacity
private

Definition at line 105 of file panel_cable_size.h.

Referenced by printAll(), and updateAll().

◆ m_AmpacityCtrl

wxTextCtrl* PANEL_CABLE_SIZE_BASE::m_AmpacityCtrl
protectedinherited

◆ m_area

double PANEL_CABLE_SIZE::m_area
private

Definition at line 99 of file panel_cable_size.h.

Referenced by printAll(), and updateAll().

◆ m_areaCtrl

wxTextCtrl* PANEL_CABLE_SIZE_BASE::m_areaCtrl
protectedinherited

◆ m_button_ResistivityConductor

wxButton* PANEL_CABLE_SIZE_BASE::m_button_ResistivityConductor
protectedinherited

◆ m_button_Temp_Coef_Conductor

wxButton* PANEL_CABLE_SIZE_BASE::m_button_Temp_Coef_Conductor
protectedinherited

◆ m_conductorMaterialResitivity

double PANEL_CABLE_SIZE::m_conductorMaterialResitivity
private

◆ m_conductorMaterialResitivityRef

double PANEL_CABLE_SIZE::m_conductorMaterialResitivityRef
private

◆ m_conductorMaterialThermalCoef

double PANEL_CABLE_SIZE::m_conductorMaterialThermalCoef
private

Definition at line 94 of file panel_cable_size.h.

Referenced by OnConductorThermCoefChange(), PANEL_CABLE_SIZE(), and updateAll().

◆ m_conductorTempCtrl

wxTextCtrl* PANEL_CABLE_SIZE_BASE::m_conductorTempCtrl
protectedinherited

◆ m_conductorTemperature

double PANEL_CABLE_SIZE::m_conductorTemperature
private

Definition at line 96 of file panel_cable_size.h.

Referenced by OnConductorTempChange(), PANEL_CABLE_SIZE(), printAll(), and updateAll().

◆ m_current

double PANEL_CABLE_SIZE::m_current
private

◆ m_currentCtrl

wxTextCtrl* PANEL_CABLE_SIZE_BASE::m_currentCtrl
protectedinherited

◆ m_diameter

double PANEL_CABLE_SIZE::m_diameter
private

◆ m_diameterCtrl

wxTextCtrl* PANEL_CABLE_SIZE_BASE::m_diameterCtrl
protectedinherited

◆ m_diameterUnit

◆ m_dissipatedPower

double PANEL_CABLE_SIZE::m_dissipatedPower
private

Definition at line 104 of file panel_cable_size.h.

Referenced by printAll(), updateAll(), and updateApplication().

◆ m_entries

std::vector<CABLE_SIZE_ENTRY> PANEL_CABLE_SIZE::m_entries
private

Definition at line 74 of file panel_cable_size.h.

Referenced by OnCableSizeChange(), and PANEL_CABLE_SIZE().

◆ m_frequencyCtrl

wxTextCtrl* PANEL_CABLE_SIZE_BASE::m_frequencyCtrl
protectedinherited

◆ m_frequencyUnit

◆ m_imperial

bool PANEL_CABLE_SIZE::m_imperial
private

Definition at line 89 of file panel_cable_size.h.

Referenced by PANEL_CABLE_SIZE().

◆ m_length

double PANEL_CABLE_SIZE::m_length
private

◆ m_lengthCtrl

wxTextCtrl* PANEL_CABLE_SIZE_BASE::m_lengthCtrl
protectedinherited

◆ m_lengthUnit

◆ m_linearResistance

double PANEL_CABLE_SIZE::m_linearResistance
private

Definition at line 100 of file panel_cable_size.h.

Referenced by printAll(), updateAll(), and updateApplication().

◆ m_linResistanceCtrl

wxTextCtrl* PANEL_CABLE_SIZE_BASE::m_linResistanceCtrl
protectedinherited

◆ m_linResistanceUnit

◆ m_maxFrequency

double PANEL_CABLE_SIZE::m_maxFrequency
private

Definition at line 101 of file panel_cable_size.h.

Referenced by printAll(), and updateAll().

◆ m_powerCtrl

wxTextCtrl* PANEL_CABLE_SIZE_BASE::m_powerCtrl
protectedinherited

◆ m_powerUnit

UNIT_SELECTOR_POWER* PANEL_CABLE_SIZE_BASE::m_powerUnit
protectedinherited

◆ m_resistanceDc

double PANEL_CABLE_SIZE::m_resistanceDc
private

Definition at line 102 of file panel_cable_size.h.

Referenced by printAll(), updateAll(), and updateApplication().

◆ m_resistanceDcCtrl

wxTextCtrl* PANEL_CABLE_SIZE_BASE::m_resistanceDcCtrl
protectedinherited

◆ m_sizeChoice

◆ m_staticText

wxStaticText* PANEL_CABLE_SIZE_BASE::m_staticText
protectedinherited

◆ m_staticText16

wxStaticText* PANEL_CABLE_SIZE_BASE::m_staticText16
protectedinherited

◆ m_staticText161

wxStaticText* PANEL_CABLE_SIZE_BASE::m_staticText161
protectedinherited

◆ m_staticText1612

wxStaticText* PANEL_CABLE_SIZE_BASE::m_staticText1612
protectedinherited

◆ m_staticText16121

wxStaticText* PANEL_CABLE_SIZE_BASE::m_staticText16121
protectedinherited

◆ m_staticText161211

wxStaticText* PANEL_CABLE_SIZE_BASE::m_staticText161211
protectedinherited

◆ m_staticText161212

wxStaticText* PANEL_CABLE_SIZE_BASE::m_staticText161212
protectedinherited

◆ m_staticText1612122

wxStaticText* PANEL_CABLE_SIZE_BASE::m_staticText1612122
protectedinherited

◆ m_staticText162

wxStaticText* PANEL_CABLE_SIZE_BASE::m_staticText162
protectedinherited

◆ m_staticText163

wxStaticText* PANEL_CABLE_SIZE_BASE::m_staticText163
protectedinherited

◆ m_staticText164

wxStaticText* PANEL_CABLE_SIZE_BASE::m_staticText164
protectedinherited

◆ m_staticText1641

wxStaticText* PANEL_CABLE_SIZE_BASE::m_staticText1641
protectedinherited

◆ m_staticText16411

wxStaticText* PANEL_CABLE_SIZE_BASE::m_staticText16411
protectedinherited

◆ m_staticText16412

wxStaticText* PANEL_CABLE_SIZE_BASE::m_staticText16412
protectedinherited

◆ m_staticText1642

wxStaticText* PANEL_CABLE_SIZE_BASE::m_staticText1642
protectedinherited

◆ m_staticText16421

wxStaticText* PANEL_CABLE_SIZE_BASE::m_staticText16421
protectedinherited

◆ m_staticText17

wxStaticText* PANEL_CABLE_SIZE_BASE::m_staticText17
protectedinherited

◆ m_staticText18

wxStaticText* PANEL_CABLE_SIZE_BASE::m_staticText18
protectedinherited

◆ m_staticText181

wxStaticText* PANEL_CABLE_SIZE_BASE::m_staticText181
protectedinherited

◆ m_staticText182

wxStaticText* PANEL_CABLE_SIZE_BASE::m_staticText182
protectedinherited

◆ m_textCtrlConductorResistivity

wxTextCtrl* PANEL_CABLE_SIZE_BASE::m_textCtrlConductorResistivity
protectedinherited

◆ m_textCtrlConductorThermCoef

wxTextCtrl* PANEL_CABLE_SIZE_BASE::m_textCtrlConductorThermCoef
protectedinherited

◆ m_updatingAmpacity

bool PANEL_CABLE_SIZE::m_updatingAmpacity
private

Definition at line 82 of file panel_cable_size.h.

Referenced by OnAmpacityChange(), PANEL_CABLE_SIZE(), and printAll().

◆ m_updatingArea

bool PANEL_CABLE_SIZE::m_updatingArea
private

Definition at line 78 of file panel_cable_size.h.

Referenced by OnAreaChange(), PANEL_CABLE_SIZE(), and printAll().

◆ m_updatingConductorMaterialResitivity

bool PANEL_CABLE_SIZE::m_updatingConductorMaterialResitivity
private

Definition at line 79 of file panel_cable_size.h.

Referenced by OnConductorResistivityChange(), PANEL_CABLE_SIZE(), and printAll().

◆ m_updatingCurrent

bool PANEL_CABLE_SIZE::m_updatingCurrent
private

Definition at line 83 of file panel_cable_size.h.

Referenced by OnCurrentChange(), PANEL_CABLE_SIZE(), and printAll().

◆ m_updatingDiameter

bool PANEL_CABLE_SIZE::m_updatingDiameter
private

Definition at line 77 of file panel_cable_size.h.

Referenced by OnDiameterChange(), PANEL_CABLE_SIZE(), and printAll().

◆ m_updatingFrequency

bool PANEL_CABLE_SIZE::m_updatingFrequency
private

Definition at line 81 of file panel_cable_size.h.

Referenced by OnFrequencyChange(), PANEL_CABLE_SIZE(), and printAll().

◆ m_updatingLength

bool PANEL_CABLE_SIZE::m_updatingLength
private

Definition at line 84 of file panel_cable_size.h.

Referenced by OnLengthChange(), PANEL_CABLE_SIZE(), and printAll().

◆ m_updatingLinResistance

bool PANEL_CABLE_SIZE::m_updatingLinResistance
private

Definition at line 80 of file panel_cable_size.h.

Referenced by OnLinResistanceChange(), PANEL_CABLE_SIZE(), and printAll().

◆ m_updatingPower

bool PANEL_CABLE_SIZE::m_updatingPower
private

Definition at line 87 of file panel_cable_size.h.

Referenced by OnPowerChange(), PANEL_CABLE_SIZE(), and printAll().

◆ m_updatingResistanceDc

bool PANEL_CABLE_SIZE::m_updatingResistanceDc
private

Definition at line 85 of file panel_cable_size.h.

Referenced by OnResistanceDcChange(), PANEL_CABLE_SIZE(), and printAll().

◆ m_updatingRVdrop

bool PANEL_CABLE_SIZE::m_updatingRVdrop
private

Definition at line 86 of file panel_cable_size.h.

Referenced by OnVDropChange(), PANEL_CABLE_SIZE(), and printAll().

◆ m_updatingUI

◆ m_vDropCtrl

wxTextCtrl* PANEL_CABLE_SIZE_BASE::m_vDropCtrl
protectedinherited

◆ m_vDropUnit

UNIT_SELECTOR_VOLTAGE* PANEL_CABLE_SIZE_BASE::m_vDropUnit
protectedinherited

◆ m_voltageDrop

double PANEL_CABLE_SIZE::m_voltageDrop
private

Definition at line 103 of file panel_cable_size.h.

Referenced by printAll(), updateAll(), and updateApplication().


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