Hello,
I am trying to write a custom user model that will be used in envelope simulations. The model is a base band signal source used to modulate an IQ modulatior. I need to know the current "time" of the simulation when the custom model code is called. During a transient analysis there is a function available called get_tr_time(), but it only returns a valid time during a transient analysis (ie called from analyze_tr). Does anyone know how to get the current simulation time in an envelope simulation (ie within analyze_nl).
0dBi
I am trying to write a custom user model that will be used in envelope simulations. The model is a base band signal source used to modulate an IQ modulatior. I need to know the current "time" of the simulation when the custom model code is called. During a transient analysis there is a function available called get_tr_time(), but it only returns a valid time during a transient analysis (ie called from analyze_tr). Does anyone know how to get the current simulation time in an envelope simulation (ie within analyze_nl).
0dBi
However, there is a workaround:
Define a model parameter (for example, my_time), and assign the parameter value as "time" in your schematic. In the model source code, time will be then available as my_time_P.