25#define ABS_ZERO ( -273.15 )
34wxString fusing_current_help =
39 const wxPoint& pos,
const wxSize& size,
40 long style,
const wxString&
name ) :
43 m_ambientUnit->SetLabel( wxT(
"°C" ) );
44 m_meltingUnit->SetLabel( wxT(
"°C" ) );
47 m_ambientValue->SetValue( wxString::Format( wxT(
"%i" ), 25 ) );
48 m_meltingValue->SetValue( wxString::Format( wxT(
"%i" ), 1084 ) );
49 m_meltingValue->SetEditable(
false );
50 m_widthValue->SetValue( wxString::Format( wxT(
"%f" ), 0.1 ) );
51 m_thicknessValue->SetValue( wxString::Format( wxT(
"%f" ), 0.035 ) );
52 m_currentValue->SetValue( wxString::Format( wxT(
"%f" ), 10.0 ) );
53 m_timeValue->SetValue( wxString::Format( wxT(
"%f" ), 0.01 ) );
58 m_htmlHelp->SetPage( msg );
61 GetSizer()->SetSizeHints(
this );
79 double Tm, Ta,
I, W, T, time;
80 bool valid_Tm, valid_Ta, valid_I, valid_W, valid_T, valid_time;
87 valid_time =
m_timeValue->GetValue().ToDouble( &time );
89 double scalingT, scalingW;
96 valid_Tm &= std::isfinite( Tm );
97 valid_Ta &= std::isfinite( Ta );
98 valid_I &= std::isfinite(
I );
99 valid_W &= std::isfinite( W );
100 valid_T &= std::isfinite( T );
101 valid_time &= std::isfinite( time );
103 if( valid_Tm && valid_Ta )
105 valid_Tm &= ( Tm > Ta );
106 valid_Ta &= ( Tm > Ta ) && ( Ta >
ABS_ZERO );
109 valid_I &= (
I > 0 );
110 valid_W &= ( W > 0 );
111 valid_T &= ( T > 0 );
112 valid_time &= ( time > 0 );
120 double latentHeat = 205350.0;
130 double deltaEnthalpy = ( Tm - Ta ) * cp;
131 double density = 8940;
132 double volumicEnergy = density * ( deltaEnthalpy + latentHeat );
147 double Ra = ( ( Ta -
ABS_ZERO - 293 ) * 0.00393 + 1 ) * 1.72e-8;
148 double Rm = ( ( Tm -
ABS_ZERO - 293 ) * 0.00393 + 1 ) * 1.72e-8;
151 double R = ( Rm + Ra ) / 2;
152 double coeff = volumicEnergy / R;
154 bool valid = valid_I && valid_W && valid_T && valid_Ta && valid_Tm && valid_time;
160 A =
I / sqrt( coeff / time );
162 m_widthValue->SetValue( wxString::Format( wxT(
"%f" ), W / scalingW ) );
173 A =
I / sqrt( coeff / time );
175 m_thicknessValue->SetValue( wxString::Format( wxT(
"%f" ), T / scalingT ) );
186 I =
A * sqrt( coeff / time );
198 time = coeff *
A *
A /
I /
I;
199 m_timeValue->SetValue( wxString::Format( wxT(
"%f" ), time ) );
215 double r = sqrt(
A / M_PI );
221 double frad = 0.5 * ( tmKelvin + 293 ) * ( tmKelvin + 293 ) * ( tmKelvin + 293 );
223 double tau = cp * density * r / (
epsilon * sigma * frad * 2 );
231 m_comment->SetLabel(
_(
"Current calculation is underestimated due to long fusing time."
Class PANEL_FUSING_CURRENT_BASE.
wxTextCtrl * m_meltingValue
wxRadioButton * m_thicknessRadio
wxTextCtrl * m_currentValue
wxRadioButton * m_widthRadio
UNIT_SELECTOR_THICKNESS * m_thicknessUnit
wxRadioButton * m_timeRadio
wxTextCtrl * m_widthValue
wxTextCtrl * m_ambientValue
wxRadioButton * m_currentRadio
wxTextCtrl * m_thicknessValue
UNIT_SELECTOR_LEN * m_widthUnit
void ThemeChanged() override
Update UI elements of the panel when the theme changes to ensure the images and fonts/colors are appr...
void m_onCalculateClick(wxCommandEvent &event) override
PANEL_FUSING_CURRENT(wxWindow *parent, wxWindowID id=wxID_ANY, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxTAB_TRAVERSAL, const wxString &name=wxEmptyString)
double GetUnitScale() override
Function GetUnitScale.
double GetUnitScale() override
Function GetUnitScale.
Some functions to handle hotkeys in KiCad.
void ConvertMarkdown2Html(const wxString &aMarkdownInput, wxString &aHtmlOutput)