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 The 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, see <https://www.gnu.org/licenses/>.
19 */
20
21
23#include "dielectric_material.h"
24#include <core/arraydim.h>
25#include <string_utils.h> // for UIDouble2Str()
26
27
28// A list of available substrate material
29// These names are used in .gbrjob file, so they are not fully free.
30// So do not change name with "used in .gbrjob file" comment.
31// These names are in fact usual substrate names.
32// However one can add and use other names for material name.
33// DO NOT translate them, as they are proper noun
35{
36 { NotSpecifiedPrm(), 0.0, 0.0 }, // Not specified, not in .gbrjob
37 { wxT( "FR4" ), 4.5, 0.02 }, // used in .gbrjob file
38 { wxT( "FR408-HR" ), 3.69, 0.0091 }, // used in .gbrjob file
39 { wxT( "Polyimide" ), 3.2, 0.004 }, // used in .gbrjob file
40 { wxT( "Kapton" ), 3.2, 0.004 }, // used in .gbrjob file
41 { wxT( "Polyolefin" ), 1.0, 0.0 }, // used in .gbrjob file
42 { wxT( "Al" ), 8.7, 0.001 }, // used in .gbrjob file
43 { wxT( "PTFE" ), 2.1, 0.0002 }, // used in .gbrjob file
44 { wxT( "Teflon" ), 2.1, 0.0002 }, // used in .gbrjob file
45 { wxT( "Ceramic" ), 1.0, 0.0 } // used in .gbrjob file
46 // Other names are free
47};
48
50{
51 { NotSpecifiedPrm(), DEFAULT_EPSILON_R_SOLDERMASK, 0.0 }, // Not specified, not in .gbrjob
52 { wxT( "Epoxy" ), DEFAULT_EPSILON_R_SOLDERMASK, 0.0 }, // Epoxy Liquid material (usual)
53 { wxT( "Liquid Ink" ), DEFAULT_EPSILON_R_SOLDERMASK, 0.0 }, // Liquid Ink Photoimageable
54 { wxT( "Dry Film" ), DEFAULT_EPSILON_R_SOLDERMASK, 0.0 } // Dry Film Photoimageable
55};
56
58{
59 { NotSpecifiedPrm(), DEFAULT_EPSILON_R_SILKSCREEN, 0.0 }, // Not specified, not in .gbrjob
60 { wxT( "Liquid Photo" ), DEFAULT_EPSILON_R_SILKSCREEN, 0.0 }, // Liquid Ink Photoimageable
61 { wxT( "Direct Printing" ), DEFAULT_EPSILON_R_SILKSCREEN, 0.0 } // Direct Legend Printing
62};
63
64
66{
67 // return a wxString to print/display Epsilon R
68 // note: we do not want scientific notation
69 wxString txt = UIDouble2Str( m_EpsilonR );
70 return txt;
71}
72
73
75{
76 // return a wxString to print/display Loss Tangent
77 // note: we do not want scientific notation
78 wxString txt = UIDouble2Str( m_LossTangent );
79 return txt;
80}
81
82
84{
85 // Fills the m_substrateList with predefined params:
86 switch( aListType )
87 {
89 for( unsigned ii = 0; ii < arrayDim( substrateMaterial ); ++ii )
90 m_substrateList.push_back( substrateMaterial[ii] );
91 break;
92
94 for( unsigned ii = 0; ii < arrayDim( solderMaskMaterial ); ++ii )
95 m_substrateList.push_back( solderMaskMaterial[ii] );
96 break;
97
99 for( unsigned ii = 0; ii < arrayDim( silkscreenMaterial ); ++ii )
100 m_substrateList.push_back( silkscreenMaterial[ii] );
101 break;
102 }
103}
104
105
107{
108 if( aIdx >= 0 && aIdx < GetCount() )
109 return &m_substrateList[aIdx];
110
111 return nullptr;
112}
113
114
116{
118 {
119 if( item.m_Name.CmpNoCase( aName ) == 0 )
120 return &item;
121 }
122
123 return nullptr;
124}
125
126
128{
129 // Find a item matching aItem. The comparison is for the name case insensitive
130 int idx = 0;
131
133 {
134
135 if( item.m_EpsilonR == aItem->m_EpsilonR &&
136 item.m_LossTangent == aItem->m_LossTangent &&
137 item.m_Name.CmpNoCase( aItem->m_Name ) == 0 )
138 {
139 return idx;
140 }
141
142 ++idx;
143 }
144
145 return -1;
146}
147
148
149int DIELECTRIC_SUBSTRATE_LIST::FindSubstrate( const wxString& aName, double aEpsilonR, double aLossTg )
150{
151 // Find a item matching parameters
152 int idx = 0;
153
155 {
156
157 if( item.m_EpsilonR == aEpsilonR &&
158 item.m_LossTangent == aLossTg &&
159 item.m_Name.CmpNoCase( aName ) == 0 )
160 {
161 return idx;
162 }
163
164 ++idx;
165 }
166
167 return -1;
168}
constexpr std::size_t arrayDim(T const (&)[N]) noexcept
Returns # of elements in an array.
Definition arraydim.h:27
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 ...