Eeschema: enable tunable VDC, IDC sources in sim

ADDED: Eeschema SPICE simulator now supports tuning VDC and IDC
sources.

Adds ability to interactively tune VDC and IDC sources in sim.
This allows users to quickly test bias/supply changes during
transient simulations.
This commit is contained in:
Troy Denton
2024-10-28 05:57:21 +00:00
committed by Seth Hillbrand
parent 69ddbeb43f
commit 1dfe431c00
2 changed files with 30 additions and 0 deletions
+26
View File
@@ -44,6 +44,21 @@ std::string SPICE_GENERATOR_SOURCE::ModelLine( const SPICE_ITEM& aItem ) const
return "";
}
std::string SPICE_GENERATOR_SOURCE::TunerCommand( const SPICE_ITEM& aItem, double aValue ) const
{
std::string result = "";
switch( aItem.model->GetType() )
{
case SIM_MODEL::TYPE::V: // VDC/IDC: it is clear which parameter should be used
case SIM_MODEL::TYPE::I:
result = fmt::format( "alter @{}={:g}", aItem.model->SpiceGenerator().ItemName( aItem ),
aValue );
break;
default: break; // other sources: unclear which parameter the user wants
}
return result;
}
std::string SPICE_GENERATOR_SOURCE::ItemLine( const SPICE_ITEM& aItem ) const
{
@@ -1207,3 +1222,14 @@ std::vector<std::string> SIM_MODEL_SOURCE::GetPinNames() const
else
return { "+", "-" };
}
const SIM_MODEL::PARAM* SIM_MODEL_SOURCE::GetTunerParam() const
{
switch( GetType() )
{
case SIM_MODEL::TYPE::V: // VDC/IDC: it is clear which parameter should be used
case SIM_MODEL::TYPE::I: return &GetParam( 0 ); break;
default: break; // other sources: unclear which parameter the user wants
}
return nullptr;
}