pcb_calculator: code cleanup. Remove a few duplicate code.

This commit is contained in:
jean-pierre charras 2019-05-01 20:57:59 +02:00
parent 839f0fbfcf
commit 460d1f2a15
23 changed files with 367 additions and 9424 deletions

View File

@ -13,6 +13,7 @@ set( PCB_CALCULATOR_SRCS
attenuators.cpp attenuators.cpp
board_classes_values.cpp board_classes_values.cpp
colorcode.cpp colorcode.cpp
common_data.cpp
electrical_spacing_values.cpp electrical_spacing_values.cpp
params_read_write.cpp params_read_write.cpp
pcb_calculator_frame.cpp pcb_calculator_frame.cpp

View File

@ -2,11 +2,11 @@
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2011-2014 Jean-Pierre Charras * Copyright (C) 2011-2014 Jean-Pierre Charras
* Copyright (C) 2004-2016 KiCad Developers, see change_log.txt for contributors. * Copyright (C) 2004-2016 KiCad Developers, see AUTHORS.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2 * as published by the Free Software Foundation; either version 3
* of the License, or (at your option) any later version. * of the License, or (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
@ -14,12 +14,8 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License along
* along with this program; if not, you may find one here: * with this program. If not, see <http://www.gnu.org/licenses/>.
* 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
*/ */
/** /**

View File

@ -2,11 +2,11 @@
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2011-2014 Jean-Pierre Charras * Copyright (C) 2011-2014 Jean-Pierre Charras
* Copyright (C) 2004-2016 KiCad Developers, see change_log.txt for contributors. * Copyright (C) 2004-2016 KiCad Developers, see AUTHORS.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2 * as published by the Free Software Foundation; either version 3
* of the License, or (at your option) any later version. * of the License, or (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
@ -14,12 +14,8 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License along
* along with this program; if not, you may find one here: * with this program. If not, see <http://www.gnu.org/licenses/>.
* 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
*/ */
/** /**

View File

@ -2,11 +2,11 @@
* This program source code file is part of KICAD, a free EDA CAD application. * This program source code file is part of KICAD, a free EDA CAD application.
* *
* Copyright (C) 2015 jean-pierre.charras * Copyright (C) 2015 jean-pierre.charras
* Copyright (C) 2015 Kicad Developers, see change_log.txt for contributors. * Copyright (C) 2015 Kicad Developers, see AUTHORS.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2 * as published by the Free Software Foundation; either version 3
* of the License, or (at your option) any later version. * of the License, or (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
@ -14,12 +14,8 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License along
* along with this program; if not, you may find one here: * with this program. If not, see <http://www.gnu.org/licenses/>.
* 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
*/ */
#include <wx/app.h> #include <wx/app.h>
@ -33,7 +29,7 @@
// A helper class to handle min values // A helper class to handle min values
// Values are in meters. // Values are in meters.
// Note : use -1.0 when a vaule is irrelevant in a class // Note : use -1.0 when a value is irrelevant in a class
class BOARD_MIN_SIZE_VALUES class BOARD_MIN_SIZE_VALUES
{ {
public: public:

View File

@ -2,11 +2,11 @@
* This program source code file is part of KICAD, a free EDA CAD application. * This program source code file is part of KICAD, a free EDA CAD application.
* *
* Copyright (C) 2011 jean-pierre.charras * Copyright (C) 2011 jean-pierre.charras
* Copyright (C) 2011 Kicad Developers, see change_log.txt for contributors. * Copyright (C) 2011 Kicad Developers, see AUTHORS.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2 * as published by the Free Software Foundation; either version 3
* of the License, or (at your option) any later version. * of the License, or (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
@ -14,12 +14,8 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License along
* along with this program; if not, you may find one here: * with this program. If not, see <http://www.gnu.org/licenses/>.
* 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
*/ */
#include <wx/app.h> #include <wx/app.h>

View File

@ -0,0 +1,102 @@
/*
* This program source code file is part of KICAD, a free EDA CAD application.
*
* Copyright (C) 2019 jean-pierre.charras
* Copyright (C) 1992-2019 Kicad Developers, see AUTHORS.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 3
* 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, see <http://www.gnu.org/licenses/>.
*/
/**
* @file common_data.cpp
* @note lists of constants used in different panels
*/
#include <common_data.h>
wxArrayString StandardRelativeDielectricConstantList()
{
wxArrayString list;
// EpsilonR ( relative dielectric constant) list
list.Add( wxT( "4.5 FR4" ) );
list.Add( wxT( "3.67 Isola FR408" ) );
list.Add( wxT( "4.04 Isola 370HR" ) );
list.Add( wxT( "3.55 Rogers RO4003C" ) );
list.Add( wxT( "3.66 Rogers R4350B" ) );
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" ) );
return list;
}
wxArrayString StandardLossTangentList()
{
wxArrayString list;
// List of current dielectric loss factor (tangent delta)
list.Clear();
list.Add( wxT( "2e-2 FR4 @ 1GHz" ) );
list.Add( wxT( "12e-3 Isola FR408 @ 2 GHz" ) );
list.Add( wxT( "21e-3 Isola 370HR @ 2 GHz" ) );
list.Add( wxT( "27e-4 Rogers RO4003C @ 10 GHz" ) );
list.Add( wxT( "21e-4 Rogers RO4003C @ 2.5 GHz" ) );
list.Add( wxT( "37e-4 Rogers RO4350B @ 10 GHz" ) );
list.Add( wxT( "31e-4 Rogers RO4350B @ 2.5 GHz" ) );
list.Add( wxT( "3e-4 beryllia @ 10GHz" ) );
list.Add( wxT( "2e-4 aluminia (Al2O3) @ 10GHz" ) );
list.Add( wxT( "1e-4 fused quartz @ 10GHz" ) );
list.Add( wxT( "2e-3 RO4003 @ 10GHz" ) );
list.Add( wxT( "9e-4 RT/duroid 5880 @ 10GHz" ) );
list.Add( wxT( "2e-4 teflon (PTFE) @ 1MHz" ) );
list.Add( wxT( "5e-2 PVC @ 1MHz" ) );
list.Add( wxT( "2e-4 PE @ 1MHz" ) );
list.Add( wxT( "1e-3 aluminum nitride @ 10GHz" ) );
list.Add( wxT( "0.015 silicon @ 10GHz" ) );
list.Add( wxT( "0.002 GaAs @ 10GHz" ) );
return list;
}
wxArrayString StandardResistivityList()
{
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" ) );
return list;
}

View File

@ -0,0 +1,50 @@
/*
* This program source code file is part of KICAD, a free EDA CAD application.
*
* Copyright (C) 2019 jean-pierre.charras
* Copyright (C) 1992-2019 Kicad Developers, see AUTHORS.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 3
* 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, see <http://www.gnu.org/licenses/>.
*/
/**
* @file common_data.h
* @note lists of constants used in different panels
*/
#ifndef COMMON_DATA_H
#define COMMON_DATA_H
#include <wx/arrstr.h>
/**
* @return a list of dielectric constants (Er) of some materials
* used to make PCBs
*/
wxArrayString StandardRelativeDielectricConstantList();
/**
* @return a list of loss tangent of some materials
* used to make PCBs
*/
wxArrayString StandardLossTangentList();
/**
* @return a list of resistivity constants (Er) of some conductors
* used to make PCBs
*/
wxArrayString StandardResistivityList();
#endif // #ifndef COMMON_DATA_H

View File

@ -6,11 +6,11 @@
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2016 Jean-Pierre Charras * Copyright (C) 2016 Jean-Pierre Charras
* Copyright (C) 1992-2016 KiCad Developers, see change_log.txt for contributors. * Copyright (C) 1992-2019 KiCad Developers, see AUTHORS.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2 * as published by the Free Software Foundation; either version 3
* of the License, or (at your option) any later version. * of the License, or (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
@ -18,12 +18,8 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License along
* along with this program; if not, you may find one here: * with this program. If not, see <http://www.gnu.org/licenses/>.
* 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
*/ */
#include <macros.h> #include <macros.h>

View File

@ -3,7 +3,7 @@
/* /*
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 1992-2011 KiCad Developers, see change_log.txt for contributors. * Copyright (C) 1992-2011 KiCad Developers, see AUTHORS.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
@ -15,12 +15,8 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License along
* along with this program; if not, you may find one here: * with this program. If not, see <http://www.gnu.org/licenses/>.
* 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
*/ */
#include <wx/wx.h> #include <wx/wx.h>

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Aug 8 2018) // C++ code generated with wxFormBuilder (version Dec 1 2018)
// http://www.wxformbuilder.org/ // http://www.wxformbuilder.org/
// //
// PLEASE DO *NOT* EDIT THIS FILE! // PLEASE DO *NOT* EDIT THIS FILE!
@ -533,10 +533,9 @@ PCB_CALCULATOR_FRAME_BASE::PCB_CALCULATOR_FRAME_BASE( wxWindow* parent, wxWindow
fgSizerVS_Inputs->SetFlexibleDirection( wxBOTH ); fgSizerVS_Inputs->SetFlexibleDirection( wxBOTH );
fgSizerVS_Inputs->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); fgSizerVS_Inputs->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
m_staticTextHoleDia = new wxStaticText( sbSizerVS_Inputs->GetStaticBox(), wxID_ANY, _("D:"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticTextHoleDia = new wxStaticText( sbSizerVS_Inputs->GetStaticBox(), wxID_ANY, _("Finished hole diameter (D):"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextHoleDia->Wrap( -1 ); m_staticTextHoleDia->Wrap( -1 );
m_staticTextHoleDia->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL, false, wxEmptyString ) ); m_staticTextHoleDia->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL, false, wxEmptyString ) );
m_staticTextHoleDia->SetToolTip( _("Finished hole dia") );
fgSizerVS_Inputs->Add( m_staticTextHoleDia, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxLEFT|wxRIGHT, 5 ); fgSizerVS_Inputs->Add( m_staticTextHoleDia, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxLEFT|wxRIGHT, 5 );
@ -548,10 +547,8 @@ PCB_CALCULATOR_FRAME_BASE::PCB_CALCULATOR_FRAME_BASE( wxWindow* parent, wxWindow
m_choiceHoleDia->SetSelection( 0 ); m_choiceHoleDia->SetSelection( 0 );
fgSizerVS_Inputs->Add( m_choiceHoleDia, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxLEFT|wxRIGHT|wxTOP, 5 ); fgSizerVS_Inputs->Add( m_choiceHoleDia, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxLEFT|wxRIGHT|wxTOP, 5 );
m_staticTextPlatingThickness = new wxStaticText( sbSizerVS_Inputs->GetStaticBox(), wxID_ANY, _("T:"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticTextPlatingThickness = new wxStaticText( sbSizerVS_Inputs->GetStaticBox(), wxID_ANY, _("Plating thickness (T):"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextPlatingThickness->Wrap( -1 ); m_staticTextPlatingThickness->Wrap( -1 );
m_staticTextPlatingThickness->SetToolTip( _("Plating thickness") );
fgSizerVS_Inputs->Add( m_staticTextPlatingThickness, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxRIGHT|wxLEFT, 5 ); 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 ); m_textCtrlPlatingThickness = new wxTextCtrl( sbSizerVS_Inputs->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
@ -602,18 +599,6 @@ PCB_CALCULATOR_FRAME_BASE::PCB_CALCULATOR_FRAME_BASE( wxWindow* parent, wxWindow
m_choiceClearanceDia->SetSelection( 0 ); m_choiceClearanceDia->SetSelection( 0 );
fgSizerVS_Inputs->Add( m_choiceClearanceDia, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxLEFT|wxRIGHT|wxTOP, 5 ); fgSizerVS_Inputs->Add( m_choiceClearanceDia, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxLEFT|wxRIGHT|wxTOP, 5 );
m_staticTextBoardThickness = new wxStaticText( sbSizerVS_Inputs->GetStaticBox(), wxID_ANY, _("PCB thickness:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextBoardThickness->Wrap( -1 );
fgSizerVS_Inputs->Add( m_staticTextBoardThickness, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxLEFT|wxRIGHT, 5 );
m_textCtrlBoardThickness = new wxTextCtrl( sbSizerVS_Inputs->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
fgSizerVS_Inputs->Add( m_textCtrlBoardThickness, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxLEFT|wxRIGHT|wxTOP, 5 );
wxArrayString m_choiceBoardThicknessChoices;
m_choiceBoardThickness = new UNIT_SELECTOR_LEN( sbSizerVS_Inputs->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, m_choiceBoardThicknessChoices, 0 );
m_choiceBoardThickness->SetSelection( 0 );
fgSizerVS_Inputs->Add( m_choiceBoardThickness, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxLEFT|wxRIGHT|wxTOP, 5 );
m_staticTextImpedance = new wxStaticText( sbSizerVS_Inputs->GetStaticBox(), wxID_ANY, _("Z0:"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticTextImpedance = new wxStaticText( sbSizerVS_Inputs->GetStaticBox(), wxID_ANY, _("Z0:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextImpedance->Wrap( -1 ); m_staticTextImpedance->Wrap( -1 );
m_staticTextImpedance->SetToolTip( _("Characteristic impedance of conductor") ); m_staticTextImpedance->SetToolTip( _("Characteristic impedance of conductor") );
@ -1666,6 +1651,7 @@ PCB_CALCULATOR_FRAME_BASE::PCB_CALCULATOR_FRAME_BASE( wxWindow* parent, wxWindow
this->SetSizer( bmainFrameSizer ); this->SetSizer( bmainFrameSizer );
this->Layout(); this->Layout();
bmainFrameSizer->Fit( this ); bmainFrameSizer->Fit( this );
this->Centre( wxBOTH ); this->Centre( wxBOTH );
// Connect Events // Connect Events
@ -1700,8 +1686,6 @@ PCB_CALCULATOR_FRAME_BASE::PCB_CALCULATOR_FRAME_BASE( wxWindow* parent, wxWindow
m_choiceViaPadDia->Connect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( PCB_CALCULATOR_FRAME_BASE::OnViaCalculate ), NULL, this ); m_choiceViaPadDia->Connect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( PCB_CALCULATOR_FRAME_BASE::OnViaCalculate ), NULL, this );
m_textCtrlClearanceDia->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( PCB_CALCULATOR_FRAME_BASE::OnViaCalculate ), NULL, this ); m_textCtrlClearanceDia->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( PCB_CALCULATOR_FRAME_BASE::OnViaCalculate ), NULL, this );
m_choiceClearanceDia->Connect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( PCB_CALCULATOR_FRAME_BASE::OnViaCalculate ), NULL, this ); m_choiceClearanceDia->Connect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( PCB_CALCULATOR_FRAME_BASE::OnViaCalculate ), NULL, this );
m_textCtrlBoardThickness->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( PCB_CALCULATOR_FRAME_BASE::OnViaCalculate ), NULL, this );
m_choiceBoardThickness->Connect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( PCB_CALCULATOR_FRAME_BASE::OnViaCalculate ), NULL, this );
m_textCtrlImpedance->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( PCB_CALCULATOR_FRAME_BASE::OnViaCalculate ), NULL, this ); m_textCtrlImpedance->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( PCB_CALCULATOR_FRAME_BASE::OnViaCalculate ), NULL, this );
m_choiceImpedance->Connect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( PCB_CALCULATOR_FRAME_BASE::OnViaCalculate ), NULL, this ); m_choiceImpedance->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_textCtrlAppliedCurrent->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( PCB_CALCULATOR_FRAME_BASE::OnViaCalculate ), NULL, this );
@ -1764,8 +1748,6 @@ PCB_CALCULATOR_FRAME_BASE::~PCB_CALCULATOR_FRAME_BASE()
m_choiceViaPadDia->Disconnect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( PCB_CALCULATOR_FRAME_BASE::OnViaCalculate ), NULL, this ); m_choiceViaPadDia->Disconnect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( PCB_CALCULATOR_FRAME_BASE::OnViaCalculate ), NULL, this );
m_textCtrlClearanceDia->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( PCB_CALCULATOR_FRAME_BASE::OnViaCalculate ), NULL, this ); m_textCtrlClearanceDia->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( PCB_CALCULATOR_FRAME_BASE::OnViaCalculate ), NULL, this );
m_choiceClearanceDia->Disconnect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( PCB_CALCULATOR_FRAME_BASE::OnViaCalculate ), NULL, this ); m_choiceClearanceDia->Disconnect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( PCB_CALCULATOR_FRAME_BASE::OnViaCalculate ), NULL, this );
m_textCtrlBoardThickness->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( PCB_CALCULATOR_FRAME_BASE::OnViaCalculate ), NULL, this );
m_choiceBoardThickness->Disconnect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( PCB_CALCULATOR_FRAME_BASE::OnViaCalculate ), NULL, this );
m_textCtrlImpedance->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( PCB_CALCULATOR_FRAME_BASE::OnViaCalculate ), NULL, this ); m_textCtrlImpedance->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( PCB_CALCULATOR_FRAME_BASE::OnViaCalculate ), NULL, this );
m_choiceImpedance->Disconnect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( PCB_CALCULATOR_FRAME_BASE::OnViaCalculate ), NULL, this ); m_choiceImpedance->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_textCtrlAppliedCurrent->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( PCB_CALCULATOR_FRAME_BASE::OnViaCalculate ), NULL, this );

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Aug 8 2018) // C++ code generated with wxFormBuilder (version Dec 1 2018)
// http://www.wxformbuilder.org/ // http://www.wxformbuilder.org/
// //
// PLEASE DO *NOT* EDIT THIS FILE! // PLEASE DO *NOT* EDIT THIS FILE!
@ -161,9 +161,6 @@ class PCB_CALCULATOR_FRAME_BASE : public KIWAY_PLAYER
wxStaticText* m_staticTextClearanceDia; wxStaticText* m_staticTextClearanceDia;
wxTextCtrl* m_textCtrlClearanceDia; wxTextCtrl* m_textCtrlClearanceDia;
UNIT_SELECTOR_LEN* m_choiceClearanceDia; UNIT_SELECTOR_LEN* m_choiceClearanceDia;
wxStaticText* m_staticTextBoardThickness;
wxTextCtrl* m_textCtrlBoardThickness;
UNIT_SELECTOR_LEN* m_choiceBoardThickness;
wxStaticText* m_staticTextImpedance; wxStaticText* m_staticTextImpedance;
wxTextCtrl* m_textCtrlImpedance; wxTextCtrl* m_textCtrlImpedance;
UNIT_SELECTOR_RESISTOR* m_choiceImpedance; UNIT_SELECTOR_RESISTOR* m_choiceImpedance;

