Scripting in Qspice

Hi Kevin,

If I want to introduce a script of digital control loop and integrate it with the analog circuit through some input/output signals, how to do that??

I have a device guideline in Github which you can download from here. Goto section of Ø-Device, there is simple tutorial and information about DLL device.

Device Reference Guide by KSKelvin.pdf at main · KSKelvin-Github/Qspice

@RDunn and I had a project to implement PID controller example using Qspice, which may be a good reference to study.

QSpice/PID_Controller at main · robdunn4/QSpice (github.com)

https://cameron-eda.com/2020/06/03/rolling-your-own-ams-simulator/#

I did PWL interfaces in a couple of old SPICE simulators too.

Your chances in Qspice are limited unless someone decides to open-source it.

Thanks for the resources Kelvin.

I am doing one closed loop simulation and the Verilog is used for DLL.
The code is absolutely fine I checked in Questasim tool.
But when I’m providing some inputs from my analog circuitry to DLL somehow the results are not coming. I checked the datatype but no improvement.

Is there any example is done for closed loop using verilog.
Just wanted to understand the data how it is taking in input.

Verilog is an area in which I have no knowledge. I only know that Qspice offers a demo circuit; the typical path is as follows: C:\Program Files\QSPICE\Examples

Copy VerilogCounter.qsch, counter.v, and counter.cpp to a directory where you have full access. Now you can compile .v and then .cpp and run the schematic.

This is all I can assist with. I hope other experts in Verilog can help you out.

Oh Okay no issues. I’ll check.
Thanks

Hi, Shaurya.

I’m not a Verilog guy either but I could check some things if you post a small example (*.qsch & code bits).

–robert

Sure Thanks.
I’m also debugging it.

Kelvin, Just few questions,
(1) Is performing stress analysis for components in Qspice is possible??

Also,
(2)Is there any option available if suppose a complex circuit is not converging so by changing those settings we can converge it?
So is there any parameters are available?

(1) I only know people commonly use Monte Carlo, but not exactly as the complex analysis I saw last week in the Smoke Analysis enquiry post which can performed in PSpice. This is really not a topic I familiar.
e.g. Monte Carlo analysis - QSPICE - Qorvo Tech Forum

(2) I think everybody hate “timestep too small” in SPICE, including myself. For Qspice, I will suggest you try following

  1. .option fastmath=0 : disable fastmath and use Qspice80.exe, this will allow 80bit math calculation, more precise math, but a bit slower in simulation
  2. .option trtol=7 method=gear : if the model is PSpice model, you may consider that. PSpice use different trtol and integration method. But you may be careful gear integration added damper into circuit, which suppress oscillation and introduce more error
  3. .option gshunt=<value> or .option cshunt=<value>, these are to add conductance or capacitance from every node to ground. Sometime, they can help simulation to converge as they add a path for current to flow to ground. Setting value to 1e-12 or 1e-11 for a try.
  4. .option maxstep : force a maximum timestep!!! Check your switching frequency or highest operating frequency, set a maxstep at least 1/10/fmax (i.e. 10 calculation samples per period)
  5. If everything fail, post the circuit to forum to see if someone can help.
  6. .option ITL4=<value> : this increase the number of transient iteration limit. May be set to 100 or 1000 to see if any improvement by allow more iteration.

Stress Analysis or Smoke Analysis, I was thinking if we could take the values of max, min parameters of voltage, current and power through tool.
And these value if i could export to excel and there I have accepted parameters for min max values, where these values are compared as per the guidelines and we can perform stress analysis in that excel.