Add a command 'plainsim': Throw out the circuit struct,
recreate it from the local storage, remove the deg monitors, no change to device instances.
This commit is contained in:
parent
3750068f1c
commit
749be37f5d
|
|
@ -444,15 +444,19 @@ struct comm spcp_coms[] = {
|
|||
{ "remcirc", com_remcirc, TRUE, TRUE,
|
||||
{ 0, 0, 0, 0 }, E_DEFHMASK, 0, 0,
|
||||
NULL,
|
||||
": Remove current citcuit." } ,
|
||||
": Remove current circuit." } ,
|
||||
{ "reset", com_rset, TRUE, TRUE,
|
||||
{ 0, 0, 0, 0 }, E_DEFHMASK, 0, 0,
|
||||
NULL,
|
||||
": Remove current ciuit, reload circuit from internal storage." } ,
|
||||
": Remove current circuit, reload circuit from internal storage." } ,
|
||||
{ "degsim", com_degsim, TRUE, TRUE,
|
||||
{ 0, 0, 0, 0 }, E_DEFHMASK, 0, 0,
|
||||
NULL,
|
||||
": Remove current circuit, reload and modify circuit." } ,
|
||||
": Remove current circuit, reload, remove deg monitors, and modify circuit." } ,
|
||||
{ "plainsim", com_plainsim, TRUE, TRUE,
|
||||
{ 0, 0, 0, 0 }, E_DEFHMASK, 0, 0,
|
||||
NULL,
|
||||
": Remove current circuit, reload, remove deg monitors, do not modify circuit." },
|
||||
{ "run", com_run, TRUE, TRUE,
|
||||
{ 0, 0, 0, 0 }, E_DEFHMASK, 0, 1,
|
||||
NULL,
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ License: Modified BSD
|
|||
#include "inpcom.h"
|
||||
|
||||
int prepare_degsim(struct card* deck);
|
||||
int prepare_plainsim(struct card* deck);
|
||||
int clear_degsim(void);
|
||||
static int add_degmodel(struct card* deck, double* result);
|
||||
|
||||
|
|
@ -71,7 +72,7 @@ int readdegparams (struct card *deck) {
|
|||
agemods[ageindex].devmodel = copy(ftok);
|
||||
else {
|
||||
fprintf(stderr, "Error: bad .agemodel syntax in line\n %s", card->line);
|
||||
controlled_exit(1);
|
||||
continue;
|
||||
}
|
||||
tfree(dftok);
|
||||
tfree(f1);
|
||||
|
|
@ -81,7 +82,7 @@ int readdegparams (struct card *deck) {
|
|||
agemods[ageindex].simmodel = copy(ftok);
|
||||
else {
|
||||
fprintf(stderr, "Error: bad .agemodel syntax in line\n %s", card->line);
|
||||
controlled_exit(1);
|
||||
continue;
|
||||
}
|
||||
tfree(dftok);
|
||||
tfree(f1);
|
||||
|
|
@ -97,11 +98,16 @@ int readdegparams (struct card *deck) {
|
|||
char* f2 = NULL;
|
||||
int err = 0;
|
||||
ftok = dftok = gettok(&cut_line);
|
||||
if (!dftok) {
|
||||
fprintf(stderr, "Error: bad .agemodel syntax in line\n % s", card->line);
|
||||
continue;
|
||||
}
|
||||
/* parameter name */
|
||||
f1 = gettok_char(&ftok, '=', FALSE, FALSE);
|
||||
if (!f1) {
|
||||
fprintf(stderr, "Error: bad .agemodel syntax in line\n % s", card->line);
|
||||
controlled_exit(1);
|
||||
tfree(dftok);
|
||||
continue;
|
||||
}
|
||||
/* parameter value */
|
||||
f2 = copy(ftok + 1);
|
||||
|
|
@ -125,7 +131,7 @@ int readdegparams (struct card *deck) {
|
|||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
return ageindex;
|
||||
}
|
||||
|
||||
/* Look for an X line.
|
||||
|
|
@ -302,8 +308,33 @@ int remsqrbra(struct card* deck) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
/* Remove the degradation monitors. */
|
||||
int prepare_plainsim(struct card* deck) {
|
||||
struct card* ldeck;
|
||||
/* skip the title line */
|
||||
for (ldeck = deck->nextcard; ldeck; ldeck = ldeck->nextcard) {
|
||||
char* line = ldeck->line;
|
||||
|
||||
if (*line == '*') {
|
||||
continue;
|
||||
}
|
||||
|
||||
/* remove the remnants of the first run */
|
||||
if (ciprefix(".model", line) && search_plain_identifier(line, "degmon")) {
|
||||
struct card* nextdeck = ldeck->nextcard;
|
||||
if (nextdeck) {
|
||||
char* nextline = nextdeck->line;
|
||||
if (*nextline == 'a' && strstr(nextline, "degmon")) {
|
||||
*nextline = '*';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Remove the degradation monitors.
|
||||
Add current measurement, delta_vg and current source.
|
||||
Add instance parameters delvto and factuo.
|
||||
Use the data retrieved from degdatahash */
|
||||
int prepare_degsim(struct card* deck) {
|
||||
struct card* prevcard = deck, *ldeck;
|
||||
|
|
|
|||
|
|
@ -37,6 +37,7 @@ extern INPmodel *modtab;
|
|||
extern NGHASHPTR modtabhash;
|
||||
|
||||
extern void setdegsim(void);
|
||||
extern void setplainsim(void);
|
||||
|
||||
#ifdef SHARED_MODULE
|
||||
extern void exec_controls(wordlist *newcontrols);
|
||||
|
|
@ -171,7 +172,8 @@ com_resume(wordlist *wl)
|
|||
}
|
||||
|
||||
|
||||
/* Throw out the circuit struct and recreate it from the deck. */
|
||||
/* Throw out the circuit struct, recreate it from the deck,
|
||||
remove the deg monitors, add degradation to instances. */
|
||||
void
|
||||
com_degsim(wordlist* wl)
|
||||
{
|
||||
|
|
@ -188,6 +190,24 @@ com_degsim(wordlist* wl)
|
|||
}
|
||||
|
||||
|
||||
/* Throw out the circuit struct, recreate it from the deck,
|
||||
remove the deg monitors, no change to device instances. */
|
||||
void
|
||||
com_plainsim(wordlist* wl)
|
||||
{
|
||||
NG_IGNORE(wl);
|
||||
|
||||
if (ft_curckt == NULL) {
|
||||
fprintf(cp_err, "Warning: there is no circuit loaded.\n");
|
||||
fprintf(cp_err, " Command 'reset' is ignored.\n");
|
||||
return;
|
||||
}
|
||||
com_remcirc(NULL);
|
||||
setplainsim();
|
||||
inp_source_recent();
|
||||
}
|
||||
|
||||
|
||||
/* Throw out the circuit struct and recreate it from the deck. */
|
||||
void
|
||||
com_rset(wordlist *wl)
|
||||
|
|
|
|||
|
|
@ -10,5 +10,6 @@ void com_resume(wordlist *wl);
|
|||
void com_rset(wordlist *wl);
|
||||
void com_remcirc(wordlist *wl);
|
||||
void com_degsim(wordlist* wl);
|
||||
void com_plainsim(wordlist* wl);
|
||||
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Reference in New Issue