From bb45cc16030250debc247da32cbae206c81baf0e Mon Sep 17 00:00:00 2001 From: Nabeel Ahmad Date: Sun, 9 Dec 2018 11:50:56 +0500 Subject: [PATCH] pcb_calculator: New tab for via calculations MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="------------2.19.0" This is a multi-part message in MIME format. --------------2.19.0 Content-Type: text/plain; charset=UTF-8; format=fixed Content-Transfer-Encoding: 8bit NEW: Adds a tab in pcb_calculator for calculations related to via size. Fixes: lp:1802222 * https://bugs.launchpad.net/kicad/+bug/1802222 --- pcb_calculator/CMakeLists.txt | 1 + .../dialogs/pcb_calculator_frame_base.cpp | 216 +- .../dialogs/pcb_calculator_frame_base.fbp | 3898 ++++++++++++++++- .../dialogs/pcb_calculator_frame_base.h | 44 +- pcb_calculator/pcb_calculator.h | 27 + pcb_calculator/pcb_calculator_frame.cpp | 4 + pcb_calculator/via_funct.cpp | 154 + 7 files changed, 4261 insertions(+), 83 deletions(-) create mode 100644 pcb_calculator/via_funct.cpp --------------2.19.0 Content-Type: text/x-patch; name="0001-pcb_calculator-New-tab-for-via-calculations.patch" Content-Transfer-Encoding: 8bit Content-Disposition: attachment; filename="0001-pcb_calculator-New-tab-for-via-calculations.patch" diff --git a/pcb_calculator/CMakeLists.txt b/pcb_calculator/CMakeLists.txt index 94d6ce469..295c39f02 100644 --- a/pcb_calculator/CMakeLists.txt +++ b/pcb_calculator/CMakeLists.txt @@ -20,6 +20,7 @@ set( PCB_CALCULATOR_SRCS datafile_read_write.cpp regulators_funct.cpp tracks_width_versus_current.cpp + via_funct.cpp transline_ident.cpp UnitSelector.cpp pcb_calculator_datafile_keywords.cpp diff --git a/pcb_calculator/dialogs/pcb_calculator_frame_base.cpp b/pcb_calculator/dialogs/pcb_calculator_frame_base.cpp index e5fa7b1bb..63becd447 100644 --- a/pcb_calculator/dialogs/pcb_calculator_frame_base.cpp +++ b/pcb_calculator/dialogs/pcb_calculator_frame_base.cpp @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Aug 2 2018) +// C++ code generated with wxFormBuilder (version Aug 8 2018) // http://www.wxformbuilder.org/ // // PLEASE DO *NOT* EDIT THIS FILE! @@ -519,6 +519,194 @@ PCB_CALCULATOR_FRAME_BASE::PCB_CALCULATOR_FRAME_BASE( wxWindow* parent, wxWindow m_panelTrackWidth->Layout(); bSizerTrackWidth->Fit( m_panelTrackWidth ); m_Notebook->AddPage( m_panelTrackWidth, _("Track Width"), false ); + m_panelViaSize = new wxPanel( m_Notebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); + wxBoxSizer* bSizerViaSize; + bSizerViaSize = new wxBoxSizer( wxHORIZONTAL ); + + wxStaticBoxSizer* sbSizerVS_Inputs; + sbSizerVS_Inputs = new wxStaticBoxSizer( new wxStaticBox( m_panelViaSize, wxID_ANY, _("Parameters:") ), wxVERTICAL ); + + wxFlexGridSizer* fgSizerVS_Inputs; + fgSizerVS_Inputs = new wxFlexGridSizer( 0, 3, 0, 0 ); + fgSizerVS_Inputs->AddGrowableCol( 1 ); + fgSizerVS_Inputs->SetFlexibleDirection( wxBOTH ); + fgSizerVS_Inputs->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); + + m_staticTextHoleDia = new wxStaticText( sbSizerVS_Inputs->GetStaticBox(), wxID_ANY, _("Finished hole dia:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticTextHoleDia->Wrap( -1 ); + m_staticTextHoleDia->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL, false, wxEmptyString ) ); + + fgSizerVS_Inputs->Add( m_staticTextHoleDia, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxLEFT|wxRIGHT, 5 ); + + m_textCtrlHoleDia = new wxTextCtrl( sbSizerVS_Inputs->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + fgSizerVS_Inputs->Add( m_textCtrlHoleDia, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxLEFT|wxRIGHT|wxTOP, 5 ); + + wxArrayString m_choiceHoleDiaChoices; + m_choiceHoleDia = new UNIT_SELECTOR_LEN( sbSizerVS_Inputs->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, m_choiceHoleDiaChoices, 0 ); + m_choiceHoleDia->SetSelection( 0 ); + fgSizerVS_Inputs->Add( m_choiceHoleDia, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxLEFT|wxRIGHT|wxTOP, 5 ); + + m_staticTextPlatingThickness = new wxStaticText( sbSizerVS_Inputs->GetStaticBox(), wxID_ANY, _("Plating thickness:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticTextPlatingThickness->Wrap( -1 ); + fgSizerVS_Inputs->Add( m_staticTextPlatingThickness, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxRIGHT|wxLEFT, 5 ); + + m_textCtrlPlatingThickness = new wxTextCtrl( sbSizerVS_Inputs->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + fgSizerVS_Inputs->Add( m_textCtrlPlatingThickness, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 ); + + wxArrayString m_choicePlatingThicknessChoices; + m_choicePlatingThickness = new UNIT_SELECTOR_LEN( sbSizerVS_Inputs->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, m_choicePlatingThicknessChoices, 0 ); + m_choicePlatingThickness->SetSelection( 0 ); + fgSizerVS_Inputs->Add( m_choicePlatingThickness, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 ); + + m_staticTextViaLength = new wxStaticText( sbSizerVS_Inputs->GetStaticBox(), wxID_ANY, _("Via length:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticTextViaLength->Wrap( -1 ); + fgSizerVS_Inputs->Add( m_staticTextViaLength, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxLEFT|wxRIGHT, 5 ); + + m_textCtrlViaLength = new wxTextCtrl( sbSizerVS_Inputs->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + fgSizerVS_Inputs->Add( m_textCtrlViaLength, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxLEFT|wxRIGHT|wxTOP, 5 ); + + wxArrayString m_choiceViaLengthChoices; + m_choiceViaLength = new UNIT_SELECTOR_LEN( sbSizerVS_Inputs->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, m_choiceViaLengthChoices, 0 ); + m_choiceViaLength->SetSelection( 0 ); + fgSizerVS_Inputs->Add( m_choiceViaLength, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxLEFT|wxRIGHT|wxTOP, 5 ); + + m_staticline31 = new wxStaticLine( sbSizerVS_Inputs->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); + fgSizerVS_Inputs->Add( m_staticline31, 0, wxEXPAND|wxTOP|wxBOTTOM, 5 ); + + m_staticline41 = new wxStaticLine( sbSizerVS_Inputs->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); + fgSizerVS_Inputs->Add( m_staticline41, 0, wxEXPAND|wxTOP|wxBOTTOM, 5 ); + + m_staticline51 = new wxStaticLine( sbSizerVS_Inputs->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); + fgSizerVS_Inputs->Add( m_staticline51, 0, wxEXPAND|wxTOP|wxBOTTOM, 5 ); + + m_staticAppliedCurrent = new wxStaticText( sbSizerVS_Inputs->GetStaticBox(), wxID_ANY, _("Applied current:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticAppliedCurrent->Wrap( -1 ); + fgSizerVS_Inputs->Add( m_staticAppliedCurrent, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxALL, 5 ); + + m_textCtrlAppliedCurrent = new wxTextCtrl( sbSizerVS_Inputs->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + fgSizerVS_Inputs->Add( m_textCtrlAppliedCurrent, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxLEFT|wxRIGHT|wxTOP, 5 ); + + m_staticText841111 = new wxStaticText( sbSizerVS_Inputs->GetStaticBox(), wxID_ANY, _("A"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText841111->Wrap( -1 ); + fgSizerVS_Inputs->Add( m_staticText841111, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); + + m_staticText6512 = new wxStaticText( sbSizerVS_Inputs->GetStaticBox(), wxID_ANY, _("Plating resistivity:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText6512->Wrap( -1 ); + fgSizerVS_Inputs->Add( m_staticText6512, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxALL, 5 ); + + m_textCtrlPlatingResistivity = new wxTextCtrl( sbSizerVS_Inputs->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + fgSizerVS_Inputs->Add( m_textCtrlPlatingResistivity, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxLEFT|wxRIGHT|wxTOP, 5 ); + + m_staticText84111 = new wxStaticText( sbSizerVS_Inputs->GetStaticBox(), wxID_ANY, _("Ohm-cm"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText84111->Wrap( -1 ); + fgSizerVS_Inputs->Add( m_staticText84111, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); + + m_staticText65121 = new wxStaticText( sbSizerVS_Inputs->GetStaticBox(), wxID_ANY, _("Temperature rise:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText65121->Wrap( -1 ); + fgSizerVS_Inputs->Add( m_staticText65121, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxALL, 5 ); + + m_textCtrlTemperatureDiff = new wxTextCtrl( sbSizerVS_Inputs->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + fgSizerVS_Inputs->Add( m_textCtrlTemperatureDiff, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxLEFT|wxRIGHT|wxTOP, 5 ); + + m_staticText841112 = new wxStaticText( sbSizerVS_Inputs->GetStaticBox(), wxID_ANY, _("deg C"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText841112->Wrap( -1 ); + fgSizerVS_Inputs->Add( m_staticText841112, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); + + + sbSizerVS_Inputs->Add( fgSizerVS_Inputs, 0, wxEXPAND, 5 ); + + + bSizerViaSize->Add( sbSizerVS_Inputs, 1, wxEXPAND|wxALL, 5 ); + + wxStaticBoxSizer* sbSizerTW_Result11; + sbSizerTW_Result11 = new wxStaticBoxSizer( new wxStaticBox( m_panelViaSize, wxID_ANY, _("Results:") ), wxVERTICAL ); + + wxFlexGridSizer* fgSizerTW_Results11; + fgSizerTW_Results11 = new wxFlexGridSizer( 6, 3, 0, 0 ); + fgSizerTW_Results11->AddGrowableCol( 1 ); + fgSizerTW_Results11->SetFlexibleDirection( wxBOTH ); + fgSizerTW_Results11->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); + + m_staticTextArea11 = new wxStaticText( sbSizerTW_Result11->GetStaticBox(), wxID_ANY, _("Resistance:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticTextArea11->Wrap( -1 ); + fgSizerTW_Results11->Add( m_staticTextArea11, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxALL, 5 ); + + m_ViaResistance = new wxStaticText( sbSizerTW_Result11->GetStaticBox(), wxID_ANY, _("dummy"), wxDefaultPosition, wxDefaultSize, 0 ); + m_ViaResistance->Wrap( -1 ); + fgSizerTW_Results11->Add( m_ViaResistance, 0, wxALIGN_CENTER_VERTICAL|wxALL|wxEXPAND, 5 ); + + m_IntTrackAreaUnitLabel1 = new wxStaticText( sbSizerTW_Result11->GetStaticBox(), wxID_ANY, _("Ohm"), wxDefaultPosition, wxDefaultSize, 0 ); + m_IntTrackAreaUnitLabel1->Wrap( -1 ); + fgSizerTW_Results11->Add( m_IntTrackAreaUnitLabel1, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); + + m_staticText65111 = new wxStaticText( sbSizerTW_Result11->GetStaticBox(), wxID_ANY, _("Voltage drop:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText65111->Wrap( -1 ); + fgSizerTW_Results11->Add( m_staticText65111, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxALL, 5 ); + + m_ViaVoltageDrop = new wxStaticText( sbSizerTW_Result11->GetStaticBox(), wxID_ANY, _("dummy"), wxDefaultPosition, wxDefaultSize, 0 ); + m_ViaVoltageDrop->Wrap( -1 ); + fgSizerTW_Results11->Add( m_ViaVoltageDrop, 0, wxALIGN_CENTER_VERTICAL|wxALL|wxEXPAND, 5 ); + + m_staticText8411 = new wxStaticText( sbSizerTW_Result11->GetStaticBox(), wxID_ANY, _("Volt"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText8411->Wrap( -1 ); + fgSizerTW_Results11->Add( m_staticText8411, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); + + m_staticText66111 = new wxStaticText( sbSizerTW_Result11->GetStaticBox(), wxID_ANY, _("Power loss:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText66111->Wrap( -1 ); + fgSizerTW_Results11->Add( m_staticText66111, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxALL, 5 ); + + m_ViaPowerLoss = new wxStaticText( sbSizerTW_Result11->GetStaticBox(), wxID_ANY, _("dummy"), wxDefaultPosition, wxDefaultSize, 0 ); + m_ViaPowerLoss->Wrap( -1 ); + fgSizerTW_Results11->Add( m_ViaPowerLoss, 0, wxALIGN_CENTER_VERTICAL|wxALL|wxEXPAND, 5 ); + + m_staticText8311 = new wxStaticText( sbSizerTW_Result11->GetStaticBox(), wxID_ANY, _("Watt"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText8311->Wrap( -1 ); + fgSizerTW_Results11->Add( m_staticText8311, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); + + m_staticText7921 = new wxStaticText( sbSizerTW_Result11->GetStaticBox(), wxID_ANY, _("Estimated ampacity:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText7921->Wrap( -1 ); + fgSizerTW_Results11->Add( m_staticText7921, 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxALL, 5 ); + + m_ViaAmpacity = new wxStaticText( sbSizerTW_Result11->GetStaticBox(), wxID_ANY, _("dummy"), wxDefaultPosition, wxDefaultSize, 0 ); + m_ViaAmpacity->Wrap( -1 ); + fgSizerTW_Results11->Add( m_ViaAmpacity, 0, wxALIGN_CENTER_VERTICAL|wxALL|wxEXPAND, 5 ); + + m_staticText79111 = new wxStaticText( sbSizerTW_Result11->GetStaticBox(), wxID_ANY, _("A"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText79111->Wrap( -1 ); + fgSizerTW_Results11->Add( m_staticText79111, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); + + m_staticline311 = new wxStaticLine( sbSizerTW_Result11->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); + fgSizerTW_Results11->Add( m_staticline311, 0, wxBOTTOM|wxEXPAND|wxTOP, 5 ); + + m_staticline312 = new wxStaticLine( sbSizerTW_Result11->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); + fgSizerTW_Results11->Add( m_staticline312, 0, wxBOTTOM|wxEXPAND|wxTOP, 5 ); + + m_staticline313 = new wxStaticLine( sbSizerTW_Result11->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); + fgSizerTW_Results11->Add( m_staticline313, 0, wxBOTTOM|wxEXPAND|wxTOP, 5 ); + + m_staticText79211 = new wxStaticText( sbSizerTW_Result11->GetStaticBox(), wxID_ANY, _("Thermal resistance:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText79211->Wrap( -1 ); + fgSizerTW_Results11->Add( m_staticText79211, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxALL, 5 ); + + m_ViaThermalResistance = new wxStaticText( sbSizerTW_Result11->GetStaticBox(), wxID_ANY, _("dummy"), wxDefaultPosition, wxDefaultSize, 0 ); + m_ViaThermalResistance->Wrap( -1 ); + fgSizerTW_Results11->Add( m_ViaThermalResistance, 0, wxALIGN_CENTER_VERTICAL|wxALL|wxEXPAND, 5 ); + + m_staticText791111 = new wxStaticText( sbSizerTW_Result11->GetStaticBox(), wxID_ANY, _("deg C/Watt"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText791111->Wrap( -1 ); + fgSizerTW_Results11->Add( m_staticText791111, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); + + + sbSizerTW_Result11->Add( fgSizerTW_Results11, 0, wxEXPAND, 5 ); + + + bSizerViaSize->Add( sbSizerTW_Result11, 1, wxEXPAND|wxALL, 5 ); + + + m_panelViaSize->SetSizer( bSizerViaSize ); + m_panelViaSize->Layout(); + bSizerViaSize->Fit( m_panelViaSize ); + m_Notebook->AddPage( m_panelViaSize, _("Via Size"), true ); m_panelElectricalSpacing = new wxPanel( m_Notebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); wxBoxSizer* bSizerElectricalClearance; bSizerElectricalClearance = new wxBoxSizer( wxHORIZONTAL ); @@ -891,7 +1079,7 @@ PCB_CALCULATOR_FRAME_BASE::PCB_CALCULATOR_FRAME_BASE( wxWindow* parent, wxWindow wxBoxSizer* bSizerButtons; bSizerButtons = new wxBoxSizer( wxHORIZONTAL ); - m_bpButtonAnalyze = new wxBitmapButton( m_panelTransline, wxID_ANY, wxBitmap( arrow_bottom_xpm ), wxDefaultPosition, wxDefaultSize, 0 ); + m_bpButtonAnalyze = new wxBitmapButton( m_panelTransline, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW|0 ); m_bpButtonAnalyze->SetBitmap( wxBitmap( arrow_bottom_xpm ) ); bSizerButtons->Add( m_bpButtonAnalyze, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); @@ -902,7 +1090,7 @@ PCB_CALCULATOR_FRAME_BASE::PCB_CALCULATOR_FRAME_BASE( wxWindow* parent, wxWindow m_SynthetizeButton = new wxButton( m_panelTransline, wxID_ANY, _("Synthesize"), wxDefaultPosition, wxDefaultSize, 0 ); bSizerButtons->Add( m_SynthetizeButton, 0, wxLEFT|wxALIGN_CENTER_VERTICAL, 5 ); - m_bpButtonSynthetize = new wxBitmapButton( m_panelTransline, wxID_ANY, wxBitmap( arrow_top_xpm ), wxDefaultPosition, wxDefaultSize, 0 ); + m_bpButtonSynthetize = new wxBitmapButton( m_panelTransline, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW|0 ); m_bpButtonSynthetize->SetBitmap( wxBitmap( arrow_top_xpm ) ); bSizerButtons->Add( m_bpButtonSynthetize, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); @@ -1119,7 +1307,7 @@ PCB_CALCULATOR_FRAME_BASE::PCB_CALCULATOR_FRAME_BASE( wxWindow* parent, wxWindow m_buttonAlcAtt = new wxButton( m_panelAttenuators, wxID_ANY, _("Calculate"), wxDefaultPosition, wxDefaultSize, 0 ); bSizerAttButt->Add( m_buttonAlcAtt, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); - m_bpButtonCalcAtt = new wxBitmapButton( m_panelAttenuators, wxID_ANY, wxBitmap( arrow_bottom_xpm ), wxDefaultPosition, wxDefaultSize, 0 ); + m_bpButtonCalcAtt = new wxBitmapButton( m_panelAttenuators, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW|0 ); m_bpButtonCalcAtt->SetBitmap( wxBitmap( arrow_bottom_xpm ) ); bSizerAttButt->Add( m_bpButtonCalcAtt, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); @@ -1330,7 +1518,7 @@ PCB_CALCULATOR_FRAME_BASE::PCB_CALCULATOR_FRAME_BASE( wxWindow* parent, wxWindow m_panelBoardClass->SetSizer( bSizerBoardClass ); m_panelBoardClass->Layout(); bSizerBoardClass->Fit( m_panelBoardClass ); - m_Notebook->AddPage( m_panelBoardClass, _("Board Classes"), true ); + m_Notebook->AddPage( m_panelBoardClass, _("Board Classes"), false ); bmainFrameSizer->Add( m_Notebook, 1, wxEXPAND, 5 ); @@ -1362,6 +1550,15 @@ PCB_CALCULATOR_FRAME_BASE::PCB_CALCULATOR_FRAME_BASE( wxWindow* parent, wxWindow m_TW_IntTrackWidth_choiceUnit->Connect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( PCB_CALCULATOR_FRAME_BASE::OnTWParametersChanged ), NULL, this ); m_IntTrackThicknessValue->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( PCB_CALCULATOR_FRAME_BASE::OnTWParametersChanged ), NULL, this ); m_IntTrackThicknessUnit->Connect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( PCB_CALCULATOR_FRAME_BASE::OnTWParametersChanged ), NULL, this ); + m_textCtrlHoleDia->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( PCB_CALCULATOR_FRAME_BASE::OnViaCalculate ), NULL, this ); + m_choiceHoleDia->Connect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( PCB_CALCULATOR_FRAME_BASE::OnViaCalculate ), NULL, this ); + m_textCtrlPlatingThickness->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( PCB_CALCULATOR_FRAME_BASE::OnViaCalculate ), NULL, this ); + m_choicePlatingThickness->Connect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( PCB_CALCULATOR_FRAME_BASE::OnViaCalculate ), NULL, this ); + m_textCtrlViaLength->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( PCB_CALCULATOR_FRAME_BASE::OnViaCalculate ), NULL, this ); + m_choiceViaLength->Connect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( PCB_CALCULATOR_FRAME_BASE::OnViaCalculate ), NULL, this ); + m_textCtrlAppliedCurrent->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( PCB_CALCULATOR_FRAME_BASE::OnViaCalculate ), NULL, this ); + m_textCtrlPlatingResistivity->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( PCB_CALCULATOR_FRAME_BASE::OnViaCalculate ), NULL, this ); + m_textCtrlTemperatureDiff->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( PCB_CALCULATOR_FRAME_BASE::OnViaCalculate ), NULL, this ); m_ElectricalSpacingUnitsSelector->Connect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( PCB_CALCULATOR_FRAME_BASE::OnElectricalSpacingUnitsSelection ), NULL, this ); m_buttonElectSpacingRefresh->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PCB_CALCULATOR_FRAME_BASE::OnElectricalSpacingRefresh ), NULL, this ); m_TranslineSelection->Connect( wxEVT_COMMAND_RADIOBOX_SELECTED, wxCommandEventHandler( PCB_CALCULATOR_FRAME_BASE::OnTranslineSelection ), NULL, this ); @@ -1405,6 +1602,15 @@ PCB_CALCULATOR_FRAME_BASE::~PCB_CALCULATOR_FRAME_BASE() m_TW_IntTrackWidth_choiceUnit->Disconnect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( PCB_CALCULATOR_FRAME_BASE::OnTWParametersChanged ), NULL, this ); m_IntTrackThicknessValue->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( PCB_CALCULATOR_FRAME_BASE::OnTWParametersChanged ), NULL, this ); m_IntTrackThicknessUnit->Disconnect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( PCB_CALCULATOR_FRAME_BASE::OnTWParametersChanged ), NULL, this ); + m_textCtrlHoleDia->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( PCB_CALCULATOR_FRAME_BASE::OnViaCalculate ), NULL, this ); + m_choiceHoleDia->Disconnect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( PCB_CALCULATOR_FRAME_BASE::OnViaCalculate ), NULL, this ); + m_textCtrlPlatingThickness->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( PCB_CALCULATOR_FRAME_BASE::OnViaCalculate ), NULL, this ); + m_choicePlatingThickness->Disconnect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( PCB_CALCULATOR_FRAME_BASE::OnViaCalculate ), NULL, this ); + m_textCtrlViaLength->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( PCB_CALCULATOR_FRAME_BASE::OnViaCalculate ), NULL, this ); + m_choiceViaLength->Disconnect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( PCB_CALCULATOR_FRAME_BASE::OnViaCalculate ), NULL, this ); + m_textCtrlAppliedCurrent->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( PCB_CALCULATOR_FRAME_BASE::OnViaCalculate ), NULL, this ); + m_textCtrlPlatingResistivity->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( PCB_CALCULATOR_FRAME_BASE::OnViaCalculate ), NULL, this ); + m_textCtrlTemperatureDiff->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( PCB_CALCULATOR_FRAME_BASE::OnViaCalculate ), NULL, this ); m_ElectricalSpacingUnitsSelector->Disconnect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( PCB_CALCULATOR_FRAME_BASE::OnElectricalSpacingUnitsSelection ), NULL, this ); m_buttonElectSpacingRefresh->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PCB_CALCULATOR_FRAME_BASE::OnElectricalSpacingRefresh ), NULL, this ); m_TranslineSelection->Disconnect( wxEVT_COMMAND_RADIOBOX_SELECTED, wxCommandEventHandler( PCB_CALCULATOR_FRAME_BASE::OnTranslineSelection ), NULL, this ); diff --git a/pcb_calculator/dialogs/pcb_calculator_frame_base.fbp b/pcb_calculator/dialogs/pcb_calculator_frame_base.fbp index f4e28d409..372834903 100644 --- a/pcb_calculator/dialogs/pcb_calculator_frame_base.fbp +++ b/pcb_calculator/dialogs/pcb_calculator_frame_base.fbp @@ -302,11 +302,11 @@ - + Regulators 0 - + 1 1 1 @@ -387,34 +387,34 @@ - + bSizerMainReg wxHORIZONTAL none - + 5 wxEXPAND 1 - + bSizeLeftpReg wxVERTICAL none - + 5 wxEXPAND 1 - + bSizerBitmapReg wxVERTICAL none - + 5 wxEXPAND 1 - + 0 protected 0 @@ -508,11 +508,11 @@ - + 5 wxALL|wxALIGN_CENTER_HORIZONTAL 0 - + 1 1 1 @@ -596,11 +596,11 @@ - + 5 wxEXPAND 1 - + 0 protected 0 @@ -608,11 +608,11 @@ - + 5 wxEXPAND 0 - + wxID_ANY Formula: @@ -716,16 +716,16 @@ - + 5 wxEXPAND 1 - + bSizerRegulRight wxVERTICAL none - + 5 wxEXPAND 0 @@ -2757,11 +2757,11 @@ - + 5 wxEXPAND 0 - + wxID_ANY Regulator: @@ -2770,11 +2770,11 @@ 1 none - + 5 wxALL|wxEXPAND 0 - + 1 1 1 @@ -2865,11 +2865,11 @@ - + 5 wxTOP|wxRIGHT|wxLEFT 0 - + 1 1 1 @@ -2956,20 +2956,20 @@ - + 5 wxEXPAND 1 - + bSizerDataFile wxHORIZONTAL none - + 5 wxBOTTOM|wxRIGHT|wxLEFT 1 - + 1 1 1 @@ -3063,11 +3063,11 @@ - + 5 wxBOTTOM|wxRIGHT|wxLEFT 0 - + 1 1 1 @@ -3168,20 +3168,20 @@ - + 5 wxEXPAND 1 - + bSizerReulBtn wxHORIZONTAL none - + 5 wxALL 0 - + 1 1 1 @@ -3280,11 +3280,11 @@ - + 5 wxALL 1 - + 1 1 1 @@ -3383,11 +3383,11 @@ - + 5 wxALL 1 - + 1 1 1 @@ -8599,7 +8599,3751 @@ - + + + Via Size + 1 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + 0 + + 1 + m_panelViaSize + 1 + + + protected + 1 + + Resizable + 1 + + + 0 + + + + wxTAB_TRAVERSAL + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + bSizerViaSize + wxHORIZONTAL + none + + 5 + wxEXPAND|wxALL + 1 + + wxID_ANY + Parameters: + + sbSizerVS_Inputs + wxVERTICAL + 1 + none + + + 5 + wxEXPAND + 0 + + 3 + wxBOTH + 1 + + 0 + + fgSizerVS_Inputs + wxFLEX_GROWMODE_SPECIFIED + none + 0 + 0 + + 5 + wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxLEFT|wxRIGHT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + ,90,90,-1,70,0 + 0 + 0 + wxID_ANY + Finished hole dia: + 0 + + 0 + + + 0 + + 1 + m_staticTextHoleDia + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALIGN_CENTER_VERTICAL|wxEXPAND|wxLEFT|wxRIGHT|wxTOP + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + 0 + + 0 + + 1 + m_textCtrlHoleDia + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + OnViaCalculate + + + + + + + + 5 + wxALIGN_CENTER_VERTICAL|wxEXPAND|wxLEFT|wxRIGHT|wxTOP + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + 0 + + 1 + m_choiceHoleDia + 1 + + + protected + 1 + + Resizable + 0 + 1 + + + UNIT_SELECTOR_LEN; UnitSelector.h + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + OnViaCalculate + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxRIGHT|wxLEFT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Plating thickness: + 0 + + 0 + + + 0 + + 1 + m_staticTextPlatingThickness + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALIGN_CENTER_VERTICAL|wxEXPAND|wxTOP|wxRIGHT|wxLEFT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + 0 + + 0 + + 1 + m_textCtrlPlatingThickness + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + OnViaCalculate + + + + + + + + 5 + wxALIGN_CENTER_VERTICAL|wxEXPAND|wxTOP|wxRIGHT|wxLEFT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + 0 + + 1 + m_choicePlatingThickness + 1 + + + protected + 1 + + Resizable + 0 + 1 + + + UNIT_SELECTOR_LEN; UnitSelector.h; Not forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + OnViaCalculate + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxLEFT|wxRIGHT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Via length: + 0 + + 0 + + + 0 + + 1 + m_staticTextViaLength + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALIGN_CENTER_VERTICAL|wxEXPAND|wxLEFT|wxRIGHT|wxTOP + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + 0 + + 0 + + 1 + m_textCtrlViaLength + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + OnViaCalculate + + + + + + + + 5 + wxALIGN_CENTER_VERTICAL|wxEXPAND|wxLEFT|wxRIGHT|wxTOP + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + 0 + + 1 + m_choiceViaLength + 1 + + + protected + 1 + + Resizable + 0 + 1 + + + UNIT_SELECTOR_LEN; UnitSelector.h; Not forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + OnViaCalculate + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND|wxTOP|wxBOTTOM + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + 0 + + 1 + m_staticline31 + 1 + + + protected + 1 + + Resizable + 1 + + wxLI_HORIZONTAL + + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND|wxTOP|wxBOTTOM + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + 0 + + 1 + m_staticline41 + 1 + + + protected + 1 + + Resizable + 1 + + wxLI_HORIZONTAL + + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND|wxTOP|wxBOTTOM + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + 0 + + 1 + m_staticline51 + 1 + + + protected + 1 + + Resizable + 1 + + wxLI_HORIZONTAL + + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Applied current: + 0 + + 0 + + + 0 + + 1 + m_staticAppliedCurrent + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALIGN_CENTER_VERTICAL|wxEXPAND|wxLEFT|wxRIGHT|wxTOP + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + 0 + + 0 + + 1 + m_textCtrlAppliedCurrent + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + OnViaCalculate + + + + + + + + 5 + wxALIGN_CENTER_VERTICAL|wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + A + 0 + + 0 + + + 0 + + 1 + m_staticText841111 + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Plating resistivity: + 0 + + 0 + + + 0 + + 1 + m_staticText6512 + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALIGN_CENTER_VERTICAL|wxEXPAND|wxLEFT|wxRIGHT|wxTOP + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + 0 + + 0 + + 1 + m_textCtrlPlatingResistivity + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + OnViaCalculate + + + + + + + + 5 + wxALIGN_CENTER_VERTICAL|wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Ohm-cm + 0 + + 0 + + + 0 + + 1 + m_staticText84111 + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Temperature rise: + 0 + + 0 + + + 0 + + 1 + m_staticText65121 + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALIGN_CENTER_VERTICAL|wxEXPAND|wxLEFT|wxRIGHT|wxTOP + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + 0 + + 0 + + 1 + m_textCtrlTemperatureDiff + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + OnViaCalculate + + + + + + + + 5 + wxALIGN_CENTER_VERTICAL|wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + deg C + 0 + + 0 + + + 0 + + 1 + m_staticText841112 + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND|wxALL + 1 + + wxID_ANY + Results: + + sbSizerTW_Result11 + wxVERTICAL + 1 + none + + + 5 + wxEXPAND + 0 + + 3 + wxBOTH + 1 + + 0 + + fgSizerTW_Results11 + wxFLEX_GROWMODE_SPECIFIED + none + 6 + 0 + + 5 + wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Resistance: + 0 + + 0 + + + 0 + + 1 + m_staticTextArea11 + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALIGN_CENTER_VERTICAL|wxALL|wxEXPAND + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + dummy + 0 + + 0 + + + 0 + + 1 + m_ViaResistance + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALIGN_CENTER_VERTICAL|wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Ohm + 0 + + 0 + + + 0 + + 1 + m_IntTrackAreaUnitLabel1 + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Voltage drop: + 0 + + 0 + + + 0 + + 1 + m_staticText65111 + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALIGN_CENTER_VERTICAL|wxALL|wxEXPAND + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + dummy + 0 + + 0 + + + 0 + + 1 + m_ViaVoltageDrop + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALIGN_CENTER_VERTICAL|wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Volt + 0 + + 0 + + + 0 + + 1 + m_staticText8411 + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Power loss: + 0 + + 0 + + + 0 + + 1 + m_staticText66111 + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALIGN_CENTER_VERTICAL|wxALL|wxEXPAND + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + dummy + 0 + + 0 + + + 0 + + 1 + m_ViaPowerLoss + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALIGN_CENTER_VERTICAL|wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Watt + 0 + + 0 + + + 0 + + 1 + m_staticText8311 + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Estimated ampacity: + 0 + + 0 + + + 0 + + 1 + m_staticText7921 + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALIGN_CENTER_VERTICAL|wxALL|wxEXPAND + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + dummy + 0 + + 0 + + + 0 + + 1 + m_ViaAmpacity + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALIGN_CENTER_VERTICAL|wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + A + 0 + + 0 + + + 0 + + 1 + m_staticText79111 + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxBOTTOM|wxEXPAND|wxTOP + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + 0 + + 1 + m_staticline311 + 1 + + + protected + 1 + + Resizable + 1 + + wxLI_HORIZONTAL + + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxBOTTOM|wxEXPAND|wxTOP + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + 0 + + 1 + m_staticline312 + 1 + + + protected + 1 + + Resizable + 1 + + wxLI_HORIZONTAL + + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxBOTTOM|wxEXPAND|wxTOP + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + 0 + + 1 + m_staticline313 + 1 + + + protected + 1 + + Resizable + 1 + + wxLI_HORIZONTAL + + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Thermal resistance: + 0 + + 0 + + + 0 + + 1 + m_staticText79211 + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALIGN_CENTER_VERTICAL|wxALL|wxEXPAND + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + dummy + 0 + + 0 + + + 0 + + 1 + m_ViaThermalResistance + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALIGN_CENTER_VERTICAL|wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + deg C/Watt + 0 + + 0 + + + 0 + + 1 + m_staticText791111 + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Electrical Spacing 0 @@ -9521,11 +13265,11 @@ - + TransLine 0 - + 1 1 1 @@ -9606,7 +13350,7 @@ - + bSizeTransline wxHORIZONTAL @@ -9894,11 +13638,11 @@ - + 5 wxALL|wxEXPAND 1 - + bMiddleSizer wxVERTICAL @@ -12833,20 +16577,20 @@ - + 5 wxALIGN_CENTER_HORIZONTAL 1 - + bSizerHelpBitmaps wxVERTICAL none - + 5 wxALL 0 - + 1 1 1 @@ -12930,11 +16674,11 @@ - + 5 wxEXPAND 0 - + 2 wxBOTH 0,1 @@ -12946,11 +16690,11 @@ protected 0 0 - + 5 wxALL 0 - + 1 1 1 @@ -13037,11 +16781,11 @@ - + 5 wxALL 0 - + 1 1 1 @@ -13134,11 +16878,11 @@ - + 5 wxEXPAND 1 - + bRightSizer wxVERTICAL @@ -14257,11 +18001,11 @@ bSizerButtons wxHORIZONTAL none - + 5 wxALL|wxALIGN_CENTER_VERTICAL 0 - + 1 1 1 @@ -14566,11 +18310,11 @@ - + 5 wxALL|wxALIGN_CENTER_VERTICAL 0 - + 1 1 1 @@ -15558,11 +19302,11 @@ - + 5 wxEXPAND|wxTOP 1 - + wxID_ANY Results: @@ -16870,11 +20614,11 @@ - + RF Attenuators 0 - + 1 1 1 @@ -16955,12 +20699,12 @@ - + bSizerAtt wxHORIZONTAL none - + 5 wxEXPAND 0 @@ -17155,7 +20899,7 @@ - + 5 wxEXPAND 0 @@ -19324,11 +23068,11 @@ 1 none - + 5 wxALL|wxEXPAND 1 - + 1 1 1 @@ -19420,11 +23164,11 @@ - + Color Code 0 - + 1 1 1 @@ -20702,11 +24446,11 @@ - + Board Classes - 1 - + 0 + 1 1 1 @@ -20787,7 +24531,7 @@ - + bSizerBoardClass wxHORIZONTAL @@ -20887,11 +24631,11 @@ - + 5 wxEXPAND 1 - + brdclsSizerRight wxVERTICAL diff --git a/pcb_calculator/dialogs/pcb_calculator_frame_base.h b/pcb_calculator/dialogs/pcb_calculator_frame_base.h index db40dfe6b..98b54346d 100644 --- a/pcb_calculator/dialogs/pcb_calculator_frame_base.h +++ b/pcb_calculator/dialogs/pcb_calculator_frame_base.h @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Aug 2 2018) +// C++ code generated with wxFormBuilder (version Aug 8 2018) // http://www.wxformbuilder.org/ // // PLEASE DO *NOT* EDIT THIS FILE! @@ -17,6 +17,7 @@ class UNIT_SELECTOR_LEN; class UNIT_SELECTOR_RESISTOR; class UNIT_SELECTOR_THICKNESS; +#include "UnitSelector.h" #include "kiway_player.h" #include #include @@ -145,6 +146,46 @@ class PCB_CALCULATOR_FRAME_BASE : public KIWAY_PLAYER wxStaticText* m_staticText792; wxStaticText* m_IntTrackLossValue; wxStaticText* m_staticText7911; + wxPanel* m_panelViaSize; + wxStaticText* m_staticTextHoleDia; + wxTextCtrl* m_textCtrlHoleDia; + UNIT_SELECTOR_LEN* m_choiceHoleDia; + wxStaticText* m_staticTextPlatingThickness; + wxTextCtrl* m_textCtrlPlatingThickness; + UNIT_SELECTOR_LEN* m_choicePlatingThickness; + wxStaticText* m_staticTextViaLength; + wxTextCtrl* m_textCtrlViaLength; + UNIT_SELECTOR_LEN* m_choiceViaLength; + wxStaticLine* m_staticline31; + wxStaticLine* m_staticline41; + wxStaticLine* m_staticline51; + wxStaticText* m_staticAppliedCurrent; + wxTextCtrl* m_textCtrlAppliedCurrent; + wxStaticText* m_staticText841111; + wxStaticText* m_staticText6512; + wxTextCtrl* m_textCtrlPlatingResistivity; + wxStaticText* m_staticText84111; + wxStaticText* m_staticText65121; + wxTextCtrl* m_textCtrlTemperatureDiff; + wxStaticText* m_staticText841112; + wxStaticText* m_staticTextArea11; + wxStaticText* m_ViaResistance; + wxStaticText* m_IntTrackAreaUnitLabel1; + wxStaticText* m_staticText65111; + wxStaticText* m_ViaVoltageDrop; + wxStaticText* m_staticText8411; + wxStaticText* m_staticText66111; + wxStaticText* m_ViaPowerLoss; + wxStaticText* m_staticText8311; + wxStaticText* m_staticText7921; + wxStaticText* m_ViaAmpacity; + wxStaticText* m_staticText79111; + wxStaticLine* m_staticline311; + wxStaticLine* m_staticline312; + wxStaticLine* m_staticline313; + wxStaticText* m_staticText79211; + wxStaticText* m_ViaThermalResistance; + wxStaticText* m_staticText791111; wxPanel* m_panelElectricalSpacing; UNIT_SELECTOR_LEN* m_ElectricalSpacingUnitsSelector; wxStaticLine* m_staticline2; @@ -289,6 +330,7 @@ class PCB_CALCULATOR_FRAME_BASE : public KIWAY_PLAYER virtual void OnTWParametersChanged( wxCommandEvent& event ) { event.Skip(); } virtual void OnTWCalculateFromExtWidth( wxCommandEvent& event ) { event.Skip(); } virtual void OnTWCalculateFromIntWidth( wxCommandEvent& event ) { event.Skip(); } + virtual void OnViaCalculate( wxCommandEvent& event ) { event.Skip(); } virtual void OnElectricalSpacingUnitsSelection( wxCommandEvent& event ) { event.Skip(); } virtual void OnElectricalSpacingRefresh( wxCommandEvent& event ) { event.Skip(); } virtual void OnTranslineSelection( wxCommandEvent& event ) { event.Skip(); } diff --git a/pcb_calculator/pcb_calculator.h b/pcb_calculator/pcb_calculator.h index b4389f101..44e5e2d58 100644 --- a/pcb_calculator/pcb_calculator.h +++ b/pcb_calculator/pcb_calculator.h @@ -176,6 +176,33 @@ private: */ void TWUpdateModeDisplay(); + // Via size calculations + + /** + * Function VS_Init + * Read config and init dialog widgets values + */ + void VS_Init( wxConfigBase* aCfg ); + + /** + * Function VS_WriteConfig + * Write Via Size prameters in config + */ + void VS_WriteConfig( wxConfigBase* aCfg ); + + /** + * Function OnViaCalculate + * Called when the user changes any value in the via calcultor. + */ + void OnViaCalculate( wxCommandEvent& event ) override; + + /** + * Function VSDisplayValues + * Displays the results of the calculation. + */ + void VSDisplayValues( double aViaResistance, double aVoltageDrop, double aPowerLoss, + double aEstimatedAmpacity, double aThermalResistance ); + // Electrical spacing panel: void OnElectricalSpacingUnitsSelection( wxCommandEvent& event ) override; void OnElectricalSpacingRefresh( wxCommandEvent& event ) override; diff --git a/pcb_calculator/pcb_calculator_frame.cpp b/pcb_calculator/pcb_calculator_frame.cpp index 04b3ad56f..fc0cf0e9d 100644 --- a/pcb_calculator/pcb_calculator_frame.cpp +++ b/pcb_calculator/pcb_calculator_frame.cpp @@ -93,6 +93,8 @@ PCB_CALCULATOR_FRAME::PCB_CALCULATOR_FRAME( KIWAY* aKiway, wxWindow* aParent ) : TW_Init( config ); + VS_Init( config ); + SetAttenuator( m_AttenuatorsSelection->GetSelection() ); ToleranceSelection( m_rbToleranceSelection->GetSelection() ); @@ -268,6 +270,8 @@ void PCB_CALCULATOR_FRAME::SaveSettings( wxConfigBase* aCfg ) m_ElectricalSpacingVoltage->GetValue() ); TW_WriteConfig( aCfg ); + + VS_WriteConfig( aCfg ); for( unsigned ii = 0; ii < m_transline_list.size(); ii++ ) m_transline_list[ii]->WriteConfig( aCfg ); diff --git a/pcb_calculator/via_funct.cpp b/pcb_calculator/via_funct.cpp new file mode 100644 index 000000000..2c3bd1451 --- /dev/null +++ b/pcb_calculator/via_funct.cpp @@ -0,0 +1,154 @@ +/* + * This program source code file is part of KICAD, a free EDA CAD application. + * + * Copyright (C) 1992-2018 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 online calculator: + * http://circuitcalculator.com/wordpress/2006/03/12/pcb-via-calculator/ + * + * Reference documents: + * https://www.ti.com/seclit/ml/slup230/slup230.pdf + * https://www.ultracad.com/articles/viacurrents.pdf + * http://www.sphere.bc.ca/class/downloads/ipc_2221a-pcb%20standards.pdf + */ + +#include +#include +#include + +#include + +#include +#include +#include + +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_CURRENT wxT( "VS_Current" ) +#define KEYWORD_VS_RESISTIVITY wxT( "VS_Resistivity" ) +#define KEYWORD_VS_TEMP_DIFF wxT( "VS_Temperature_Differential" ) + +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_CURRENT, &msg, wxT( "1" ) ); + m_textCtrlAppliedCurrent->SetValue( msg ); + aCfg->Read( KEYWORD_VS_RESISTIVITY, &msg, wxT( "1.9e-6" ) ); + m_textCtrlPlatingResistivity->SetValue( msg ); + aCfg->Read( KEYWORD_VS_TEMP_DIFF, &msg, wxT( "10" ) ); + m_textCtrlTemperatureDiff->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_CURRENT, m_textCtrlAppliedCurrent->GetValue() ); + aCfg->Write( KEYWORD_VS_RESISTIVITY, m_textCtrlPlatingResistivity->GetValue() ); + aCfg->Write( KEYWORD_VS_TEMP_DIFF, m_textCtrlTemperatureDiff->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 appliedCurrent = std::abs( DoubleFromString( m_textCtrlAppliedCurrent->GetValue() ) ); + double platingResistivity = std::abs( DoubleFromString( m_textCtrlPlatingResistivity->GetValue() ) ); + double temperatureDiff = std::abs( DoubleFromString( m_textCtrlTemperatureDiff->GetValue() ) ); + + // Normalize units + finishedHoleDia *= m_choiceHoleDia->GetUnitScale(); + platingThickness *= m_choicePlatingThickness->GetUnitScale(); + viaLength *= m_choiceViaLength->GetUnitScale(); + platingResistivity = platingResistivity / 100; // Ohm-cm to Ohm-m + + // Caclulate cross-sectional area of the via's cyclinderical structure + double area = M_PI * (finishedHoleDia + platingThickness) * platingThickness; // m^2 + + double viaResistance = platingResistivity * viaLength / area; // Ohms + + const double thermalResistivity = 98 * UNIT_MIL; // K·m/Watt + double thermalResistance = thermalResistivity * viaLength / area; // deg C/Watt + + double voltageDrop = appliedCurrent * viaResistance; + + double powerLoss = appliedCurrent * voltageDrop; + + // IPC-2221-based estimated ampacity + 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); + + // Update the display + VSDisplayValues( viaResistance, voltageDrop, powerLoss, estimatedAmpacity, thermalResistance ); +} + +void PCB_CALCULATOR_FRAME::VSDisplayValues( double aViaResistance, double aVoltageDrop, + double aPowerLoss, double aEstimatedAmpacity, double aThermalResistance ) +{ + 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 ); +} --------------2.19.0--