KiCad PCB EDA Suite
Loading...
Searching...
No Matches
dielectric_material.cpp
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 (C) 2019 Jean-Pierre Charras, jp.charras at wanadoo.fr
5 * Copyright (C) 2009-2021 KiCad Developers, see AUTHORS.txt for contributors.
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version 2
10 * of the License, or (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, you may find one here:
19 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
20 * or you may search the http://www.gnu.org website for the version 2 license,
21 * or you may write to the Free Software Foundation, Inc.,
22 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
23 */
24
25
27#include "dielectric_material.h"
28#include <core/arraydim.h>
29#include <string_utils.h> // for UIDouble2Str()
30
31
32// A list of available substrate material
33// These names are used in .gbrjob file, so they are not fully free.
34// So do not change name with "used in .gbrjob file" comment.
35// These names are in fact usual substrate names.
36// However one can add and use other names for material name.
37// DO NOT translate them, as they are proper noun
39{
40 { NotSpecifiedPrm(), 0.0, 0.0 }, // Not specified, not in .gbrjob
41 { wxT( "FR4" ), 4.5, 0.02 }, // used in .gbrjob file
42 { wxT( "FR408-HR" ), 3.69, 0.0091 }, // used in .gbrjob file
43 { wxT( "Polyimide" ), 3.2, 0.004 }, // used in .gbrjob file
44 { wxT( "Kapton" ), 3.2, 0.004 }, // used in .gbrjob file
45 { wxT( "Polyolefin" ), 1.0, 0.0 }, // used in .gbrjob file
46 { wxT( "Al" ), 8.7, 0.001 }, // used in .gbrjob file
47 { wxT( "PTFE" ), 2.1, 0.0002 }, // used in .gbrjob file
48 { wxT( "Teflon" ), 2.1, 0.0002 }, // used in .gbrjob file
49 { wxT( "Ceramic" ), 1.0, 0.0 } // used in .gbrjob file
50 // Other names are free
51};
52
54{
55 { NotSpecifiedPrm(), DEFAULT_EPSILON_R_SOLDERMASK, 0.0 }, // Not specified, not in .gbrjob
56 { wxT( "Epoxy" ), DEFAULT_EPSILON_R_SOLDERMASK, 0.0 }, // Epoxy Liquid material (usual)
57 { wxT( "Liquid Ink" ), DEFAULT_EPSILON_R_SOLDERMASK, 0.0 }, // Liquid Ink Photoimageable
58 { wxT( "Dry Film" ), DEFAULT_EPSILON_R_SOLDERMASK, 0.0 } // Dry Film Photoimageable
59};
60
62{
63 { NotSpecifiedPrm(), DEFAULT_EPSILON_R_SILKSCREEN, 0.0 }, // Not specified, not in .gbrjob
64 { wxT( "Liquid Photo" ), DEFAULT_EPSILON_R_SILKSCREEN, 0.0 }, // Liquid Ink Photoimageable
65 { wxT( "Direct Printing" ), DEFAULT_EPSILON_R_SILKSCREEN, 0.0 } // Direct Legend Printing
66};
67
68
70{
71 // return a wxString to print/display Epsilon R
72 // note: we do not want scientific notation
73 wxString txt = UIDouble2Str( m_EpsilonR );
74 return txt;
75}
76
77
79{
80 // return a wxString to print/display Loss Tangent
81 // note: we do not want scientific notation
82 wxString txt = UIDouble2Str( m_LossTangent );
83 return txt;
84}
85
86
88{
89 // Fills the m_substrateList with predefined params:
90 switch( aListType )
91 {
93 for( unsigned ii = 0; ii < arrayDim( substrateMaterial ); ++ii )
94 m_substrateList.push_back( substrateMaterial[ii] );
95 break;
96
98 for( unsigned ii = 0; ii < arrayDim( solderMaskMaterial ); ++ii )
99 m_substrateList.push_back( solderMaskMaterial[ii] );
100 break;
101
103 for( unsigned ii = 0; ii < arrayDim( silkscreenMaterial ); ++ii )
104 m_substrateList.push_back( silkscreenMaterial[ii] );
105 break;
106 }
107}
108
109
111{
112 if( aIdx >= 0 && aIdx < GetCount() )
113 return &m_substrateList[aIdx];
114
115 return nullptr;
116}
117
118
120{
122 {
123 if( item.m_Name.CmpNoCase( aName ) == 0 )
124 return &item;
125 }
126
127 return nullptr;
128}
129
130
132{
133 // Find a item matching aItem. The comparison is for the name case insensitive
134 int idx = 0;
135
137 {
138
139 if( item.m_EpsilonR == aItem->m_EpsilonR &&
140 item.m_LossTangent == aItem->m_LossTangent &&
141 item.m_Name.CmpNoCase( aItem->m_Name ) == 0 )
142 {
143 return idx;
144 }
145
146 ++idx;
147 }
148
149 return -1;
150}
151
152
153int DIELECTRIC_SUBSTRATE_LIST::FindSubstrate( const wxString& aName, double aEpsilonR, double aLossTg )
154{
155 // Find a item matching parameters
156 int idx = 0;
157
159 {
160
161 if( item.m_EpsilonR == aEpsilonR &&
162 item.m_LossTangent == aLossTg &&
163 item.m_Name.CmpNoCase( aName ) == 0 )
164 {
165 return idx;
166 }
167
168 ++idx;
169 }
170
171 return -1;
172}
constexpr std::size_t arrayDim(T const (&)[N]) noexcept
Returns # of elements in an array.
Definition: arraydim.h:31
int FindSubstrate(DIELECTRIC_SUBSTRATE *aItem)
Find a item in list similar to aItem.
DIELECTRIC_SUBSTRATE * GetSubstrate(int aIdx)
DIELECTRIC_SUBSTRATE_LIST(DL_MATERIAL_LIST_TYPE aListType)
std::vector< DIELECTRIC_SUBSTRATE > m_substrateList
< The list of available substrates. It contains at least predefined substrates
static DIELECTRIC_SUBSTRATE silkscreenMaterial[]
static DIELECTRIC_SUBSTRATE solderMaskMaterial[]
static DIELECTRIC_SUBSTRATE substrateMaterial[]
wxString NotSpecifiedPrm()
#define DEFAULT_EPSILON_R_SILKSCREEN
#define DEFAULT_EPSILON_R_SOLDERMASK
std::string UIDouble2Str(double aValue)
Print a float number without using scientific notation and no trailing 0 We want to avoid scientific ...