Qucs / qucs

Qucs Project official mirror
http://qucs.sourceforge.net/
GNU General Public License v2.0
1.16k stars 213 forks source link

Spice4qucs. A tool to simulate Qucs circuit with ngspice #77

Closed ra3xdh closed 7 years ago

ra3xdh commented 10 years ago

There may be way to overcome #34 and #41. I started implementation of spice4qucs extension. This extension allows you to switch between qucsator simulation kernel and ngspice simulation kernel. You can simulate your Qucs circuits with ngspice using this extension. I am planning to add menu entry Simulation->Simulate with spice. Spice simulation will be available after execution of this menu. Spice simulation results will be converted to Qucs simulation data and diagrams will be available from the display page. With spice4qucs you can use good old spice to simulate Qucs circuits with it.

You can see current state of work at https://github.com/ra3xdh/qucs/tree/spice4qucs

Now implemented only conversion of the Qucs circuit to Spice netlist.

Not all components conversion is implemented. The list of spice-compatible components:

The list of supported simulations:

Sample schematic is available here: https://gist.github.com/ra3xdh/6c554e32e531c25e6e6b

To test spice4qucs open this schematic with Qucs, then execute Simulation->Simulate with spice. Spice netlist is located at $HOME/.qucs/spice4qucs.cir. Now switch to system terminal and execute ngspice:

ngspice $HOME/.qucs/spice4qucs.cir

Then run simulation and see waveforms:

run
plot v(drain)

The simulation fails for this schematic with Qucs, but ngspice simulates it correctly.

Have you any suggestions? Should I continue work in this direction?

My current task list:

MikeBrinson commented 8 years ago

The current development round includes adding new analogue models to Qucs-S and introducing the first release of digital component models for true mixed mode analogue-digital simulation. Both these developments have reached a stage where I plan to start pushing sets of new models to the spice4qucs_current branch for testing purposes. In this note I will introduce a new development in compact device model libraries. Recent improvements, by Vadim, now allow XSPICE CodeModel blocks to be included in subcircuits held in Qucs-S libraries. As a first example of this important modelling feature I have added a MESFET library to Qucs-S. At this stage only the Curtice level1 model for GaAs transistors has been released. More MEFET models to follow. The simulation test circuits shown below give an indication of the new model operation.

Digital models for Qucs-S mixed mode analogue-digital simulation are under development and testing. Over the next few months digital models for both Xyce and Ngspice/SPICE OPUS will be released. As a starting point a nearly complete set of combinational digital component models for Xspice are ready for pushing to the spice4qucs_branch for testing. If everything goes to plan I will release this new contribution ASAP.

Notes on both the new analogue and digital model developments will also follow in the Qucs-S Help documentation. mesfetdc1 mesfetdc2 mesfetac

MikeBrinson commented 8 years ago

The first version of the Xyce Digital Library has been pushed to branch spice4qucs_current. At this stage it only contains combinational logic elements, digital pulse generators, and AtoD/DtoA bridge elements. The library is very experimental and will probably have significant bugs. Also note that so far there is no documentation - this will follow in the future. When depends on how much time I can devote to improving the Qucs-S Help documentation.

More Xyce combination logic blocks and sequential components will be posted to the spice4qucs_current branch ASAP. Work is also starting on an equivalent Ngspice/SPICE OPUS Digital Library.

To give everyone an idea as to how the new Xyce Digital Library works the following examples are attached.

xycedigitalcomps xdfig1 xdfig2 xdfig3 xdfig4 xdfig5

MikeBrinson commented 8 years ago

Added a basic RF inductor model to the AnalogueCM library. This model is an example of a composite compact device model which has the number of model nodes minimised, yielding fast simulation run times. The following diagram illustrates the properties of the model. A number of references which describe the model physical properties are included with the RFind specification. rfind

blumount commented 7 years ago

Hi, I'm a new user of "qucs-0.0.19S-RC8", and enjoying this cool project.

I have a problem regarding "XyceDigital" library (perhaps same for all "SUBCKT" devices). The problem is as follows.

I created a schematic with XyceDigital library components (eg. AND2) and put some devices by mirroring about Y axis. After I closed my project and reopen it, I found that all mirrored devices are returned to the original direction. How can I keep these devices mirrored?

Thank you.

ra3xdh commented 7 years ago

@blumount : Yes, It's a bug. I can reproduce it with SpiceLibComp. I will try to add a fix in the next version. Also RC8 is not the latest , we have a 0.0.19 release now. See https://ra3xdh.github.io/ for more information and download links. Use issue tracker at my home repository to report the bugs https://github.com/ra3xdh/qucs/issues . Look at https://github.com/ra3xdh/qucs/issues/17 to track the status of this bug.

blumount commented 7 years ago

@ra3xdh : Thank you! I'll update to 0.0.19, and waiting for fix release.

ra3xdh commented 7 years ago

Closing, because #275 is closed. See details at https://github.com/Qucs/qucs/pull/275#issuecomment-311961111 Qucs-S development will be continued at http://ra3xdh.github.io/ Use issue tacker https://github.com/ra3xdh/qucs/issues to report bugs on spice4qucs.