Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Qucs-S creating corrupt libraries #432

Closed
5 tasks done
tomhajjar opened this issue Jan 3, 2024 · 11 comments · Fixed by #520
Closed
5 tasks done

Qucs-S creating corrupt libraries #432

tomhajjar opened this issue Jan 3, 2024 · 11 comments · Fixed by #520
Assignees
Labels
Milestone

Comments

@tomhajjar
Copy link

tomhajjar commented Jan 3, 2024

I'm having issues with Qucs-S 24.1.0 creating libraries consisting of only the symbol section. The Spice section is missing. The goal was to make a OpAmp library that worked for qucsator and ngspice. The name I used is OpAmp.lib.

Qucs-S 0.0.24 works. However, since the model.sch files were created by 24.0.1 I have to do a lot more mouse clicks waving rev problems.

The problem seems to occur in Qucs-S 24.1.0 after jumping back and forth between using ngspice and qucsator multiple times to check that each model.sch for the library is functional for both qucsator and ngspice. The library is made properly a few times and then it become corrupt every new attempt. What exact sequence triggers the issue is unknown.

What is really odd is once the "problem" happens, it seems like the project or files become corrupted. Every attempt to make the library fails. I cannot find anything wrong with the project or the files. Restarting Qucs or Rebooting the PC doesn't help. I even made a new project containing only the model.sch and models.cir files. The created library was good only the first time and became "corrupt" every future attempt.

As stated in #402, any wrong mouse click will make the files x times bigger and make you re-enter the descriptions over and over. Not being able to overwrite a library even in the usr_lib folder is annoying. I've had to delete the file countless times. It should give a warning and allow the overwrite. If you want to make a new "system" library of the same name you must delete the system file. Using a new name is a problem since you cannot just rename the library later since the library name is embedded inside the file multiple times for each device.

TODO list from @ra3xdh

  • Disable qucsconv invocation when creating library
  • Add warnings like "Subcircuit contains SpiceFile device. No Qucsaator model generated."
  • Allow to create the system and user library with the same name
  • Ask to rewrite library in user_lib directory.
  • Update symbols in SpiceOpamp.lib

BAD
2024-01-03_164924

GOOD
2024-01-03_164945

Op-Amp_Library_prj.zip

@tomhajjar
Copy link
Author

tomhajjar commented Jan 4, 2024

Vadim

Can you explain what the "new" folders containing *.lst files in the usr_lib directory that are created when making the new library are used for? Qucs/QucsStudio never created them.

The *.lst files look like entries in the the Qucs libraries for qucsator. Are they needed by Qucs-S for qucsator during analysis or are they temporary "scratch" folders? Can they be deleted after the library is made?

The new libraries Qucs-S makes look very different than the libraries Qucs made for qucsator. Can Qucs-S make qucsator "compatible" libraries?

The blacklist files also hide files in the usr_lib directory. This can make creating replacement libraries with the same name as the system library more difficult. Renaming libraries is not possible without a lot of editing of the contents.

2024-01-03_185542

2024-01-03_185618

@ra3xdh
Copy link
Owner

ra3xdh commented Jan 4, 2024

The goal was to make a OpAmp library that worked for qucsator and ngspice. The name I used is OpAmp.lib.

The SpiceOpamp.lib doesn't contain qucsator models intentionally. The making of the complex IC library containing both SPICE/Qucsator netlist doesn't cost its time effort. The Qucsator has very poor performance for the netlist converted form SPICE. Also Qucsator has poor performance for schematics with many nonlinear devices. I have tried to make such library about 5 years ago, and it the simulation may hang or fail to converge even for simple Opamp circuit. So I decided to restrict realistic Opamp models by SPICE only. It's better to have no qucsator model that have the model that will fail to converge every time. The Qucsator should be restricted by only RF devices. Ideal Opamp is sufficient for Qucsator.

Can you explain what the "new" folders containing *.lst files

