The Designer's Guide Community
Forum
Welcome, Guest. Please Login or Register. Please follow the Forum guidelines.
Mar 28th, 2024, 1:00pm
Pages: 1
Send Topic Print
how to model second order differential equation with variable coefficients in ve (Read 3710 times)
mahesh venkatt
New Member
*
Offline



Posts: 4

how to model second order differential equation with variable coefficients in ve
Feb 17th, 2015, 11:17am
 
Hello everybody,

I have a transfer function OP(s)/IP(s) = (DC_gain * (1+s/z1)) / ((1+s/p1) (1+s/p2))
Values of z1, p1and p2 will change during the simulation.
I know that I cannot use Laplace_zp filter present in verilogams because values of z1, p1 and p2 will change during simulation which is not allowed in case of Laplace_zp filter.

Another solution I tried was to launch multiple Laplace_zp filters with different z1, p1 and p2 values and pass the filter value to the output based on the z1, p1 and p2 selection. This is actually working but impact my simulation speed a lot. I need to literally launch around 40 filters which is killing my simulation speeds.
Another solution i thought of trying is to convert the transfer function to 2nd order differential equations with variable coefficients
Now my equation looks some thing like this
      (1/p1*p2) d^2/dt(OP) + (p1+p2)/(p1*p2) d/dt(OP) + OP(t) = dc_gain * (1/z1) d/dt(IP) + dc_gain *IP(t)  ----- (1)
     
      OP(t) = ( dc_gain * (1/z1) d/dt(IP) + (dc_gain * IP(t))) - ( (1/p1*p2) d^2/dt(OP) + (p1+p2)/(p1*p2) d/dt(OP) )   ---- (2)

      Where p1, p2 and z1 will change during the course of simulation.


Code:
input [5:0] select_pole_zero_sig_i;
logic [5:0] select_pole_zero_sig_i;

electrical node1;
integer sel;

analog begin
  @(initial_step) begin
    sel = select_pole_zero_sig_i;
    zero_real = -(2 * `M_PI * freq_z1[sel]);
    pole1_real = - (2 * `M_PI * freq_p1);
    pole2_real = - (2 * `M_PI * freq_p2_[sel]);
  end

  @(select_pole_zero_sig_i) begin
    sel = select_pole_zero_sig_i;
    zero_real = -(2 * `M_PI * freq_z1[sel]);
    pole2_real = - (2 * `M_PI * freq_p2_[sel]);
  end
  // here i am converting equation (2) to verilogA
  V(node1) <+ ddt(V(op, on));
  V(op, on) <+  ((dc_gain * (ddt(V(ip, in))/zero_real)) + dc_gain * V(ip, in)) -
	( ((1/(pole1_real*pole2_real)) * ddt(V(node1))) +
	  (((pole1_real + pole2_real) / (pole1_real*pole2_real)) * ddt(V(op, on))) );
end
 



DC has successfully converged. But convergence failed while doing Trans analysis. Can somebody help me on this?
Back to top
 
« Last Edit: Feb 17th, 2015, 11:14pm by mahesh venkatt »  
View Profile   IP Logged
raja.cedt
Senior Fellow
******
Offline



Posts: 1516
Germany
Re: how to model second order differential equation with variable coefficients in ve
Reply #1 - Feb 18th, 2015, 5:25am
 
Hello,
Why cant you use SVCVS, there you can directly write transfer function and simulation takes no time.

Thanks,
Raj.
Back to top
 
 
View Profile WWW raja.sekhar86   IP Logged
mahesh venkatt
New Member
*
Offline



Posts: 4

Re: how to model second order differential equation with variable coefficients in ve
Reply #2 - Feb 18th, 2015, 9:41am
 
Hi Raj,

I think SVCVS also works like verilogA  laplace_zp filter. we can't change zeros/poles during simulation in SVCVS and in Laplace_zp. My problem is my zero and pole will change during simulation. That is the main reason I choose to convert the transfer function from s-domain to time domain.

Thanks
Mahesh
Back to top
 
 
View Profile   IP Logged
mahesh venkatt
New Member
*
Offline



Posts: 4

Re: how to model second order differential equation with variable coefficients in ve
Reply #3 - Feb 20th, 2015, 1:51am
 
Hello Everybody,

I could manage to solve the issue that i posted. Earlier i assigned sign as negative to zero, pole1 and pole2s but i shall take them as positive values. And also using this method it is also possible to change the zero, pole and pole2 values during simulation.

Regards
Venkata Mahesh
Back to top
 
 
View Profile   IP Logged
Pages: 1
Send Topic Print
Copyright 2002-2024 Designer’s Guide Consulting, Inc. Designer’s Guide® is a registered trademark of Designer’s Guide Consulting, Inc. All rights reserved. Send comments or questions to editor@designers-guide.org. Consider submitting a paper or model.