View File

@ -2,11 +2,11 @@
* This program source code file is part of KICAD, a free EDA CAD application. * This program source code file is part of KICAD, a free EDA CAD application.
* *
* Copyright (C) 2011 jean-pierre.charras * Copyright (C) 2011 jean-pierre.charras
* Copyright (C) 2011 Kicad Developers, see change_log.txt for contributors. * Copyright (C) 2011 Kicad Developers, see AUTHORS.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2 * as published by the Free Software Foundation; either version 3
* of the License, or (at your option) any later version. * of the License, or (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
@ -14,12 +14,8 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License along
* along with this program; if not, you may find one here: * with this program. If not, see <http://www.gnu.org/licenses/>.
* 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
*/ */
#include <wx/app.h> #include <wx/app.h>

View File

@ -2,11 +2,11 @@
* This program source code file is part of KICAD, a free EDA CAD application. * This program source code file is part of KICAD, a free EDA CAD application.
* *
* Copyright (C) 2015 jean-pierre.charras * Copyright (C) 2015 jean-pierre.charras
* Copyright (C) 2015 Kicad Developers, see change_log.txt for contributors. * Copyright (C) 2015 Kicad Developers, see AUTHORS.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2 * as published by the Free Software Foundation; either version 3
* of the License, or (at your option) any later version. * of the License, or (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
@ -14,12 +14,8 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License along
* along with this program; if not, you may find one here: * with this program. If not, see <http://www.gnu.org/licenses/>.
* 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
*/ */
#include <fctsys.h> #include <fctsys.h>
#include <pgm_base.h> #include <pgm_base.h>

View File

@ -1,11 +1,11 @@
/* /*
* This program source code file is part of KICAD, a free EDA CAD application. * This program source code file is part of KICAD, a free EDA CAD application.
* *
* Copyright (C) 1992-2015 Kicad Developers, see change_log.txt for contributors. * Copyright (C) 1992-2015 Kicad Developers, see AUTHORS.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2 * as published by the Free Software Foundation; either version 3
* of the License, or (at your option) any later version. * of the License, or (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
@ -13,12 +13,8 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License along
* along with this program; if not, you may find one here: * with this program. If not, see <http://www.gnu.org/licenses/>.
* 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
*/ */
/** /**

View File

@ -2,11 +2,11 @@
* This program source code file is part of KICAD, a free EDA CAD application. * This program source code file is part of KICAD, a free EDA CAD application.
* *
* Copyright (C) 1992-2015 jean-pierre.charras * Copyright (C) 1992-2015 jean-pierre.charras
* Copyright (C) 1992-2015 Kicad Developers, see change_log.txt for contributors. * Copyright (C) 1992-2015 Kicad Developers, see AUTHORS.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2 * as published by the Free Software Foundation; either version 3
* of the License, or (at your option) any later version. * of the License, or (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
@ -14,12 +14,8 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License along
* along with this program; if not, you may find one here: * with this program. If not, see <http://www.gnu.org/licenses/>.
* 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
*/ */
#include <wx/wx.h> #include <wx/wx.h>
#include <wx/config.h> #include <wx/config.h>

View File

@ -5,11 +5,11 @@
* This program source code file is part of KICAD, a free EDA CAD application. * This program source code file is part of KICAD, a free EDA CAD application.
* *
* Copyright (C) 1992-2011 jean-pierre.charras * Copyright (C) 1992-2011 jean-pierre.charras
* Copyright (C) 1992-2011 Kicad Developers, see change_log.txt for contributors. * Copyright (C) 1992-2011 Kicad Developers, see AUTHORS.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2 * as published by the Free Software Foundation; either version 3
* of the License, or (at your option) any later version. * of the License, or (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
@ -17,12 +17,8 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License along
* along with this program; if not, you may find one here: * with this program. If not, see <http://www.gnu.org/licenses/>.
* 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
*/ */
#include <wx/wx.h> #include <wx/wx.h>
#include <wx/config.h> #include <wx/config.h>

View File

@ -2,11 +2,11 @@
* This program source code file is part of KICAD, a free EDA CAD application. * This program source code file is part of KICAD, a free EDA CAD application.
* *
* Copyright (C) 2011 jean-pierre.charras * Copyright (C) 2011 jean-pierre.charras
* Copyright (C) 1992-2015 Kicad Developers, see change_log.txt for contributors. * Copyright (C) 1992-2015 Kicad Developers, see AUTHORS.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2 * as published by the Free Software Foundation; either version 3
* of the License, or (at your option) any later version. * of the License, or (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
@ -14,12 +14,8 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License along
* along with this program; if not, you may find one here: * with this program. If not, see <http://www.gnu.org/licenses/>.
* 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
*/ */
/* see /* see

View File

@ -2,11 +2,11 @@
* This program source code file is part of KICAD, a free EDA CAD application. * This program source code file is part of KICAD, a free EDA CAD application.
* *
* Copyright (C) 2011 jean-pierre.charras * Copyright (C) 2011 jean-pierre.charras
* Copyright (C) 1992-2011 Kicad Developers, see change_log.txt for contributors. * Copyright (C) 1992-2011 Kicad Developers, see AUTHORS.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2 * as published by the Free Software Foundation; either version 3
* of the License, or (at your option) any later version. * of the License, or (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
@ -14,12 +14,8 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License along
* along with this program; if not, you may find one here: * with this program. If not, see <http://www.gnu.org/licenses/>.
* 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
*/ */
#include <wx/wx.h> #include <wx/wx.h>
#include <wx/config.h> #include <wx/config.h>
@ -29,6 +25,7 @@
#include <pcb_calculator.h> #include <pcb_calculator.h>
#include <UnitSelector.h> #include <UnitSelector.h>
#include <common_data.h>
extern double DoubleFromString( const wxString& TextValue ); extern double DoubleFromString( const wxString& TextValue );
@ -45,26 +42,7 @@ extern double DoubleFromString( const wxString& TextValue );
*/ */
void PCB_CALCULATOR_FRAME::OnTranslineEpsilonR_Button( wxCommandEvent& event ) void PCB_CALCULATOR_FRAME::OnTranslineEpsilonR_Button( wxCommandEvent& event )
{ {
wxArrayString list; wxArrayString list = StandardRelativeDielectricConstantList();
// EpsilonR ( relative dielectric constant) list
list.Add( wxT( "4.5 FR4" ) );
list.Add( wxT( "3.67 Isola FR408" ) );
list.Add( wxT( "4.04 Isola 370HR" ) );
list.Add( wxT( "3.55 Rogers RO4003C" ) );
list.Add( wxT( "3.66 Rogers R4350B" ) );
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, wxString value = wxGetSingleChoice( wxEmptyString,
_("Relative Dielectric Constants"), list).BeforeFirst( ' ' ); _("Relative Dielectric Constants"), list).BeforeFirst( ' ' );
@ -79,28 +57,7 @@ void PCB_CALCULATOR_FRAME::OnTranslineEpsilonR_Button( wxCommandEvent& event )
*/ */
void PCB_CALCULATOR_FRAME::OnTranslineTanD_Button( wxCommandEvent& event ) void PCB_CALCULATOR_FRAME::OnTranslineTanD_Button( wxCommandEvent& event )
{ {
wxArrayString list; wxArrayString list = StandardLossTangentList();
// List of current dielectric loss factor (tangent delta)
list.Clear();
list.Add( wxT( "2e-2 FR4 @ 1GHz" ) );
list.Add( wxT( "12e-3 Isola FR408 @ 2 GHz" ) );
list.Add( wxT( "21e-3 Isola 370HR @ 2 GHz" ) );
list.Add( wxT( "27e-4 Rogers RO4003C @ 10 GHz" ) );
list.Add( wxT( "21e-4 Rogers RO4003C @ 2.5 GHz" ) );
list.Add( wxT( "37e-4 Rogers RO4350B @ 10 GHz" ) );
list.Add( wxT( "31e-4 Rogers RO4350B @ 2.5 GHz" ) );
list.Add( wxT( "3e-4 beryllia @ 10GHz" ) );
list.Add( wxT( "2e-4 aluminia (Al2O3) @ 10GHz" ) );
list.Add( wxT( "1e-4 fused quartz @ 10GHz" ) );
list.Add( wxT( "2e-3 RO4003 @ 10GHz" ) );
list.Add( wxT( "9e-4 RT/duroid 5880 @ 10GHz" ) );
list.Add( wxT( "2e-4 teflon (PTFE) @ 1MHz" ) );
list.Add( wxT( "5e-2 PVC @ 1MHz" ) );
list.Add( wxT( "2e-4 PE @ 1MHz" ) );
list.Add( wxT( "1e-3 aluminum nitride @ 10GHz" ) );
list.Add( wxT( "0.015 silicon @ 10GHz" ) );
list.Add( wxT( "0.002 GaAs @ 10GHz" ) );
wxString value = wxGetSingleChoice( wxEmptyString, wxString value = wxGetSingleChoice( wxEmptyString,
_("Dielectric Loss Factor"), list).BeforeFirst( ' ' ); _("Dielectric Loss Factor"), list).BeforeFirst( ' ' );
@ -115,20 +72,7 @@ void PCB_CALCULATOR_FRAME::OnTranslineTanD_Button( wxCommandEvent& event )
*/ */
void PCB_CALCULATOR_FRAME::OnTranslineRho_Button( wxCommandEvent& event ) void PCB_CALCULATOR_FRAME::OnTranslineRho_Button( wxCommandEvent& event )
{ {
wxArrayString list; wxArrayString list = StandardResistivityList();
// 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, wxString value = wxGetSingleChoice( wxEmptyString,
_("Specific Resistance"), list).BeforeFirst( ' ' ); _("Specific Resistance"), list).BeforeFirst( ' ' );

View File

@ -2,11 +2,11 @@
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2011-2014 Jean-Pierre Charras * Copyright (C) 2011-2014 Jean-Pierre Charras
* Copyright (C) 2004-2014 KiCad Developers, see change_log.txt for contributors. * Copyright (C) 2004-2014 KiCad Developers, see AUTHORS.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2 * as published by the Free Software Foundation; either version 3
* of the License, or (at your option) any later version. * of the License, or (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
@ -14,12 +14,8 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License along
* along with this program; if not, you may find one here: * with this program. If not, see <http://www.gnu.org/licenses/>.
* 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
*/ */
/** /**

View File

@ -2,11 +2,11 @@
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2011-2014 Jean-Pierre Charras * Copyright (C) 2011-2014 Jean-Pierre Charras
* Copyright (C) 2004-2014 KiCad Developers, see change_log.txt for contributors. * Copyright (C) 2004-2014 KiCad Developers, see AUTHORS.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2 * as published by the Free Software Foundation; either version 3
* of the License, or (at your option) any later version. * of the License, or (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
@ -14,12 +14,8 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License along
* along with this program; if not, you may find one here: * with this program. If not, see <http://www.gnu.org/licenses/>.
* 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
*/ */
/** /**

View File

@ -2,11 +2,11 @@
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2011-2014 Jean-Pierre Charras * Copyright (C) 2011-2014 Jean-Pierre Charras
* Copyright (C) 2004-2016 KiCad Developers, see change_log.txt for contributors. * Copyright (C) 2004-2016 KiCad Developers, see AUTHORS.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2 * as published by the Free Software Foundation; either version 3
* of the License, or (at your option) any later version. * of the License, or (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
@ -14,12 +14,8 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License along
* along with this program; if not, you may find one here: * with this program. If not, see <http://www.gnu.org/licenses/>.
* 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
*/ */
/* /*

View File

@ -1,11 +1,11 @@
/* /*
* This program source code file is part of KICAD, a free EDA CAD application. * 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. * Copyright (C) 1992-2019 Kicad Developers, see AUTHORS.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2 * as published by the Free Software Foundation; either version 3
* of the License, or (at your option) any later version. * of the License, or (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
@ -13,12 +13,8 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License along
* along with this program; if not, you may find one here: * with this program. If not, see <http://www.gnu.org/licenses/>.
* 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: /* All calculations are based on this [1] online calculator:
@ -56,6 +52,8 @@
#include <UnitSelector.h> #include <UnitSelector.h>
#include <units_scales.h> #include <units_scales.h>
#include <common_data.h>
extern double DoubleFromString( const wxString& TextValue ); extern double DoubleFromString( const wxString& TextValue );
// Key words to read/write some parameters in config: // Key words to read/write some parameters in config:
@ -69,8 +67,6 @@ extern double DoubleFromString( const wxString& TextValue );
#define KEYWORD_VS_PAD_DIA_UNIT wxT( "VS_Pad_Dia_Unit" ) #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 wxT( "VS_Clearance_Dia" )
#define KEYWORD_VS_CLEARANCE_DIA_UNIT wxT( "VS_Clearance_Dia_Unit" ) #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 wxT( "VS_Characteristic_Impedance" )
#define KEYWORD_VS_CH_IMPEDANCE_UNIT wxT( "VS_Characteristic_Impedance_Unit" ) #define KEYWORD_VS_CH_IMPEDANCE_UNIT wxT( "VS_Characteristic_Impedance_Unit" )
#define KEYWORD_VS_CURRENT wxT( "VS_Current" ) #define KEYWORD_VS_CURRENT wxT( "VS_Current" )
@ -85,22 +81,7 @@ extern double DoubleFromString( const wxString& TextValue );
*/ */
void PCB_CALCULATOR_FRAME::OnViaEpsilonR_Button( wxCommandEvent& event ) void PCB_CALCULATOR_FRAME::OnViaEpsilonR_Button( wxCommandEvent& event )
{ {
wxArrayString list; wxArrayString list = StandardRelativeDielectricConstantList();
// 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, wxString value = wxGetSingleChoice( wxEmptyString,
_("Relative Dielectric Constants"), list).BeforeFirst( ' ' ); _("Relative Dielectric Constants"), list).BeforeFirst( ' ' );
@ -114,20 +95,7 @@ void PCB_CALCULATOR_FRAME::OnViaEpsilonR_Button( wxCommandEvent& event )
*/ */
void PCB_CALCULATOR_FRAME::OnViaRho_Button( wxCommandEvent& event ) void PCB_CALCULATOR_FRAME::OnViaRho_Button( wxCommandEvent& event )
{ {
wxArrayString list; wxArrayString list = StandardResistivityList();
// 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, wxString value = wxGetSingleChoice( wxEmptyString,
_("Specific Resistance"), list).BeforeFirst( ' ' ); _("Specific Resistance"), list).BeforeFirst( ' ' );
@ -140,35 +108,38 @@ void PCB_CALCULATOR_FRAME::VS_Init( wxConfigBase* aCfg )
int tmp; int tmp;
wxString msg; wxString msg;
#define DEFAULT_UNIT_SEL_MM 0
// Read parameter values // Read parameter values
aCfg->Read( KEYWORD_VS_HOLE_DIA, &msg, wxT( "18" ) ); aCfg->Read( KEYWORD_VS_HOLE_DIA, &msg, wxT( "0.4" ) );
m_textCtrlHoleDia->SetValue( msg ); m_textCtrlHoleDia->SetValue( msg );
aCfg->Read( KEYWORD_VS_HOLE_DIA_UNIT, &tmp, 0 ); aCfg->Read( KEYWORD_VS_HOLE_DIA_UNIT, &tmp, DEFAULT_UNIT_SEL_MM );
m_choiceHoleDia->SetSelection( tmp ); m_choiceHoleDia->SetSelection( tmp );
aCfg->Read( KEYWORD_VS_THICKNESS, &msg, wxT( "1" ) );
aCfg->Read( KEYWORD_VS_THICKNESS, &msg, wxT( "0.035" ) );
m_textCtrlPlatingThickness->SetValue( msg ); m_textCtrlPlatingThickness->SetValue( msg );
aCfg->Read( KEYWORD_VS_THICKNESS_UNIT, &tmp, 0 ); aCfg->Read( KEYWORD_VS_THICKNESS_UNIT, &tmp, DEFAULT_UNIT_SEL_MM );
m_choicePlatingThickness->SetSelection( tmp ); m_choicePlatingThickness->SetSelection( tmp );
aCfg->Read( KEYWORD_VS_LENGTH, &msg, wxT( "60" ) );
aCfg->Read( KEYWORD_VS_LENGTH, &msg, wxT( "1.6" ) );
m_textCtrlViaLength->SetValue( msg ); m_textCtrlViaLength->SetValue( msg );
aCfg->Read( KEYWORD_VS_LENGTH_UNIT, &tmp, 0 ); aCfg->Read( KEYWORD_VS_LENGTH_UNIT, &tmp, DEFAULT_UNIT_SEL_MM );
m_choiceViaLength->SetSelection( tmp ); m_choiceViaLength->SetSelection( tmp );
aCfg->Read( KEYWORD_VS_PAD_DIA, &msg, wxT( "22" ) );
aCfg->Read( KEYWORD_VS_PAD_DIA, &msg, wxT( "0.6" ) );
m_textCtrlViaPadDia->SetValue( msg ); m_textCtrlViaPadDia->SetValue( msg );
aCfg->Read( KEYWORD_VS_PAD_DIA_UNIT, &tmp, 0 ); aCfg->Read( KEYWORD_VS_PAD_DIA_UNIT, &tmp, DEFAULT_UNIT_SEL_MM );
m_choiceViaPadDia->SetSelection( tmp ); m_choiceViaPadDia->SetSelection( tmp );
aCfg->Read( KEYWORD_VS_CLEARANCE_DIA, &msg, wxT( "25" ) );
aCfg->Read( KEYWORD_VS_CLEARANCE_DIA, &msg, wxT( "1.0" ) );
m_textCtrlClearanceDia->SetValue( msg ); m_textCtrlClearanceDia->SetValue( msg );
aCfg->Read( KEYWORD_VS_CLEARANCE_DIA_UNIT, &tmp, 0 ); aCfg->Read( KEYWORD_VS_CLEARANCE_DIA_UNIT, &tmp, DEFAULT_UNIT_SEL_MM );
m_choiceClearanceDia->SetSelection( tmp ); 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" ) ); aCfg->Read( KEYWORD_VS_CH_IMPEDANCE, &msg, wxT( "50" ) );
m_textCtrlImpedance->SetValue( msg ); m_textCtrlImpedance->SetValue( msg );
aCfg->Read( KEYWORD_VS_CH_IMPEDANCE_UNIT , &tmp, 0 ); aCfg->Read( KEYWORD_VS_CH_IMPEDANCE_UNIT , &tmp, DEFAULT_UNIT_SEL_MM );
m_choiceImpedance->SetSelection( tmp ); m_choiceImpedance->SetSelection( tmp );
aCfg->Read( KEYWORD_VS_CURRENT, &msg, wxT( "1" ) ); aCfg->Read( KEYWORD_VS_CURRENT, &msg, wxT( "1" ) );
m_textCtrlAppliedCurrent->SetValue( msg ); m_textCtrlAppliedCurrent->SetValue( msg );
aCfg->Read( KEYWORD_VS_RESISTIVITY, &msg, wxT( "1.72e-8" ) ); aCfg->Read( KEYWORD_VS_RESISTIVITY, &msg, wxT( "1.72e-8" ) );
@ -194,8 +165,6 @@ void PCB_CALCULATOR_FRAME::VS_WriteConfig( wxConfigBase* aCfg )
aCfg->Write( KEYWORD_VS_PAD_DIA_UNIT, m_choiceViaPadDia->GetSelection() ); 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, m_textCtrlClearanceDia->GetValue() );
aCfg->Write( KEYWORD_VS_CLEARANCE_DIA_UNIT, m_choiceClearanceDia->GetSelection() ); 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, m_textCtrlImpedance->GetValue() );
aCfg->Write( KEYWORD_VS_CH_IMPEDANCE_UNIT, m_choiceImpedance->GetSelection() ); aCfg->Write( KEYWORD_VS_CH_IMPEDANCE_UNIT, m_choiceImpedance->GetSelection() );
aCfg->Write( KEYWORD_VS_CURRENT, m_textCtrlAppliedCurrent->GetValue() ); aCfg->Write( KEYWORD_VS_CURRENT, m_textCtrlAppliedCurrent->GetValue() );
@ -213,7 +182,6 @@ void PCB_CALCULATOR_FRAME::OnViaCalculate( wxCommandEvent& event )
double viaLength = std::abs( DoubleFromString( m_textCtrlViaLength->GetValue() ) ); double viaLength = std::abs( DoubleFromString( m_textCtrlViaLength->GetValue() ) );
double padDia = std::abs( DoubleFromString( m_textCtrlViaPadDia->GetValue() ) ); double padDia = std::abs( DoubleFromString( m_textCtrlViaPadDia->GetValue() ) );
double clearanceDia = std::abs( DoubleFromString( m_textCtrlClearanceDia->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 charImpedance = std::abs( DoubleFromString( m_textCtrlImpedance->GetValue() ) );
double appliedCurrent = std::abs( DoubleFromString( m_textCtrlAppliedCurrent->GetValue() ) ); double appliedCurrent = std::abs( DoubleFromString( m_textCtrlAppliedCurrent->GetValue() ) );
double platingResistivity = std::abs( DoubleFromString( m_textCtrlPlatingResistivity->GetValue() ) ); double platingResistivity = std::abs( DoubleFromString( m_textCtrlPlatingResistivity->GetValue() ) );
@ -227,7 +195,6 @@ void PCB_CALCULATOR_FRAME::OnViaCalculate( wxCommandEvent& event )
viaLength *= m_choiceViaLength->GetUnitScale(); viaLength *= m_choiceViaLength->GetUnitScale();
padDia *= m_choiceViaPadDia->GetUnitScale(); padDia *= m_choiceViaPadDia->GetUnitScale();
clearanceDia *= m_choiceClearanceDia->GetUnitScale(); clearanceDia *= m_choiceClearanceDia->GetUnitScale();
pcbThickness *= m_choiceBoardThickness->GetUnitScale();
charImpedance *= m_choiceImpedance->GetUnitScale(); charImpedance *= m_choiceImpedance->GetUnitScale();
platingResistivity = platingResistivity / 100; // Ohm-cm to Ohm-m platingResistivity = platingResistivity / 100; // Ohm-cm to Ohm-m
@ -279,30 +246,30 @@ void PCB_CALCULATOR_FRAME::VSDisplayValues( double aViaResistance, double aVolta
{ {
wxString msg; wxString msg;
msg.Printf( wxT( "%g" ), aViaResistance ); msg.Printf( "%g", aViaResistance );
m_ViaResistance->SetLabel( msg ); m_ViaResistance->SetLabel( msg );
msg.Printf( wxT( "%g" ), aVoltageDrop ); msg.Printf( "%g", aVoltageDrop );
m_ViaVoltageDrop->SetLabel( msg ); m_ViaVoltageDrop->SetLabel( msg );
msg.Printf( wxT( "%g" ), aPowerLoss ); msg.Printf( "%g", aPowerLoss );
m_ViaPowerLoss->SetLabel( msg ); m_ViaPowerLoss->SetLabel( msg );
msg.Printf( wxT( "%g" ), aEstimatedAmpacity ); msg.Printf( "%g", aEstimatedAmpacity );
m_ViaAmpacity->SetLabel( msg ); m_ViaAmpacity->SetLabel( msg );
msg.Printf( wxT( "%g" ), aThermalResistance ); msg.Printf( "%g", aThermalResistance );
m_ViaThermalResistance->SetLabel( msg ); m_ViaThermalResistance->SetLabel( msg );
msg.Printf( wxT( "%g" ), aCapacitance ); msg.Printf( "%g", aCapacitance );
m_ViaCapacitance->SetLabel( msg ); m_ViaCapacitance->SetLabel( msg );
msg.Printf( wxT( "%g" ), aTimeDegradation ); msg.Printf( "%g", aTimeDegradation );
m_RiseTimeOutput->SetLabel( msg ); m_RiseTimeOutput->SetLabel( msg );
msg.Printf( wxT( "%g" ), aInductance ); msg.Printf( "%g", aInductance );
m_Inductance->SetLabel( msg ); m_Inductance->SetLabel( msg );
msg.Printf( wxT( "%g" ), aReactance ); msg.Printf( "%g", aReactance );
m_Reactance->SetLabel( msg ); m_Reactance->SetLabel( msg );
} }