KiCad PCB EDA Suite
Loading...
Searching...
No Matches
panel_setup_tuning_profile_info.h
Go to the documentation of this file.
1/*
2* This program source code file is part of KiCad, a free EDA CAD application.
3 *
4 * Copyright The KiCad Developers, see AUTHORS.txt for contributors.
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version 2
9 * of the License, or (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, you may find one here:
18 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
19 * or you may search the http://www.gnu.org website for the version 2 license,
20 * or you may write to the Free Software Foundation, Inc.,
21 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
22 */
23
24#ifndef PANEL_SETUP_TUNING_PROFILE_INFO_H
25#define PANEL_SETUP_TUNING_PROFILE_INFO_H
26
33#include <widgets/unit_binder.h>
35#include <layer_ids.h>
36
38
40{
41public:
42 PANEL_SETUP_TUNING_PROFILE_INFO( wxWindow* aParentWindow, PANEL_SETUP_TUNING_PROFILES* parentPanel );
43
45
47 void UpdateLayerNames();
48
50 void LoadProfile( const TUNING_PROFILE& aProfile );
51
54
56 void OnProfileNameChanged( wxCommandEvent& event ) override;
57
59 void OnChangeProfileType( wxCommandEvent& event ) override;
60
62 void OnAddTrackRow( wxCommandEvent& event ) override;
63
65 void OnRemoveTrackRow( wxCommandEvent& event ) override;
66
68 void OnAddViaOverride( wxCommandEvent& event ) override;
69
71 void OnRemoveViaOverride( wxCommandEvent& event ) override;
72
74 wxString GetProfileName() const;
75
77 bool ValidateProfile( size_t aPageIndex );
78
79private:
89
98
99 enum class CalculationType
100 {
104 };
105
107 void initPanel();
108
110 void setColumnWidths();
111
114 std::pair<int, int> calculateSingleMicrostrip( const int aRow, CalculationType aCalculationType );
115
118 std::pair<int, int> calculateSingleStripline( const int aRow, CalculationType aCalculationType );
119
122 std::tuple<int, int, int> calculateDifferentialMicrostrip( int aRow, CalculationType aCalculationType );
123
126 std::tuple<int, int, int> calculateDifferentialStripline( int aRow, CalculationType aCalculationType );
127
129 static double calculateSkinDepth( double aFreq, double aMurc, double aSigma );
130
133 static int getStackupLayerId( const std::vector<BOARD_STACKUP_ITEM*>& aLayerList, PCB_LAYER_ID aPcbLayerId );
134
142 static std::pair<double, double>
143 calculateAverageDielectricConstants( const std::vector<BOARD_STACKUP_ITEM*>& aStackupLayerList,
144 const std::vector<int>& dielectricLayerStackupIds,
145 const EDA_IU_SCALE& aIuScale );
146
148 void getDielectricDetails( const std::vector<BOARD_STACKUP_ITEM*>& aStackupLayerList, int aSignalLayerId,
149 int aReferenceLayerId, std::vector<int>& aDielectricLayerStackupIds,
150 double& aDielectricLayerHeight );
151
153 double getTargetImpedance() const;
154
156 void calculateTrackParametersForCell( int aRow, int aCol );
157
160
163
166
169
172
175
178
179 // Electrical resistivity or specific electrical resistance of copper (ohm*meter)
180 static constexpr double RHO = 1.72e-8;
181};
182
183
184#endif //PANEL_SETUP_TUNING_PROFILE_INFO_H
PANEL_SETUP_TUNING_PROFILE_INFO_BASE(wxWindow *parent, wxWindowID id=wxID_ANY, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxSize(719, 506), long style=wxTAB_TRAVERSAL, const wxString &name=wxEmptyString)
std::tuple< int, int, int > calculateDifferentialStripline(int aRow, CalculationType aCalculationType)
Calculates the track width, pair gap, or delay for the given propagation grid row.
void OnAddViaOverride(wxCommandEvent &event) override
Adds a via override row.
void getDielectricDetails(const std::vector< BOARD_STACKUP_ITEM * > &aStackupLayerList, int aSignalLayerId, int aReferenceLayerId, std::vector< int > &aDielectricLayerStackupIds, double &aDielectricLayerHeight)
Gets the dielectric layers and heights for dielectrics between the two given copper layer IDs.
MICROSTRIP m_microstripCalc
Calculator for single microstrip parameters.
COUPLED_STRIPLINE m_coupledStriplineCalc
Calculator for coupled (differential) stripline parameters.
void initPanel()
Initialises all controls on the panel.
void calculateTrackParametersForCell(int aRow, int aCol)
Calculates the required track parameters for the given track parameters grid row and col.
double getTargetImpedance() const
Gets the target impedance for the profile.
STRIPLINE m_striplineCalc
Calculator for single stripline parameters.
static double calculateSkinDepth(double aFreq, double aMurc, double aSigma)
Calculate the effective skin depth for the given parameters.
bool ValidateProfile(size_t aPageIndex)
Validate this panel's data.
void UpdateLayerNames()
Updates the displayed layer names in all grids.
std::pair< int, int > calculateSingleMicrostrip(const int aRow, CalculationType aCalculationType)
Calculates the track width or delay for the given propagation grid row.
std::tuple< int, int, int > calculateDifferentialMicrostrip(int aRow, CalculationType aCalculationType)
Calculates the track width, pair gap, or delay for the given propagation grid row.
static int getStackupLayerId(const std::vector< BOARD_STACKUP_ITEM * > &aLayerList, PCB_LAYER_ID aPcbLayerId)
Gets the index in to the layer list for the given layer.
UNIT_BINDER m_viaPropagationUnits
Units for global via propagation unit delay.
PANEL_SETUP_TUNING_PROFILE_INFO(wxWindow *aParentWindow, PANEL_SETUP_TUNING_PROFILES *parentPanel)
void LoadProfile(const TUNING_PROFILE &aProfile)
Loads the given profile in to the panel.
TUNING_PROFILE GetProfile() const
Saves the panel to the given profile.
PANEL_SETUP_TUNING_PROFILES * m_parentPanel
The parent setup panel.
void OnChangeProfileType(wxCommandEvent &event) override
Changes between Single and Differential profiles.
void OnRemoveTrackRow(wxCommandEvent &event) override
Removes a row from the track propagation grid.
wxString GetProfileName() const
Gets the name of this profile.
std::pair< int, int > calculateSingleStripline(const int aRow, CalculationType aCalculationType)
Calculates the track width or delay for the given propagation grid row.
static std::pair< double, double > calculateAverageDielectricConstants(const std::vector< BOARD_STACKUP_ITEM * > &aStackupLayerList, const std::vector< int > &dielectricLayerStackupIds, const EDA_IU_SCALE &aIuScale)
Calculates the geometric average of the dielectric material properties.
COUPLED_MICROSTRIP m_coupledMicrostripCalc
Calculator for coupled (differential) microstrip parameters.
void onChangeProfileType(TUNING_PROFILE::PROFILE_TYPE aType) const
Sets the panel display for the given tuning type.
void OnRemoveViaOverride(wxCommandEvent &event) override
Removes a via override row.
void OnAddTrackRow(wxCommandEvent &event) override
Adds a row to the track propagation grid.
void setColumnWidths()
Set up the widths of all grid columns.
void OnProfileNameChanged(wxCommandEvent &event) override
Updates the parent notebook control.
PCB_LAYER_ID
A quick note on layer IDs:
Definition layer_ids.h:60
Represents a single line in the tuning profile configuration grid.