Added new datatypes to vectors (impedance, admittance,atc.) A. Roldan -

espice
This commit is contained in:
pnenzi 2009-01-16 14:31:07 +00:00
parent 8c3ca11c62
commit 5f716e4b61
4 changed files with 104 additions and 8 deletions

View File

@ -1,3 +1,9 @@
2009-01-16 Paolo Nenzi
* src/frontend/evaluate.c, src/frontend/typedefs.c, src/include/sim.h:
Added some vector types from Espice (impedance, admittance, power etc.)
The original implementation by A. Roldan did not fit immediatly. I had
to comment two definitions. I could not test "plotab".
2009-01-15 Paolo Nenzi
* src/spicelib/devices/vsrc/vsrc.c,
* src/spicelib/devices/isrc/isrc.c,

View File

@ -16,6 +16,7 @@ Author: 1985 Wayne A. Christopher, U. C. Berkeley CAD Group
#include "evaluate.h"
#include "sim.h" /* To get SV_VOLTAGE definition */
/* static declarations */
static RETSIGTYPE sig_matherr(void);
@ -277,8 +278,89 @@ doop(char what,
res->v_dims[i] = v2->v_dims[i];
}
/* This depends somewhat on what the operation is. XXX Should fix */
res->v_type = v1->v_type;
/* This depends somewhat on what the operation is. XXX Should fix
* res->v_type = v1->v_type;
* Introduced to show the real units coming out from an
* operation. A.Roldán
*/
switch (what)
{
case '*': /* Multiplication of two vectors */
switch(v1->v_type)
{
case SV_VOLTAGE:
switch(v2->v_type)
{
case SV_VOLTAGE:
res->v_type = SV_VOLTAGE;
break;
case SV_CURRENT:
res->v_type = SV_POWER;
break;
default:
break;
}
break;
case SV_CURRENT:
switch(v2->v_type)
{
case SV_VOLTAGE:
res->v_type = SV_POWER;
break;
case SV_CURRENT:
res->v_type = SV_CURRENT;
break;
default:
break;
}
break;
default:
break;
}
break;
case '/': //Multiplicación de 2 vectores
switch(v1->v_type)
{
case SV_VOLTAGE:
switch(v2->v_type)
{
case SV_VOLTAGE:
res->v_type = SV_NOTYPE;
break;
case SV_CURRENT:
res->v_type = SV_IMPEDANCE;
break;
default:
break;
}
break;
case SV_CURRENT:
switch(v2->v_type)
{
case SV_VOLTAGE:
res->v_type = SV_ADMITANCE;
break;
case SV_CURRENT:
res->v_type = SV_NOTYPE;
break;
default:
break;
}
break;
default:
break;
}
default:
break;
}
vec_new(res);
/* Free the temporary data areas we used, if we allocated any. */

View File

@ -14,7 +14,7 @@ Author: 1986 Wayne A. Christopher, U. C. Berkeley CAD Group
#include "typesdef.h"
#define NUMTYPES 128 /* If this is too little we can use a list. */
#define NUMTYPES 128+4 /* If this is too little we can use a list. */
#define NUMPLOTTYPES 512 /* Since there may be more than 1 pat/type. */
struct type {
@ -40,14 +40,19 @@ struct type types[NUMTYPES] = {
{ "onoise-integrated", "V or A" } ,
{ "inoise-spectrum", "(V or A)^2/Hz" } ,
{ "inoise-integrated", "V or A" } ,
{ "output-noise", NULL } ,
{ "input-noise", NULL } ,
/* { "output-noise", NULL } , */
/* { "input-noise", NULL } , */
{ "pole", NULL } ,
{ "zero", NULL } ,
{ "s-param", NULL } ,
{ "temp-sweep", "Celsius" } ,/* Added by HT */
{ "res-sweep", "Ohm" } ,/* Added by HT */
{ "res-sweep", "Ohms" } ,/* Added by HT */
{ "impedance", "Ohms" } ,/* Added by A.Roldan */
{ "admittance", "Mhos" } ,/* Added by A.Roldan */
{ "power", "W" } , /* Added by A.Roldan */
{ "phase", "Degree" } , /* Added by A.Roldan */
{ "decibel", "dB" } , /* Added by A.Roldan */
} ;
@ -77,7 +82,7 @@ struct plotab plotabs[NUMPLOTTYPES] = {
{ "spect", "spect" },
} ;
int notypes = 15;/* change 14 to 15 by H.T*/
int notypes = 15 ;/* change 14 to 15 by H.T*/
int noplotabs = 20;/* change 18 to 20 by H.T*/
/* A command to define types for vectors and plots. This will generally

View File

@ -15,7 +15,10 @@ enum simulation_types {
SV_ZERO,
SV_SPARAM,
SV_TEMP,
SV_RES
SV_RES,
SV_IMPEDANCE, //Añadido por A.Roldán
SV_ADMITANCE, //Añadido por A.Roldán
SV_POWER //Añadido por A.Roldán
};
#endif