Add a parameter m (output multiplicator)

to spice2poly code model.
This commit is contained in:
Holger Vogt 2025-05-11 16:41:47 +02:00
parent 8e60d4dd0f
commit 39a0fe78cd
2 changed files with 20 additions and 6 deletions

View File

@ -47,7 +47,7 @@ required syntax.
This model may also be called directly as follows:
a1 [ <input(s)> ] <output> xxx
.model xxx spice2poly ( coef = [ <list of 2G6 compatible coefficients> ] )
.model xxx spice2poly ( coef = [ <list of 2G6 compatible coefficients> ] [m = val] )
Refer to the 2G6 User Guide for an explanation of the coefficients.
@ -102,12 +102,14 @@ void spice2poly (ARGS)
double sum; /* Temporary for accumulating sum of terms */
double product; /* Temporary for accumulating product */
double mult; /* multplicator for G and F sources */
/* Get number of input values */
num_inputs = PORT_SIZE(in);
mult = PARAM(m);
/* If this is the first call to the model, allocate the static variable */
/* array */
@ -165,7 +167,7 @@ void spice2poly (ARGS)
/* Add the product times the appropriate coefficient into the sum */
sum += coef[i] * product;
}
OUTPUT(out) = sum;
OUTPUT(out) = sum * mult;
/* Compute and output the partials for each input */
@ -201,13 +203,13 @@ void spice2poly (ARGS)
sum += coef[j] * product;
}
PARTIAL(out,in[i]) = sum;
PARTIAL(out,in[i]) = sum * mult;
/* If this is DC analysis, save the partial for use as AC gain */
/* value in an AC analysis */
if(ANALYSIS == MIF_DC)
STATIC_VAR(acgains[i]) = sum;
STATIC_VAR(acgains[i]) = sum * mult;
}
/* Free the allocated items and return */

View File

@ -16,7 +16,8 @@ AUTHORS
MODIFICATIONS
<date> <person name> <nature of modifications>
11/05/2025 Holger Vogt
new parameter m (multiplicator)
SUMMARY
@ -67,6 +68,17 @@ Vector: yes
Vector_Bounds: [2 -]
Null_Allowed: no
PARAMETER_TABLE:
Parameter_Name: m
Description: "multiplicator"
Data_Type: real
Default_Value: 1
Limits: -
Vector: no
Vector_Bounds: -
Null_Allowed: yes
STATIC_VAR_TABLE: