Un-comment and repair AM and SFFM sources.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/16529
This commit is contained in:
Jeff Young 2024-01-06 14:48:20 +00:00
parent a310c0a05a
commit bbdefa05eb
4 changed files with 46 additions and 53 deletions

View File

@ -187,8 +187,8 @@ SIM_MODEL::INFO SIM_MODEL::TypeInfo( TYPE aType )
case TYPE::V_SIN: return { DEVICE_T::V, "SIN", "Sine" }; case TYPE::V_SIN: return { DEVICE_T::V, "SIN", "Sine" };
case TYPE::V_PULSE: return { DEVICE_T::V, "PULSE", "Pulse" }; case TYPE::V_PULSE: return { DEVICE_T::V, "PULSE", "Pulse" };
case TYPE::V_EXP: return { DEVICE_T::V, "EXP", "Exponential" }; case TYPE::V_EXP: return { DEVICE_T::V, "EXP", "Exponential" };
//case TYPE::V_SFAM: return { DEVICE_T::V, "SFAM", "Single-frequency AM" }; case TYPE::V_AM: return { DEVICE_T::V, "AM", "Amplitude modulated" };
//case TYPE::V_SFFM: return { DEVICE_T::V, "SFFM", "Single-frequency FM" }; case TYPE::V_SFFM: return { DEVICE_T::V, "SFFM", "Single-frequency FM" };
case TYPE::V_VCL: return { DEVICE_T::E, "", "Voltage-controlled" }; case TYPE::V_VCL: return { DEVICE_T::E, "", "Voltage-controlled" };
case TYPE::V_CCL: return { DEVICE_T::H, "", "Current-controlled" }; case TYPE::V_CCL: return { DEVICE_T::H, "", "Current-controlled" };
case TYPE::V_PWL: return { DEVICE_T::V, "PWL", "Piecewise linear" }; case TYPE::V_PWL: return { DEVICE_T::V, "PWL", "Piecewise linear" };
@ -205,8 +205,8 @@ SIM_MODEL::INFO SIM_MODEL::TypeInfo( TYPE aType )
case TYPE::I_SIN: return { DEVICE_T::I, "SIN", "Sine" }; case TYPE::I_SIN: return { DEVICE_T::I, "SIN", "Sine" };
case TYPE::I_PULSE: return { DEVICE_T::I, "PULSE", "Pulse" }; case TYPE::I_PULSE: return { DEVICE_T::I, "PULSE", "Pulse" };
case TYPE::I_EXP: return { DEVICE_T::I, "EXP", "Exponential" }; case TYPE::I_EXP: return { DEVICE_T::I, "EXP", "Exponential" };
//case TYPE::I_SFAM: return { DEVICE_T::I, "SFAM", "Single-frequency AM" }; case TYPE::I_AM: return { DEVICE_T::I, "AM", "Amplitude modulated" };
//case TYPE::I_SFFM: return { DEVICE_T::I, "SFFM", "Single-frequency FM" }; case TYPE::I_SFFM: return { DEVICE_T::I, "SFFM", "Single-frequency FM" };
case TYPE::I_VCL: return { DEVICE_T::G, "", "Voltage-controlled" }; case TYPE::I_VCL: return { DEVICE_T::G, "", "Voltage-controlled" };
case TYPE::I_CCL: return { DEVICE_T::F, "", "Current-controlled" }; case TYPE::I_CCL: return { DEVICE_T::F, "", "Current-controlled" };
case TYPE::I_PWL: return { DEVICE_T::I, "PWL", "Piecewise linear" }; case TYPE::I_PWL: return { DEVICE_T::I, "PWL", "Piecewise linear" };
@ -324,8 +324,8 @@ SIM_MODEL::SPICE_INFO SIM_MODEL::SpiceInfo( TYPE aType )
case TYPE::V_SIN: return { "V", "", "SIN" }; case TYPE::V_SIN: return { "V", "", "SIN" };
case TYPE::V_PULSE: return { "V", "", "PULSE" }; case TYPE::V_PULSE: return { "V", "", "PULSE" };
case TYPE::V_EXP: return { "V", "", "EXP" }; case TYPE::V_EXP: return { "V", "", "EXP" };
//case TYPE::V_SFAM: return { "V", "", "AM" }; case TYPE::V_AM: return { "V", "", "AM" };
//case TYPE::V_SFFM: return { "V", "", "SFFM" }; case TYPE::V_SFFM: return { "V", "", "SFFM" };
case TYPE::V_VCL: return { "E", "", "" }; case TYPE::V_VCL: return { "E", "", "" };
case TYPE::V_CCL: return { "H", "", "" }; case TYPE::V_CCL: return { "H", "", "" };
case TYPE::V_PWL: return { "V", "", "PWL" }; case TYPE::V_PWL: return { "V", "", "PWL" };
@ -342,8 +342,8 @@ SIM_MODEL::SPICE_INFO SIM_MODEL::SpiceInfo( TYPE aType )
case TYPE::I_PULSE: return { "I", "", "PULSE" }; case TYPE::I_PULSE: return { "I", "", "PULSE" };
case TYPE::I_SIN: return { "I", "", "SIN" }; case TYPE::I_SIN: return { "I", "", "SIN" };
case TYPE::I_EXP: return { "I", "", "EXP" }; case TYPE::I_EXP: return { "I", "", "EXP" };
//case TYPE::I_SFAM: return { "V", "", "AM" }; case TYPE::I_AM: return { "V", "", "AM" };
//case TYPE::I_SFFM: return { "V", "", "SFFM" }; case TYPE::I_SFFM: return { "V", "", "SFFM" };
case TYPE::I_VCL: return { "G", "", "" }; case TYPE::I_VCL: return { "G", "", "" };
case TYPE::I_CCL: return { "F", "", "" }; case TYPE::I_CCL: return { "F", "", "" };
case TYPE::I_PWL: return { "I", "", "PWL" }; case TYPE::I_PWL: return { "I", "", "PWL" };
@ -913,10 +913,10 @@ std::unique_ptr<SIM_MODEL> SIM_MODEL::Create( TYPE aType )
case TYPE::I_PULSE: case TYPE::I_PULSE:
case TYPE::V_EXP: case TYPE::V_EXP:
case TYPE::I_EXP: case TYPE::I_EXP:
/*case TYPE::V_SFAM: case TYPE::V_AM:
case TYPE::I_SFAM: case TYPE::I_AM:
case TYPE::V_SFFM: case TYPE::V_SFFM:
case TYPE::I_SFFM:*/ case TYPE::I_SFFM:
case TYPE::V_VCL: case TYPE::V_VCL:
case TYPE::V_CCL: case TYPE::V_CCL:
case TYPE::V_PWL: case TYPE::V_PWL:

