Sim: Add mutual inductor model
This commit is contained in:
parent
371985b3e2
commit
e56635a02b
|
@ -280,15 +280,16 @@ set( EESCHEMA_SRCS
|
|||
sim/sim_library_spice.cpp
|
||||
sim/sim_model.cpp
|
||||
sim/sim_model_behavioral.cpp
|
||||
sim/sim_model_xspice.cpp
|
||||
sim/sim_model_ideal.cpp
|
||||
sim/sim_model_mutual_inductor.cpp
|
||||
sim/sim_model_ngspice.cpp
|
||||
sim/sim_model_ngspice_data.cpp
|
||||
sim/sim_model_spice.cpp
|
||||
sim/sim_model_source.cpp
|
||||
sim/sim_model_switch.cpp
|
||||
sim/sim_model_subckt.cpp
|
||||
sim/sim_model_switch.cpp
|
||||
sim/sim_model_tline.cpp
|
||||
sim/sim_model_xspice.cpp
|
||||
sim/sim_value.cpp
|
||||
|
||||
tools/assign_footprints.cpp
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
#include <sim/sim_model.h>
|
||||
#include <sim/sim_model_behavioral.h>
|
||||
#include <sim/sim_model_ideal.h>
|
||||
#include <sim/sim_model_mutual_inductor.h>
|
||||
#include <sim/sim_model_ngspice.h>
|
||||
#include <sim/sim_model_source.h>
|
||||
#include <sim/sim_model_spice.h>
|
||||
|
@ -126,15 +127,13 @@ SIM_MODEL::INFO SIM_MODEL::TypeInfo( TYPE aType )
|
|||
case TYPE::NONE: return { DEVICE_TYPE_::NONE, "", "" };
|
||||
|
||||
case TYPE::R: return { DEVICE_TYPE_::R, "", "Ideal" };
|
||||
//case TYPE::R_ADV: return { DEVICE_TYPE::R, "ADV", "Advanced" };
|
||||
case TYPE::R_BEHAVIORAL: return { DEVICE_TYPE_::R, "=", "Behavioral" };
|
||||
|
||||
case TYPE::C: return { DEVICE_TYPE_::C, "", "Ideal" };
|
||||
//case TYPE::C_ADV: return { DEVICE_TYPE::C, "ADV", "Advanced" };
|
||||
case TYPE::C_BEHAVIORAL: return { DEVICE_TYPE_::C, "=", "Behavioral" };
|
||||
|
||||
case TYPE::L: return { DEVICE_TYPE_::L, "", "Ideal" };
|
||||
//case TYPE::L_ADV: return { DEVICE_TYPE::L, "ADV", "Advanced" };
|
||||
case TYPE::L_MUTUAL: return { DEVICE_TYPE_::L, "MUTUAL", "Mutual" };
|
||||
case TYPE::L_BEHAVIORAL: return { DEVICE_TYPE_::L, "=", "Behavioral" };
|
||||
|
||||
case TYPE::TLINE_Z0: return { DEVICE_TYPE_::TLINE, "Z0", "Characteristic impedance" };
|
||||
|
@ -256,15 +255,13 @@ SIM_MODEL::SPICE_INFO SIM_MODEL::SpiceInfo( TYPE aType )
|
|||
switch( aType )
|
||||
{
|
||||
case TYPE::R: return { "R", "" };
|
||||
//case TYPE::R_ADV: return { "R", "r" };
|
||||
case TYPE::R_BEHAVIORAL: return { "R", "", "", "0", false, true };
|
||||
|
||||
case TYPE::C: return { "C", "" };
|
||||
//case TYPE::C_ADV: return { "C", "c", };
|
||||
case TYPE::C_BEHAVIORAL: return { "C", "", "", "0", false, true };
|
||||
|
||||
case TYPE::L: return { "L", "" };
|
||||
//case TYPE::L_ADV: return { "L", "l" };
|
||||
case TYPE::L_MUTUAL: return { "K", "" };
|
||||
case TYPE::L_BEHAVIORAL: return { "L", "", "", "0", false, true };
|
||||
|
||||
//case TYPE::TLINE_Z0: return { "T" };
|
||||
|
@ -1451,6 +1448,9 @@ std::unique_ptr<SIM_MODEL> SIM_MODEL::create( TYPE aType )
|
|||
case TYPE::L:
|
||||
return std::make_unique<SIM_MODEL_IDEAL>( aType );
|
||||
|
||||
case TYPE::L_MUTUAL:
|
||||
return std::make_unique<SIM_MODEL_MUTUAL_INDUCTOR>();
|
||||
|
||||
case TYPE::R_BEHAVIORAL:
|
||||
case TYPE::C_BEHAVIORAL:
|
||||
case TYPE::L_BEHAVIORAL:
|
||||
|
|
|
@ -160,15 +160,13 @@ public:
|
|||
NONE,
|
||||
|
||||
R,
|
||||
//R_ADV,
|
||||
R_BEHAVIORAL,
|
||||
|
||||
C,
|
||||
//C_ADV,
|
||||
C_BEHAVIORAL,
|
||||
|
||||
L,
|
||||
//L_ADV,
|
||||
L_MUTUAL,
|
||||
L_BEHAVIORAL,
|
||||
|
||||
TLINE_Z0,
|
||||
|
|
|
@ -0,0 +1,80 @@
|
|||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2022 Mikolaj Wielgus
|
||||
* Copyright (C) 2022 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
* 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
|
||||
*/
|
||||
|
||||
#include <sim/sim_model_mutual_inductor.h>
|
||||
|
||||
|
||||
SIM_MODEL_MUTUAL_INDUCTOR::SIM_MODEL_MUTUAL_INDUCTOR() : SIM_MODEL( SIM_MODEL::TYPE::L_MUTUAL )
|
||||
{
|
||||
static std::vector<PARAM::INFO> paramInfos = makeParamInfos();
|
||||
|
||||
for( const PARAM::INFO& paramInfo : paramInfos )
|
||||
AddParam( paramInfo );
|
||||
}
|
||||
|
||||
|
||||
wxString SIM_MODEL_MUTUAL_INDUCTOR::GenerateSpiceItemParamValuePair( const PARAM& aParam,
|
||||
bool& aIsFirst ) const
|
||||
{
|
||||
wxString result;
|
||||
|
||||
result << aParam.value->ToSimpleString() << " ";
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
const std::vector<SIM_MODEL::PARAM::INFO> SIM_MODEL_MUTUAL_INDUCTOR::makeParamInfos()
|
||||
{
|
||||
std::vector<PARAM::INFO> paramInfos;
|
||||
PARAM::INFO paramInfo;
|
||||
|
||||
paramInfo.name = "l1";
|
||||
paramInfo.type = SIM_VALUE::TYPE_STRING;
|
||||
paramInfo.unit = "";
|
||||
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;
|
||||
paramInfo.unit = "";
|
||||
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;
|
||||
}
|
|
@ -0,0 +1,42 @@
|
|||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2022 Mikolaj Wielgus
|
||||
* Copyright (C) 2022 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
* 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
|
||||
*/
|
||||
|
||||
#ifndef SIM_MODEL_MUTUAL_INDUCTOR_H
|
||||
#define SIM_MODEL_MUTUAL_INDUCTOR_H
|
||||
|
||||
#include <sim/sim_model.h>
|
||||
|
||||
|
||||
class SIM_MODEL_MUTUAL_INDUCTOR : public SIM_MODEL
|
||||
{
|
||||
public:
|
||||
SIM_MODEL_MUTUAL_INDUCTOR();
|
||||
|
||||
wxString GenerateSpiceItemParamValuePair( const PARAM& aParam, bool& aIsFirst ) const override;
|
||||
|
||||
private:
|
||||
static const std::vector<PARAM::INFO> makeParamInfos();
|
||||
};
|
||||
|
||||
#endif // SIM_MODEL_MUTUAL_INDUCTOR_H
|
|
@ -265,9 +265,11 @@
|
|||
}
|
||||
],
|
||||
"meta": {
|
||||
"version": 2
|
||||
"version": 3
|
||||
},
|
||||
"net_colors": null
|
||||
"net_colors": null,
|
||||
"netclass_assignments": null,
|
||||
"netclass_patterns": []
|
||||
},
|
||||
"pcbnew": {
|
||||
"last_paths": {
|
||||
|
|
Loading…
Reference in New Issue