according the Cadebnce suggestions I made such kind of VA module:
// VerilogA for bhvLib, vctemp, veriloga`include "constants.vams"`include "disciplines.vams"
module vctemp(in); parameter real tupdate = 10u from (1p:1];input in;electrical in;real temper=0;analog begin@(timer(tupdate,tupdate)) begin temper = V(in); $cds_set_temperature(temper);endendendmodule
Without timer I got unfortunately a crash with spectre. But with timer the DC and tran analysis with a thermal RC network (generating Vin) works fine (just a bit slow).
However, I also want to check the stability for my thermal loop, and this does not work well, because the loop gain plots are very noisy with the VA cell in my testbench.
I believe, if we had a continous T update according the the input voltage, stb would work fine, but as mentioned then I got the crashes.
I made an alternative modeling without verilogA and using a vcvs with -2mV//K to mimic the bipolar T-sensor behavior, and that works well also in stb analysis. But it would be great to make stb working also together with that VA module.
Does anybody has an idea to make cds_set_temperature work in stb (or AC) analysis?
StephanWeber said:Does anybody has an idea to make cds_set_temperature work in stb (or AC) analysis?
My limited understanding of the use of $cds_set_temperature from the verilog-A reference manual:
expression should be a real-type expression that represents the temperature to be set in degree Celsius. You can use variables and parameters in the expression.
When $cds_set_temperature() is called during simulation, the simulation behavior changes in a way similar to dynamic parameter simulation.
Hence, its use appears to be designed to be an alternative to using the temperature as a dynamic parameter in a transient simulation. This makes sense as you noted without a timer in your veriloga code, the simulation did not complete successfully.
As such, have you explored using a timer in your veriloga code to change the temperature at specific times in a transient simulation. For example, you might change the temperature every 1 ms to use an arbitrary example. Include a stability analysis (acnames = stb) at actimes of, for example, 0.50 ms 1.50 ms 2.50 ms. If you perform a transient simulation for 3 ms, the temperature will change from its value at time = 0, 1 ms, 2 ms, and 3 ms. A stability analysis will be performed at the DC operating point at simulation times 0.50 ms, 1.50 ms, and 2.50 ms. The acname and actimes parameters are set in the Transient simulation GUI under the Options-> Output tab as shown in Figure 1.
Do you think this might help you? Without knowing all the details of your circuit and application, I am not sure if it will address your question, but thought I would at least pass the thought by you StephanWeber.
the problem with stb analysis is that it looks incorrect, both for stb in general, and also for stb used in actimes and acnames. I believe it is a deeper problem.
You should contact support. I'm not sure this will work anyway - changing the temperature should only be done discretely and in small steps as is likely to cause major convergence difficulty otherwise.
My understanding of your question is that you a have a thermal controller that includes a BJT based temperature sensor and presumably some control circuit driving a heating element and you want to use stb analysis to check the stability of this loop when the thermal network is modeled with some RC network. If that is a correct understanding then I do not believe you will be able to get $cds_set_temperature() to work. stb analysis, like an ac analysis, finds a operating point, linearizes the network around that operating point and then simulates with frequency as a variable. $cds_set_temperature() doesn't really have the notion of an AC response from some signal to temperature. I think what you'll need to do is develop a model for your temperature sensor. That may be as simple as fitting a straight line or low order polynomial to a sensor output vs temperature curve that you simulate. Similarly, you would need a model for the heater + thermal network. You could do all of this with electrical analogies for the thermal network where you do something like use voltages to represent temperature and current to represent power. Alternatively you could write Verilog-A models and use the "thermal" discipline for the thermal portions of your model. The "thermal"discipline uses the "Temperature" nature as the potential and "Power" nature as the flow (see disciplines.vams in the spectre install directory). But the short answer is that from the point of view of AC and AC-like (noise, stb) simulations, temperature is like a fixed part of the operating point as opposed to an input to linearized models. If you sweep temperature in an AC sim, then spectre recomputes an operating point at each temperature but runs the AC part at a fixed frequency.
Your approach of using the timer to call $cds_set_temperature() should work though in a transient simulation as long as you can ensure small steps in temperature