exclude simple e and h sources from getting a series voltage source
by undoing the name conversion
This commit is contained in:
parent
cfa473ad96
commit
5ace7ff1fd
|
|
@ -6114,11 +6114,24 @@ struct replace_currm
|
||||||
struct replace_currm *next;
|
struct replace_currm *next;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/* check if fourth token of sname starts with POLY */
|
||||||
|
static bool
|
||||||
|
is_poly_source(char *sname)
|
||||||
|
{
|
||||||
|
char *nstr = nexttok(sname);
|
||||||
|
nstr = nexttok(nstr);
|
||||||
|
nstr = nexttok(nstr);
|
||||||
|
if (ciprefix("POLY", nstr))
|
||||||
|
return TRUE;
|
||||||
|
else
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
/* Measure current in node 1 of all devices, e.g. I, B, F, and G.
|
/* Measure current in node 1 of all devices, e.g. I, B, F, G.
|
||||||
I(V...) will be ignored, however H, E nonlinear voltage
|
I(V...) will be ignored, I(E...) and I(H...) will be undone if
|
||||||
sources may be converted later
|
they are simple linear sources, however E nonlinear voltage
|
||||||
to B source, therefore we need to add current measurement here.
|
source will be converted later to B source,
|
||||||
|
therefore we need to add current measurement here.
|
||||||
First find all ocurrencies of i(XYZ), store their cards, then
|
First find all ocurrencies of i(XYZ), store their cards, then
|
||||||
search for XYZ, but only within respective subcircuit, or if
|
search for XYZ, but only within respective subcircuit, or if
|
||||||
all happens at top level. Other hierarchy is ignored for now.
|
all happens at top level. Other hierarchy is ignored for now.
|
||||||
|
|
@ -6273,6 +6286,24 @@ inp_meas_current(struct card *deck)
|
||||||
if (eq(".ends", tok) && rep->s_start)
|
if (eq(".ends", tok) && rep->s_start)
|
||||||
break;
|
break;
|
||||||
if (eq(rep->rtoken, tok)) {
|
if (eq(rep->rtoken, tok)) {
|
||||||
|
/* special treatment if we have an e (VCVS) or h (CCVS) source:
|
||||||
|
check if it is a simple linear source, if yes, don't do a
|
||||||
|
replacement, instead undo the already done name conversion */
|
||||||
|
if (((tok[0] == 'e') || (tok[0] == 'h')) && !strchr(curr_line, '=') && !is_poly_source(card->line)) {
|
||||||
|
/* simple linear e source */
|
||||||
|
char *searchstr = tprintf("i(v_%s)", tok);
|
||||||
|
char *thisline = rep->cline->line;
|
||||||
|
char *findstr = strstr(thisline, searchstr);
|
||||||
|
while (findstr) {
|
||||||
|
if (prefix(searchstr, findstr))
|
||||||
|
memcpy(findstr, " i(", 4);
|
||||||
|
findstr = strstr(thisline, searchstr);
|
||||||
|
if (ft_ngdebug)
|
||||||
|
printf("i(%s) moved back to i(%s) in\n%s\n\n", searchstr, tok, rep->cline->line);
|
||||||
|
}
|
||||||
|
tfree(searchstr);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
node1 = gettok(&curr_line);
|
node1 = gettok(&curr_line);
|
||||||
/* Add _vmeas only once to first device node.
|
/* Add _vmeas only once to first device node.
|
||||||
Continue if we already have modified device "tok" */
|
Continue if we already have modified device "tok" */
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue