From 4646bc0eef34527d12fa31114ba5c0ecb2f3faa5 Mon Sep 17 00:00:00 2001 From: Jakub Kozdon Date: Fri, 4 Oct 2019 17:05:50 +0200 Subject: [PATCH] Pcb Calculator: Convert tracks width versus current formula to markdown. --- .gitignore | 1 + pcb_calculator/CMakeLists.txt | 2 ++ .../tracks_width_versus_current.cpp | 36 +++++++------------ .../tracks_width_versus_current_formula.md | 15 ++++++++ 4 files changed, 30 insertions(+), 24 deletions(-) create mode 100644 pcb_calculator/tracks_width_versus_current_formula.md diff --git a/.gitignore b/.gitignore index 7a4c04491c..619c7f9631 100644 --- a/.gitignore +++ b/.gitignore @@ -26,6 +26,7 @@ pcb_calculator/attenuators/bridget_tee_formula.h pcb_calculator/attenuators/pi_formula.h pcb_calculator/attenuators/splitter_formula.h pcb_calculator/attenuators/tee_formula.h +pcb_calculator/tracks_width_versus_current_formula.h Makefile CMakeCache.txt auto_renamed_to_cpp diff --git a/pcb_calculator/CMakeLists.txt b/pcb_calculator/CMakeLists.txt index 76dfba0569..0e7d88a31d 100644 --- a/pcb_calculator/CMakeLists.txt +++ b/pcb_calculator/CMakeLists.txt @@ -191,12 +191,14 @@ endfunction() md_doc2h( ${CMAKE_CURRENT_SOURCE_DIR}/attenuators/splitter_formula ) md_doc2h( ${CMAKE_CURRENT_SOURCE_DIR}/attenuators/pi_formula ) md_doc2h( ${CMAKE_CURRENT_SOURCE_DIR}/attenuators/tee_formula ) + md_doc2h( ${CMAKE_CURRENT_SOURCE_DIR}/tracks_width_versus_current_formula ) set( DOCS_LIST ${CMAKE_CURRENT_SOURCE_DIR}/attenuators/pi_formula.h ${CMAKE_CURRENT_SOURCE_DIR}/attenuators/tee_formula.h ${CMAKE_CURRENT_SOURCE_DIR}/attenuators/bridget_tee_formula.h ${CMAKE_CURRENT_SOURCE_DIR}/attenuators/splitter_formula.h + ${CMAKE_CURRENT_SOURCE_DIR}/tracks_width_versus_current_formula.h ) set_source_files_properties( attenuators/attenuator_classes.cpp diff --git a/pcb_calculator/tracks_width_versus_current.cpp b/pcb_calculator/tracks_width_versus_current.cpp index f77683e171..2e00e32096 100644 --- a/pcb_calculator/tracks_width_versus_current.cpp +++ b/pcb_calculator/tracks_width_versus_current.cpp @@ -28,6 +28,7 @@ #include #include #include +#include #include @@ -35,6 +36,9 @@ #include #include +wxString tracks_width_versus_current_formula = +#include + extern double DoubleFromString( const wxString& TextValue ); // Key words to read/write some parameters in config: @@ -440,30 +444,14 @@ void PCB_CALCULATOR_FRAME::TW_Init( wxConfigBase* aCfg ) aCfg->Read( KEYWORD_TW_INTTRACK_THICKNESS_UNIT, &tmp, 0 ); m_IntTrackThicknessUnit->SetSelection( tmp ); - // Init formulas text - msg = "
"; - msg << _( "If you specify the maximum current, then the trace " - "widths will be calculated to suit." ) - << "
" << _( "If you specify one of the trace widths, the maximum " - "current it can handle will be calculated. The width " - "for the other trace to also handle this current will " - "then be calculated." ) - << "
" << _( "The controlling value is shown in bold." ) << "

" - << _( "The calculations are valid for currents up to 35A " - "(external) or 17.5A (internal), temperature rises " - "up to 100 deg C, and widths of up to 400mil (10mm)." )<< "
" - << _( "The formula, from IPC 2221, is" ) - << "
I = K * dT0.44 * (W*H)0.725
" - << _( "where:" ) << "
I = " - << _( "maximum current in amps" ) - << "
dT = " - << _( "temperature rise above ambient in deg C" ) - << "
W,H = " - << _( "width and thickness in mils" ) << "
" - << "K = " - << _( "0.024 for internal traces or 0.048 for external traces" ); - - m_htmlWinFormulas->AppendToPage( msg ); + if( tracks_width_versus_current_formula.StartsWith( "SetPage( tracks_width_versus_current_formula ); + else + { + wxString html_txt; + ConvertMarkdown2Html( wxGetTranslation( tracks_width_versus_current_formula ), html_txt ); + m_htmlWinFormulas->SetPage( html_txt ); + } // Make sure the correct master mode is displayed. TWUpdateModeDisplay(); diff --git a/pcb_calculator/tracks_width_versus_current_formula.md b/pcb_calculator/tracks_width_versus_current_formula.md new file mode 100644 index 0000000000..09b2633935 --- /dev/null +++ b/pcb_calculator/tracks_width_versus_current_formula.md @@ -0,0 +1,15 @@ +If you specify the maximum current, then the trace widths will be calculated to suit. + +If you specify one of the trace widths, the maximum current it can handle will be calculated. The width for the other trace to also handle this current will then be calculated. + +The controlling value is shown in bold. + +The calculations are valid for currents up to 35A (external) or 17.5A (internal), temperature rises up to 100 deg C, and widths of up to 400mil (10mm). + +The formula, from IPC 2221, is +
__I = K * dT0.44 * (W*H)0.725__
+where: +__I__ = maximum current in amps +__dt__ = temperature rise above ambient in deg C +__W,H__ = width and thickness in mils +__K__ = 0.024 for internal traces or 0.048 for external traces