2022-09-11 17:00:09 +00:00
|
|
|
/*
|
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
|
|
*
|
|
|
|
* Copyright (C) 2022 Mikolaj Wielgus
|
2024-01-23 15:14:09 +00:00
|
|
|
* Copyright (C) 2022-2024 KiCad Developers, see AUTHORS.txt for contributors.
|
2022-09-11 17:00:09 +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 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, you may find one here:
|
|
|
|
* https://www.gnu.org/licenses/gpl-3.0.html
|
|
|
|
* or you may search the http://www.gnu.org website for the version 3 license,
|
|
|
|
* or you may write to the Free Software Foundation, Inc.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
|
|
|
*/
|
|
|
|
|
2022-11-21 04:01:12 +00:00
|
|
|
#include <sim/sim_model_l_mutual.h>
|
2022-09-11 17:00:09 +00:00
|
|
|
|
|
|
|
|
2022-11-21 04:01:12 +00:00
|
|
|
std::string SPICE_GENERATOR_L_MUTUAL::ItemParams() const
|
2022-09-11 17:00:09 +00:00
|
|
|
{
|
2022-09-22 05:38:45 +00:00
|
|
|
std::string result;
|
2022-09-11 17:00:09 +00:00
|
|
|
|
2022-09-15 03:25:57 +00:00
|
|
|
for( const SIM_MODEL::PARAM& param : GetInstanceParams() )
|
2023-02-22 09:10:06 +00:00
|
|
|
result.append( " " + SIM_VALUE::ToSpice( param.value ) );
|
2022-09-14 07:19:25 +00:00
|
|
|
|
|
|
|
return result;
|
2022-09-11 17:00:09 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2022-11-21 04:01:12 +00:00
|
|
|
SIM_MODEL_L_MUTUAL::SIM_MODEL_L_MUTUAL() :
|
2024-01-21 22:25:24 +00:00
|
|
|
SIM_MODEL( SIM_MODEL::TYPE::K, std::make_unique<SPICE_GENERATOR_L_MUTUAL>( *this ) )
|
2022-09-11 17:00:09 +00:00
|
|
|
{
|
2022-09-14 07:19:25 +00:00
|
|
|
static std::vector<PARAM::INFO> paramInfos = makeParamInfos();
|
2022-09-14 01:15:42 +00:00
|
|
|
|
2022-09-14 07:19:25 +00:00
|
|
|
for( const PARAM::INFO& paramInfo : paramInfos )
|
|
|
|
AddParam( paramInfo );
|
2022-09-11 17:00:09 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2022-11-21 04:01:12 +00:00
|
|
|
const std::vector<SIM_MODEL::PARAM::INFO> SIM_MODEL_L_MUTUAL::makeParamInfos()
|
2022-09-11 17:00:09 +00:00
|
|
|
{
|
|
|
|
std::vector<PARAM::INFO> paramInfos;
|
|
|
|
PARAM::INFO paramInfo;
|
|
|
|
|
|
|
|
paramInfo.name = "l1";
|
|
|
|
paramInfo.type = SIM_VALUE::TYPE_STRING;
|
2024-01-21 22:25:24 +00:00
|
|
|
paramInfo.unit = "(Reference)";
|
2022-09-11 17:00:09 +00:00
|
|
|
paramInfo.category = PARAM::CATEGORY::PRINCIPAL;
|
|
|
|
paramInfo.defaultValue = "";
|
|
|
|
paramInfo.description = "Inductor 1";
|
|
|
|
paramInfo.isSpiceInstanceParam = true;
|
|
|
|
paramInfos.push_back( paramInfo );
|
|
|
|
|
|
|
|
paramInfo.name = "l2";
|
|
|
|
paramInfo.type = SIM_VALUE::TYPE_STRING;
|
2024-01-21 22:25:24 +00:00
|
|
|
paramInfo.unit = "(Reference)";
|
2022-09-11 17:00:09 +00:00
|
|
|
paramInfo.category = PARAM::CATEGORY::PRINCIPAL;
|
|
|
|
paramInfo.defaultValue = "";
|
|
|
|
paramInfo.description = "Inductor 2";
|
|
|
|
paramInfo.isSpiceInstanceParam = true;
|
|
|
|
paramInfos.push_back( paramInfo );
|
|
|
|
|
|
|
|
paramInfo.name = "k";
|
|
|
|
paramInfo.type = SIM_VALUE::TYPE_FLOAT;
|
|
|
|
paramInfo.unit = "";
|
|
|
|
paramInfo.category = PARAM::CATEGORY::PRINCIPAL;
|
|
|
|
paramInfo.defaultValue = "";
|
|
|
|
paramInfo.description = "Coupling coefficient";
|
|
|
|
paramInfo.isSpiceInstanceParam = true;
|
|
|
|
paramInfos.push_back( paramInfo );
|
|
|
|
|
|
|
|
return paramInfos;
|
|
|
|
}
|