patch no. 16 by Thomy add a function cm_get_circuit to allow accessing the circuit structure ckt from within an XSPICE code model. This is a change to the interface and requires recopiling all code models!
This commit is contained in:
parent
a04b562dd9
commit
7bc7651cd3
|
|
@ -48,6 +48,7 @@ NON-STANDARD FEATURES
|
|||
|
||||
#include <stdio.h>
|
||||
#include "ngspice/cmtypes.h"
|
||||
#include "ngspice/cktdefs.h"
|
||||
|
||||
|
||||
void cm_climit_fcn(double in, double in_offset, double cntl_upper,
|
||||
|
|
@ -102,6 +103,7 @@ Complex_t cm_complex_multiply(Complex_t x, Complex_t y);
|
|||
Complex_t cm_complex_divide(Complex_t x, Complex_t y);
|
||||
|
||||
char *cm_get_path(void);
|
||||
CKTcircuit *cm_get_circuit(void);
|
||||
|
||||
FILE *cm_stream_out(void);
|
||||
FILE *cm_stream_in(void);
|
||||
|
|
|
|||
|
|
@ -64,6 +64,7 @@ struct coreInfo_t {
|
|||
Complex_t ((*dllitf_cm_complex_multiply)(Complex_t, Complex_t));
|
||||
Complex_t ((*dllitf_cm_complex_divide)(Complex_t, Complex_t));
|
||||
char * ((*dllitf_cm_get_path)(void));
|
||||
CKTcircuit *((*dllitf_cm_get_circuit)(void));
|
||||
FILE * ((*dllitf_cm_stream_out)(void));
|
||||
FILE * ((*dllitf_cm_stream_in)(void));
|
||||
FILE * ((*dllitf_cm_stream_err)(void));
|
||||
|
|
|
|||
|
|
@ -37,6 +37,7 @@ INTERFACES
|
|||
cm_message_get_errmsg()
|
||||
cm_message_send()
|
||||
cm_get_path()
|
||||
cm_get_circuit()
|
||||
|
||||
REFERENCED FILES
|
||||
|
||||
|
|
@ -706,3 +707,21 @@ char *cm_get_path(void)
|
|||
return Infile_Path;
|
||||
}
|
||||
|
||||
|
||||
/* cm_get_circuit(void)
|
||||
|
||||
To build complex custom-built xspice-models, access to certain
|
||||
parameters (e.g. maximum step size) may be needed to get reasonable
|
||||
results of a simulation. In detail, this may be necessary when
|
||||
spice interacts with an external sensor-simulator and the results
|
||||
of that external simulator do not have a direct impact on the spice
|
||||
circuit. Then, modifying the maximum step size on the fly may help
|
||||
to improve the simulation results. Modifying such parameters has to
|
||||
be done carefully. The patch enhances the xspice interface with
|
||||
access to the (fundamental) ckt pointer.
|
||||
*/
|
||||
|
||||
CKTcircuit *cm_get_circuit(void)
|
||||
{
|
||||
return(g_mif_info.ckt);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -64,6 +64,7 @@ struct coreInfo_t coreInfo =
|
|||
cm_complex_multiply,
|
||||
cm_complex_divide,
|
||||
cm_get_path,
|
||||
cm_get_circuit,
|
||||
no_file,
|
||||
no_file,
|
||||
no_file,
|
||||
|
|
|
|||
|
|
@ -366,6 +366,10 @@ char * cm_get_path(void) {
|
|||
return (coreitf->dllitf_cm_get_path)();
|
||||
}
|
||||
|
||||
CKTcircuit *cm_get_circuit(void) {
|
||||
return (coreitf->dllitf_cm_get_circuit)();
|
||||
}
|
||||
|
||||
FILE * cm_stream_out(void) {
|
||||
return (coreitf->dllitf_cm_stream_out)();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -62,6 +62,7 @@ struct coreInfo_t coreInfo =
|
|||
cm_complex_multiply,
|
||||
cm_complex_divide,
|
||||
cm_get_path,
|
||||
cm_get_circuit,
|
||||
no_file,
|
||||
no_file,
|
||||
no_file,
|
||||
|
|
|
|||
Loading…
Reference in New Issue