new measure commands
This commit is contained in:
parent
99533fa109
commit
248e44b883
|
|
@ -1,5 +1,9 @@
|
|||
2009-12-20 Holger Vogt
|
||||
* fixinf the time 0 value of sine in isrc, vsrc
|
||||
* fixing the time 0 value of sine in isrc, vsrc
|
||||
* fteext.h, com_measure2.c, measure.c, commands.c:
|
||||
New .meas functions min_at or max_at will return the x value (maximum at x)
|
||||
meas command is now available in the .control ... .endc section in ngspice
|
||||
(still not tested for all possible variations, but ...).
|
||||
|
||||
2009-12-19 Paolo Nenzi
|
||||
* src/spicelib/devices/isrc/isrcacct.c, src/spicelib/devices/vsrc/vsrcacct.c:
|
||||
|
|
|
|||
|
|
@ -89,6 +89,7 @@ c1 out gnd 220fF
|
|||
.meas tran skew4 when v(out)=skew_meas fall=LAST
|
||||
.meas tran skew5 FIND v(out) AT=2n
|
||||
.meas tran v0_min min i(v0) from='dfall' to='dfall+period'
|
||||
.meas tran i_v0_min min_at i(v0) from='dfall' to='dfall+period'
|
||||
.meas tran v0_avg avg i(v0) from='dfall' to='dfall+period'
|
||||
.meas tran v0_integ integ i(v0) from='dfall' to='dfall+period'
|
||||
.meas tran v0_rms rms i(v0) from='dfall' to='dfall+period'
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -279,6 +279,10 @@ struct comm spcp_coms[] = {
|
|||
{ 0, 0, 0, 0 }, E_DEFHMASK, 4, LOTS,
|
||||
(void (*)()) NULL,
|
||||
"start_freq stop_freq step_freq vector ... : Create a frequency domain plot." } ,
|
||||
{ "meas", com_meas, FALSE, FALSE, TRUE,
|
||||
{ 0, 0, 0, 0 }, E_DEFHMASK, 1, LOTS,
|
||||
(void (*)()) NULL,
|
||||
"various ... : User defined signal evaluation." } ,
|
||||
{ "show", com_show, FALSE, TRUE, FALSE,
|
||||
{ 040, 040, 040, 040 }, E_DEFHMASK, 0, LOTS,
|
||||
(void (*)()) NULL,
|
||||
|
|
|
|||
|
|
@ -33,6 +33,48 @@ static bool measures_passed; /* TRUE: stop simulation (if option autostop is set
|
|||
extern bool ft_batchmode;
|
||||
extern bool rflag;
|
||||
|
||||
/* measure in interactive mode:
|
||||
meas command inside .control ... .endc loop or manually entered.
|
||||
meas has to be followed by the standard tokens (see measure_extract_variables()).
|
||||
The result is put into a vector with name "result"
|
||||
*/
|
||||
|
||||
void
|
||||
com_meas(wordlist *wl) {
|
||||
/* wl: in, input line of meas command */
|
||||
char *line_in, *outvar, newvec[1000];
|
||||
wordlist * wl_count, *wl_let;
|
||||
int fail;
|
||||
double result = 0;
|
||||
|
||||
if (!wl) {
|
||||
com_display((wordlist *) NULL);
|
||||
return;
|
||||
}
|
||||
wl_count = wl;
|
||||
line_in = wl_flatten(wl);
|
||||
|
||||
/* get output var name */
|
||||
wl_count = wl_count->wl_next;
|
||||
outvar = wl_count->wl_word;
|
||||
|
||||
fail = get_measure2(wl, &result, NULL, FALSE) ;
|
||||
|
||||
if (fail) {
|
||||
fprintf(stdout, "meas %s failed!\n", line_in);
|
||||
return;
|
||||
}
|
||||
|
||||
sprintf(newvec, "%s = %f\0", outvar, result);
|
||||
wl_let = alloc(struct wordlist);
|
||||
wl_let->wl_next = NULL;
|
||||
wl_let->wl_word = copy(newvec);
|
||||
com_let(wl_let);
|
||||
wl_free(wl_let);
|
||||
// fprintf(stdout, "in: %s\n", line_in);
|
||||
}
|
||||
|
||||
|
||||
static bool
|
||||
chkAnalysisType( char *an_type ) {
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -233,7 +233,8 @@ extern void com_fft(wordlist*);
|
|||
|
||||
/* com_sysinfo.c */
|
||||
extern void com_sysinfo();
|
||||
/* ginterface.c */
|
||||
|
||||
/* ginterface.c
|
||||
|
||||
extern bool gi_init();
|
||||
extern bool gi_endpause;
|
||||
|
|
@ -255,6 +256,7 @@ extern void gi_resetcolor();
|
|||
extern void gi_setlinestyle();
|
||||
extern void gi_text();
|
||||
extern void gi_update();
|
||||
*/
|
||||
|
||||
/* graf.c */
|
||||
|
||||
|
|
@ -408,6 +410,7 @@ extern struct plot *raw_read();
|
|||
/* meas.c */
|
||||
extern void do_measure(char *what, bool chk_only);
|
||||
extern bool check_autostop(char *what);
|
||||
extern void com_meas(wordlist *wl);
|
||||
|
||||
/* resource.c */
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue