mirror of
https://git.code.sf.net/p/ngspice/ngspice
synced 2026-08-22 13:57:32 +02:00
Added new datatypes to vectors (impedance, admittance,atc.) A. Roldan -
espice
This commit is contained in:
+84
-2
@@ -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. */
|
||||
|
||||
+10
-5
@@ -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
|
||||
|
||||
+4
-1
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user