View File

@ -239,8 +239,8 @@ public:
V_SIN, V_SIN,
V_PULSE, V_PULSE,
V_EXP, V_EXP,
//V_SFAM, V_AM,
//V_SFFM, V_SFFM,
V_VCL, V_VCL,
V_CCL, V_CCL,
V_PWL, V_PWL,
@ -257,8 +257,8 @@ public:
I_SIN, I_SIN,
I_PULSE, I_PULSE,
I_EXP, I_EXP,
//I_SFAM, I_AM,
//I_SFFM, I_SFFM,
I_VCL, I_VCL,
I_CCL, I_CCL,
I_PWL, I_PWL,

View File

@ -337,11 +337,11 @@ const std::vector<SIM_MODEL::PARAM::INFO>& SIM_MODEL_SOURCE::makeParamInfos( TYP
static std::vector<PARAM::INFO> vexp = makeExpParamInfos( "y", "V" ); static std::vector<PARAM::INFO> vexp = makeExpParamInfos( "y", "V" );
static std::vector<PARAM::INFO> iexp = makeExpParamInfos( "y", "A" ); static std::vector<PARAM::INFO> iexp = makeExpParamInfos( "y", "A" );
/*static std::vector<PARAM::INFO> vsfam = makeSfamParamInfos( "y", "V" ); static std::vector<PARAM::INFO> vam = makeAMParamInfos( "y", "V" );
static std::vector<PARAM::INFO> isfam = makeSfamParamInfos( "y", "A" ); static std::vector<PARAM::INFO> iam = makeAMParamInfos( "y", "A" );
static std::vector<PARAM::INFO> vsffm = makeSffmParamInfos( "y", "V" ); static std::vector<PARAM::INFO> vsffm = makeSFFMParamInfos( "y", "V" );
static std::vector<PARAM::INFO> isffm = makeSffmParamInfos( "y", "A" );*/ static std::vector<PARAM::INFO> isffm = makeSFFMParamInfos( "y", "A" );
static std::vector<PARAM::INFO> vcvs = makeVcParamInfos( "" ); static std::vector<PARAM::INFO> vcvs = makeVcParamInfos( "" );
static std::vector<PARAM::INFO> ccvs = makeCcParamInfos( "ohm" ); static std::vector<PARAM::INFO> ccvs = makeCcParamInfos( "ohm" );
@ -382,10 +382,10 @@ const std::vector<SIM_MODEL::PARAM::INFO>& SIM_MODEL_SOURCE::makeParamInfos( TYP
case TYPE::I_PULSE: return ipulse; case TYPE::I_PULSE: return ipulse;
case TYPE::V_EXP: return vexp; case TYPE::V_EXP: return vexp;
case TYPE::I_EXP: return iexp; case TYPE::I_EXP: return iexp;
//case TYPE::V_SFAM: return vsfam; case TYPE::V_AM: return vam;
//case TYPE::I_SFAM: return isfam; case TYPE::I_AM: return iam;
//case TYPE::V_SFFM: return vsffm; case TYPE::V_SFFM: return vsffm;
//case TYPE::I_SFFM: return isffm; case TYPE::I_SFFM: return isffm;
case TYPE::V_VCL: return vcvs; case TYPE::V_VCL: return vcvs;
case TYPE::V_CCL: return ccvs; case TYPE::V_CCL: return ccvs;
case TYPE::V_PWL: return vpwl; case TYPE::V_PWL: return vpwl;
@ -630,40 +630,26 @@ std::vector<SIM_MODEL::PARAM::INFO> SIM_MODEL_SOURCE::makeExpParamInfos( const s
} }
/*std::vector<SIM_MODEL::PARAM::INFO> SIM_MODEL_SOURCE::makeSfamParamInfos( const std::string& aPrefix, const std::string& aUnit ) std::vector<SIM_MODEL::PARAM::INFO> SIM_MODEL_SOURCE::makeAMParamInfos( const std::string& aPrefix,
const std::string& aUnit )
{ {
std::vector<PARAM::INFO> paramInfos; std::vector<PARAM::INFO> paramInfos;
PARAM::INFO paramInfo; PARAM::INFO paramInfo;
paramInfo.name = "dc"; paramInfo.name = "va";
paramInfo.type = SIM_VALUE::TYPE_FLOAT;
paramInfo.unit = aUnit;
paramInfo.category = SIM_MODEL::PARAM::CATEGORY::PRINCIPAL;
paramInfo.defaultValue = "";
paramInfo.description = "DC offset";
paramInfo.name = "ampl";
paramInfo.type = SIM_VALUE::TYPE_FLOAT; paramInfo.type = SIM_VALUE::TYPE_FLOAT;
paramInfo.unit = aUnit; paramInfo.unit = aUnit;
paramInfo.category = SIM_MODEL::PARAM::CATEGORY::PRINCIPAL; paramInfo.category = SIM_MODEL::PARAM::CATEGORY::PRINCIPAL;
paramInfo.defaultValue = ""; paramInfo.defaultValue = "";
paramInfo.description = "Amplitude"; paramInfo.description = "Amplitude";
paramInfos.push_back( paramInfo );
paramInfo.name = "mo";
paramInfo.type = SIM_VALUE::TYPE_FLOAT;
paramInfo.unit = "";
paramInfo.category = SIM_MODEL::PARAM::CATEGORY::PRINCIPAL;
paramInfo.defaultValue = "";
paramInfo.description = "Modulating signal offset";
paramInfos.push_back( paramInfo ); paramInfos.push_back( paramInfo );
paramInfo.name = "fc"; paramInfo.name = "vo";
paramInfo.type = SIM_VALUE::TYPE_FLOAT; paramInfo.type = SIM_VALUE::TYPE_FLOAT;
paramInfo.unit = "Hz"; paramInfo.unit = aUnit;
paramInfo.category = SIM_MODEL::PARAM::CATEGORY::PRINCIPAL; paramInfo.category = SIM_MODEL::PARAM::CATEGORY::PRINCIPAL;
paramInfo.defaultValue = ""; paramInfo.defaultValue = "";
paramInfo.description = "Carrier frequency"; paramInfo.description = "DC offset";
paramInfos.push_back( paramInfo ); paramInfos.push_back( paramInfo );
paramInfo.name = "mf"; paramInfo.name = "mf";
@ -674,17 +660,25 @@ std::vector<SIM_MODEL::PARAM::INFO> SIM_MODEL_SOURCE::makeExpParamInfos( const s
paramInfo.description = "Modulating frequency"; paramInfo.description = "Modulating frequency";
paramInfos.push_back( paramInfo ); paramInfos.push_back( paramInfo );
appendAcParamInfos( paramInfos, aUnit ); paramInfo.name = "fc";
paramInfo.type = SIM_VALUE::TYPE_FLOAT;
paramInfo.unit = "Hz";
paramInfo.category = SIM_MODEL::PARAM::CATEGORY::PRINCIPAL;
paramInfo.defaultValue = "";
paramInfo.description = "Carrier frequency";
paramInfos.push_back( paramInfo );
return paramInfos; return paramInfos;
} }
std::vector<SIM_MODEL::PARAM::INFO> SIM_MODEL_SOURCE::makeSffmParamInfos( const std::string& aPrefix, const std::string& aUnit ) std::vector<SIM_MODEL::PARAM::INFO> SIM_MODEL_SOURCE::makeSFFMParamInfos( const std::string& aPrefix,
const std::string& aUnit )
{ {
std::vector<PARAM::INFO> paramInfos; std::vector<PARAM::INFO> paramInfos;
PARAM::INFO paramInfo; PARAM::INFO paramInfo;
paramInfo.name = "dc"; paramInfo.name = "vo";
paramInfo.type = SIM_VALUE::TYPE_FLOAT; paramInfo.type = SIM_VALUE::TYPE_FLOAT;
paramInfo.unit = aUnit; paramInfo.unit = aUnit;
paramInfo.category = SIM_MODEL::PARAM::CATEGORY::PRINCIPAL; paramInfo.category = SIM_MODEL::PARAM::CATEGORY::PRINCIPAL;
@ -692,7 +686,7 @@ std::vector<SIM_MODEL::PARAM::INFO> SIM_MODEL_SOURCE::makeSffmParamInfos( const
paramInfo.description = "DC offset"; paramInfo.description = "DC offset";
paramInfos.push_back( paramInfo ); paramInfos.push_back( paramInfo );
paramInfo.name = "ampl"; paramInfo.name = "va";
paramInfo.type = SIM_VALUE::TYPE_FLOAT; paramInfo.type = SIM_VALUE::TYPE_FLOAT;
paramInfo.unit = aUnit; paramInfo.unit = aUnit;
paramInfo.category = SIM_MODEL::PARAM::CATEGORY::PRINCIPAL; paramInfo.category = SIM_MODEL::PARAM::CATEGORY::PRINCIPAL;
@ -740,9 +734,8 @@ std::vector<SIM_MODEL::PARAM::INFO> SIM_MODEL_SOURCE::makeSffmParamInfos( const
paramInfo.description = "Signal phase"; paramInfo.description = "Signal phase";
paramInfos.push_back( paramInfo ); paramInfos.push_back( paramInfo );
appendAcParamInfos( paramInfos, aUnit );
return paramInfos; return paramInfos;
}*/ }
std::vector<SIM_MODEL::PARAM::INFO> SIM_MODEL_SOURCE::makeCcParamInfos( const std::string& aGainUnit ) std::vector<SIM_MODEL::PARAM::INFO> SIM_MODEL_SOURCE::makeCcParamInfos( const std::string& aGainUnit )

