Browse Source
pcb_calculator: New tab for via calculations
pcb_calculator: New tab for via calculations
NEW: Adds a tab in pcb_calculator for calculations related to via size. Fixes: lp:1802222 * https://bugs.launchpad.net/kicad/+bug/1802222pull/15/head
committed by
Seth Hillbrand
9 changed files with 15331 additions and 91 deletions
-
1pcb_calculator/CMakeLists.txt
-
361pcb_calculator/bitmaps/sources/via.svg
-
1053pcb_calculator/bitmaps/via.xpm
-
376pcb_calculator/dialogs/pcb_calculator_frame_base.cpp
-
13207pcb_calculator/dialogs/pcb_calculator_frame_base.fbp
-
74pcb_calculator/dialogs/pcb_calculator_frame_base.h
-
38pcb_calculator/pcb_calculator.h
-
4pcb_calculator/pcb_calculator_frame.cpp
-
308pcb_calculator/via.cpp
@ -0,0 +1,361 @@ |
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?> |
|||
<!-- Created with Inkscape (http://www.inkscape.org/) --> |
|||
|
|||
<svg |
|||
xmlns:dc="http://purl.org/dc/elements/1.1/" |
|||
xmlns:cc="http://creativecommons.org/ns#" |
|||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" |
|||
xmlns:svg="http://www.w3.org/2000/svg" |
|||
xmlns="http://www.w3.org/2000/svg" |
|||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" |
|||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" |
|||
width="287.31168" |
|||
height="288.8616" |
|||
viewBox="0 0 76.017877 76.427968" |
|||
version="1.1" |
|||
id="svg8" |
|||
inkscape:version="0.92.1 r15371" |
|||
sodipodi:docname="via.svg" |
|||
inkscape:export-filename="D:\private-local\working\kicad\kicad\pcb_calculator\bitmaps\sources\via.png" |
|||
inkscape:export-xdpi="80.409149" |
|||
inkscape:export-ydpi="80.409149"> |
|||
<defs |
|||
id="defs2"> |
|||
<marker |
|||
inkscape:isstock="true" |
|||
style="overflow:visible" |
|||
id="marker9465" |
|||
refX="0" |
|||
refY="0" |
|||
orient="auto" |
|||
inkscape:stockid="Arrow2Lend"> |
|||
<path |
|||
transform="matrix(-1.1,0,0,-1.1,-1.1,0)" |
|||
d="M 8.7185878,4.0337352 -2.2072895,0.01601326 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z" |
|||
style="fill:#0402fc;fill-opacity:1;fill-rule:evenodd;stroke:#0402fc;stroke-width:0.625;stroke-linejoin:round;stroke-opacity:1" |
|||
id="path9463" |
|||
inkscape:connector-curvature="0" /> |
|||
</marker> |
|||
<marker |
|||
inkscape:isstock="true" |
|||
style="overflow:visible" |
|||
id="marker9401" |
|||
refX="0" |
|||
refY="0" |
|||
orient="auto" |
|||
inkscape:stockid="Arrow2Lstart"> |
|||
<path |
|||
transform="matrix(1.1,0,0,1.1,1.1,0)" |
|||
d="M 8.7185878,4.0337352 -2.2072895,0.01601326 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z" |
|||
style="fill:#0402fc;fill-opacity:1;fill-rule:evenodd;stroke:#0402fc;stroke-width:0.625;stroke-linejoin:round;stroke-opacity:1" |
|||
id="path9399" |
|||
inkscape:connector-curvature="0" /> |
|||
</marker> |
|||
<marker |
|||
inkscape:stockid="Arrow2Lend" |
|||
orient="auto" |
|||
refY="0" |
|||
refX="0" |
|||
id="Arrow2Lend" |
|||
style="overflow:visible" |
|||
inkscape:isstock="true" |
|||
inkscape:collect="always"> |
|||
<path |
|||
id="path8476" |
|||
style="fill:#0402fc;fill-opacity:1;fill-rule:evenodd;stroke:#0402fc;stroke-width:0.625;stroke-linejoin:round;stroke-opacity:1" |
|||
d="M 8.7185878,4.0337352 -2.2072895,0.01601326 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z" |
|||
transform="matrix(-1.1,0,0,-1.1,-1.1,0)" |
|||
inkscape:connector-curvature="0" /> |
|||
</marker> |
|||
<marker |
|||
inkscape:stockid="Arrow1Lend" |
|||
orient="auto" |
|||
refY="0" |
|||
refX="0" |
|||
id="Arrow1Lend" |
|||
style="overflow:visible" |
|||
inkscape:isstock="true"> |
|||
<path |
|||
id="path8458" |
|||
d="M 0,0 5,-5 -12.5,0 5,5 Z" |
|||
style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1.00000003pt;stroke-opacity:1" |
|||
transform="matrix(-0.8,0,0,-0.8,-10,0)" |
|||
inkscape:connector-curvature="0" /> |
|||
</marker> |
|||
<marker |
|||
inkscape:stockid="Arrow2Lstart" |
|||
orient="auto" |
|||
refY="0" |
|||
refX="0" |
|||
id="marker8801" |
|||
style="overflow:visible" |
|||
inkscape:isstock="true" |
|||
inkscape:collect="always"> |
|||
<path |
|||
id="path8799" |
|||
style="fill:#0402fc;fill-opacity:1;fill-rule:evenodd;stroke:#0402fc;stroke-width:0.625;stroke-linejoin:round;stroke-opacity:1" |
|||
d="M 8.7185878,4.0337352 -2.2072895,0.01601326 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z" |
|||
transform="matrix(1.1,0,0,1.1,1.1,0)" |
|||
inkscape:connector-curvature="0" /> |
|||
</marker> |
|||
<marker |
|||
inkscape:stockid="Arrow1Mstart" |
|||
orient="auto" |
|||
refY="0" |
|||
refX="0" |
|||
id="Arrow1Mstart" |
|||
style="overflow:visible" |
|||
inkscape:isstock="true"> |
|||
<path |
|||
id="path8461" |
|||
d="M 0,0 5,-5 -12.5,0 5,5 Z" |
|||
style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1.00000003pt;stroke-opacity:1" |
|||
transform="matrix(0.4,0,0,0.4,4,0)" |
|||
inkscape:connector-curvature="0" /> |
|||
</marker> |
|||
<marker |
|||
inkscape:stockid="Arrow2Lstart" |
|||
orient="auto" |
|||
refY="0" |
|||
refX="0" |
|||
id="Arrow2Lstart" |
|||
style="overflow:visible" |
|||
inkscape:isstock="true"> |
|||
<path |
|||
id="path8473" |
|||
style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:0.625;stroke-linejoin:round;stroke-opacity:1" |
|||
d="M 8.7185878,4.0337352 -2.2072895,0.01601326 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z" |
|||
transform="matrix(1.1,0,0,1.1,1.1,0)" |
|||
inkscape:connector-curvature="0" /> |
|||
</marker> |
|||
<marker |
|||
inkscape:stockid="Arrow1Lstart" |
|||
orient="auto" |
|||
refY="0" |
|||
refX="0" |
|||
id="marker8341" |
|||
style="overflow:visible" |
|||
inkscape:isstock="true"> |
|||
<path |
|||
id="path8339" |
|||
d="M 0,0 5,-5 -12.5,0 5,5 Z" |
|||
style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1.00000003pt;stroke-opacity:1" |
|||
transform="matrix(0.8,0,0,0.8,10,0)" |
|||
inkscape:connector-curvature="0" /> |
|||
</marker> |
|||
<marker |
|||
inkscape:isstock="true" |
|||
style="overflow:visible" |
|||
id="marker4531" |
|||
refX="0" |
|||
refY="0" |
|||
orient="auto" |
|||
inkscape:stockid="Arrow1Lstart"> |
|||
<path |
|||
transform="matrix(0.8,0,0,0.8,10,0)" |
|||
style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1.00000003pt;stroke-opacity:1" |
|||
d="M 0,0 5,-5 -12.5,0 5,5 Z" |
|||
id="path4529" |
|||
inkscape:connector-curvature="0" /> |
|||
</marker> |
|||
<marker |
|||
inkscape:isstock="true" |
|||
style="overflow:visible" |
|||
id="marker4495" |
|||
refX="0" |
|||
refY="0" |
|||
orient="auto" |
|||
inkscape:stockid="Arrow1Lstart"> |
|||
<path |
|||
transform="matrix(0.8,0,0,0.8,10,0)" |
|||
style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1.00000003pt;stroke-opacity:1" |
|||
d="M 0,0 5,-5 -12.5,0 5,5 Z" |
|||
id="path4493" |
|||
inkscape:connector-curvature="0" /> |
|||
</marker> |
|||
<symbol |
|||
id="RightAndDownArrow"> |
|||
<title |
|||
id="title2315">Right and Down Arrow</title> |
|||
<path |
|||
inkscape:connector-curvature="0" |
|||
d="M 14.816667,14.816667 H 6.35 L 3.4395833,11.90625 h 6.35 L 3.7041667,5.8208333 5.8208333,3.7041667 11.90625,9.7895833 v -6.35 L 14.816667,6.35 Z" |
|||
style="stroke:none;stroke-width:0.26458332" |
|||
id="path2317" /> |
|||
</symbol> |
|||
<marker |
|||
inkscape:isstock="true" |
|||
style="overflow:visible" |
|||
id="marker9465-7" |
|||
refX="0" |
|||
refY="0" |
|||
orient="auto" |
|||
inkscape:stockid="Arrow2Lend"> |
|||
<path |
|||
inkscape:connector-curvature="0" |
|||
transform="matrix(-1.1,0,0,-1.1,-1.1,0)" |
|||
d="M 8.7185878,4.0337352 -2.2072895,0.01601326 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z" |
|||
style="fill:#0402fc;fill-opacity:1;fill-rule:evenodd;stroke:#0402fc;stroke-width:0.625;stroke-linejoin:round;stroke-opacity:1" |
|||
id="path9463-6" /> |
|||
</marker> |
|||
</defs> |
|||
<sodipodi:namedview |
|||
id="base" |
|||
pagecolor="#ffffff" |
|||
bordercolor="#666666" |
|||
borderopacity="1.0" |
|||
inkscape:pageopacity="1" |
|||
inkscape:pageshadow="2" |
|||
inkscape:zoom="1.072" |
|||
inkscape:cx="102.28598" |
|||
inkscape:cy="209.41831" |
|||
inkscape:document-units="mm" |
|||
inkscape:current-layer="layer1" |
|||
showgrid="false" |
|||
inkscape:window-width="1366" |
|||
inkscape:window-height="705" |
|||
inkscape:window-x="-8" |
|||
inkscape:window-y="-8" |
|||
inkscape:window-maximized="1" |
|||
inkscape:measure-start="-145.714,988.571" |
|||
inkscape:measure-end="148.571,591.429" |
|||
showguides="true" |
|||
inkscape:lockguides="false" |
|||
units="px" |
|||
objecttolerance="20" |
|||
inkscape:snap-global="true" |
|||
inkscape:snap-bbox="false" |
|||
inkscape:snap-others="true" |
|||
inkscape:snap-object-midpoints="true" |
|||
inkscape:snap-tangential="true" |
|||
inkscape:snap-perpendicular="true" |
|||
inkscape:object-paths="true" |
|||
inkscape:snap-intersection-paths="true" |
|||
inkscape:snap-smooth-nodes="true" |
|||
inkscape:object-nodes="true" |
|||
inkscape:snap-midpoints="true" |
|||
inkscape:pagecheckerboard="false" |
|||
fit-margin-top="0" |
|||
fit-margin-left="0" |
|||
fit-margin-right="0" |
|||
fit-margin-bottom="0"> |
|||
<inkscape:grid |
|||
type="xygrid" |
|||
id="grid3684" |
|||
originx="-18.400886" |
|||
originy="-30.764148" /> |
|||
</sodipodi:namedview> |
|||
<metadata |
|||
id="metadata5"> |
|||
<rdf:RDF> |
|||
<cc:Work |
|||
rdf:about=""> |
|||
<dc:format>image/svg+xml</dc:format> |
|||
<dc:type |
|||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> |
|||
<dc:title></dc:title> |
|||
<cc:license |
|||
rdf:resource="http://creativecommons.org/licenses/by-sa/4.0/" /> |
|||
</cc:Work> |
|||
<cc:License |
|||
rdf:about="http://creativecommons.org/licenses/by-sa/4.0/"> |
|||
<cc:permits |
|||
rdf:resource="http://creativecommons.org/ns#Reproduction" /> |
|||
<cc:permits |
|||
rdf:resource="http://creativecommons.org/ns#Distribution" /> |
|||
<cc:requires |
|||
rdf:resource="http://creativecommons.org/ns#Notice" /> |
|||
<cc:requires |
|||
rdf:resource="http://creativecommons.org/ns#Attribution" /> |
|||
<cc:permits |
|||
rdf:resource="http://creativecommons.org/ns#DerivativeWorks" /> |
|||
<cc:requires |
|||
rdf:resource="http://creativecommons.org/ns#ShareAlike" /> |
|||
</cc:License> |
|||
</rdf:RDF> |
|||
</metadata> |
|||
<g |
|||
inkscape:label="Layer 1" |
|||
inkscape:groupmode="layer" |
|||
id="layer1" |
|||
transform="translate(-18.400887,-189.80787)"> |
|||
<circle |
|||
id="path3680" |
|||
style="fill:#ffffff;stroke:#000000;stroke-width:0.5291667;stroke-miterlimit:4;stroke-dasharray:none" |
|||
transform="rotate(151.126)" |
|||
cy="-232.45309" |
|||
cx="56.370422" |
|||
r="31.26413" /> |
|||
<circle |
|||
id="path3680-3" |
|||
style="fill:#fcb23c;fill-opacity:1;stroke:none;stroke-width:0.35277778;stroke-miterlimit:4;stroke-dasharray:none" |
|||
transform="rotate(151.126)" |
|||
cy="-232.45309" |
|||
cx="56.370422" |
|||
r="27.438532" /> |
|||
<circle |
|||
id="path3680-3-8" |
|||
style="fill:#cccecc;fill-opacity:1;stroke:none;stroke-width:0.35277778;stroke-miterlimit:4;stroke-dasharray:none" |
|||
transform="rotate(151.126)" |
|||
cy="-232.45309" |
|||
cx="56.370419" |
|||
r="19.417116" /> |
|||
<path |
|||
style="fill:none;stroke:#0402fc;stroke-width:0.35277778;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:1.41111115, 1.41111115;stroke-dashoffset:0;stroke-opacity:1" |
|||
d="m 43.468435,230.84224 v -36.2682" |
|||
id="path11320" |
|||
inkscape:connector-curvature="0" /> |
|||
<path |
|||
inkscape:connector-curvature="0" |
|||
id="use4645" |
|||
d="m 82.302065,230.91777 v -36.2682" |
|||
style="fill:none;stroke:#0402fc;stroke-width:0.35277778;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:1.41111115, 1.41111115;stroke-dashoffset:0;stroke-opacity:1" /> |
|||
<path |
|||
style="fill:none;stroke:#0402fc;stroke-width:0.35277778;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;marker-start:url(#marker8801);marker-end:url(#Arrow2Lend)" |
|||
d="m 43.468435,197.25123 h 38.83363" |
|||
id="path8441" |
|||
inkscape:connector-curvature="0" /> |
|||
<text |
|||
xml:space="preserve" |
|||
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:8.46666622px;line-height:1.25;font-family:sans-serif;-inkscape-font-specification:'sans-serif, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-feature-settings:normal;text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#0402fc;fill-opacity:1;stroke:none;stroke-width:0.35277778;stroke-miterlimit:4;stroke-dasharray:none" |
|||
x="59.458069" |
|||
y="195.96356" |
|||
id="text8995"><tspan |
|||
sodipodi:role="line" |
|||
id="tspan8993" |
|||
x="59.458069" |
|||
y="195.96356" |
|||
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:8.46666622px;font-family:sans-serif;-inkscape-font-specification:'sans-serif, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-feature-settings:normal;text-align:start;writing-mode:lr-tb;text-anchor:start;fill:#0402fc;fill-opacity:1;stroke-width:0.35277778;stroke-miterlimit:4;stroke-dasharray:none">D</tspan></text> |
|||
<path |
|||
inkscape:connector-curvature="0" |
|||
id="path9381" |
|||
d="M 63.084305,250.19193 H 23.910954" |
|||
style="fill:none;stroke:#0402fc;stroke-width:0.35277778;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:1.41111115, 1.41111115;stroke-dashoffset:0;stroke-opacity:1" /> |
|||
<path |
|||
style="fill:none;stroke:#0402fc;stroke-width:0.35277778;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:1.41111115, 1.41111115;stroke-dashoffset:0;stroke-opacity:1" |
|||
d="M 63.044661,258.21388 H 23.87131" |
|||
id="path9383" |
|||
inkscape:connector-curvature="0" /> |
|||
<path |
|||
inkscape:connector-curvature="0" |
|||
id="path9397" |
|||
d="m 26.967687,237.97416 v 11.93043" |
|||
style="fill:none;stroke:#0402fc;stroke-width:0.35277778;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;marker-end:url(#marker9465)" /> |
|||
<text |
|||
xml:space="preserve" |
|||
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:8.46666622px;line-height:0.30000001;font-family:sans-serif;-inkscape-font-specification:'sans-serif, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-feature-settings:normal;text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#0402fc;fill-opacity:1;stroke:none;stroke-width:0.35277778;stroke-miterlimit:4;stroke-dasharray:none" |
|||
x="18.400887" |
|||
y="246.25377" |
|||
id="text8995-0"><tspan |
|||
sodipodi:role="line" |
|||
x="18.400887" |
|||
y="246.25377" |
|||
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:8.46666622px;line-height:0.30000001;font-family:sans-serif;-inkscape-font-specification:'sans-serif, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-feature-settings:normal;text-align:start;writing-mode:lr-tb;text-anchor:start;fill:#0402fc;fill-opacity:1;stroke-width:0.35277778;stroke-miterlimit:4;stroke-dasharray:none" |
|||
id="tspan10739">T</tspan></text> |
|||
<path |
|||
inkscape:connector-curvature="0" |
|||
id="path9397-6" |
|||
d="m 26.980116,266.23583 v -8.02195" |
|||
style="fill:none;stroke:#0402fc;stroke-width:0.35277778;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;marker-end:url(#marker9465-7)" /> |
|||
</g> |
|||
</svg> |
|||
1053
pcb_calculator/bitmaps/via.xpm
File diff suppressed because it is too large
View File
File diff suppressed because it is too large
View File
13207
pcb_calculator/dialogs/pcb_calculator_frame_base.fbp
File diff suppressed because it is too large
View File
File diff suppressed because it is too large
View File
@ -0,0 +1,308 @@ |
|||
/*
|
|||
* This program source code file is part of KICAD, a free EDA CAD application. |
|||
* |
|||
* Copyright (C) 1992-2019 Kicad Developers, see change_log.txt for contributors. |
|||
* |
|||
* This program is free software; you can redistribute it and/or |
|||
* modify it under the terms of the GNU General Public License |
|||
* as published by the Free Software Foundation; either version 2 |
|||
* of the License, or (at your option) any later version. |
|||
* |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program; if not, you may find one here: |
|||
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
|||
* or you may search the http://www.gnu.org website for the version 2 license,
|
|||
* or you may write to the Free Software Foundation, Inc., |
|||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA |
|||
*/ |
|||
|
|||
/* All calculations are based on this [1] online calculator:
|
|||
* |
|||
* References: |
|||
* |
|||
* [1]: The CircuitCalculator.com Blog - PCB Via Calculator |
|||
* http://circuitcalculator.com/wordpress/2006/03/12/pcb-via-calculator/
|
|||
* |
|||
* [2]: Constructing Your Power Supply - Layout Considerations |
|||
* https://www.ti.com/seclit/ml/slup230/slup230.pdf
|
|||
* |
|||
* [3]: Current Carrying Capacity of Vias - Some Conceptual Observations |
|||
* https://www.ultracad.com/articles/viacurrents.pdf
|
|||
* |
|||
* [4]: IPC-2221A - Generic Standard on Printed Board Design |
|||
* http://www.sphere.bc.ca/class/downloads/ipc_2221a-pcb%20standards.pdf
|
|||
* |
|||
* [5]: Copper - online catalogue source - Goodfellow |
|||
* http://www.goodfellow.com/E/Copper.html
|
|||
* |
|||
* [6]: Thermal Conductivity of Metals, Metallic Elements and Alloys |
|||
* https://www.engineeringtoolbox.com/thermal-conductivity-metals-d_858.html
|
|||
* |
|||
* [7]: Johnson & Graham, High Speed Digital Design: A Handbook of Black Magic |
|||
*/ |
|||
|
|||
#include <cmath>
|
|||
#include <wx/wx.h>
|
|||
#include <wx/config.h>
|
|||
|
|||
#include <pcb_calculator_frame_base.h>
|
|||
|
|||
#include <pcb_calculator.h>
|
|||
#include <UnitSelector.h>
|
|||
#include <units_scales.h>
|
|||
|
|||
extern double DoubleFromString( const wxString& TextValue ); |
|||
|
|||
// Key words to read/write some parameters in config:
|
|||
#define KEYWORD_VS_HOLE_DIA wxT( "VS_Hole_Dia" )
|
|||
#define KEYWORD_VS_HOLE_DIA_UNIT wxT( "VS_Hole_Dia_Unit" )
|
|||
#define KEYWORD_VS_THICKNESS wxT( "VS_Plating_Thickness" )
|
|||
#define KEYWORD_VS_THICKNESS_UNIT wxT( "VS_Plating_Thickness_Unit" )
|
|||
#define KEYWORD_VS_LENGTH wxT( "VS_Via_Length" )
|
|||
#define KEYWORD_VS_LENGTH_UNIT wxT( "VS_Via_Length_Unit" )
|
|||
#define KEYWORD_VS_PAD_DIA wxT( "VS_Pad_Dia" )
|
|||
#define KEYWORD_VS_PAD_DIA_UNIT wxT( "VS_Pad_Dia_Unit" )
|
|||
#define KEYWORD_VS_CLEARANCE_DIA wxT( "VS_Clearance_Dia" )
|
|||
#define KEYWORD_VS_CLEARANCE_DIA_UNIT wxT( "VS_Clearance_Dia_Unit" )
|
|||
#define KEYWORD_VS_PCB_THICKNESS wxT( "VS_PCB_Thickness" )
|
|||
#define KEYWORD_VS_PCB_THICKNESS_UNIT wxT( "VS_PCB_Thickness_Unit" )
|
|||
#define KEYWORD_VS_CH_IMPEDANCE wxT( "VS_Characteristic_Impedance" )
|
|||
#define KEYWORD_VS_CH_IMPEDANCE_UNIT wxT( "VS_Characteristic_Impedance_Unit" )
|
|||
#define KEYWORD_VS_CURRENT wxT( "VS_Current" )
|
|||
#define KEYWORD_VS_RESISTIVITY wxT( "VS_Resistivity" )
|
|||
#define KEYWORD_VS_PERMITTIVITY wxT( "VS_Permittivity" )
|
|||
#define KEYWORD_VS_TEMP_DIFF wxT( "VS_Temperature_Differential" )
|
|||
#define KEYWORD_VS_PULSE_RISE_TIME wxT( "VS_Pulse_Rise_Time" )
|
|||
|
|||
/**
|
|||
* Shows a list of current relative dielectric constant(Er) |
|||
* and set the selected value in main dialog frame |
|||
*/ |
|||
void PCB_CALCULATOR_FRAME::OnViaEpsilonR_Button( wxCommandEvent& event ) |
|||
{ |
|||
wxArrayString list; |
|||
|
|||
// EpsilonR ( relative dielectric constant) list
|
|||
list.Add( wxT( "4.5 FR4" ) ); |
|||
list.Add( wxT( "9.8 alumina (Al2O3)" ) ); |
|||
list.Add( wxT( "3.78 fused quartz" ) ); |
|||
list.Add( wxT( "3.38 RO4003" ) ); |
|||
list.Add( wxT( "2.2 RT/duroid 5880" ) ); |
|||
list.Add( wxT( "10.2 RT/duroid 6010LM" ) ); |
|||
list.Add( wxT( "2.1 teflon (PTFE)" ) ); |
|||
list.Add( wxT( "4.0 PVC" ) ); |
|||
list.Add( wxT( "2.3 PE" ) ); |
|||
list.Add( wxT( "6.6 beryllia (BeO)" ) ); |
|||
list.Add( wxT( "8.7 aluminum nitride" ) ); |
|||
list.Add( wxT( "11.9 silicon" ) ); |
|||
list.Add( wxT( "12.9 GaAs" ) ); |
|||
|
|||
wxString value = wxGetSingleChoice( wxEmptyString, |
|||
_("Relative Dielectric Constants"), list).BeforeFirst( ' ' ); |
|||
if( ! value.IsEmpty() ) |
|||
m_textCtrlPlatingPermittivity->SetValue( value ); |
|||
} |
|||
|
|||
/**
|
|||
* Shows a list of current Specific resistance list (rho) |
|||
* and set the selected value in main dialog frame |
|||
*/ |
|||
void PCB_CALCULATOR_FRAME::OnViaRho_Button( wxCommandEvent& event ) |
|||
{ |
|||
wxArrayString list; |
|||
|
|||
// Specific resistance list in ohms*meters (rho):
|
|||
list.Clear(); |
|||
list.Add( wxT( "2.4e-8 gold" ) ); |
|||
list.Add( wxT( "1.72e-8 copper" ) ); |
|||
list.Add( wxT( "1.62e-8 silver" ) ); |
|||
list.Add( wxT( "12.4e-8 tin" ) ); |
|||
list.Add( wxT( "10.5e-8 platinum" ) ); |
|||
list.Add( wxT( "2.62e-8 aluminum" ) ); |
|||
list.Add( wxT( "6.9e-8 nickel" ) ); |
|||
list.Add( wxT( "3.9e-8 brass (66Cu 34Zn)" ) ); |
|||
list.Add( wxT( "9.71e-8 iron" ) ); |
|||
list.Add( wxT( "6.0e-8 zinc" ) ); |
|||
|
|||
wxString value = wxGetSingleChoice( wxEmptyString, |
|||
_("Specific Resistance"), list).BeforeFirst( ' ' ); |
|||
if( ! value.IsEmpty() ) |
|||
m_textCtrlPlatingResistivity->SetValue( value ); |
|||
} |
|||
|
|||
void PCB_CALCULATOR_FRAME::VS_Init( wxConfigBase* aCfg ) |
|||
{ |
|||
int tmp; |
|||
wxString msg; |
|||
|
|||
// Read parameter values
|
|||
aCfg->Read( KEYWORD_VS_HOLE_DIA, &msg, wxT( "18" ) ); |
|||
m_textCtrlHoleDia->SetValue( msg ); |
|||
aCfg->Read( KEYWORD_VS_HOLE_DIA_UNIT, &tmp, 0 ); |
|||
m_choiceHoleDia->SetSelection( tmp ); |
|||
aCfg->Read( KEYWORD_VS_THICKNESS, &msg, wxT( "1" ) ); |
|||
m_textCtrlPlatingThickness->SetValue( msg ); |
|||
aCfg->Read( KEYWORD_VS_THICKNESS_UNIT, &tmp, 0 ); |
|||
m_choicePlatingThickness->SetSelection( tmp ); |
|||
aCfg->Read( KEYWORD_VS_LENGTH, &msg, wxT( "60" ) ); |
|||
m_textCtrlViaLength->SetValue( msg ); |
|||
aCfg->Read( KEYWORD_VS_LENGTH_UNIT, &tmp, 0 ); |
|||
m_choiceViaLength->SetSelection( tmp ); |
|||
aCfg->Read( KEYWORD_VS_PAD_DIA, &msg, wxT( "22" ) ); |
|||
m_textCtrlViaPadDia->SetValue( msg ); |
|||
aCfg->Read( KEYWORD_VS_PAD_DIA_UNIT, &tmp, 0 ); |
|||
m_choiceViaPadDia->SetSelection( tmp ); |
|||
aCfg->Read( KEYWORD_VS_CLEARANCE_DIA, &msg, wxT( "25" ) ); |
|||
m_textCtrlClearanceDia->SetValue( msg ); |
|||
aCfg->Read( KEYWORD_VS_CLEARANCE_DIA_UNIT, &tmp, 0 ); |
|||
m_choiceClearanceDia->SetSelection( tmp ); |
|||
aCfg->Read( KEYWORD_VS_PCB_THICKNESS, &msg, wxT( "70" ) ); |
|||
m_textCtrlBoardThickness->SetValue( msg ); |
|||
aCfg->Read( KEYWORD_VS_PCB_THICKNESS_UNIT, &tmp, 0 ); |
|||
m_choiceBoardThickness->SetSelection( tmp ); |
|||
aCfg->Read( KEYWORD_VS_CH_IMPEDANCE, &msg, wxT( "50" ) ); |
|||
m_textCtrlImpedance->SetValue( msg ); |
|||
aCfg->Read( KEYWORD_VS_CH_IMPEDANCE_UNIT , &tmp, 0 ); |
|||
m_choiceImpedance->SetSelection( tmp ); |
|||
aCfg->Read( KEYWORD_VS_CURRENT, &msg, wxT( "1" ) ); |
|||
m_textCtrlAppliedCurrent->SetValue( msg ); |
|||
aCfg->Read( KEYWORD_VS_RESISTIVITY, &msg, wxT( "1.72e-8" ) ); |
|||
m_textCtrlPlatingResistivity->SetValue( msg ); |
|||
aCfg->Read( KEYWORD_VS_PERMITTIVITY, &msg, wxT( "4.5" ) ); |
|||
m_textCtrlPlatingPermittivity->SetValue( msg ); |
|||
aCfg->Read( KEYWORD_VS_TEMP_DIFF, &msg, wxT( "10" ) ); |
|||
m_textCtrlTemperatureDiff->SetValue( msg ); |
|||
aCfg->Read( KEYWORD_VS_PULSE_RISE_TIME, &msg, wxT( "1" ) ); |
|||
m_textCtrlRiseTime->SetValue( msg ); |
|||
} |
|||
|
|||
void PCB_CALCULATOR_FRAME::VS_WriteConfig( wxConfigBase* aCfg ) |
|||
{ |
|||
// Save current parameters values in config
|
|||
aCfg->Write( KEYWORD_VS_HOLE_DIA, m_textCtrlHoleDia->GetValue() ); |
|||
aCfg->Write( KEYWORD_VS_HOLE_DIA_UNIT, m_choiceHoleDia->GetSelection() ); |
|||
aCfg->Write( KEYWORD_VS_THICKNESS, m_textCtrlPlatingThickness->GetValue() ); |
|||
aCfg->Write( KEYWORD_VS_THICKNESS_UNIT, m_choicePlatingThickness->GetSelection() ); |
|||
aCfg->Write( KEYWORD_VS_LENGTH, m_textCtrlViaLength->GetValue() ); |
|||
aCfg->Write( KEYWORD_VS_LENGTH_UNIT, m_choiceViaLength->GetSelection() ); |
|||
aCfg->Write( KEYWORD_VS_PAD_DIA, m_textCtrlViaPadDia->GetValue() ); |
|||
aCfg->Write( KEYWORD_VS_PAD_DIA_UNIT, m_choiceViaPadDia->GetSelection() ); |
|||
aCfg->Write( KEYWORD_VS_CLEARANCE_DIA, m_textCtrlClearanceDia->GetValue() ); |
|||
aCfg->Write( KEYWORD_VS_CLEARANCE_DIA_UNIT, m_choiceClearanceDia->GetSelection() ); |
|||
aCfg->Write( KEYWORD_VS_PCB_THICKNESS, m_textCtrlBoardThickness->GetValue() ); |
|||
aCfg->Write( KEYWORD_VS_PCB_THICKNESS_UNIT, m_choiceBoardThickness->GetSelection() ); |
|||
aCfg->Write( KEYWORD_VS_CH_IMPEDANCE, m_textCtrlImpedance->GetValue() ); |
|||
aCfg->Write( KEYWORD_VS_CH_IMPEDANCE_UNIT, m_choiceImpedance->GetSelection() ); |
|||
aCfg->Write( KEYWORD_VS_CURRENT, m_textCtrlAppliedCurrent->GetValue() ); |
|||
aCfg->Write( KEYWORD_VS_RESISTIVITY, m_textCtrlPlatingResistivity->GetValue() ); |
|||
aCfg->Write( KEYWORD_VS_PERMITTIVITY, m_textCtrlPlatingPermittivity->GetValue() ); |
|||
aCfg->Write( KEYWORD_VS_TEMP_DIFF, m_textCtrlTemperatureDiff->GetValue() ); |
|||
aCfg->Write( KEYWORD_VS_PULSE_RISE_TIME, m_textCtrlRiseTime->GetValue() ); |
|||
} |
|||
|
|||
void PCB_CALCULATOR_FRAME::OnViaCalculate( wxCommandEvent& event ) |
|||
{ |
|||
// Load parameters
|
|||
double finishedHoleDia = std::abs( DoubleFromString( m_textCtrlHoleDia->GetValue() ) ); |
|||
double platingThickness = std::abs( DoubleFromString( m_textCtrlPlatingThickness->GetValue() ) ); |
|||
double viaLength = std::abs( DoubleFromString( m_textCtrlViaLength->GetValue() ) ); |
|||
double padDia = std::abs( DoubleFromString( m_textCtrlViaPadDia->GetValue() ) ); |
|||
double clearanceDia = std::abs( DoubleFromString( m_textCtrlClearanceDia->GetValue() ) ); |
|||
double pcbThickness = std::abs( DoubleFromString( m_textCtrlBoardThickness->GetValue() ) ); |
|||
double charImpedance = std::abs( DoubleFromString( m_textCtrlImpedance->GetValue() ) ); |
|||
double appliedCurrent = std::abs( DoubleFromString( m_textCtrlAppliedCurrent->GetValue() ) ); |
|||
double platingResistivity = std::abs( DoubleFromString( m_textCtrlPlatingResistivity->GetValue() ) ); |
|||
double relativePermitivity = std::abs( DoubleFromString( m_textCtrlPlatingPermittivity->GetValue() ) ); |
|||
double temperatureDiff = std::abs( DoubleFromString( m_textCtrlTemperatureDiff->GetValue() ) ); |
|||
double pulseRiseTime = std::abs( DoubleFromString( m_textCtrlRiseTime->GetValue() ) ); |
|||
|
|||
// Normalize units
|
|||
finishedHoleDia *= m_choiceHoleDia->GetUnitScale(); |
|||
platingThickness *= m_choicePlatingThickness->GetUnitScale(); |
|||
viaLength *= m_choiceViaLength->GetUnitScale(); |
|||
padDia *= m_choiceViaPadDia->GetUnitScale(); |
|||
clearanceDia *= m_choiceClearanceDia->GetUnitScale(); |
|||
pcbThickness *= m_choiceBoardThickness->GetUnitScale(); |
|||
charImpedance *= m_choiceImpedance->GetUnitScale(); |
|||
platingResistivity = platingResistivity / 100; // Ohm-cm to Ohm-m
|
|||
|
|||
// Calculate cross-sectional area of the via's cylindrical structure [3]
|
|||
double area = M_PI * (finishedHoleDia + platingThickness) * platingThickness; // m^2
|
|||
|
|||
double viaResistance = platingResistivity * viaLength / area; // Ohms
|
|||
|
|||
// Using thermal resistivity value 2.49e-3 meter-Kelvin/Watt, equivalent to
|
|||
// thermal conductivity of 401 Watt/(meter-Kelvin) [5][6]
|
|||
const double thermalResistivity = 2.49e-3; // m K/W
|
|||
double thermalResistance = thermalResistivity * viaLength / area; // deg C/W
|
|||
|
|||
double voltageDrop = appliedCurrent * viaResistance; |
|||
|
|||
double powerLoss = appliedCurrent * voltageDrop; |
|||
|
|||
// Estimate current carrying capacity of the via
|
|||
// See comment #17 in [1] for a brief discussion on the formula
|
|||
// This formula from IPC-2221 [4] is also used in the Track Width calculator
|
|||
area /= pow( UNIT_MIL, 2 ); // m^2 to mil^2
|
|||
const double k = 0.048; |
|||
const double b = 0.44; |
|||
const double c = 0.725; |
|||
double estimatedAmpacity = k * pow( temperatureDiff, b ) * pow( area, c ); |
|||
|
|||
// Equation 7.6 in [7]
|
|||
double capacitance = 55.51 * relativePermitivity * viaLength * padDia; |
|||
capacitance /= clearanceDia - padDia; |
|||
|
|||
// Equation 7.8 in [7]
|
|||
double timeDegradation = 2.2 * capacitance * charImpedance / 2; |
|||
|
|||
// Equation 7.9 in [7]
|
|||
double inductance = 200 * viaLength; |
|||
inductance *= log( 4 * viaLength / finishedHoleDia ) + 1; |
|||
|
|||
// Equation 7.11 in [7]
|
|||
double reactance = M_PI * inductance / pulseRiseTime; |
|||
|
|||
// Update the display
|
|||
VSDisplayValues( viaResistance, voltageDrop, powerLoss, estimatedAmpacity, |
|||
thermalResistance, capacitance, timeDegradation, inductance, reactance ); |
|||
} |
|||
|
|||
void PCB_CALCULATOR_FRAME::VSDisplayValues( double aViaResistance, double aVoltageDrop, |
|||
double aPowerLoss, double aEstimatedAmpacity, double aThermalResistance, |
|||
double aCapacitance, double aTimeDegradation, double aInductance, double aReactance ) |
|||
{ |
|||
wxString msg; |
|||
|
|||
msg.Printf( wxT( "%g" ), aViaResistance ); |
|||
m_ViaResistance->SetLabel( msg ); |
|||
|
|||
msg.Printf( wxT( "%g" ), aVoltageDrop ); |
|||
m_ViaVoltageDrop->SetLabel( msg ); |
|||
|
|||
msg.Printf( wxT( "%g" ), aPowerLoss ); |
|||
m_ViaPowerLoss->SetLabel( msg ); |
|||
|
|||
msg.Printf( wxT( "%g" ), aEstimatedAmpacity ); |
|||
m_ViaAmpacity->SetLabel( msg ); |
|||
|
|||
msg.Printf( wxT( "%g" ), aThermalResistance ); |
|||
m_ViaThermalResistance->SetLabel( msg ); |
|||
|
|||
msg.Printf( wxT( "%g" ), aCapacitance ); |
|||
m_ViaCapacitance->SetLabel( msg ); |
|||
|
|||
msg.Printf( wxT( "%g" ), aTimeDegradation ); |
|||
m_RiseTimeOutput->SetLabel( msg ); |
|||
|
|||
msg.Printf( wxT( "%g" ), aInductance ); |
|||
m_Inductance->SetLabel( msg ); |
|||
|
|||
msg.Printf( wxT( "%g" ), aReactance ); |
|||
m_Reactance->SetLabel( msg ); |
|||
} |
|||
Write
Preview
Loading…
Cancel
Save
Reference in new issue