Divya Gupta
Divya Gupta

Reputation: 41

What does "no compatibility mode selected" means in ngspice and how to solve it?

I want to write the code for fullwave bridge rectifier with resistance as load and I wrote the following code. But it showed an error. It showed "No compatibility mode selected". This is the code I wrote.

fullwave bridge rectifier
*Specifying circuit components
v1 1 0 sin(0 15 60 0 0)
rload 2 3 17k
d1 1 2 mod1
d2 0 2 mod1
d3 3 1 mod1
d4 3 0 mod1
.model mod1 d
.tran .5m 25m
.plot tran v(1,0) v(2,3)
.end

I am new to ngspice and just currently learning it. I tried to browse through its manual but couldn't get what I am searching for. I also tried to browse through various sites to rectify my mistake in the code but I couldn't get any solution of what changes to do in the code. I need help to rectify my code proceed my learnings in ngspice. Thank You.

Upvotes: 4

Views: 4679

Answers (2)

HannesW
HannesW

Reputation: 11

At the time of writing, section 16.14 of the currently newest ngspice manual (for version 41, https://ngspice.sourceforge.io/docs.html), compatibility is discussed.

As per section 16.14.5, set ngbehavior=ps will for example select the PSPICE compatibility mode. Section 16.6 describes how to do this in the "User defined configuration file .spiceinit", while section 17.7 describes how to set these variables in interactive mode.

In the folder where i am running spice, i created a file .spiceinit having the following content:

set ngbehavior = ps

Now ngspice prints: Note: Compatibility modes selected: ps

Running this command on Linux: ngspice -batch fullwave_bridge_rectifier.cir where fullwave_bridge_rectifier.cir contains the exact circuit provided in the questions, i get no errors. Part of the output this ASCII graph:

Legend:  + = v(1)             * = v(2)-v(3)        
--------------------------------------------------------------------------
 time       v(1)    -2.00e+01   -1.00e+01    0.00e+00    1.00e+01    2.00e+01   
----------------------|-----------|-----------|-----------|-----------|
 0.000e+00  0.000e+00 .           .           X           .           .   
 5.000e-04  2.806e+00 .           .           .* +        .           .   
 1.000e-03  5.503e+00 .           .           .    *+     .           .   
 1.500e-03  8.010e+00 .           .           .       *+  .           .   
 2.000e-03  1.023e+01 .           .           .         * +           .   
 2.500e-03  1.209e+01 .           .           .           * +         .   
 3.000e-03  1.352e+01 .           .           .           . * +       .   
 3.500e-03  1.448e+01 .           .           .           .  * +      .   
 4.000e-03  1.492e+01 .           .           .           .   *+      .   
 4.500e-03  1.483e+01 .           .           .           .   *+      .   
 5.000e-03  1.421e+01 .           .           .           .  * +      .   
 5.500e-03  1.310e+01 .           .           .           . *+        .   
 6.000e-03  1.152e+01 .           .           .           *+          .   
 6.500e-03  9.526e+00 .           .           .        * +.           .   
 7.000e-03  7.199e+00 .           .           .      *+   .           .   
 7.500e-03  4.617e+00 .           .           .   *+      .           .   
 8.000e-03  1.872e+00 .           .           * +         .           .   
 8.500e-03 -9.400e-01 .           .         + *           .           .   
 9.000e-03 -3.718e+00 .           .      +    .  *        .           .   
 9.500e-03 -6.365e+00 .           .   +       .     *     .           .   
 1.000e-02 -8.786e+00 .           .+          .        *  .           .   
 1.050e-02 -1.090e+01 .         + .           .          *.           .   
 1.100e-02 -1.262e+01 .       +   .           .           .*          .   
 1.150e-02 -1.390e+01 .      +    .           .           .  *        .   
 1.200e-02 -1.468e+01 .     +     .           .           .   *       .   
 1.250e-02 -1.495e+01 .     +     .           .           .   *       .   
 1.300e-02 -1.468e+01 .     +     .           .           .   *       .   
 1.350e-02 -1.390e+01 .      +    .           .           .  *        .   
 1.400e-02 -1.262e+01 .       +   .           .           .*          .   
 1.450e-02 -1.089e+01 .         + .           .          *.           .   
 1.500e-02 -8.784e+00 .           .+          .        *  .           .   
 1.550e-02 -6.362e+00 .           .   +       .     *     .           .   
 1.600e-02 -3.716e+00 .           .      +    .  *        .           .   
 1.650e-02 -9.370e-01 .           .         + *           .           .   
 1.700e-02  1.875e+00 .           .           .*+         .           .   
 1.750e-02  4.620e+00 .           .           .   *+      .           .   
 1.800e-02  7.202e+00 .           .           .      *+   .           .   
 1.850e-02  9.528e+00 .           .           .        * +.           .   
 1.900e-02  1.152e+01 .           .           .           *+          .   
 1.950e-02  1.310e+01 .           .           .           . *+        .   
 2.000e-02  1.422e+01 .           .           .           .  * +      .   
 2.050e-02  1.483e+01 .           .           .           .   *+      .   
 2.100e-02  1.492e+01 .           .           .           .   *+      .   
 2.150e-02  1.448e+01 .           .           .           .  * +      .   
 2.200e-02  1.352e+01 .           .           .           . * +       .   
 2.250e-02  1.209e+01 .           .           .           * +         .   
 2.300e-02  1.023e+01 .           .           .         * +           .   
 2.350e-02  8.007e+00 .           .           .       *+  .           .   
 2.400e-02  5.501e+00 .           .           .    *+     .           .   
 2.450e-02  2.799e+00 .           .           .* +        .           .   
 2.500e-02  5.511e-15 .           .          *+           .           .   
----------------------|-----------|-----------|-----------|-----------|
 time       v(1)    -2.00e+01   -1.00e+01    0.00e+00    1.00e+01    2.00e+01

I do therefore believe that the questions circuit description is not only syntactically correct, but also functionally.

All that said, having no compatibility mode selected is not an error. It is information that ngspice emits to aid the user in troubleshooting. Other than the difference in the compatibility mode information, I get the same output whether a compatibility mode is set or not.

Upvotes: 1

coold69
coold69

Reputation: 1

set spicebehavior=hs 

hs stands for hspice but you can use

set spicebehavior=all

Upvotes: 0

Related Questions