2022-02-21 03:58:31 +00:00
|
|
|
/*
|
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
|
|
*
|
|
|
|
* Copyright (C) 2022 Mikolaj Wielgus
|
2023-02-22 09:10:06 +00:00
|
|
|
* Copyright (C) 2022-2023 KiCad Developers, see AUTHORS.txt for contributors.
|
2022-02-21 03:58:31 +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
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <sim/sim_model_source.h>
|
2022-09-22 05:38:45 +00:00
|
|
|
|
|
|
|
#include <fmt/core.h>
|
2022-06-21 02:22:52 +00:00
|
|
|
#include <pegtl.hpp>
|
|
|
|
#include <pegtl/contrib/parse_tree.hpp>
|
2022-02-21 03:58:31 +00:00
|
|
|
|
|
|
|
|
2022-06-21 02:22:52 +00:00
|
|
|
namespace SIM_MODEL_SOURCE_PARSER
|
|
|
|
{
|
|
|
|
using namespace SIM_MODEL_SOURCE_GRAMMAR;
|
|
|
|
|
|
|
|
template <typename Rule> struct pwlValuesSelector : std::false_type {};
|
|
|
|
template <> struct pwlValuesSelector<number<SIM_VALUE::TYPE_FLOAT, NOTATION::SI>>
|
|
|
|
: std::true_type {};
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2022-10-10 23:23:00 +00:00
|
|
|
std::string SPICE_GENERATOR_SOURCE::ModelLine( const SPICE_ITEM& aItem ) const
|
2022-04-01 04:30:50 +00:00
|
|
|
{
|
|
|
|
return "";
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2022-10-10 23:23:00 +00:00
|
|
|
std::string SPICE_GENERATOR_SOURCE::ItemLine( const SPICE_ITEM& aItem ) const
|
2022-04-01 04:30:50 +00:00
|
|
|
{
|
2023-02-15 14:43:16 +00:00
|
|
|
SPICE_ITEM item = aItem;
|
2022-06-12 03:39:13 +00:00
|
|
|
|
2023-02-18 02:17:48 +00:00
|
|
|
std::string ac = "";
|
|
|
|
std::string dc = "";
|
|
|
|
|
2023-05-20 19:58:13 +00:00
|
|
|
if( const SIM_MODEL::PARAM* ac_param = m_model.FindParam( "ac" ) )
|
|
|
|
ac = SIM_VALUE::ToSpice( ac_param->value );
|
|
|
|
if( const SIM_MODEL::PARAM* dc_param = m_model.FindParam( "dc" ) )
|
|
|
|
dc = SIM_VALUE::ToSpice( dc_param->value );
|
2023-02-18 02:17:48 +00:00
|
|
|
|
|
|
|
bool emptyLine = true;
|
|
|
|
item.modelName = "";
|
2022-12-19 01:19:55 +00:00
|
|
|
|
2023-02-18 02:17:48 +00:00
|
|
|
// @FIXME
|
|
|
|
// the keyword "DC" refers to both offset of a sine source, and value for DC analysis
|
|
|
|
// Because of this, both values are always equal in a sine source.
|
|
|
|
//
|
|
|
|
// suggestion: rename the sine parameter from "DC" to "offset"
|
|
|
|
|
|
|
|
if( dc != "" )
|
|
|
|
{
|
|
|
|
emptyLine = false;
|
|
|
|
item.modelName += fmt::format( "DC {} ", dc );
|
2023-02-15 14:43:16 +00:00
|
|
|
}
|
2023-02-18 02:17:48 +00:00
|
|
|
|
2024-01-21 22:25:24 +00:00
|
|
|
if( m_model.GetSpiceInfo().functionName != ""
|
2023-09-12 12:44:30 +00:00
|
|
|
&& m_model.GetType() != SIM_MODEL::TYPE::V // DC-only sources are already processed
|
|
|
|
&& m_model.GetType() != SIM_MODEL::TYPE::I )
|
2022-05-31 02:55:48 +00:00
|
|
|
{
|
2022-09-22 05:38:45 +00:00
|
|
|
std::string args = "";
|
2023-10-24 20:57:34 +00:00
|
|
|
|
2022-09-14 07:19:25 +00:00
|
|
|
switch( m_model.GetType() )
|
2022-06-21 02:22:52 +00:00
|
|
|
{
|
2022-09-15 03:25:57 +00:00
|
|
|
case SIM_MODEL::TYPE::V_PWL:
|
|
|
|
case SIM_MODEL::TYPE::I_PWL:
|
2022-06-12 03:39:13 +00:00
|
|
|
{
|
2023-02-22 09:10:06 +00:00
|
|
|
tao::pegtl::string_input<> in( m_model.GetParam( 0 ).value, "from_content" );
|
2022-06-21 02:22:52 +00:00
|
|
|
std::unique_ptr<tao::pegtl::parse_tree::node> root;
|
|
|
|
|
|
|
|
try
|
|
|
|
{
|
|
|
|
root = tao::pegtl::parse_tree::parse<SIM_MODEL_SOURCE_PARSER::pwlValuesGrammar,
|
|
|
|
SIM_MODEL_SOURCE_PARSER::pwlValuesSelector>
|
|
|
|
( in );
|
|
|
|
}
|
2022-08-15 19:45:54 +00:00
|
|
|
catch( const tao::pegtl::parse_error& )
|
2022-06-21 02:22:52 +00:00
|
|
|
{
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if( root )
|
|
|
|
{
|
|
|
|
for( const auto& node : root->children )
|
|
|
|
{
|
|
|
|
if( node->is_type<SIM_MODEL_SOURCE_PARSER::number<SIM_VALUE::TYPE_FLOAT,
|
|
|
|
SIM_VALUE::NOTATION::SI>>() )
|
|
|
|
{
|
2023-02-22 09:10:06 +00:00
|
|
|
args.append( SIM_VALUE::ToSpice( node->string() ) + " " );
|
2022-06-21 02:22:52 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2023-02-15 14:43:16 +00:00
|
|
|
|
2022-06-21 02:22:52 +00:00
|
|
|
break;
|
2023-02-15 14:43:16 +00:00
|
|
|
}
|
2022-06-21 02:22:52 +00:00
|
|
|
|
2022-09-15 03:25:57 +00:00
|
|
|
case SIM_MODEL::TYPE::V_WHITENOISE:
|
|
|
|
case SIM_MODEL::TYPE::I_WHITENOISE:
|
2022-09-22 05:38:45 +00:00
|
|
|
args.append( getParamValueString( "rms", "0" ) + " " );
|
|
|
|
args.append( getParamValueString( "dt", "0" ) + " " );
|
|
|
|
args.append( "0 0 0 0 0 " );
|
2022-06-21 02:22:52 +00:00
|
|
|
break;
|
|
|
|
|
2022-09-15 03:25:57 +00:00
|
|
|
case SIM_MODEL::TYPE::V_PINKNOISE:
|
|
|
|
case SIM_MODEL::TYPE::I_PINKNOISE:
|
2022-09-22 05:38:45 +00:00
|
|
|
args.append( "0 " );
|
|
|
|
args.append( getParamValueString( "dt", "0" ) + " " );
|
|
|
|
args.append( getParamValueString( "slope", "0" ) + " " );
|
|
|
|
args.append( getParamValueString( "rms", "0" ) + " " );
|
|
|
|
args.append( "0 0 0 " );
|
2022-06-21 02:22:52 +00:00
|
|
|
break;
|
|
|
|
|
2022-09-15 03:25:57 +00:00
|
|
|
case SIM_MODEL::TYPE::V_BURSTNOISE:
|
|
|
|
case SIM_MODEL::TYPE::I_BURSTNOISE:
|
2022-09-22 05:38:45 +00:00
|
|
|
args.append( "0 0 0 0 " );
|
|
|
|
args.append( getParamValueString( "ampl", "0" ) + " " );
|
|
|
|
args.append( getParamValueString( "tcapt", "0" ) + " " );
|
|
|
|
args.append( getParamValueString( "temit", "0" ) + " " );
|
2022-06-21 02:22:52 +00:00
|
|
|
break;
|
2023-10-24 20:57:34 +00:00
|
|
|
|
2022-09-15 03:25:57 +00:00
|
|
|
case SIM_MODEL::TYPE::V_RANDUNIFORM:
|
|
|
|
case SIM_MODEL::TYPE::I_RANDUNIFORM:
|
2022-06-21 02:22:52 +00:00
|
|
|
{
|
2022-09-22 05:38:45 +00:00
|
|
|
args.append( "1 " );
|
2024-01-06 18:00:50 +00:00
|
|
|
args.append( getParamValueString( "ts", "0" ) + " " );
|
2022-09-22 05:38:45 +00:00
|
|
|
args.append( getParamValueString( "td", "0" ) + " " );
|
2024-01-06 18:00:50 +00:00
|
|
|
args.append( getParamValueString( "range", "1" ) + " " );
|
|
|
|
args.append( getParamValueString( "offset", "0" ) + " " );
|
2022-06-21 02:22:52 +00:00
|
|
|
break;
|
2023-02-15 14:43:16 +00:00
|
|
|
}
|
2022-06-21 02:22:52 +00:00
|
|
|
|
2024-01-06 18:00:50 +00:00
|
|
|
case SIM_MODEL::TYPE::V_RANDGAUSSIAN:
|
|
|
|
case SIM_MODEL::TYPE::I_RANDGAUSSIAN:
|
2022-09-22 05:38:45 +00:00
|
|
|
args.append( "2 " );
|
2024-01-06 18:00:50 +00:00
|
|
|
args.append( getParamValueString( "ts", "0" ) + " " );
|
2022-09-22 05:38:45 +00:00
|
|
|
args.append( getParamValueString( "td", "0" ) + " " );
|
2024-01-06 18:00:50 +00:00
|
|
|
args.append( getParamValueString( "stddev", "1" ) + " " );
|
2022-09-22 05:38:45 +00:00
|
|
|
args.append( getParamValueString( "mean", "0" ) + " " );
|
2022-06-21 02:22:52 +00:00
|
|
|
break;
|
|
|
|
|
2022-09-15 03:25:57 +00:00
|
|
|
case SIM_MODEL::TYPE::V_RANDEXP:
|
|
|
|
case SIM_MODEL::TYPE::I_RANDEXP:
|
2022-09-22 05:38:45 +00:00
|
|
|
args.append( "3 " );
|
2024-01-06 18:00:50 +00:00
|
|
|
args.append( getParamValueString( "ts", "0" ) + " " );
|
2022-09-22 05:38:45 +00:00
|
|
|
args.append( getParamValueString( "td", "0" ) + " " );
|
2024-01-06 18:00:50 +00:00
|
|
|
args.append( getParamValueString( "mean", "1" ) + " " );
|
2022-09-22 05:38:45 +00:00
|
|
|
args.append( getParamValueString( "offset", "0" ) + " " );
|
2022-06-21 02:22:52 +00:00
|
|
|
break;
|
|
|
|
|
2023-05-20 19:58:13 +00:00
|
|
|
case SIM_MODEL::TYPE::V_RANDPOISSON:
|
2022-09-15 03:25:57 +00:00
|
|
|
case SIM_MODEL::TYPE::I_RANDPOISSON:
|
2022-09-22 05:38:45 +00:00
|
|
|
args.append( "4 " );
|
2024-01-06 18:00:50 +00:00
|
|
|
args.append( getParamValueString( "ts", "0" ) + " " );
|
2023-05-20 19:58:13 +00:00
|
|
|
args.append( getParamValueString( "td", "0" ) + " " );
|
2024-01-06 18:00:50 +00:00
|
|
|
args.append( getParamValueString( "lambda", "1" ) + " " );
|
2023-05-20 19:58:13 +00:00
|
|
|
args.append( getParamValueString( "offset", "0" ) + " " );
|
|
|
|
break;
|
2022-06-21 02:22:52 +00:00
|
|
|
|
|
|
|
default:
|
2022-09-15 03:25:57 +00:00
|
|
|
for( const SIM_MODEL::PARAM& param : m_model.GetParams() )
|
2022-06-21 02:22:52 +00:00
|
|
|
{
|
2024-05-09 22:35:58 +00:00
|
|
|
if( ac != "" && ( param.Matches( "ac" ) || param.Matches( "ph" ) ) )
|
|
|
|
continue;
|
|
|
|
|
2023-02-22 09:10:06 +00:00
|
|
|
std::string argStr = SIM_VALUE::ToSpice( param.value );
|
2022-06-21 02:22:52 +00:00
|
|
|
|
|
|
|
if( argStr != "" )
|
2022-09-22 05:38:45 +00:00
|
|
|
args.append( argStr + " " );
|
2022-06-21 02:22:52 +00:00
|
|
|
}
|
2023-02-15 14:43:16 +00:00
|
|
|
|
2022-06-21 02:22:52 +00:00
|
|
|
break;
|
2022-06-12 03:39:13 +00:00
|
|
|
}
|
2022-04-01 04:30:50 +00:00
|
|
|
|
2023-02-18 02:17:48 +00:00
|
|
|
emptyLine = false;
|
2024-01-21 22:25:24 +00:00
|
|
|
item.modelName += fmt::format( "{}( {}) ", m_model.GetSpiceInfo().functionName, args );
|
2022-06-12 03:39:13 +00:00
|
|
|
}
|
2023-05-20 19:58:13 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
switch( m_model.GetType() )
|
|
|
|
case SIM_MODEL::TYPE::V_VCL:
|
|
|
|
case SIM_MODEL::TYPE::I_VCL:
|
|
|
|
{
|
|
|
|
item.modelName += fmt::format( "{} ", getParamValueString( "gain", "1.0" ) );
|
|
|
|
emptyLine = false;
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case SIM_MODEL::TYPE::V_CCL:
|
|
|
|
case SIM_MODEL::TYPE::I_CCL:
|
|
|
|
item.modelName += fmt::format( "{} {} ",
|
|
|
|
getParamValueString( "control", "V?" ),
|
|
|
|
getParamValueString( "gain", "1.0" ) );
|
|
|
|
emptyLine = false;
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2023-02-18 02:17:48 +00:00
|
|
|
|
|
|
|
if( ac != "" )
|
|
|
|
{
|
|
|
|
std::string ph = "";
|
|
|
|
|
2023-05-20 19:58:13 +00:00
|
|
|
if( const SIM_MODEL::PARAM* ph_param = m_model.FindParam( "ph" ) )
|
|
|
|
ph = SIM_VALUE::ToSpice( ph_param->value );
|
2023-02-18 02:17:48 +00:00
|
|
|
|
|
|
|
emptyLine = false;
|
2023-07-04 16:01:12 +00:00
|
|
|
item.modelName += fmt::format( "AC {} {} ", ac, ph );
|
|
|
|
}
|
|
|
|
|
|
|
|
std::string portnum = "";
|
|
|
|
|
|
|
|
if( const SIM_MODEL::PARAM* portnum_param = m_model.FindParam( "portnum" ) )
|
|
|
|
portnum = SIM_VALUE::ToSpice( portnum_param->value );
|
|
|
|
|
|
|
|
if( portnum != "" )
|
|
|
|
{
|
|
|
|
item.modelName += fmt::format( "portnum {} ", portnum );
|
|
|
|
|
|
|
|
std::string z0 = "";
|
|
|
|
|
|
|
|
if( const SIM_MODEL::PARAM* z0_param = m_model.FindParam( "z0" ) )
|
|
|
|
z0 = SIM_VALUE::ToSpice( z0_param->value );
|
|
|
|
|
|
|
|
if( z0 != "" )
|
|
|
|
item.modelName += fmt::format( "z0 {} ", z0 );
|
2023-02-18 02:17:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if( emptyLine )
|
2022-12-17 15:21:35 +00:00
|
|
|
{
|
2023-02-22 09:10:06 +00:00
|
|
|
item.modelName = SIM_VALUE::ToSpice( m_model.GetParam( 0 ).value );
|
2022-12-17 15:21:35 +00:00
|
|
|
}
|
2022-04-01 04:30:50 +00:00
|
|
|
|
2022-10-10 23:23:00 +00:00
|
|
|
return SPICE_GENERATOR::ItemLine( item );
|
2022-09-14 07:19:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2022-09-22 05:38:45 +00:00
|
|
|
std::string SPICE_GENERATOR_SOURCE::getParamValueString( const std::string& aParamName,
|
|
|
|
const std::string& aDefaultValue ) const
|
2022-09-14 07:19:25 +00:00
|
|
|
{
|
2023-02-18 10:07:29 +00:00
|
|
|
std::string result = "";
|
2023-10-24 20:57:34 +00:00
|
|
|
|
2023-02-18 10:07:29 +00:00
|
|
|
if ( m_model.FindParam( aParamName ) )
|
2023-02-22 09:10:06 +00:00
|
|
|
result = SIM_VALUE::ToSpice( m_model.FindParam( aParamName )->value );
|
2022-09-14 07:19:25 +00:00
|
|
|
|
|
|
|
if( result == "" )
|
|
|
|
result = aDefaultValue;
|
|
|
|
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2022-12-21 00:38:52 +00:00
|
|
|
SIM_MODEL_SOURCE::SIM_MODEL_SOURCE( TYPE aType ) :
|
|
|
|
SIM_MODEL( aType, std::make_unique<SPICE_GENERATOR_SOURCE>( *this ),
|
|
|
|
std::make_unique<SIM_MODEL_SOURCE_SERIALIZER>( *this ) )
|
2022-09-14 07:19:25 +00:00
|
|
|
{
|
|
|
|
for( const SIM_MODEL::PARAM::INFO& paramInfo : makeParamInfos( aType ) )
|
|
|
|
AddParam( paramInfo );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2023-02-22 09:10:06 +00:00
|
|
|
void SIM_MODEL_SOURCE::doSetParamValue( int aParamIndex, const std::string& aValue )
|
2022-04-01 04:30:50 +00:00
|
|
|
{
|
|
|
|
// Sources are special. All preceding parameter values must be filled. If they are not, fill
|
|
|
|
// them out automatically. If a value is nulled, delete everything after it.
|
2023-02-22 09:10:06 +00:00
|
|
|
if( aValue.empty() )
|
2022-04-01 04:30:50 +00:00
|
|
|
{
|
2024-01-06 18:00:50 +00:00
|
|
|
for( int paramIndex = aParamIndex; paramIndex < GetParamCount(); ++paramIndex )
|
2022-08-24 04:13:55 +00:00
|
|
|
{
|
2023-02-22 09:10:06 +00:00
|
|
|
m_params.at( aParamIndex ).value = "";
|
2022-08-24 04:13:55 +00:00
|
|
|
}
|
2022-04-01 04:30:50 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2022-10-04 15:17:41 +00:00
|
|
|
for( int paramIndex = 0; paramIndex < aParamIndex; ++paramIndex )
|
2022-04-01 04:30:50 +00:00
|
|
|
{
|
2023-02-22 09:10:06 +00:00
|
|
|
if( GetParam( paramIndex ).value == "" )
|
2022-10-12 01:38:12 +00:00
|
|
|
{
|
2024-01-06 22:01:23 +00:00
|
|
|
double dummy;
|
|
|
|
wxString defaultValue = m_params.at( aParamIndex ).info.defaultValue;
|
|
|
|
|
|
|
|
if( !defaultValue.ToDouble( &dummy ) )
|
|
|
|
defaultValue = wxT( "0" );
|
2024-01-06 18:00:50 +00:00
|
|
|
|
|
|
|
m_params.at( aParamIndex ).value = defaultValue;
|
2024-01-06 22:01:23 +00:00
|
|
|
SIM_MODEL::SetParamValue( paramIndex, defaultValue.ToStdString() );
|
2022-10-12 01:38:12 +00:00
|
|
|
}
|
2022-04-01 04:30:50 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-02-22 09:10:06 +00:00
|
|
|
return SIM_MODEL::doSetParamValue( aParamIndex, aValue );
|
2022-04-01 04:30:50 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2022-08-28 12:51:03 +00:00
|
|
|
const std::vector<SIM_MODEL::PARAM::INFO>& SIM_MODEL_SOURCE::makeParamInfos( TYPE aType )
|
2022-06-21 02:22:52 +00:00
|
|
|
{
|
2022-09-30 12:29:44 +00:00
|
|
|
static std::vector<PARAM::INFO> vdc = makeDcParamInfos( "y", "V" );
|
|
|
|
static std::vector<PARAM::INFO> idc = makeDcParamInfos( "y", "A" );
|
2022-06-21 02:22:52 +00:00
|
|
|
|
2022-09-30 12:29:44 +00:00
|
|
|
static std::vector<PARAM::INFO> vsin = makeSinParamInfos( "y", "V" );
|
|
|
|
static std::vector<PARAM::INFO> isin = makeSinParamInfos( "y", "A" );
|
2022-06-21 02:22:52 +00:00
|
|
|
|
2022-09-30 12:29:44 +00:00
|
|
|
static std::vector<PARAM::INFO> vpulse = makePulseParamInfos( "y", "V" );
|
|
|
|
static std::vector<PARAM::INFO> ipulse = makePulseParamInfos( "y", "A" );
|
2022-06-21 02:22:52 +00:00
|
|
|
|
2022-09-30 12:29:44 +00:00
|
|
|
static std::vector<PARAM::INFO> vexp = makeExpParamInfos( "y", "V" );
|
|
|
|
static std::vector<PARAM::INFO> iexp = makeExpParamInfos( "y", "A" );
|
2022-06-21 02:22:52 +00:00
|
|
|
|
2024-01-06 14:48:20 +00:00
|
|
|
static std::vector<PARAM::INFO> vam = makeAMParamInfos( "y", "V" );
|
|
|
|
static std::vector<PARAM::INFO> iam = makeAMParamInfos( "y", "A" );
|
2022-06-21 02:22:52 +00:00
|
|
|
|
2024-01-06 14:48:20 +00:00
|
|
|
static std::vector<PARAM::INFO> vsffm = makeSFFMParamInfos( "y", "V" );
|
|
|
|
static std::vector<PARAM::INFO> isffm = makeSFFMParamInfos( "y", "A" );
|
2022-06-21 02:22:52 +00:00
|
|
|
|
2023-05-20 19:58:13 +00:00
|
|
|
static std::vector<PARAM::INFO> vcvs = makeVcParamInfos( "" );
|
|
|
|
static std::vector<PARAM::INFO> ccvs = makeCcParamInfos( "ohm" );
|
2022-09-30 12:29:44 +00:00
|
|
|
static std::vector<PARAM::INFO> vpwl = makePwlParamInfos( "y", "Voltage", "V" );
|
2023-05-20 19:58:13 +00:00
|
|
|
|
|
|
|
static std::vector<PARAM::INFO> vccs = makeVcParamInfos( "S" );
|
|
|
|
static std::vector<PARAM::INFO> cccs = makeCcParamInfos( "" );
|
2022-09-30 12:29:44 +00:00
|
|
|
static std::vector<PARAM::INFO> ipwl = makePwlParamInfos( "y", "Current", "A" );
|
2022-06-21 02:22:52 +00:00
|
|
|
|
2022-09-30 12:29:44 +00:00
|
|
|
static std::vector<PARAM::INFO> vwhitenoise = makeWhiteNoiseParamInfos( "y", "V" );
|
|
|
|
static std::vector<PARAM::INFO> iwhitenoise = makeWhiteNoiseParamInfos( "y", "A" );
|
2022-06-21 02:22:52 +00:00
|
|
|
|
2022-09-30 12:29:44 +00:00
|
|
|
static std::vector<PARAM::INFO> vpinknoise = makePinkNoiseParamInfos( "y", "V" );
|
|
|
|
static std::vector<PARAM::INFO> ipinknoise = makePinkNoiseParamInfos( "y", "A" );
|
2022-06-21 02:22:52 +00:00
|
|
|
|
2022-09-30 12:29:44 +00:00
|
|
|
static std::vector<PARAM::INFO> vburstnoise = makeBurstNoiseParamInfos( "y", "V" );
|
|
|
|
static std::vector<PARAM::INFO> iburstnoise = makeBurstNoiseParamInfos( "y", "A" );
|
2022-06-21 02:22:52 +00:00
|
|
|
|
2022-09-30 12:29:44 +00:00
|
|
|
static std::vector<PARAM::INFO> vrandomuniform = makeRandomUniformParamInfos( "y", "V" );
|
|
|
|
static std::vector<PARAM::INFO> irandomuniform = makeRandomUniformParamInfos( "y", "A" );
|
2022-06-21 02:22:52 +00:00
|
|
|
|
2022-09-30 12:29:44 +00:00
|
|
|
static std::vector<PARAM::INFO> vrandomnormal = makeRandomNormalParamInfos( "y", "V" );
|
|
|
|
static std::vector<PARAM::INFO> irandomnormal = makeRandomNormalParamInfos( "y", "A" );
|
2022-06-21 02:22:52 +00:00
|
|
|
|
2022-09-30 12:29:44 +00:00
|
|
|
static std::vector<PARAM::INFO> vrandomexp = makeRandomExpParamInfos( "y", "V" );
|
|
|
|
static std::vector<PARAM::INFO> irandomexp = makeRandomExpParamInfos( "y", "A" );
|
2022-06-21 02:22:52 +00:00
|
|
|
|
2022-09-30 12:29:44 +00:00
|
|
|
static std::vector<PARAM::INFO> vrandompoisson = makeRandomPoissonParamInfos( "y", "V" );
|
|
|
|
static std::vector<PARAM::INFO> irandompoisson = makeRandomPoissonParamInfos( "y", "A" );
|
2022-06-21 02:22:52 +00:00
|
|
|
|
|
|
|
switch( aType )
|
|
|
|
{
|
2024-01-06 18:00:50 +00:00
|
|
|
case TYPE::V: return vdc;
|
|
|
|
case TYPE::I: return idc;
|
|
|
|
case TYPE::V_SIN: return vsin;
|
|
|
|
case TYPE::I_SIN: return isin;
|
|
|
|
case TYPE::V_PULSE: return vpulse;
|
|
|
|
case TYPE::I_PULSE: return ipulse;
|
|
|
|
case TYPE::V_EXP: return vexp;
|
|
|
|
case TYPE::I_EXP: return iexp;
|
|
|
|
case TYPE::V_AM: return vam;
|
|
|
|
case TYPE::I_AM: return iam;
|
|
|
|
case TYPE::V_SFFM: return vsffm;
|
|
|
|
case TYPE::I_SFFM: return isffm;
|
|
|
|
case TYPE::V_VCL: return vcvs;
|
|
|
|
case TYPE::V_CCL: return ccvs;
|
|
|
|
case TYPE::V_PWL: return vpwl;
|
|
|
|
case TYPE::I_VCL: return vccs;
|
|
|
|
case TYPE::I_CCL: return cccs;
|
|
|
|
case TYPE::I_PWL: return ipwl;
|
|
|
|
case TYPE::V_WHITENOISE: return vwhitenoise;
|
|
|
|
case TYPE::I_WHITENOISE: return iwhitenoise;
|
|
|
|
case TYPE::V_PINKNOISE: return vpinknoise;
|
|
|
|
case TYPE::I_PINKNOISE: return ipinknoise;
|
|
|
|
case TYPE::V_BURSTNOISE: return vburstnoise;
|
|
|
|
case TYPE::I_BURSTNOISE: return iburstnoise;
|
|
|
|
case TYPE::V_RANDUNIFORM: return vrandomuniform;
|
|
|
|
case TYPE::I_RANDUNIFORM: return irandomuniform;
|
|
|
|
case TYPE::V_RANDGAUSSIAN: return vrandomnormal;
|
|
|
|
case TYPE::I_RANDGAUSSIAN: return irandomnormal;
|
|
|
|
case TYPE::V_RANDEXP: return vrandomexp;
|
|
|
|
case TYPE::I_RANDEXP: return irandomexp;
|
|
|
|
case TYPE::V_RANDPOISSON: return vrandompoisson;
|
|
|
|
case TYPE::I_RANDPOISSON: return irandompoisson;
|
2022-06-21 02:22:52 +00:00
|
|
|
default:
|
|
|
|
wxFAIL_MSG( "Unhandled SIM_MODEL type in SIM_MODEL_SOURCE" );
|
2022-08-28 12:51:03 +00:00
|
|
|
static std::vector<SIM_MODEL::PARAM::INFO> empty;
|
2022-06-21 02:22:52 +00:00
|
|
|
return empty;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2023-05-21 10:23:56 +00:00
|
|
|
std::vector<SIM_MODEL::PARAM::INFO> SIM_MODEL_SOURCE::makeDcParamInfos( const std::string& aPrefix,
|
|
|
|
const std::string& aUnit )
|
2022-04-12 14:37:06 +00:00
|
|
|
{
|
|
|
|
std::vector<PARAM::INFO> paramInfos;
|
|
|
|
PARAM::INFO paramInfo;
|
|
|
|
|
|
|
|
paramInfo.name = "dc";
|
2022-06-21 02:22:52 +00:00
|
|
|
paramInfo.type = SIM_VALUE::TYPE_FLOAT;
|
2022-04-12 14:37:06 +00:00
|
|
|
paramInfo.unit = aUnit;
|
|
|
|
paramInfo.category = SIM_MODEL::PARAM::CATEGORY::PRINCIPAL;
|
|
|
|
paramInfo.defaultValue = "0";
|
|
|
|
paramInfo.description = "DC value";
|
|
|
|
paramInfos.push_back( paramInfo );
|
|
|
|
|
2022-06-12 03:39:13 +00:00
|
|
|
appendAcParamInfos( paramInfos, aUnit );
|
2023-07-04 16:01:12 +00:00
|
|
|
appendSpParamInfos( paramInfos, aUnit );
|
2022-04-12 14:37:06 +00:00
|
|
|
return paramInfos;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2023-05-21 10:23:56 +00:00
|
|
|
std::vector<SIM_MODEL::PARAM::INFO> SIM_MODEL_SOURCE::makeSinParamInfos( const std::string& aPrefix,
|
|
|
|
const std::string& aUnit )
|
2022-04-12 14:37:06 +00:00
|
|
|
{
|
|
|
|
std::vector<PARAM::INFO> paramInfos;
|
|
|
|
PARAM::INFO paramInfo;
|
|
|
|
|
|
|
|
paramInfo.name = "dc";
|
2022-06-21 02:22:52 +00:00
|
|
|
paramInfo.type = SIM_VALUE::TYPE_FLOAT;
|
2022-04-12 14:37:06 +00:00
|
|
|
paramInfo.unit = aUnit;
|
|
|
|
paramInfo.category = SIM_MODEL::PARAM::CATEGORY::PRINCIPAL;
|
|
|
|
paramInfo.defaultValue = "";
|
|
|
|
paramInfo.description = "DC offset";
|
|
|
|
paramInfos.push_back( paramInfo );
|
|
|
|
|
|
|
|
paramInfo.name = "ampl";
|
2022-06-21 02:22:52 +00:00
|
|
|
paramInfo.type = SIM_VALUE::TYPE_FLOAT;
|
2022-04-12 14:37:06 +00:00
|
|
|
paramInfo.unit = aUnit;
|
|
|
|
paramInfo.category = SIM_MODEL::PARAM::CATEGORY::PRINCIPAL;
|
|
|
|
paramInfo.defaultValue = "";
|
|
|
|
paramInfo.description = "Amplitude";
|
|
|
|
paramInfos.push_back( paramInfo );
|
|
|
|
|
|
|
|
paramInfo.name = "f";
|
2022-06-21 02:22:52 +00:00
|
|
|
paramInfo.type = SIM_VALUE::TYPE_FLOAT;
|
2022-04-12 14:37:06 +00:00
|
|
|
paramInfo.unit = "Hz";
|
|
|
|
paramInfo.category = SIM_MODEL::PARAM::CATEGORY::PRINCIPAL;
|
|
|
|
paramInfo.defaultValue = "1/tstop";
|
|
|
|
paramInfo.description = "Frequency";
|
|
|
|
paramInfos.push_back( paramInfo );
|
|
|
|
|
|
|
|
paramInfo.name = "td";
|
2022-06-21 02:22:52 +00:00
|
|
|
paramInfo.type = SIM_VALUE::TYPE_FLOAT;
|
2022-04-12 14:37:06 +00:00
|
|
|
paramInfo.unit = "s";
|
|
|
|
paramInfo.category = SIM_MODEL::PARAM::CATEGORY::PRINCIPAL;
|
|
|
|
paramInfo.defaultValue = "0";
|
|
|
|
paramInfo.description = "Delay";
|
|
|
|
paramInfos.push_back( paramInfo );
|
|
|
|
|
|
|
|
paramInfo.name = "theta";
|
2022-06-21 02:22:52 +00:00
|
|
|
paramInfo.type = SIM_VALUE::TYPE_FLOAT;
|
2022-04-12 14:37:06 +00:00
|
|
|
paramInfo.unit = "1/s";
|
|
|
|
paramInfo.category = SIM_MODEL::PARAM::CATEGORY::PRINCIPAL;
|
|
|
|
paramInfo.defaultValue = "0";
|
|
|
|
paramInfo.description = "Damping factor";
|
|
|
|
paramInfos.push_back( paramInfo );
|
|
|
|
|
2023-02-18 00:38:46 +00:00
|
|
|
paramInfo.name = "phase";
|
2022-06-21 02:22:52 +00:00
|
|
|
paramInfo.type = SIM_VALUE::TYPE_FLOAT;
|
2022-06-12 03:39:13 +00:00
|
|
|
paramInfo.unit = "°";
|
2022-04-12 14:37:06 +00:00
|
|
|
paramInfo.category = SIM_MODEL::PARAM::CATEGORY::PRINCIPAL;
|
|
|
|
paramInfo.defaultValue = "0";
|
|
|
|
paramInfo.description = "Phase";
|
2023-02-18 00:38:46 +00:00
|
|
|
paramInfos.push_back( paramInfo );
|
2022-04-12 14:37:06 +00:00
|
|
|
|
2022-06-12 03:39:13 +00:00
|
|
|
appendAcParamInfos( paramInfos, aUnit );
|
2023-07-04 16:01:12 +00:00
|
|
|
appendSpParamInfos( paramInfos, aUnit );
|
2022-04-12 14:37:06 +00:00
|
|
|
return paramInfos;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2023-05-21 10:23:56 +00:00
|
|
|
std::vector<SIM_MODEL::PARAM::INFO> SIM_MODEL_SOURCE::makePulseParamInfos( const std::string& aPrefix,
|
|
|
|
const std::string& aUnit )
|
2022-02-21 03:58:31 +00:00
|
|
|
{
|
|
|
|
std::vector<PARAM::INFO> paramInfos;
|
|
|
|
PARAM::INFO paramInfo;
|
|
|
|
|
|
|
|
paramInfo.name = aPrefix + "1";
|
2022-06-21 02:22:52 +00:00
|
|
|
paramInfo.type = SIM_VALUE::TYPE_FLOAT;
|
2022-02-21 03:58:31 +00:00
|
|
|
paramInfo.unit = aUnit;
|
|
|
|
paramInfo.category = PARAM::CATEGORY::PRINCIPAL;
|
|
|
|
paramInfo.defaultValue = "";
|
|
|
|
paramInfo.description = "Initial value";
|
|
|
|
paramInfos.push_back( paramInfo );
|
|
|
|
|
|
|
|
paramInfo.name = aPrefix + "2";
|
2022-06-21 02:22:52 +00:00
|
|
|
paramInfo.type = SIM_VALUE::TYPE_FLOAT;
|
2022-02-21 03:58:31 +00:00
|
|
|
paramInfo.unit = aUnit;
|
|
|
|
paramInfo.category = PARAM::CATEGORY::PRINCIPAL;
|
|
|
|
paramInfo.defaultValue = "";
|
2022-11-11 04:19:53 +00:00
|
|
|
paramInfo.description = "Pulsed value";
|
2022-02-21 03:58:31 +00:00
|
|
|
paramInfos.push_back( paramInfo );
|
|
|
|
|
|
|
|
paramInfo.name = "td";
|
2022-06-21 02:22:52 +00:00
|
|
|
paramInfo.type = SIM_VALUE::TYPE_FLOAT;
|
2022-02-21 03:58:31 +00:00
|
|
|
paramInfo.unit = "s";
|
|
|
|
paramInfo.category = PARAM::CATEGORY::PRINCIPAL;
|
|
|
|
paramInfo.defaultValue = "0";
|
|
|
|
paramInfo.description = "Delay";
|
|
|
|
paramInfos.push_back( paramInfo );
|
|
|
|
|
|
|
|
paramInfo.name = "tr";
|
2022-06-21 02:22:52 +00:00
|
|
|
paramInfo.type = SIM_VALUE::TYPE_FLOAT;
|
2022-02-21 03:58:31 +00:00
|
|
|
paramInfo.unit = "s";
|
|
|
|
paramInfo.category = PARAM::CATEGORY::PRINCIPAL;
|
|
|
|
paramInfo.defaultValue = "tstep";
|
|
|
|
paramInfo.description = "Rise time";
|
|
|
|
paramInfos.push_back( paramInfo );
|
|
|
|
|
|
|
|
paramInfo.name = "tf";
|
2022-06-21 02:22:52 +00:00
|
|
|
paramInfo.type = SIM_VALUE::TYPE_FLOAT;
|
2022-02-21 03:58:31 +00:00
|
|
|
paramInfo.unit = "s";
|
|
|
|
paramInfo.category = PARAM::CATEGORY::PRINCIPAL;
|
|
|
|
paramInfo.defaultValue = "tstep";
|
|
|
|
paramInfo.description = "Fall time";
|
|
|
|
paramInfos.push_back( paramInfo );
|
|
|
|
|
2022-06-12 03:39:13 +00:00
|
|
|
paramInfo.name = "tw"; // Ngspice calls it "pw".
|
2022-06-21 02:22:52 +00:00
|
|
|
paramInfo.type = SIM_VALUE::TYPE_FLOAT;
|
2022-02-21 03:58:31 +00:00
|
|
|
paramInfo.unit = "s";
|
|
|
|
paramInfo.category = PARAM::CATEGORY::PRINCIPAL;
|
|
|
|
paramInfo.defaultValue = "tstop";
|
|
|
|
paramInfo.description = "Pulse width";
|
|
|
|
paramInfos.push_back( paramInfo );
|
|
|
|
|
|
|
|
paramInfo.name = "per";
|
2022-06-21 02:22:52 +00:00
|
|
|
paramInfo.type = SIM_VALUE::TYPE_FLOAT;
|
2022-02-21 03:58:31 +00:00
|
|
|
paramInfo.unit = "s";
|
|
|
|
paramInfo.category = PARAM::CATEGORY::PRINCIPAL;
|
|
|
|
paramInfo.defaultValue = "tstop";
|
|
|
|
paramInfo.description = "Period";
|
|
|
|
paramInfos.push_back( paramInfo );
|
|
|
|
|
2023-01-06 13:44:45 +00:00
|
|
|
paramInfo.name = "np";
|
|
|
|
paramInfo.type = SIM_VALUE::TYPE_INT;
|
|
|
|
paramInfo.unit = "";
|
2022-02-21 03:58:31 +00:00
|
|
|
paramInfo.category = PARAM::CATEGORY::PRINCIPAL;
|
2023-01-06 13:44:45 +00:00
|
|
|
paramInfo.defaultValue = "";
|
|
|
|
paramInfo.description = "Number of pulses";
|
|
|
|
paramInfos.push_back( paramInfo );
|
2022-02-21 03:58:31 +00:00
|
|
|
|
2022-06-12 03:39:13 +00:00
|
|
|
appendAcParamInfos( paramInfos, aUnit );
|
2023-07-04 16:01:12 +00:00
|
|
|
appendSpParamInfos( paramInfos, aUnit );
|
2022-02-21 03:58:31 +00:00
|
|
|
return paramInfos;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2023-05-21 10:23:56 +00:00
|
|
|
std::vector<SIM_MODEL::PARAM::INFO> SIM_MODEL_SOURCE::makeExpParamInfos( const std::string& aPrefix,
|
|
|
|
const std::string& aUnit )
|
2022-02-21 03:58:31 +00:00
|
|
|
{
|
|
|
|
std::vector<PARAM::INFO> paramInfos;
|
|
|
|
PARAM::INFO paramInfo;
|
|
|
|
|
|
|
|
paramInfo.name = aPrefix + "1";
|
2022-06-21 02:22:52 +00:00
|
|
|
paramInfo.type = SIM_VALUE::TYPE_FLOAT;
|
2022-02-21 03:58:31 +00:00
|
|
|
paramInfo.unit = aUnit;
|
|
|
|
paramInfo.category = SIM_MODEL::PARAM::CATEGORY::PRINCIPAL;
|
|
|
|
paramInfo.defaultValue = "";
|
|
|
|
paramInfo.description = "Initial value";
|
|
|
|
paramInfos.push_back( paramInfo );
|
|
|
|
|
|
|
|
paramInfo.name = aPrefix + "2";
|
2022-06-21 02:22:52 +00:00
|
|
|
paramInfo.type = SIM_VALUE::TYPE_FLOAT;
|
2022-02-21 03:58:31 +00:00
|
|
|
paramInfo.unit = aUnit;
|
|
|
|
paramInfo.category = SIM_MODEL::PARAM::CATEGORY::PRINCIPAL;
|
|
|
|
paramInfo.defaultValue = "";
|
|
|
|
paramInfo.description = "Pulsed value";
|
|
|
|
paramInfos.push_back( paramInfo );
|
|
|
|
|
|
|
|
paramInfo.name = "td1";
|
2022-06-21 02:22:52 +00:00
|
|
|
paramInfo.type = SIM_VALUE::TYPE_FLOAT;
|
2022-02-21 03:58:31 +00:00
|
|
|
paramInfo.unit = "s";
|
|
|
|
paramInfo.category = SIM_MODEL::PARAM::CATEGORY::PRINCIPAL;
|
|
|
|
paramInfo.defaultValue = "0";
|
|
|
|
paramInfo.description = "Rise delay time";
|
|
|
|
paramInfos.push_back( paramInfo );
|
|
|
|
|
|
|
|
paramInfo.name = "tau1";
|
2022-06-21 02:22:52 +00:00
|
|
|
paramInfo.type = SIM_VALUE::TYPE_FLOAT;
|
2022-02-21 03:58:31 +00:00
|
|
|
paramInfo.unit = "s";
|
|
|
|
paramInfo.category = SIM_MODEL::PARAM::CATEGORY::PRINCIPAL;
|
|
|
|
paramInfo.defaultValue = "tstep";
|
|
|
|
paramInfo.description = "Rise time constant";
|
|
|
|
paramInfos.push_back( paramInfo );
|
|
|
|
|
|
|
|
paramInfo.name = "td2";
|
2022-06-21 02:22:52 +00:00
|
|
|
paramInfo.type = SIM_VALUE::TYPE_FLOAT;
|
2022-02-21 03:58:31 +00:00
|
|
|
paramInfo.unit = "s";
|
|
|
|
paramInfo.category = SIM_MODEL::PARAM::CATEGORY::PRINCIPAL;
|
|
|
|
paramInfo.defaultValue = "td1+tstep";
|
|
|
|
paramInfo.description = "Fall delay time";
|
|
|
|
paramInfos.push_back( paramInfo );
|
|
|
|
|
|
|
|
paramInfo.name = "tau2";
|
2022-06-21 02:22:52 +00:00
|
|
|
paramInfo.type = SIM_VALUE::TYPE_FLOAT;
|
2022-02-21 03:58:31 +00:00
|
|
|
paramInfo.unit = "s";
|
|
|
|
paramInfo.category = SIM_MODEL::PARAM::CATEGORY::PRINCIPAL;
|
|
|
|
paramInfo.defaultValue = "tstep";
|
|
|
|
paramInfo.description = "Fall time constant";
|
|
|
|
paramInfos.push_back( paramInfo );
|
|
|
|
|
2022-06-12 03:39:13 +00:00
|
|
|
appendAcParamInfos( paramInfos, aUnit );
|
2023-07-04 16:01:12 +00:00
|
|
|
appendSpParamInfos( paramInfos, aUnit );
|
2022-02-21 03:58:31 +00:00
|
|
|
return paramInfos;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2024-01-06 14:48:20 +00:00
|
|
|
std::vector<SIM_MODEL::PARAM::INFO> SIM_MODEL_SOURCE::makeAMParamInfos( const std::string& aPrefix,
|
|
|
|
const std::string& aUnit )
|
2022-02-21 03:58:31 +00:00
|
|
|
{
|
|
|
|
std::vector<PARAM::INFO> paramInfos;
|
|
|
|
PARAM::INFO paramInfo;
|
|
|
|
|
2024-01-10 20:27:30 +00:00
|
|
|
paramInfo.name = "vo";
|
2022-06-21 02:22:52 +00:00
|
|
|
paramInfo.type = SIM_VALUE::TYPE_FLOAT;
|
2022-02-21 03:58:31 +00:00
|
|
|
paramInfo.unit = aUnit;
|
|
|
|
paramInfo.category = SIM_MODEL::PARAM::CATEGORY::PRINCIPAL;
|
|
|
|
paramInfo.defaultValue = "";
|
2024-01-10 20:27:30 +00:00
|
|
|
paramInfo.description = "Overall offset";
|
2022-02-21 03:58:31 +00:00
|
|
|
paramInfos.push_back( paramInfo );
|
2024-01-06 14:48:20 +00:00
|
|
|
|
2024-01-10 20:27:30 +00:00
|
|
|
paramInfo.name = "vmo";
|
2022-06-21 02:22:52 +00:00
|
|
|
paramInfo.type = SIM_VALUE::TYPE_FLOAT;
|
2024-01-06 14:48:20 +00:00
|
|
|
paramInfo.unit = aUnit;
|
2022-02-21 03:58:31 +00:00
|
|
|
paramInfo.category = SIM_MODEL::PARAM::CATEGORY::PRINCIPAL;
|
|
|
|
paramInfo.defaultValue = "";
|
2024-01-10 20:27:30 +00:00
|
|
|
paramInfo.description = "Modulation signal offset";
|
2022-02-21 03:58:31 +00:00
|
|
|
paramInfos.push_back( paramInfo );
|
|
|
|
|
2024-01-10 20:27:30 +00:00
|
|
|
paramInfo.name = "vma";
|
2022-06-21 02:22:52 +00:00
|
|
|
paramInfo.type = SIM_VALUE::TYPE_FLOAT;
|
2024-01-10 20:27:30 +00:00
|
|
|
paramInfo.unit = aUnit;
|
2022-02-21 03:58:31 +00:00
|
|
|
paramInfo.category = SIM_MODEL::PARAM::CATEGORY::PRINCIPAL;
|
|
|
|
paramInfo.defaultValue = "";
|
2024-01-10 20:27:30 +00:00
|
|
|
paramInfo.description = "Modulation signal amplitude";
|
2022-02-21 03:58:31 +00:00
|
|
|
paramInfos.push_back( paramInfo );
|
|
|
|
|
2024-01-10 20:27:30 +00:00
|
|
|
paramInfo.name = "fm";
|
2024-01-06 18:00:50 +00:00
|
|
|
paramInfo.type = SIM_VALUE::TYPE_FLOAT;
|
2024-01-10 20:27:30 +00:00
|
|
|
paramInfo.unit = "Hz";
|
2024-01-06 18:00:50 +00:00
|
|
|
paramInfo.category = SIM_MODEL::PARAM::CATEGORY::PRINCIPAL;
|
2024-01-10 20:27:30 +00:00
|
|
|
paramInfo.defaultValue = "5/tstop";
|
|
|
|
paramInfo.description = "Modulation signal frequency";
|
2024-01-06 18:00:50 +00:00
|
|
|
paramInfos.push_back( paramInfo );
|
|
|
|
|
2024-01-06 14:48:20 +00:00
|
|
|
paramInfo.name = "fc";
|
2022-06-21 02:22:52 +00:00
|
|
|
paramInfo.type = SIM_VALUE::TYPE_FLOAT;
|
2022-02-21 03:58:31 +00:00
|
|
|
paramInfo.unit = "Hz";
|
|
|
|
paramInfo.category = SIM_MODEL::PARAM::CATEGORY::PRINCIPAL;
|
2024-01-10 20:27:30 +00:00
|
|
|
paramInfo.defaultValue = "500/tstop";
|
|
|
|
paramInfo.description = "Carrier signal frequency";
|
2022-02-21 03:58:31 +00:00
|
|
|
paramInfos.push_back( paramInfo );
|
|
|
|
|
2024-01-06 18:00:50 +00:00
|
|
|
paramInfo.name = "td";
|
|
|
|
paramInfo.type = SIM_VALUE::TYPE_FLOAT;
|
|
|
|
paramInfo.unit = "s";
|
|
|
|
paramInfo.category = SIM_MODEL::PARAM::CATEGORY::PRINCIPAL;
|
|
|
|
paramInfo.defaultValue = "0";
|
2024-01-10 20:27:30 +00:00
|
|
|
paramInfo.description = "Overall delay";
|
2024-01-06 18:00:50 +00:00
|
|
|
paramInfos.push_back( paramInfo );
|
|
|
|
|
2024-01-10 20:27:30 +00:00
|
|
|
paramInfo.name = "phasem";
|
2024-01-06 18:00:50 +00:00
|
|
|
paramInfo.type = SIM_VALUE::TYPE_FLOAT;
|
|
|
|
paramInfo.unit = "°";
|
|
|
|
paramInfo.category = SIM_MODEL::PARAM::CATEGORY::PRINCIPAL;
|
|
|
|
paramInfo.defaultValue = "0";
|
|
|
|
paramInfo.description = "Modulation signal phase";
|
|
|
|
paramInfos.push_back( paramInfo );
|
|
|
|
|
|
|
|
paramInfo.name = "phasec";
|
|
|
|
paramInfo.type = SIM_VALUE::TYPE_FLOAT;
|
|
|
|
paramInfo.unit = "°";
|
|
|
|
paramInfo.category = SIM_MODEL::PARAM::CATEGORY::PRINCIPAL;
|
|
|
|
paramInfo.defaultValue = "0";
|
|
|
|
paramInfo.description = "Carrier signal phase";
|
|
|
|
paramInfos.push_back( paramInfo );
|
|
|
|
|
|
|
|
appendAcParamInfos( paramInfos, aUnit );
|
|
|
|
appendSpParamInfos( paramInfos, aUnit );
|
2022-02-21 03:58:31 +00:00
|
|
|
return paramInfos;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2024-01-06 14:48:20 +00:00
|
|
|
std::vector<SIM_MODEL::PARAM::INFO> SIM_MODEL_SOURCE::makeSFFMParamInfos( const std::string& aPrefix,
|
|
|
|
const std::string& aUnit )
|
2022-02-21 03:58:31 +00:00
|
|
|
{
|
|
|
|
std::vector<PARAM::INFO> paramInfos;
|
|
|
|
PARAM::INFO paramInfo;
|
|
|
|
|
2024-01-06 14:48:20 +00:00
|
|
|
paramInfo.name = "vo";
|
2022-06-21 02:22:52 +00:00
|
|
|
paramInfo.type = SIM_VALUE::TYPE_FLOAT;
|
2022-02-21 03:58:31 +00:00
|
|
|
paramInfo.unit = aUnit;
|
|
|
|
paramInfo.category = SIM_MODEL::PARAM::CATEGORY::PRINCIPAL;
|
|
|
|
paramInfo.defaultValue = "";
|
|
|
|
paramInfo.description = "DC offset";
|
|
|
|
paramInfos.push_back( paramInfo );
|
|
|
|
|
2024-01-06 14:48:20 +00:00
|
|
|
paramInfo.name = "va";
|
2022-06-21 02:22:52 +00:00
|
|
|
paramInfo.type = SIM_VALUE::TYPE_FLOAT;
|
2022-02-21 03:58:31 +00:00
|
|
|
paramInfo.unit = aUnit;
|
|
|
|
paramInfo.category = SIM_MODEL::PARAM::CATEGORY::PRINCIPAL;
|
|
|
|
paramInfo.defaultValue = "";
|
|
|
|
paramInfo.description = "Amplitude";
|
|
|
|
paramInfos.push_back( paramInfo );
|
|
|
|
|
2024-01-10 20:27:30 +00:00
|
|
|
paramInfo.name = "fm";
|
2022-06-21 02:22:52 +00:00
|
|
|
paramInfo.type = SIM_VALUE::TYPE_FLOAT;
|
2022-02-21 03:58:31 +00:00
|
|
|
paramInfo.unit = "Hz";
|
|
|
|
paramInfo.category = SIM_MODEL::PARAM::CATEGORY::PRINCIPAL;
|
2024-01-10 20:27:30 +00:00
|
|
|
paramInfo.defaultValue = "5/tstop";
|
|
|
|
paramInfo.description = "Modulating frequency";
|
2022-02-21 03:58:31 +00:00
|
|
|
paramInfos.push_back( paramInfo );
|
|
|
|
|
|
|
|
paramInfo.name = "mdi";
|
2022-06-21 02:22:52 +00:00
|
|
|
paramInfo.type = SIM_VALUE::TYPE_FLOAT;
|
2022-02-21 03:58:31 +00:00
|
|
|
paramInfo.unit = "";
|
|
|
|
paramInfo.category = SIM_MODEL::PARAM::CATEGORY::PRINCIPAL;
|
|
|
|
paramInfo.defaultValue = "";
|
|
|
|
paramInfo.description = "Modulation index";
|
|
|
|
paramInfos.push_back( paramInfo );
|
|
|
|
|
2024-01-10 20:27:30 +00:00
|
|
|
paramInfo.name = "fc";
|
2022-06-21 02:22:52 +00:00
|
|
|
paramInfo.type = SIM_VALUE::TYPE_FLOAT;
|
2022-02-21 03:58:31 +00:00
|
|
|
paramInfo.unit = "Hz";
|
|
|
|
paramInfo.category = SIM_MODEL::PARAM::CATEGORY::PRINCIPAL;
|
2024-01-10 20:27:30 +00:00
|
|
|
paramInfo.defaultValue = "500/tstop";
|
|
|
|
paramInfo.description = "Carrier frequency";
|
2022-02-21 03:58:31 +00:00
|
|
|
paramInfos.push_back( paramInfo );
|
|
|
|
|
2024-01-10 20:27:30 +00:00
|
|
|
paramInfo.name = "phasem";
|
2022-06-21 02:22:52 +00:00
|
|
|
paramInfo.type = SIM_VALUE::TYPE_FLOAT;
|
2022-06-12 03:39:13 +00:00
|
|
|
paramInfo.unit = "°";
|
2022-02-21 03:58:31 +00:00
|
|
|
paramInfo.category = SIM_MODEL::PARAM::CATEGORY::PRINCIPAL;
|
|
|
|
paramInfo.defaultValue = "0";
|
2024-01-10 20:27:30 +00:00
|
|
|
paramInfo.description = "Modulating signal phase";
|
2022-02-21 03:58:31 +00:00
|
|
|
paramInfos.push_back( paramInfo );
|
|
|
|
|
2024-01-10 20:27:30 +00:00
|
|
|
paramInfo.name = "phasec";
|
2022-06-21 02:22:52 +00:00
|
|
|
paramInfo.type = SIM_VALUE::TYPE_FLOAT;
|
2022-06-12 03:39:13 +00:00
|
|
|
paramInfo.unit = "°";
|
2022-02-21 03:58:31 +00:00
|
|
|
paramInfo.category = SIM_MODEL::PARAM::CATEGORY::PRINCIPAL;
|
|
|
|
paramInfo.defaultValue = "0";
|
2024-01-10 20:27:30 +00:00
|
|
|
paramInfo.description = "Carrier signal phase";
|
2022-02-21 03:58:31 +00:00
|
|
|
paramInfos.push_back( paramInfo );
|
|
|
|
|
2024-01-06 18:00:50 +00:00
|
|
|
appendAcParamInfos( paramInfos, aUnit );
|
|
|
|
appendSpParamInfos( paramInfos, aUnit );
|
2022-02-21 03:58:31 +00:00
|
|
|
return paramInfos;
|
2024-01-06 14:48:20 +00:00
|
|
|
}
|
2022-02-21 03:58:31 +00:00
|
|
|
|
|
|
|
|
2023-05-21 10:23:56 +00:00
|
|
|
std::vector<SIM_MODEL::PARAM::INFO> SIM_MODEL_SOURCE::makeCcParamInfos( const std::string& aGainUnit )
|
2023-05-20 19:58:13 +00:00
|
|
|
{
|
|
|
|
std::vector<PARAM::INFO> paramInfos;
|
|
|
|
PARAM::INFO paramInfo;
|
|
|
|
|
|
|
|
paramInfo.name = "gain";
|
|
|
|
paramInfo.id = 1;
|
|
|
|
paramInfo.type = SIM_VALUE::TYPE_FLOAT;
|
|
|
|
paramInfo.unit = aGainUnit;
|
|
|
|
paramInfo.description = "Gain";
|
|
|
|
paramInfos.push_back( paramInfo );
|
|
|
|
|
|
|
|
paramInfo.name = "control";
|
|
|
|
paramInfo.id = 2;
|
|
|
|
paramInfo.type = SIM_VALUE::TYPE_STRING;
|
2024-02-24 22:34:23 +00:00
|
|
|
paramInfo.unit = "";
|
2023-05-20 19:58:13 +00:00
|
|
|
paramInfo.description = "Controlling voltage source";
|
|
|
|
paramInfos.push_back( paramInfo );
|
|
|
|
|
|
|
|
return paramInfos;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2023-05-21 10:23:56 +00:00
|
|
|
std::vector<SIM_MODEL::PARAM::INFO> SIM_MODEL_SOURCE::makeVcParamInfos( const std::string& aGainUnit )
|
2023-05-20 19:58:13 +00:00
|
|
|
{
|
|
|
|
std::vector<PARAM::INFO> paramInfos;
|
|
|
|
PARAM::INFO paramInfo;
|
|
|
|
|
|
|
|
paramInfo.name = "gain";
|
|
|
|
paramInfo.id = 1;
|
|
|
|
paramInfo.type = SIM_VALUE::TYPE_FLOAT;
|
|
|
|
paramInfo.unit = aGainUnit;
|
|
|
|
paramInfo.description = "Gain";
|
|
|
|
paramInfos.push_back( paramInfo );
|
|
|
|
|
|
|
|
return paramInfos;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2023-05-21 10:23:56 +00:00
|
|
|
std::vector<SIM_MODEL::PARAM::INFO> SIM_MODEL_SOURCE::makePwlParamInfos( const std::string& aPrefix,
|
|
|
|
const std::string& aQuantity,
|
|
|
|
const std::string& aUnit )
|
2022-02-21 03:58:31 +00:00
|
|
|
{
|
|
|
|
std::vector<PARAM::INFO> paramInfos;
|
|
|
|
PARAM::INFO paramInfo;
|
|
|
|
|
2022-06-21 02:22:52 +00:00
|
|
|
paramInfo.name = "pwl";
|
|
|
|
paramInfo.type = SIM_VALUE::TYPE_STRING;
|
|
|
|
paramInfo.unit = "s," + aUnit;
|
|
|
|
paramInfo.category = SIM_MODEL::PARAM::CATEGORY::PRINCIPAL;
|
|
|
|
paramInfo.defaultValue = "";
|
|
|
|
paramInfo.description = aUnit == "V" ? "Time-voltage points" : "Time-current points";
|
|
|
|
paramInfos.push_back( paramInfo );
|
|
|
|
|
|
|
|
// TODO: Ngspice doesn't support "td" and "r" for current sources, so let's disable that for
|
|
|
|
// now.
|
|
|
|
|
|
|
|
/*paramInfo.name = "td";
|
|
|
|
paramInfo.type = SIM_VALUE::TYPE_FLOAT;
|
|
|
|
paramInfo.unit = "s";
|
|
|
|
paramInfo.category = SIM_MODEL::PARAM::CATEGORY::PRINCIPAL;
|
|
|
|
paramInfo.defaultValue = "0";
|
|
|
|
paramInfo.description = aUnit == "V" ? "Time-voltage points" : "Time-current points";
|
|
|
|
paramInfo.isSpiceInstanceParam = true;
|
|
|
|
paramInfos.push_back( paramInfo );
|
|
|
|
|
|
|
|
paramInfo.name = "repeat";
|
|
|
|
paramInfo.type = SIM_VALUE::TYPE_BOOL;
|
|
|
|
paramInfo.unit = "";
|
|
|
|
paramInfo.category = SIM_MODEL::PARAM::CATEGORY::PRINCIPAL;
|
|
|
|
paramInfo.defaultValue = "0";
|
|
|
|
paramInfo.description = "Repeat forever";
|
|
|
|
paramInfo.isSpiceInstanceParam = true;
|
|
|
|
paramInfo.spiceInstanceName = "r";
|
|
|
|
paramInfos.push_back( paramInfo );*/
|
|
|
|
|
|
|
|
/*paramInfo.name = "t";
|
|
|
|
paramInfo.type = SIM_VALUE::TYPE_FLOAT_VECTOR;
|
2022-02-21 03:58:31 +00:00
|
|
|
paramInfo.unit = "s";
|
|
|
|
paramInfo.category = SIM_MODEL::PARAM::CATEGORY::PRINCIPAL;
|
|
|
|
paramInfo.defaultValue = "";
|
|
|
|
paramInfo.description = "Time vector";
|
|
|
|
paramInfos.push_back( paramInfo );
|
|
|
|
|
|
|
|
paramInfo.name = aPrefix;
|
2022-06-21 02:22:52 +00:00
|
|
|
paramInfo.type = SIM_VALUE::TYPE_FLOAT_VECTOR;
|
2022-02-21 03:58:31 +00:00
|
|
|
paramInfo.unit = aUnit;
|
|
|
|
paramInfo.category = SIM_MODEL::PARAM::CATEGORY::PRINCIPAL;
|
|
|
|
paramInfo.defaultValue = "";
|
|
|
|
paramInfo.description = aQuantity + " vector";
|
|
|
|
paramInfos.push_back( paramInfo );
|
|
|
|
|
|
|
|
paramInfo.name = "repeat";
|
2022-06-21 02:22:52 +00:00
|
|
|
paramInfo.type = SIM_VALUE::TYPE_BOOL;
|
2022-02-21 03:58:31 +00:00
|
|
|
paramInfo.unit = "";
|
|
|
|
paramInfo.category = SIM_MODEL::PARAM::CATEGORY::PRINCIPAL;
|
|
|
|
paramInfo.defaultValue = "";
|
|
|
|
paramInfo.description = "Repeat forever";
|
|
|
|
paramInfos.push_back( paramInfo );
|
|
|
|
|
|
|
|
paramInfo.name = "td";
|
2022-06-21 02:22:52 +00:00
|
|
|
paramInfo.type = SIM_VALUE::TYPE_FLOAT;
|
2022-02-21 03:58:31 +00:00
|
|
|
paramInfo.unit = "s";
|
|
|
|
paramInfo.category = SIM_MODEL::PARAM::CATEGORY::PRINCIPAL;
|
|
|
|
paramInfo.defaultValue = "0";
|
|
|
|
paramInfo.description = "Delay";
|
2022-06-21 02:22:52 +00:00
|
|
|
paramInfos.push_back( paramInfo );*/
|
2022-02-21 03:58:31 +00:00
|
|
|
|
2022-06-12 03:39:13 +00:00
|
|
|
appendAcParamInfos( paramInfos, aUnit );
|
2023-07-04 16:01:12 +00:00
|
|
|
appendSpParamInfos( paramInfos, aUnit );
|
2022-02-21 03:58:31 +00:00
|
|
|
return paramInfos;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2023-05-21 10:23:56 +00:00
|
|
|
std::vector<SIM_MODEL::PARAM::INFO> SIM_MODEL_SOURCE::makeWhiteNoiseParamInfos( const std::string& aPrefix,
|
|
|
|
const std::string& aUnit )
|
2022-02-21 03:58:31 +00:00
|
|
|
{
|
|
|
|
std::vector<PARAM::INFO> paramInfos;
|
|
|
|
PARAM::INFO paramInfo;
|
|
|
|
|
2022-06-21 02:22:52 +00:00
|
|
|
paramInfo.name = "rms";
|
|
|
|
paramInfo.type = SIM_VALUE::TYPE_FLOAT;
|
2022-02-21 03:58:31 +00:00
|
|
|
paramInfo.unit = aUnit;
|
|
|
|
paramInfo.category = SIM_MODEL::PARAM::CATEGORY::PRINCIPAL;
|
|
|
|
paramInfo.defaultValue = "0";
|
|
|
|
paramInfo.description = "White noise RMS amplitude";
|
|
|
|
paramInfos.push_back( paramInfo );
|
|
|
|
|
2022-06-21 02:22:52 +00:00
|
|
|
paramInfo.name = "dt";
|
|
|
|
paramInfo.type = SIM_VALUE::TYPE_FLOAT;
|
2022-03-09 01:40:59 +00:00
|
|
|
paramInfo.unit = "s";
|
2022-02-21 03:58:31 +00:00
|
|
|
paramInfo.category = SIM_MODEL::PARAM::CATEGORY::PRINCIPAL;
|
|
|
|
paramInfo.defaultValue = "0";
|
2022-03-09 01:40:59 +00:00
|
|
|
paramInfo.description = "Time step";
|
2022-02-21 03:58:31 +00:00
|
|
|
paramInfos.push_back( paramInfo );
|
|
|
|
|
2022-06-12 03:39:13 +00:00
|
|
|
appendAcParamInfos( paramInfos, aUnit );
|
2023-07-04 16:01:12 +00:00
|
|
|
appendSpParamInfos( paramInfos, aUnit );
|
2022-02-21 03:58:31 +00:00
|
|
|
return paramInfos;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2023-10-24 20:57:34 +00:00
|
|
|
std::vector<SIM_MODEL::PARAM::INFO> SIM_MODEL_SOURCE::makePinkNoiseParamInfos( const std::string& aPrefix,
|
2023-05-21 10:23:56 +00:00
|
|
|
const std::string& aUnit )
|
2022-02-21 03:58:31 +00:00
|
|
|
{
|
|
|
|
std::vector<PARAM::INFO> paramInfos;
|
|
|
|
PARAM::INFO paramInfo;
|
|
|
|
|
2022-06-21 02:22:52 +00:00
|
|
|
paramInfo.name = "rms";
|
|
|
|
paramInfo.type = SIM_VALUE::TYPE_FLOAT;
|
2022-02-21 03:58:31 +00:00
|
|
|
paramInfo.unit = "";
|
|
|
|
paramInfo.category = SIM_MODEL::PARAM::CATEGORY::PRINCIPAL;
|
|
|
|
paramInfo.defaultValue = "0";
|
2022-06-21 02:22:52 +00:00
|
|
|
paramInfo.description = "1/f noise RMS amplitude";
|
2022-02-21 03:58:31 +00:00
|
|
|
paramInfos.push_back( paramInfo );
|
|
|
|
|
2022-06-21 02:22:52 +00:00
|
|
|
paramInfo.name = "slope";
|
|
|
|
paramInfo.type = SIM_VALUE::TYPE_FLOAT;
|
2022-02-21 03:58:31 +00:00
|
|
|
paramInfo.unit = "";
|
|
|
|
paramInfo.category = SIM_MODEL::PARAM::CATEGORY::PRINCIPAL;
|
2022-06-21 02:22:52 +00:00
|
|
|
paramInfo.defaultValue = "1";
|
|
|
|
paramInfo.description = "1/f noise exponent";
|
2022-02-21 03:58:31 +00:00
|
|
|
paramInfos.push_back( paramInfo );
|
|
|
|
|
2022-06-21 02:22:52 +00:00
|
|
|
paramInfo.name = "dt";
|
|
|
|
paramInfo.type = SIM_VALUE::TYPE_FLOAT;
|
2022-02-21 03:58:31 +00:00
|
|
|
paramInfo.unit = "s";
|
|
|
|
paramInfo.category = SIM_MODEL::PARAM::CATEGORY::PRINCIPAL;
|
|
|
|
paramInfo.defaultValue = "0";
|
|
|
|
paramInfo.description = "Time step";
|
|
|
|
paramInfos.push_back( paramInfo );
|
|
|
|
|
2022-06-12 03:39:13 +00:00
|
|
|
appendAcParamInfos( paramInfos, aUnit );
|
2023-07-04 16:01:12 +00:00
|
|
|
appendSpParamInfos( paramInfos, aUnit );
|
2022-02-21 03:58:31 +00:00
|
|
|
return paramInfos;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2023-05-21 10:23:56 +00:00
|
|
|
std::vector<SIM_MODEL::PARAM::INFO> SIM_MODEL_SOURCE::makeBurstNoiseParamInfos( const std::string& aPrefix,
|
|
|
|
const std::string& aUnit )
|
2022-02-21 03:58:31 +00:00
|
|
|
{
|
|
|
|
std::vector<PARAM::INFO> paramInfos;
|
|
|
|
PARAM::INFO paramInfo;
|
|
|
|
|
2022-06-21 02:22:52 +00:00
|
|
|
paramInfo.name = "ampl";
|
|
|
|
paramInfo.type = SIM_VALUE::TYPE_FLOAT;
|
2022-03-09 01:40:59 +00:00
|
|
|
paramInfo.unit = aUnit;
|
|
|
|
paramInfo.category = SIM_MODEL::PARAM::CATEGORY::PRINCIPAL;
|
|
|
|
paramInfo.defaultValue = "0";
|
|
|
|
paramInfo.description = "Burst noise amplitude";
|
|
|
|
paramInfos.push_back( paramInfo );
|
|
|
|
|
2022-06-21 02:22:52 +00:00
|
|
|
paramInfo.name = "tcapt";
|
|
|
|
paramInfo.type = SIM_VALUE::TYPE_FLOAT;
|
2022-02-21 03:58:31 +00:00
|
|
|
paramInfo.unit = "s";
|
|
|
|
paramInfo.category = SIM_MODEL::PARAM::CATEGORY::PRINCIPAL;
|
|
|
|
paramInfo.defaultValue = "0";
|
|
|
|
paramInfo.description = "Burst noise trap capture time";
|
|
|
|
paramInfos.push_back( paramInfo );
|
|
|
|
|
2022-06-21 02:22:52 +00:00
|
|
|
paramInfo.name = "temit";
|
|
|
|
paramInfo.type = SIM_VALUE::TYPE_FLOAT;
|
2022-02-21 03:58:31 +00:00
|
|
|
paramInfo.unit = "s";
|
|
|
|
paramInfo.category = SIM_MODEL::PARAM::CATEGORY::PRINCIPAL;
|
|
|
|
paramInfo.defaultValue = "0";
|
|
|
|
paramInfo.description = "Burst noise trap emission time";
|
|
|
|
paramInfos.push_back( paramInfo );
|
|
|
|
|
2022-06-12 03:39:13 +00:00
|
|
|
appendAcParamInfos( paramInfos, aUnit );
|
2023-07-04 16:01:12 +00:00
|
|
|
appendSpParamInfos( paramInfos, aUnit );
|
2022-02-21 03:58:31 +00:00
|
|
|
return paramInfos;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2023-05-21 10:23:56 +00:00
|
|
|
std::vector<SIM_MODEL::PARAM::INFO> SIM_MODEL_SOURCE::makeRandomUniformParamInfos( const std::string& aPrefix,
|
|
|
|
const std::string& aUnit )
|
2022-02-21 03:58:31 +00:00
|
|
|
{
|
|
|
|
std::vector<PARAM::INFO> paramInfos;
|
|
|
|
PARAM::INFO paramInfo;
|
|
|
|
|
2024-01-06 18:00:50 +00:00
|
|
|
paramInfo.name = "ts";
|
2022-06-21 02:22:52 +00:00
|
|
|
paramInfo.type = SIM_VALUE::TYPE_FLOAT;
|
2024-01-06 18:00:50 +00:00
|
|
|
paramInfo.unit = "s";
|
2022-02-21 03:58:31 +00:00
|
|
|
paramInfo.category = SIM_MODEL::PARAM::CATEGORY::PRINCIPAL;
|
2024-01-06 18:00:50 +00:00
|
|
|
paramInfo.defaultValue = "";
|
|
|
|
paramInfo.description = "Individual voltage duration";
|
2022-02-21 03:58:31 +00:00
|
|
|
paramInfos.push_back( paramInfo );
|
|
|
|
|
2024-01-06 18:00:50 +00:00
|
|
|
paramInfo.name = "td";
|
2022-06-21 02:22:52 +00:00
|
|
|
paramInfo.type = SIM_VALUE::TYPE_FLOAT;
|
2024-01-06 18:00:50 +00:00
|
|
|
paramInfo.unit = "s";
|
2022-02-21 03:58:31 +00:00
|
|
|
paramInfo.category = SIM_MODEL::PARAM::CATEGORY::PRINCIPAL;
|
2024-01-06 18:00:50 +00:00
|
|
|
paramInfo.defaultValue = "0";
|
|
|
|
paramInfo.description = "Delay";
|
2022-02-21 03:58:31 +00:00
|
|
|
paramInfos.push_back( paramInfo );
|
|
|
|
|
2024-01-06 18:00:50 +00:00
|
|
|
paramInfo.name = "range";
|
2022-06-21 02:22:52 +00:00
|
|
|
paramInfo.type = SIM_VALUE::TYPE_FLOAT;
|
2024-01-06 18:00:50 +00:00
|
|
|
paramInfo.unit = aUnit;
|
2022-06-21 02:22:52 +00:00
|
|
|
paramInfo.category = SIM_MODEL::PARAM::CATEGORY::PRINCIPAL;
|
2024-01-06 18:00:50 +00:00
|
|
|
paramInfo.defaultValue = "1";
|
|
|
|
paramInfo.description = "Range";
|
2022-06-21 02:22:52 +00:00
|
|
|
paramInfos.push_back( paramInfo );
|
|
|
|
|
2024-01-06 18:00:50 +00:00
|
|
|
paramInfo.name = "offset";
|
2022-06-21 02:22:52 +00:00
|
|
|
paramInfo.type = SIM_VALUE::TYPE_FLOAT;
|
2024-01-06 18:00:50 +00:00
|
|
|
paramInfo.unit = aUnit;
|
2022-02-21 03:58:31 +00:00
|
|
|
paramInfo.category = SIM_MODEL::PARAM::CATEGORY::PRINCIPAL;
|
|
|
|
paramInfo.defaultValue = "0";
|
2024-01-06 18:00:50 +00:00
|
|
|
paramInfo.description = "Offset";
|
2022-02-21 03:58:31 +00:00
|
|
|
paramInfos.push_back( paramInfo );
|
|
|
|
|
2022-06-12 03:39:13 +00:00
|
|
|
appendAcParamInfos( paramInfos, aUnit );
|
2023-07-04 16:01:12 +00:00
|
|
|
appendSpParamInfos( paramInfos, aUnit );
|
2022-02-21 03:58:31 +00:00
|
|
|
return paramInfos;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2023-05-21 10:23:56 +00:00
|
|
|
std::vector<SIM_MODEL::PARAM::INFO> SIM_MODEL_SOURCE::makeRandomNormalParamInfos( const std::string& aPrefix,
|
|
|
|
const std::string& aUnit )
|
2022-02-21 03:58:31 +00:00
|
|
|
{
|
|
|
|
std::vector<PARAM::INFO> paramInfos;
|
|
|
|
PARAM::INFO paramInfo;
|
|
|
|
|
2024-01-06 18:00:50 +00:00
|
|
|
paramInfo.name = "ts";
|
2022-06-21 02:22:52 +00:00
|
|
|
paramInfo.type = SIM_VALUE::TYPE_FLOAT;
|
2024-01-06 18:00:50 +00:00
|
|
|
paramInfo.unit = "s";
|
|
|
|
paramInfo.category = SIM_MODEL::PARAM::CATEGORY::PRINCIPAL;
|
|
|
|
paramInfo.defaultValue = "";
|
|
|
|
paramInfo.description = "Individual voltage duration";
|
|
|
|
paramInfos.push_back( paramInfo );
|
|
|
|
|
|
|
|
paramInfo.name = "td";
|
|
|
|
paramInfo.type = SIM_VALUE::TYPE_FLOAT;
|
|
|
|
paramInfo.unit = "s";
|
2022-02-21 03:58:31 +00:00
|
|
|
paramInfo.category = SIM_MODEL::PARAM::CATEGORY::PRINCIPAL;
|
|
|
|
paramInfo.defaultValue = "0";
|
2024-01-06 18:00:50 +00:00
|
|
|
paramInfo.description = "Delay";
|
2022-02-21 03:58:31 +00:00
|
|
|
paramInfos.push_back( paramInfo );
|
|
|
|
|
|
|
|
paramInfo.name = "stddev";
|
2022-06-21 02:22:52 +00:00
|
|
|
paramInfo.type = SIM_VALUE::TYPE_FLOAT;
|
2022-02-21 03:58:31 +00:00
|
|
|
paramInfo.unit = aUnit;
|
|
|
|
paramInfo.category = SIM_MODEL::PARAM::CATEGORY::PRINCIPAL;
|
|
|
|
paramInfo.defaultValue = "1";
|
|
|
|
paramInfo.description = "Standard deviation";
|
|
|
|
paramInfos.push_back( paramInfo );
|
|
|
|
|
2024-01-06 18:00:50 +00:00
|
|
|
paramInfo.name = "mean";
|
2022-06-21 02:22:52 +00:00
|
|
|
paramInfo.type = SIM_VALUE::TYPE_FLOAT;
|
2024-01-06 18:00:50 +00:00
|
|
|
paramInfo.unit = aUnit;
|
2022-02-21 03:58:31 +00:00
|
|
|
paramInfo.category = SIM_MODEL::PARAM::CATEGORY::PRINCIPAL;
|
|
|
|
paramInfo.defaultValue = "0";
|
2024-01-06 18:00:50 +00:00
|
|
|
paramInfo.description = "Mean";
|
2022-02-21 03:58:31 +00:00
|
|
|
paramInfos.push_back( paramInfo );
|
|
|
|
|
2022-06-12 03:39:13 +00:00
|
|
|
appendAcParamInfos( paramInfos, aUnit );
|
2023-07-04 16:01:12 +00:00
|
|
|
appendSpParamInfos( paramInfos, aUnit );
|
2022-02-21 03:58:31 +00:00
|
|
|
return paramInfos;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2023-05-21 10:23:56 +00:00
|
|
|
std::vector<SIM_MODEL::PARAM::INFO> SIM_MODEL_SOURCE::makeRandomExpParamInfos( const std::string& aPrefix,
|
|
|
|
const std::string& aUnit )
|
2022-02-21 03:58:31 +00:00
|
|
|
{
|
|
|
|
std::vector<PARAM::INFO> paramInfos;
|
|
|
|
PARAM::INFO paramInfo;
|
|
|
|
|
2024-01-06 18:00:50 +00:00
|
|
|
paramInfo.name = "ts";
|
2022-06-21 02:22:52 +00:00
|
|
|
paramInfo.type = SIM_VALUE::TYPE_FLOAT;
|
2024-01-06 18:00:50 +00:00
|
|
|
paramInfo.unit = "s";
|
|
|
|
paramInfo.category = SIM_MODEL::PARAM::CATEGORY::PRINCIPAL;
|
|
|
|
paramInfo.defaultValue = "";
|
|
|
|
paramInfo.description = "Individual voltage duration";
|
|
|
|
paramInfos.push_back( paramInfo );
|
|
|
|
|
|
|
|
paramInfo.name = "td";
|
|
|
|
paramInfo.type = SIM_VALUE::TYPE_FLOAT;
|
|
|
|
paramInfo.unit = "s";
|
2022-02-21 03:58:31 +00:00
|
|
|
paramInfo.category = SIM_MODEL::PARAM::CATEGORY::PRINCIPAL;
|
|
|
|
paramInfo.defaultValue = "0";
|
2024-01-06 18:00:50 +00:00
|
|
|
paramInfo.description = "Delay";
|
2022-02-21 03:58:31 +00:00
|
|
|
paramInfos.push_back( paramInfo );
|
|
|
|
|
|
|
|
paramInfo.name = "mean";
|
2022-06-21 02:22:52 +00:00
|
|
|
paramInfo.type = SIM_VALUE::TYPE_FLOAT;
|
2022-02-21 03:58:31 +00:00
|
|
|
paramInfo.unit = aUnit;
|
|
|
|
paramInfo.category = SIM_MODEL::PARAM::CATEGORY::PRINCIPAL;
|
|
|
|
paramInfo.defaultValue = "1";
|
|
|
|
paramInfo.description = "Mean";
|
|
|
|
paramInfos.push_back( paramInfo );
|
|
|
|
|
2024-01-06 18:00:50 +00:00
|
|
|
paramInfo.name = "offset";
|
2022-06-21 02:22:52 +00:00
|
|
|
paramInfo.type = SIM_VALUE::TYPE_FLOAT;
|
2024-01-06 18:00:50 +00:00
|
|
|
paramInfo.unit = aUnit;
|
2022-02-21 03:58:31 +00:00
|
|
|
paramInfo.category = SIM_MODEL::PARAM::CATEGORY::PRINCIPAL;
|
|
|
|
paramInfo.defaultValue = "0";
|
2024-01-06 18:00:50 +00:00
|
|
|
paramInfo.description = "Offset";
|
2022-02-21 03:58:31 +00:00
|
|
|
paramInfos.push_back( paramInfo );
|
|
|
|
|
2022-06-12 03:39:13 +00:00
|
|
|
appendAcParamInfos( paramInfos, aUnit );
|
2023-07-04 16:01:12 +00:00
|
|
|
appendSpParamInfos( paramInfos, aUnit );
|
2022-02-21 03:58:31 +00:00
|
|
|
return paramInfos;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2023-05-21 10:23:56 +00:00
|
|
|
std::vector<SIM_MODEL::PARAM::INFO> SIM_MODEL_SOURCE::makeRandomPoissonParamInfos( const std::string& aPrefix,
|
|
|
|
const std::string& aUnit )
|
2022-02-21 03:58:31 +00:00
|
|
|
{
|
|
|
|
std::vector<PARAM::INFO> paramInfos;
|
|
|
|
PARAM::INFO paramInfo;
|
|
|
|
|
2024-01-06 18:00:50 +00:00
|
|
|
paramInfo.name = "ts";
|
2022-06-21 02:22:52 +00:00
|
|
|
paramInfo.type = SIM_VALUE::TYPE_FLOAT;
|
2024-01-06 18:00:50 +00:00
|
|
|
paramInfo.unit = "s";
|
2022-02-21 03:58:31 +00:00
|
|
|
paramInfo.category = SIM_MODEL::PARAM::CATEGORY::PRINCIPAL;
|
2024-01-06 18:00:50 +00:00
|
|
|
paramInfo.defaultValue = "";
|
|
|
|
paramInfo.description = "Individual voltage duration";
|
2022-02-21 03:58:31 +00:00
|
|
|
paramInfos.push_back( paramInfo );
|
|
|
|
|
2024-01-06 18:00:50 +00:00
|
|
|
paramInfo.name = "td";
|
2022-06-21 02:22:52 +00:00
|
|
|
paramInfo.type = SIM_VALUE::TYPE_FLOAT;
|
2024-01-06 18:00:50 +00:00
|
|
|
paramInfo.unit = "s";
|
2022-02-21 03:58:31 +00:00
|
|
|
paramInfo.category = SIM_MODEL::PARAM::CATEGORY::PRINCIPAL;
|
2024-01-06 18:00:50 +00:00
|
|
|
paramInfo.defaultValue = "0";
|
|
|
|
paramInfo.description = "Delay";
|
2022-02-21 03:58:31 +00:00
|
|
|
paramInfos.push_back( paramInfo );
|
|
|
|
|
2024-01-06 18:00:50 +00:00
|
|
|
paramInfo.name = "lambda";
|
2022-06-21 02:22:52 +00:00
|
|
|
paramInfo.type = SIM_VALUE::TYPE_FLOAT;
|
2024-01-06 18:00:50 +00:00
|
|
|
paramInfo.unit = aUnit;
|
2022-06-21 02:22:52 +00:00
|
|
|
paramInfo.category = SIM_MODEL::PARAM::CATEGORY::PRINCIPAL;
|
2024-01-06 18:00:50 +00:00
|
|
|
paramInfo.defaultValue = "1";
|
|
|
|
paramInfo.description = "Lambda";
|
2022-06-21 02:22:52 +00:00
|
|
|
paramInfos.push_back( paramInfo );
|
|
|
|
|
2024-01-06 18:00:50 +00:00
|
|
|
paramInfo.name = "offset";
|
2022-06-21 02:22:52 +00:00
|
|
|
paramInfo.type = SIM_VALUE::TYPE_FLOAT;
|
2024-01-06 18:00:50 +00:00
|
|
|
paramInfo.unit = aUnit;
|
2022-02-21 03:58:31 +00:00
|
|
|
paramInfo.category = SIM_MODEL::PARAM::CATEGORY::PRINCIPAL;
|
|
|
|
paramInfo.defaultValue = "0";
|
2024-01-06 18:00:50 +00:00
|
|
|
paramInfo.description = "Offset";
|
2022-02-21 03:58:31 +00:00
|
|
|
paramInfos.push_back( paramInfo );
|
|
|
|
|
2022-06-12 03:39:13 +00:00
|
|
|
appendAcParamInfos( paramInfos, aUnit );
|
2023-07-04 16:01:12 +00:00
|
|
|
appendSpParamInfos( paramInfos, aUnit );
|
2022-02-21 03:58:31 +00:00
|
|
|
return paramInfos;
|
|
|
|
}
|
2022-06-12 03:39:13 +00:00
|
|
|
|
2023-05-21 10:23:56 +00:00
|
|
|
void SIM_MODEL_SOURCE::appendAcParamInfos( std::vector<PARAM::INFO>& aParamInfos, const std::string& aUnit )
|
2022-06-12 03:39:13 +00:00
|
|
|
{
|
|
|
|
PARAM::INFO paramInfo;
|
|
|
|
|
|
|
|
paramInfo.name = "ac";
|
2022-06-21 02:22:52 +00:00
|
|
|
paramInfo.type = SIM_VALUE::TYPE_FLOAT;
|
2022-06-12 03:39:13 +00:00
|
|
|
paramInfo.unit = aUnit;
|
|
|
|
paramInfo.category = SIM_MODEL::PARAM::CATEGORY::AC;
|
|
|
|
paramInfo.defaultValue = "0";
|
|
|
|
paramInfo.description = "AC magnitude";
|
|
|
|
aParamInfos.push_back( paramInfo );
|
|
|
|
|
|
|
|
paramInfo.name = "ph";
|
2022-06-21 02:22:52 +00:00
|
|
|
paramInfo.type = SIM_VALUE::TYPE_FLOAT;
|
2022-06-12 03:39:13 +00:00
|
|
|
paramInfo.unit = "°";
|
|
|
|
paramInfo.category = SIM_MODEL::PARAM::CATEGORY::AC;
|
|
|
|
paramInfo.defaultValue = "0";
|
|
|
|
paramInfo.description = "AC phase";
|
|
|
|
aParamInfos.push_back( paramInfo );
|
|
|
|
}
|
2023-05-20 19:58:13 +00:00
|
|
|
|
2023-07-04 16:01:12 +00:00
|
|
|
void SIM_MODEL_SOURCE::appendSpParamInfos( std::vector<PARAM::INFO>& aParamInfos,
|
|
|
|
const std::string& aUnit )
|
|
|
|
{
|
|
|
|
PARAM::INFO paramInfo;
|
|
|
|
|
|
|
|
if( !strcmp( aUnit.c_str(), "V" ) )
|
|
|
|
{
|
|
|
|
paramInfo.name = "portnum";
|
|
|
|
paramInfo.type = SIM_VALUE::TYPE_INT;
|
|
|
|
paramInfo.unit = "";
|
|
|
|
paramInfo.category = SIM_MODEL::PARAM::CATEGORY::S_PARAM;
|
|
|
|
paramInfo.defaultValue = "";
|
|
|
|
paramInfo.description = "Port number";
|
|
|
|
aParamInfos.push_back( paramInfo );
|
|
|
|
|
|
|
|
paramInfo.name = "z0";
|
|
|
|
paramInfo.type = SIM_VALUE::TYPE_FLOAT;
|
|
|
|
paramInfo.unit = "Ohm";
|
|
|
|
paramInfo.category = SIM_MODEL::PARAM::CATEGORY::S_PARAM;
|
|
|
|
paramInfo.defaultValue = "";
|
|
|
|
paramInfo.description = "Internal impedance";
|
|
|
|
aParamInfos.push_back( paramInfo );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-05-20 19:58:13 +00:00
|
|
|
|
|
|
|
std::vector<std::string> SIM_MODEL_SOURCE::GetPinNames() const
|
|
|
|
{
|
|
|
|
if( GetDeviceType() == SIM_MODEL::DEVICE_T::E || GetDeviceType() == SIM_MODEL::DEVICE_T::G )
|
|
|
|
return { "+", "-", "C+", "C-" };
|
|
|
|
else
|
|
|
|
return { "+", "-" };
|
|
|
|
}
|