The Designer's Guide Community Forum
https://designers-guide.org/forum/YaBB.pl Design Languages >> Verilog-AMS >> solving for nonlinear diff. equation in nonlinear oscillator models https://designers-guide.org/forum/YaBB.pl?num=1219873266 Message started by Aigneryu on Aug 27th, 2008, 2:41pm |
Title: solving for nonlinear diff. equation in nonlinear oscillator models Post by Aigneryu on Aug 27th, 2008, 2:41pm I followed the description in : "Implementing Nonlinear Oscillator Macromodels using Verilog-AMS for Accurate Prediction of Injection Locking Behaviors of Oscillators". The example given in the paper is performed in their in-house simulator. I modified the original verilog-AMS formatted model to verilog-A and simulate it in spectre transient. The main idea for solving the nonlinear differential equation is making use of the KCL such that the simulator can force the equation to be zero and solve the variables implicitly. However, when I implement this model, the error in the KCL node always blows up in spectre simulation as long as I add non-zero perturbation. Following is the model and the needed table I use. // VerilogA for nonlinear oscillator, veriloga `include "constants.vams" `include "disciplines.vams" module oscillator(vout, alpha, phase_out, in); input in; electrical in; output vout; electrical vout; output alpha; output phase_out; electrical phase_out; // PARAMETERS parameter real fc = 1G from (0:inf); // need to be the same as the ppv recording freq parameter real gmin= 1e-12; // LOCAL VARIABLES electrical KCL_node; electrical alpha; real phase, ppv, period, wc, perturbed_time; analog begin @(initial_step) begin //set up initial condition for eq(9) V(alpha) <+ 0; V(KCL_node) <+0; wc = 2*`M_PI*fc; period = 1/fc; end perturbed_time = ($abstime+V(alpha)) % period; // look up ppv table from spectre ppv = $table_model(perturbed_time, "/usr2/ppv.txt", "L"); // sum up terms to a floating KCL node to force spectre to solve the equation // right hand side of eq(9) // right hand side of eq(9) I(KCL_node) <+ -ppv*V(in) + ddt(V(alpha)); // optional leaky gmin to help the convergence I(KCL_node) <+ gmin*V(KCL_node); // The KCL at KCL_node forces // so that eq(9) is solved at each time point phase = V(alpha)*wc; // output only // look up table to generate output //V(out) <+ $table_model(perturbed_time, "osc_output.table", "L"); V(vout) <+ sin(wc*perturbed_time); V(phase_out) <+ phase; end endmodule // ppv table "ppv.txt" 0.0000000e+000 5.8420400e+001 6.2500000e-011 -3.0277600e+002 1.2500000e-010 -7.1041400e+002 1.8749995e-010 -9.5435500e+002 2.5000000e-010 -9.0634200e+002 3.1249995e-010 -6.8783200e+002 3.7500000e-010 -4.9533300e+002 4.3749995e-010 -3.5968600e+002 5.0000000e-010 -1.8772200e+002 5.6249995e-010 1.0692840e+002 6.2500000e-010 5.1263730e+002 6.8749995e-010 8.6598650e+002 7.5000000e-010 9.6490730e+002 8.1249995e-010 8.0380730e+002 8.7500000e-010 5.8170910e+002 9.3749995e-010 4.2522800e+002 1.0000000e-009 2.8483540e+002 can anybody give me a suggestion for solving nonlinear differential equations in spectre? Sincerely, |
The Designer's Guide Community Forum » Powered by YaBB 2.2.2! YaBB © 2000-2008. All Rights Reserved. |