These files are produced by qucsconv utility that converts SPICE netlists to Qucsator. The conversion is not performed when SPICE kernel is selected. The library contains the lst file reference instead of model inclusion. I don't know why Qucs developers decided to use *.lst files. It's need to completely disable this procedure, because the may be misleaded.

Can Qucs-S make qucsator "compatible" libraries?

Yes, it can if the netlist contain only primitive devices and unified equations. For example the Crystal.lib was made in a such way.

@ra3xdh
Copy link
Owner

ra3xdh commented Jan 4, 2024

I have added TODO for this issue. Outcome: conversion SPICE/Qucs should be disabled to prevent convergence errors or similar issues with qucsator. The qucsator model should be generated only for subcircuits that consists of equatios and primitive devices. Add warnings like "Subcircuit contains SpiceFile device. No Qucsaator model generated." Qucsator is not recommended for general purpose circuits simulation and should be restricted by RF domain only.

@ra3xdh ra3xdh added the library label Jan 4, 2024
@ra3xdh ra3xdh added this to the 24.1.0 milestone Jan 4, 2024
@tomhajjar
Copy link
Author

Vadim

What about the OpAmp Library missing the device Spice file information as shown in the "BAD" example? Were you able to recreate this?

@ra3xdh
Copy link
Owner

ra3xdh commented Jan 4, 2024

What about the OpAmp Library missing the device Spice file information as shown in the "BAD" example?

This library was created by Qucsator mode. It is activated when Qucsator is selected as the default simulation backend. This mode was intended to create libraries for pure Qucs without SPICE extensions. I would disable this mode and keep only Qucs-S library workflow.

@tomhajjar
Copy link
Author

Being able to create a library with the same name as one in the system or usr_lib folders without having to delete any first would be nice. Since the file is written to the usr_lib folder a warning should be sufficient before allowing over-write. System libraries can always be replaced if deleted or over-written.

@tomhajjar
Copy link
Author

tomhajjar commented Jan 4, 2024

As a side note, the symbols used in the original OpAmps.lib and SpiceOpamp.lib have issues. That was another reason for creating a new OpAmp library. The symbols don't indicate Vcc, Vee or GND/Enable or have a universal size and pinout. Assuming one knows what the unlabeled pins are, when you mirror the device it is easy to connect the device wrong. I propose using symbols with labeling for each pin and tryin to have universal sizes. Need to create new symbols with Enable pins.

I also did work on making a Voltage Comparator library since Qucs-S lacks one.

2024-01-04_091334

@ra3xdh
Copy link
Owner

ra3xdh commented Jan 4, 2024

the original OpAmps.lib and SpiceOpamp.lib have issues

I would edit the library in the text editor and add labels near the pins instead of recreation of the library. You may edit one symbol and look its code to determine where to insert label definitions.

the original OpAmps.lib

This library is deprecated and kept only compatibility with old schematics. It should not be modified. See #232

I also did work on making a Voltage Comparator library since Qucs-S lacks one.

Yes, this contribution is highly welcome. The SpiceOpamp library contains only LM311 model.

@tomhajjar
Copy link
Author

Here is the revised SpiceOpamp.lib and test data to confirm the labels assigned to pins are correct. SpiceOpamp.lib is in the folder.

2024-01-04_114000

2024-01-04_114147

2024-01-04_114305

2024-01-04_114354

SpiceOpamp_library_prj.zip

@ra3xdh
Copy link
Owner

ra3xdh commented Jan 4, 2024

Here is the revised SpiceOpamp.lib

Thanks! I have just uploaded an updated library in the repository.

@ra3xdh ra3xdh self-assigned this Feb 1, 2024
@ra3xdh ra3xdh linked a pull request Feb 1, 2024 that will close this issue
ra3xdh added a commit that referenced this issue Feb 1, 2024
@ra3xdh
Copy link
Owner

ra3xdh commented Feb 1, 2024

Fixed via #520

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants