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 );
261 double aExtThickness,
double aIntThickness )
268 msg.Printf( wxT(
"%g" ), aCurrent );
279 msg.Printf( wxT(
"%g" ), aExtWidth / extScale );
285 msg.Printf( wxT(
"%g" ), aIntWidth / intScale );
290 msg.Printf( wxT(
"%g" ), (aExtWidth * aExtThickness) / (extScale * extScale) );
292 msg.Printf( wxT(
"%g" ), (aIntWidth * aIntThickness) / (intScale * intScale) );
297 msg = strunit + wxT(
"²" );
300 msg = strunit + wxT(
"²" );
309 double extResistance = ( rho * trackLen ) / ( aExtWidth * aExtThickness );
310 double intResistance = ( rho * trackLen ) / ( aIntWidth * aIntThickness );
313 msg.Printf( wxT(
"%g" ), extResistance );
315 msg.Printf( wxT(
"%g" ), intResistance );
319 double extV = extResistance * aCurrent;
320 msg.Printf( wxT(
"%g" ), extV );
322 double intV = intResistance * aCurrent;
323 msg.Printf( wxT(
"%g" ), intV );
327 msg.Printf( wxT(
"%g" ), extV * aCurrent );
329 msg.Printf( wxT(
"%g" ), intV * aCurrent );
345 labelfont.SetWeight( wxFONTWEIGHT_BOLD );
346 controlfont.SetWeight( wxFONTWEIGHT_BOLD );
350 labelfont.SetWeight( wxFONTWEIGHT_NORMAL );
351 controlfont.SetWeight( wxFONTWEIGHT_NORMAL );
363 labelfont.SetWeight( wxFONTWEIGHT_BOLD );
364 controlfont.SetWeight( wxFONTWEIGHT_BOLD );
368 labelfont.SetWeight( wxFONTWEIGHT_NORMAL );
369 controlfont.SetWeight( wxFONTWEIGHT_NORMAL );
381 labelfont.SetWeight( wxFONTWEIGHT_BOLD );
382 controlfont.SetWeight( wxFONTWEIGHT_BOLD );
386 labelfont.SetWeight( wxFONTWEIGHT_NORMAL );
387 controlfont.SetWeight( wxFONTWEIGHT_NORMAL );
395 GetSizer()->Layout();
407 bool aUseInternalLayer )
410 double scale = aUseInternalLayer ? 0.024 : 0.048;
420 double dtmp = log( aCurrent ) - log(
scale ) - 0.44 * log( aDeltaT_C ) - 0.725 * log( aThickness );
422 double trackWidth = exp( dtmp );
430 bool aUseInternalLayer )
433 double scale = aUseInternalLayer ? 0.024 : 0.048;
439 double area = aThickness * aWidth;
440 double current =
scale * pow( aDeltaT_C, 0.44 ) * pow( area, 0.725 );
485 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 ...
enum PANEL_TRACK_WIDTH::@42 m_TWMode
void ThemeChanged() override
Update UI elements of the panel when the theme changes to ensure the images and fonts/colors are appr...
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