49 const wxPoint& pos,
const wxSize& size,
50 long style,
const wxString&
name ) :
52 m_TWMode( TW_MASTER_CURRENT ),
64 GetSizer()->SetSizeHints(
this );
113 event.StopPropagation();
137 double extTrackWidth =
TWCalculateWidth( current, extThickness, deltaT_C,
false );
138 double intTrackWidth =
TWCalculateWidth( current, intThickness, deltaT_C,
true );
141 TWDisplayValues( current, extTrackWidth, intTrackWidth, extThickness, intThickness );
153 event.StopPropagation();
171 double intTrackWidth;
185 TWDisplayValues( current, extTrackWidth, intTrackWidth, extThickness, intThickness );
197 event.StopPropagation();
215 double extTrackWidth;
230 TWDisplayValues( current, extTrackWidth, intTrackWidth, extThickness, intThickness );
262 double aExtThickness,
double aIntThickness )
269 msg.Printf( wxT(
"%g" ), aCurrent );
280 msg.Printf( wxT(
"%g" ), aExtWidth / extScale );
286 msg.Printf( wxT(
"%g" ), aIntWidth / intScale );
291 msg.Printf( wxT(
"%g" ), (aExtWidth * aExtThickness) / (extScale * extScale) );
293 msg.Printf( wxT(
"%g" ), (aIntWidth * aIntThickness) / (intScale * intScale) );
298 msg = strunit + wxT(
"²" );
301 msg = strunit + wxT(
"²" );
310 double extResistance = ( rho * trackLen ) / ( aExtWidth * aExtThickness );
311 double intResistance = ( rho * trackLen ) / ( aIntWidth * aIntThickness );
314 msg.Printf( wxT(
"%g" ), extResistance );
316 msg.Printf( wxT(
"%g" ), intResistance );
320 double extV = extResistance * aCurrent;
321 msg.Printf( wxT(
"%g" ), extV );
323 double intV = intResistance * aCurrent;
324 msg.Printf( wxT(
"%g" ), intV );
328 msg.Printf( wxT(
"%g" ), extV * aCurrent );
330 msg.Printf( wxT(
"%g" ), intV * aCurrent );
346 labelfont.SetWeight( wxFONTWEIGHT_BOLD );
347 controlfont.SetWeight( wxFONTWEIGHT_BOLD );
351 labelfont.SetWeight( wxFONTWEIGHT_NORMAL );
352 controlfont.SetWeight( wxFONTWEIGHT_NORMAL );
364 labelfont.SetWeight( wxFONTWEIGHT_BOLD );
365 controlfont.SetWeight( wxFONTWEIGHT_BOLD );
369 labelfont.SetWeight( wxFONTWEIGHT_NORMAL );
370 controlfont.SetWeight( wxFONTWEIGHT_NORMAL );
382 labelfont.SetWeight( wxFONTWEIGHT_BOLD );
383 controlfont.SetWeight( wxFONTWEIGHT_BOLD );
387 labelfont.SetWeight( wxFONTWEIGHT_NORMAL );
388 controlfont.SetWeight( wxFONTWEIGHT_NORMAL );
396 GetSizer()->Layout();
408 bool aUseInternalLayer )
411 double scale = aUseInternalLayer ? 0.024 : 0.048;
421 double dtmp = log( aCurrent ) - log(
scale ) - 0.44 * log( aDeltaT_C ) - 0.725 * log( aThickness );
423 double trackWidth = exp( dtmp );
431 bool aUseInternalLayer )
434 double scale = aUseInternalLayer ? 0.024 : 0.048;
440 double area = aThickness * aWidth;
441 double current =
scale * pow( aDeltaT_C, 0.44 ) * pow( area, 0.725 );
486 wxCommandEvent
dummy;
bool SetPage(const wxString &aSource) override
Class PANEL_TRACK_WIDTH_BASE.
wxTextCtrl * m_TrackLengthValue
wxTextCtrl * m_IntTrackThicknessValue
wxTextCtrl * m_ExtTrackThicknessValue
wxStaticText * m_staticTextCurrent
wxStaticText * m_staticTextExtWidth
wxStaticText * m_ExtTrackLossValue
wxStaticText * m_IntTrackVDropValue
HTML_WINDOW * m_htmlWinFormulas
wxStaticText * m_extTrackResUnits
wxTextCtrl * m_IntTrackWidthValue
wxTextCtrl * m_TrackCurrentValue
wxStaticText * m_intTrackResUnits
wxStaticText * m_IntTrackResistValue
wxStaticText * m_staticTextIntWidth
wxStaticText * m_IntTrackLossValue
UNIT_SELECTOR_THICKNESS * m_IntTrackThicknessUnit
wxStaticText * m_ExtTrackAreaValue
UNIT_SELECTOR_LEN * m_TW_IntTrackWidth_choiceUnit
wxStaticText * m_resistivityUnits
wxStaticText * m_ExtTrackVDropValue
wxStaticText * m_IntTrackAreaValue
UNIT_SELECTOR_THICKNESS * m_ExtTrackThicknessUnit
UNIT_SELECTOR_LEN * m_TW_ExtTrackWidth_choiceUnit
wxStaticText * m_staticText63
UNIT_SELECTOR_LEN * m_TW_CuLength_choiceUnit
wxStaticText * m_ExtTrackResistValue
wxTextCtrl * m_TrackDeltaTValue
wxTextCtrl * m_ExtTrackWidthValue
wxStaticText * m_intTrackAreaUnitLabel
wxTextCtrl * m_TWResistivity
wxStaticText * m_extTrackAreaUnitLabel
wxStaticText * m_trackTempUnits
PANEL_TRACK_WIDTH(wxWindow *parent, wxWindowID id=wxID_ANY, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxTAB_TRAVERSAL, const wxString &name=wxEmptyString)
double TWCalculateCurrent(double aWidth, double aThickness, double aDeltaT_C, bool aUseInternalLayer)
Calculate maximum current based on given width and temperature rise.
void SaveSettings(PCB_CALCULATOR_SETTINGS *aCfg) override
Save the settings from the panel.
double TWCalculateWidth(double aCurrent, double aThickness, double aDeltaT_C, bool aUseInternalLayer)
Calculate track width required based on given current and temperature rise.
void OnTWCalculateFromIntWidth(wxCommandEvent &event) override
Update the calculations when the user changes the desired internal trace width.
void TWUpdateModeDisplay()
Update the fields to show whether the maximum current, external trace width, or internal trace width ...
void ThemeChanged() override
Update UI elements of the panel when the theme changes to ensure the images and fonts/colors are appr...
enum PANEL_TRACK_WIDTH::@44 m_TWMode
void OnTWResetButtonClick(wxCommandEvent &event) override
Update the calculations when the user clicks the reset button.
void OnTWParametersChanged(wxCommandEvent &event) override
Update the calculations the user changes the general parameters.
void OnTWCalculateFromCurrent(wxCommandEvent &event) override
Update the calculations when the user changes the desired maximum current.
void OnTWCalculateFromExtWidth(wxCommandEvent &event) override
Update the calculations when the user changes the desired external trace width.
void LoadSettings(PCB_CALCULATOR_SETTINGS *aCfg) override
Load the settings into the panel.
void TWDisplayValues(double aCurrent, double aExtWidth, double aIntWidth, double aExtThickness, double aIntThickness)
Display the results of a calculation (including resulting values such as the resistance and power los...
double GetUnitScale() override
Function GetUnitScale.
double GetUnitScale() override
Function GetUnitScale.
Some functions to handle hotkeys in KiCad.
EDA_ANGLE abs(const EDA_ANGLE &aAngle)
double DoubleFromString(const wxString &TextValue)
const double copper_resistivity
const double copper_resistivity
wxString tracks_width_versus_current_formula
std::vector< FAB_LAYER_COLOR > dummy
void ConvertMarkdown2Html(const wxString &aMarkdownInput, wxString &aHtmlOutput)
int int_track_width_units
wxString int_track_thickness
int int_track_thickness_units
int ext_track_thickness_units
int ext_track_width_units
wxString ext_track_thickness