35#include <units_scales.h>
50 const wxPoint& pos,
const wxSize& size,
51 long style,
const wxString&
name ) :
65 GetSizer()->SetSizeHints(
this );
114 event.StopPropagation();
138 double extTrackWidth =
TWCalculateWidth( current, extThickness, deltaT_C,
false );
139 double intTrackWidth =
TWCalculateWidth( current, intThickness, deltaT_C,
true );
142 TWDisplayValues( current, extTrackWidth, intTrackWidth, extThickness, intThickness );
154 event.StopPropagation();
172 double intTrackWidth;
186 TWDisplayValues( current, extTrackWidth, intTrackWidth, extThickness, intThickness );
198 event.StopPropagation();
216 double extTrackWidth;
231 TWDisplayValues( current, extTrackWidth, intTrackWidth, extThickness, intThickness );
263 double aExtThickness,
double aIntThickness )
270 msg.Printf( wxT(
"%g" ), aCurrent );
281 msg.Printf( wxT(
"%g" ), aExtWidth / extScale );
287 msg.Printf( wxT(
"%g" ), aIntWidth / intScale );
292 msg.Printf( wxT(
"%g" ), (aExtWidth * aExtThickness) / (extScale * extScale) );
294 msg.Printf( wxT(
"%g" ), (aIntWidth * aIntThickness) / (intScale * intScale) );
299 msg = strunit + wxT(
"²" );
302 msg = strunit + wxT(
"²" );
311 double extResistance = ( rho * trackLen ) / ( aExtWidth * aExtThickness );
312 double intResistance = ( rho * trackLen ) / ( aIntWidth * aIntThickness );
315 msg.Printf( wxT(
"%g" ), extResistance );
317 msg.Printf( wxT(
"%g" ), intResistance );
321 double extV = extResistance * aCurrent;
322 msg.Printf( wxT(
"%g" ), extV );
324 double intV = intResistance * aCurrent;
325 msg.Printf( wxT(
"%g" ), intV );
329 msg.Printf( wxT(
"%g" ), extV * aCurrent );
331 msg.Printf( wxT(
"%g" ), intV * aCurrent );
347 labelfont.SetWeight( wxFONTWEIGHT_BOLD );
348 controlfont.SetWeight( wxFONTWEIGHT_BOLD );
352 labelfont.SetWeight( wxFONTWEIGHT_NORMAL );
353 controlfont.SetWeight( wxFONTWEIGHT_NORMAL );
365 labelfont.SetWeight( wxFONTWEIGHT_BOLD );
366 controlfont.SetWeight( wxFONTWEIGHT_BOLD );
370 labelfont.SetWeight( wxFONTWEIGHT_NORMAL );
371 controlfont.SetWeight( wxFONTWEIGHT_NORMAL );
383 labelfont.SetWeight( wxFONTWEIGHT_BOLD );
384 controlfont.SetWeight( wxFONTWEIGHT_BOLD );
388 labelfont.SetWeight( wxFONTWEIGHT_NORMAL );
389 controlfont.SetWeight( wxFONTWEIGHT_NORMAL );
397 GetSizer()->Layout();
404 bool aUseInternalLayer )
407 aCurrent, aThickness /
UNIT_MIL, aDeltaT_C, aUseInternalLayer );
414 bool aUseInternalLayer )
417 aDeltaT_C, aUseInternalLayer );
460 wxCommandEvent
dummy;
wxTextCtrl * m_TrackLengthValue
wxTextCtrl * m_IntTrackThicknessValue
PANEL_TRACK_WIDTH_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)
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...
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...
enum PANEL_TRACK_WIDTH::@132265162345043127367315227343052112174236206025 m_TWMode
Some functions to handle hotkeys in KiCad.
double CurrentFromWidth(double aWidthMils, double aThicknessMils, double aDeltaT_C, bool aUseInternalLayer)
Compute the maximum current a track can carry for a given temperature rise.
double WidthFromCurrent(double aCurrentA, double aThicknessMils, double aDeltaT_C, bool aUseInternalLayer)
Compute the track width required to carry a given current for a given temperature rise.
EDA_ANGLE abs(const EDA_ANGLE &aAngle)
double DoubleFromString(const wxString &TextValue)
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