Error on line 15 : a1 amp_in common amp_out amp
MIF-ERROR - unable to find definition of model amp
Model issue on line 22 : .model amp amplifier (gain=-10 in_offset=1e-3 rin=1e6 ro …
Unknown model type amplifier - ignored
Regards,
Fahim
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I have changed the common with gnd also but still getting same error.
I had follow the below steps.
Step1: Created the new directory under ngspice/src/xspice/icm/xtradev as Amplifier.
Step2 : Copied interface and cmodel file in it.
Step3: did the necessary changes in it.
Step4: Added name of code model in the modpath.lst file.
Step5: Now to load the codemodel I created the release directory under the ngspice directory.
step6: cd release
step7: ../configure -enable-xspice -disable-debug -with-readline=yes
Step8: make
Step9 : sudo make install
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
ngspice internally sets all command lines to lower case letters before execution.
Please rename your code model accordingly:
Amplifier --> amplifier
and try again.
Holger
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
C_Function_Name: ucm_amplifier
Spice_Model_Name: amplifier
Description: "A simple gain block"
PORT_TABLE:
Port_Name: amp_in amp_out
Description: "input" "output"
Direction: in out
Default_Type: v v
Allowed_Types:
Vector: no no
Vector_Bounds: - -
Null_Allowed: no no
PARAMETER_TABLE:
Parameter_Name: in_offset gain rin rout
Description: "input offset" "gain" "input resistance" "Output resistance"
Data_Type: real real real real
Default_Value: 0.0 1.0 0.0 0.0
Limits: - - - -
Vector: no no no no
Vector_Bounds: - - - -
Null_Allowed: yes yes yes yes
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I did not detect a princple bug, was able do generate a new code model 'amplifier' according to (MS Windows, MINGW compiler):
Step1: Created the new directory under ngspice/src/xspice/icm/xtradev as Amplifier.
Step2 : Copied interface and cmodel file in it.
Step3: did the necessary changes in it.
Step4: Added name of code model in the modpath.lst file.
Step5: cd 'ngspice directory'
step6: cd release
step7: ../configure -enable-xspice -disable-debug -with-readline=yes
Step8: make clean
Step9 : make
step 10: make install
However I changed line
OUTPUT(amp_out) = PARAM(gain) *((PARAM(rout))*(PARAM(rin)) + PARAM(in_offset));
(not input, gain multipled by resistance?) back to
OUTPUT(amp_out) = PARAM(gain) *(INPUT(amp_in) + PARAM(in_offset));
all common to gnd in the input file,
and everything works well!
Holger
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi,
I am new to the Ngspice/Xspice.
I am trying to create the new code model. I have created the interface and model file.
Can anyone please tell me the steps to load the new code model. he code is as below please let me know if the usage of new code model is proper or not
Small Signal Amplifier
*
*This circuit simulates a small signal amplifier
*with a diode limiter.
*
.dc Vin -1 1 .05
*
Vin Input common DC 0
R_source Input Amp_In 100
*
D_Neg 0 Amp_In 1n4148
D_Pos Amp_In common 1n4148
*
C1 Amp_In common 1uF
A1 Amp_In common Amp_Out Amp
R_Load Amp_Out common 1000
*
.model 1n4148 D (is=2.495E-09 rs=4.755E-01 n=1.679E+00
+ tt=3.030E-09 cjo=1.700E-12 vj=1 m=1.959E-01 bv=1.000E+02
+ ibv=1.000E-04)
*
.model Amp Amplifier (gain = -10 in_offset = 1e-3
+ rin = 1e6 rout = 1e1)
*
.end
Regards
Fahim
The new code model is Amplifier. Thanks
Fahim,
please have a look at the actual manual
http://ngspice.sourceforge.net/docs/ngspice-manual.pdf
chapters 25.3 and 27.2 ff
Regards
Holger
Hi Holger,
I have follow the same steps to create the model but its still not working and giving above error.
Could please let me know if there is any error in the code given above.
Regards,
Fahim
Fahim,
you have to be more specific:
What error message?
Correctness of usage depends on your new code model!
What are the new interface specifications?
Holger
Fahim,
please also have a look at the manual, chapter 2.1 on the gnd node!
Holger
Hi Holger,
I am getting the below error.
Error on line 15 : a1 amp_in common amp_out amp
MIF-ERROR - unable to find definition of model amp
Model issue on line 22 : .model amp amplifier (gain=-10 in_offset=1e-3 rin=1e6 ro …
Unknown model type amplifier - ignored
Regards,
Fahim
Regarding the ground model I have one common branch in my model which act as ground.
To check whether this causing the problem I deleted the port in the interface file and use it as gnd.
But still its giving me error.
Fahim,
you have to replace 'common' by 'gnd'.
The error message however tells you that your new code model has not been recongnized by ngspice.
The only way to help you may be that you decribe what you did 'step by step'.
Holger
Hi,
I have changed the common with gnd also but still getting same error.
I had follow the below steps.
Step1: Created the new directory under ngspice/src/xspice/icm/xtradev as Amplifier.
Step2 : Copied interface and cmodel file in it.
Step3: did the necessary changes in it.
Step4: Added name of code model in the modpath.lst file.
Step5: Now to load the codemodel I created the release directory under the ngspice directory.
step6: cd release
step7: ../configure -enable-xspice -disable-debug -with-readline=yes
Step8: make
Step9 : sudo make install
as a short test, replace
.model Amp Amplifier (gain = -10 in_offset = 1e-3 rin = 1e6 rout = 1e1)
by
.model Amp gain(gain = -10 in_offset = 1e-3)
Holger
I had use the existing model gain and it was running without any error.
Regards,
Fahim
next test:
to see if codemodel has been made, goto :
ngspice/release/src/xspice/icm/xtradev/amplifier
Is there a cfunc.c, cfunc.o, ifspec.c ifspec.o ?
Holger
Yes its there.
Should I uninstall ngspice and then install it again?
Fahim
yes
try a
make clean
first. You may then do
make 2>&1 | tee make.log
instead of
make
, which gives you a make.log file in dir ngspice for analysis.
Holger
make uninstall
will remove the installed files.
Holger
correction:
make.log to be found in ngspice/release
Holger
I checked the log in release but no error for creating .c and .o file.
make uninstall will uninstall the ngspice correct?
Fahim
just another idea:
ngspice internally sets all command lines to lower case letters before execution.
Please rename your code model accordingly:
Amplifier --> amplifier
and try again.
Holger
I try it but still not working
Fahim
next step:
Could you please list your input files:
cfunc.mod and ifspec.ifs.
I will cheeck if there is something irregular.
I have easily been able to generate a XSPICE model 'amplifier' using the procedure described.
Regards
Holger
/*ifspec.ifs*/
NAME_TABLE:
C_Function_Name: ucm_amplifier
Spice_Model_Name: amplifier
Description: "A simple gain block"
PORT_TABLE:
Port_Name: amp_in amp_out
Description: "input" "output"
Direction: in out
Default_Type: v v
Allowed_Types:
Vector: no no
Vector_Bounds: - -
Null_Allowed: no no
PARAMETER_TABLE:
Parameter_Name: in_offset gain rin rout
Description: "input offset" "gain" "input resistance" "Output resistance"
Data_Type: real real real real
Default_Value: 0.0 1.0 0.0 0.0
Limits: - - - -
Vector: no no no no
Vector_Bounds: - - - -
Null_Allowed: yes yes yes yes
/*cfund.mod*/
/*=== UCM_AMPLIFIER ROUTINE ===*/
void ucm_amplifier(ARGS) /* structure holding parms, inputs, outputs, etc. */
{
Mif_Complex_t ac_gain;
if(ANALYSIS != MIF_AC) {
OUTPUT(amp_out) = PARAM(gain) *((PARAM(rout))*(PARAM(rin)) + PARAM(in_offset));
PARTIAL(amp_out,amp_in) = PARAM(gain);
}
else {
ac_gain.real = PARAM(gain);
ac_gain.imag= 0.0;
AC_GAIN(amp_out,amp_in) = ac_gain;
}
}
Hi,
I did not detect a princple bug, was able do generate a new code model 'amplifier' according to (MS Windows, MINGW compiler):
Step1: Created the new directory under ngspice/src/xspice/icm/xtradev as Amplifier.
Step2 : Copied interface and cmodel file in it.
Step3: did the necessary changes in it.
Step4: Added name of code model in the modpath.lst file.
Step5: cd 'ngspice directory'
step6: cd release
step7: ../configure -enable-xspice -disable-debug -with-readline=yes
Step8: make clean
Step9 : make
step 10: make install
However I changed line
OUTPUT(amp_out) = PARAM(gain) *((PARAM(rout))*(PARAM(rin)) + PARAM(in_offset));
(not input, gain multipled by resistance?) back to
OUTPUT(amp_out) = PARAM(gain) *(INPUT(amp_in) + PARAM(in_offset));
all common to gnd in the input file,
and everything works well!
Holger
Hi Holger,
I think there should not be problem with above statement because it is creating the .c and .o file without any error.
However I changed the cmod file but still it is not working. Could you please share the files.