View File

@ -90,10 +90,10 @@ private:
const std::string& aUnit ); const std::string& aUnit );
static std::vector<PARAM::INFO> makeExpParamInfos( const std::string& aPrefix, static std::vector<PARAM::INFO> makeExpParamInfos( const std::string& aPrefix,
const std::string& aUnit ); const std::string& aUnit );
//static std::vector<PARAM::INFO> makeSfamParamInfos( const std::string& aPrefix, static std::vector<PARAM::INFO> makeAMParamInfos( const std::string& aPrefix,
// const std::string& aUnit ); const std::string& aUnit );
//static std::vector<PARAM::INFO> makeSffmParamInfos( const std::string& aPrefix, static std::vector<PARAM::INFO> makeSFFMParamInfos( const std::string& aPrefix,
// const std::string& aUnit ); const std::string& aUnit );
static std::vector<SIM_MODEL::PARAM::INFO> makeVcParamInfos( const std::string& aGainUnit ); static std::vector<SIM_MODEL::PARAM::INFO> makeVcParamInfos( const std::string& aGainUnit );
static std::vector<SIM_MODEL::PARAM::INFO> makeCcParamInfos( const std::string& aGainUnit ); static std::vector<SIM_MODEL::PARAM::INFO> makeCcParamInfos( const std::string& aGainUnit );
static std::vector<PARAM::INFO> makePwlParamInfos( const std::string& aPrefix, static std::vector<PARAM::INFO> makePwlParamInfos( const std::string& aPrefix,