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

Add SPICE entry for VCresistor #959

Closed
2 tasks done
tomhajjar opened this issue Sep 25, 2024 · 9 comments · Fixed by #1016
Closed
2 tasks done

Add SPICE entry for VCresistor #959

tomhajjar opened this issue Sep 25, 2024 · 9 comments · Fixed by #1016
Assignees
Milestone

Comments

@tomhajjar
Copy link

tomhajjar commented Sep 25, 2024

I updated all the files 9/26/24.

I'm having an issue getting three Voltage Controlled Resistor models in the link below to work in Qucs-S.
http://www.ecircuitcenter.com/Circuits/vc_resistor1/vc_resistor1.htm

ngspice:
I made three netlists, VCResistor1.cir, VCResistor2.cir and VCResistor3.cir and confirmed they work in ngspice.
Normally I edit the Qucs-S generated netlist but this time I edited the netlist from the web page above.

Qucs-S:
VCRES2.cir is the same as the original model VCRES2.lib but uses .PARAM R=10k.
I cannot get "VRES2_tran.sch" or "VRES2_lib_tran.sch" to work. "VRES2_lib_tran.sch" should be the same as "VCResistor2.cir".

TODO list

  • Add SPICE entry for VCresistor device
  • Change Qucsator netlist entry to make this device ADMS-independent

2024-09-25_135627
2024-09-25_135604

VCR_prj.zip

@ra3xdh
Copy link
Owner

ra3xdh commented Sep 25, 2024

The SPICE model is not implemented for VCresistor. It is not a standard SPICE device. It is represented as the equivalent subcircuit in the attached SPICE netlists. Furthermore this device is marked as SPICE-incompatible in Qucs-S, one cannot insert in SPICE mode. It never worked with SPICE backend. I can try to add SPICE model for this device in the future version.

@tomhajjar
Copy link
Author

tomhajjar commented Sep 25, 2024

You misunderstand, This project doesn't use VCresistor. It uses all Spice compatible components. I made the symbol from scratch.

@ra3xdh
Copy link
Owner

ra3xdh commented Sep 25, 2024

Ngspice netlist and Qucs-S schematic uses different VCresistor model. Try setting the low voltage of square wave source to 0.1V and the simulation will work. Otherwise you have division by zero inside the subcircuit equation. It is not Qucs-S error. I can reproduce the same error with Ngspice CLI version after switching the model and setting the low voltage of the PWL source in the netlist to 0.0V.

@tomhajjar
Copy link
Author

tomhajjar commented Sep 25, 2024

Did you open the attached project? There is no "VCresistor". The input is a triangle wave.

@ra3xdh
Copy link
Owner

ra3xdh commented Sep 25, 2024

Yes, I tried the simulation. Everything works after setting U0=0.1V on the source. Otherwise you have division by zero in the model.

image

@tomhajjar
Copy link
Author

tomhajjar commented Sep 25, 2024

I updated all the files 9/26/24. The Author recommends using VCRES2. I didn't put extra components like 0.001 Volts/Ohms to stop divide by zero. A little more work and we might have a viable VCR for the library.

There are numerous other VCR models available I didn't test.

VCR_prj.zip

@ra3xdh ra3xdh changed the title Simulations work in ngspice but not Qucs-S Add SPICE entry for VCresistor Sep 26, 2024
@ra3xdh ra3xdh self-assigned this Sep 26, 2024
@ra3xdh
Copy link
Owner

ra3xdh commented Sep 26, 2024

I will add the SPICE entry for the device in the system library in the next release. Also it should be possible to correct Qucsator device entry to make this device ADMS-independent. In fact the VCRes device is a VCCS with equation.

@tomhajjar
Copy link
Author

New device should have some protection against "crashing" ngspice or qucsator-rf. Adding some 0.001 resistors or 1mv sources could help.

Another issue is the question of the "resistor" being polarity sensitive. I haven't tested this however. If this is an issue, the new symbol I created should reflect this.

ngspice has a "Behavioral" resistor. This could be an alternative.

2024-09-26_093509

@ra3xdh
Copy link
Owner

ra3xdh commented Oct 23, 2024

Implemented by #1016

@ra3xdh ra3xdh added this to the 24.4.0 milestone Oct 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants