2019-09-09 18:30:43 +00:00
|
|
|
/*
|
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
|
|
*
|
|
|
|
* Copyright (C) 2019 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
2021-08-14 07:42:05 +00:00
|
|
|
* Copyright (C) 2009-2021 KiCad Developers, see AUTHORS.txt for contributors.
|
2019-09-09 18:30:43 +00:00
|
|
|
*
|
|
|
|
* 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
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
2019-09-27 15:12:24 +00:00
|
|
|
#include "stackup_predefined_prms.h"
|
2019-09-09 18:30:43 +00:00
|
|
|
#include "dielectric_material.h"
|
2020-11-18 01:21:04 +00:00
|
|
|
#include <core/arraydim.h>
|
2022-09-17 03:35:16 +00:00
|
|
|
#include <string_utils.h> // for UIDouble2Str()
|
2019-09-09 18:30:43 +00:00
|
|
|
|
|
|
|
|
|
|
|
// A list of available substrate material
|
|
|
|
// These names are used in .gbrjob file, so they are not fully free.
|
|
|
|
// So do not change name with "used in .gbrjob file" comment.
|
|
|
|
// These names are in fact usual substrate names.
|
|
|
|
// However one can add and use other names for material name.
|
|
|
|
// DO NOT translate them, as they are proper noun
|
|
|
|
static DIELECTRIC_SUBSTRATE substrateMaterial[] =
|
|
|
|
{
|
2022-02-04 22:44:59 +00:00
|
|
|
{ NotSpecifiedPrm(), 0.0, 0.0 }, // Not specified, not in .gbrjob
|
|
|
|
{ wxT( "FR4" ), 4.5, 0.02 }, // used in .gbrjob file
|
|
|
|
{ wxT( "FR408-HR" ), 3.69, 0.0091 }, // used in .gbrjob file
|
|
|
|
{ wxT( "Polyimide" ), 3.2, 0.004 }, // used in .gbrjob file
|
|
|
|
{ wxT( "Kapton" ), 3.2, 0.004 }, // used in .gbrjob file
|
|
|
|
{ wxT( "Polyolefin" ), 1.0, 0.0 }, // used in .gbrjob file
|
|
|
|
{ wxT( "Al" ), 8.7, 0.001 }, // used in .gbrjob file
|
|
|
|
{ wxT( "PTFE" ), 2.1, 0.0002 }, // used in .gbrjob file
|
|
|
|
{ wxT( "Teflon" ), 2.1, 0.0002 }, // used in .gbrjob file
|
|
|
|
{ wxT( "Ceramic" ), 1.0, 0.0 } // used in .gbrjob file
|
2021-08-05 20:47:23 +00:00
|
|
|
// Other names are free
|
2019-09-09 18:30:43 +00:00
|
|
|
};
|
|
|
|
|
2019-09-24 12:33:28 +00:00
|
|
|
static DIELECTRIC_SUBSTRATE solderMaskMaterial[] =
|
|
|
|
{
|
2022-02-04 22:44:59 +00:00
|
|
|
{ NotSpecifiedPrm(), DEFAULT_EPSILON_R_SOLDERMASK, 0.0 }, // Not specified, not in .gbrjob
|
|
|
|
{ wxT( "Epoxy" ), DEFAULT_EPSILON_R_SOLDERMASK, 0.0 }, // Epoxy Liquid material (usual)
|
|
|
|
{ wxT( "Liquid Ink" ), DEFAULT_EPSILON_R_SOLDERMASK, 0.0 }, // Liquid Ink Photoimageable
|
|
|
|
{ wxT( "Dry Film" ), DEFAULT_EPSILON_R_SOLDERMASK, 0.0 } // Dry Film Photoimageable
|
2019-09-24 12:33:28 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
static DIELECTRIC_SUBSTRATE silkscreenMaterial[] =
|
|
|
|
{
|
2022-02-04 22:44:59 +00:00
|
|
|
{ NotSpecifiedPrm(), DEFAULT_EPSILON_R_SILKSCREEN, 0.0 }, // Not specified, not in .gbrjob
|
|
|
|
{ wxT( "Liquid Photo" ), DEFAULT_EPSILON_R_SILKSCREEN, 0.0 }, // Liquid Ink Photoimageable
|
|
|
|
{ wxT( "Direct Printing" ), DEFAULT_EPSILON_R_SILKSCREEN, 0.0 } // Direct Legend Printing
|
2019-09-24 12:33:28 +00:00
|
|
|
};
|
|
|
|
|
2019-09-09 18:30:43 +00:00
|
|
|
|
|
|
|
wxString DIELECTRIC_SUBSTRATE::FormatEpsilonR()
|
|
|
|
{
|
|
|
|
// return a wxString to print/display Epsilon R
|
2021-08-14 07:42:05 +00:00
|
|
|
// note: we do not want scientific notation
|
2022-09-17 03:35:16 +00:00
|
|
|
wxString txt = UIDouble2Str( m_EpsilonR );
|
2019-09-09 18:30:43 +00:00
|
|
|
return txt;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
wxString DIELECTRIC_SUBSTRATE::FormatLossTangent()
|
|
|
|
{
|
|
|
|
// return a wxString to print/display Loss Tangent
|
2021-08-14 07:42:05 +00:00
|
|
|
// note: we do not want scientific notation
|
2022-09-17 03:35:16 +00:00
|
|
|
wxString txt = UIDouble2Str( m_LossTangent );
|
2019-09-09 18:30:43 +00:00
|
|
|
return txt;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2019-09-24 12:33:28 +00:00
|
|
|
DIELECTRIC_SUBSTRATE_LIST::DIELECTRIC_SUBSTRATE_LIST( DL_MATERIAL_LIST_TYPE aListType )
|
2019-09-09 18:30:43 +00:00
|
|
|
{
|
|
|
|
// Fills the m_substrateList with predefined params:
|
2019-09-24 12:33:28 +00:00
|
|
|
switch( aListType )
|
|
|
|
{
|
|
|
|
case DL_MATERIAL_DIELECTRIC:
|
|
|
|
for( unsigned ii = 0; ii < arrayDim( substrateMaterial ); ++ii )
|
|
|
|
m_substrateList.push_back( substrateMaterial[ii] );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case DL_MATERIAL_SOLDERMASK:
|
|
|
|
for( unsigned ii = 0; ii < arrayDim( solderMaskMaterial ); ++ii )
|
|
|
|
m_substrateList.push_back( solderMaskMaterial[ii] );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case DL_MATERIAL_SILKSCREEN:
|
|
|
|
for( unsigned ii = 0; ii < arrayDim( silkscreenMaterial ); ++ii )
|
|
|
|
m_substrateList.push_back( silkscreenMaterial[ii] );
|
|
|
|
break;
|
|
|
|
}
|
2019-09-09 18:30:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
DIELECTRIC_SUBSTRATE* DIELECTRIC_SUBSTRATE_LIST::GetSubstrate( int aIdx )
|
|
|
|
{
|
|
|
|
if( aIdx >= 0 && aIdx < GetCount() )
|
|
|
|
return &m_substrateList[aIdx];
|
|
|
|
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
DIELECTRIC_SUBSTRATE* DIELECTRIC_SUBSTRATE_LIST::GetSubstrate( const wxString& aName )
|
|
|
|
{
|
|
|
|
for( DIELECTRIC_SUBSTRATE& item : m_substrateList )
|
|
|
|
{
|
|
|
|
if( item.m_Name.CmpNoCase( aName ) == 0 )
|
|
|
|
return &item;
|
|
|
|
}
|
|
|
|
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int DIELECTRIC_SUBSTRATE_LIST::FindSubstrate( DIELECTRIC_SUBSTRATE* aItem )
|
|
|
|
{
|
|
|
|
// Find a item matching aItem. The comparison is for the name case insensitive
|
|
|
|
int idx = 0;
|
2021-08-05 20:47:23 +00:00
|
|
|
|
2019-09-09 18:30:43 +00:00
|
|
|
for( DIELECTRIC_SUBSTRATE& item : m_substrateList )
|
|
|
|
{
|
|
|
|
|
|
|
|
if( item.m_EpsilonR == aItem->m_EpsilonR &&
|
|
|
|
item.m_LossTangent == aItem->m_LossTangent &&
|
2021-08-05 20:47:23 +00:00
|
|
|
item.m_Name.CmpNoCase( aItem->m_Name ) == 0 )
|
|
|
|
{
|
2019-09-09 18:30:43 +00:00
|
|
|
return idx;
|
2021-08-05 20:47:23 +00:00
|
|
|
}
|
2019-09-09 18:30:43 +00:00
|
|
|
|
|
|
|
++idx;
|
|
|
|
}
|
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int DIELECTRIC_SUBSTRATE_LIST::FindSubstrate( const wxString& aName, double aEpsilonR, double aLossTg )
|
|
|
|
{
|
|
|
|
// Find a item matching parameters
|
|
|
|
int idx = 0;
|
2021-08-05 20:47:23 +00:00
|
|
|
|
2019-09-09 18:30:43 +00:00
|
|
|
for( DIELECTRIC_SUBSTRATE& item : m_substrateList )
|
|
|
|
{
|
|
|
|
|
|
|
|
if( item.m_EpsilonR == aEpsilonR &&
|
|
|
|
item.m_LossTangent == aLossTg &&
|
2021-08-05 20:47:23 +00:00
|
|
|
item.m_Name.CmpNoCase( aName ) == 0 )
|
|
|
|
{
|
2019-09-09 18:30:43 +00:00
|
|
|
return idx;
|
2021-08-05 20:47:23 +00:00
|
|
|
}
|
2019-09-09 18:30:43 +00:00
|
|
|
|
|
|
|
++idx;
|
|
|
|
}
|
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|