The Designer's Guide Community
Forum
Welcome, Guest. Please Login or Register. Please follow the Forum guidelines.
May 6th, 2024, 6:24am
Pages: 1
Send Topic Print
Solving a differential equation using VerilogA Model (Read 3486 times)
Ricky Chen
Community Member
***
Offline



Posts: 49

Solving a differential equation using VerilogA Model
Sep 19th, 2013, 7:06am
 
Dear All,

I need to solve a differntial eqaition in my VerilogA marco-model

The eqaution I want to solve is:-



ddt(V(alpha)) = Vx * V(in)

V(in) is the input signal ( as a function of time 't')  to the model.

Vx is read from a "table_model" at (t + V(alpha) i.e (  $(abstime) + V(alpha)  )

To solve this  I did as below:-



// define branches
branch (alpha) alpha1;
branch (alpha) alpha2;

I(alpha1) <+ -Vx * V(in);

I(alpha2) <+ ddt(V(alpha));



 The KCL at alpha forces I(alpha1) + I(alpha2) = 0  and solve the differntial equation.  



I went and checked the results.

At  $abstime = t1

    Vx * V(in)= x1

    V(alpha)= y1

At  $abstime = t2

    Vx * V(in)= x2

    V(alpha)= y2



I think y2 should be equal to

        y2= [ x2 * (t2 - t1) ]  + y1.

But SPECTRE is showing something different than "y2" .


Can anybody please tell where I am going wrong ?
Whether my line of thought is correct ?
or it may be some accuracy issue of Spectre lile Reltol, Vabstol,Abstol playing some rule ?

Also I solve the above differntial eqaution using MATLAB ODE45().
It is totally different from the SPECTRE result !



Kind Regards,
Back to top
 
« Last Edit: Sep 19th, 2013, 11:43am by Ricky Chen »  
View Profile   IP Logged
boe
Community Fellow
*****
Offline



Posts: 615

Re: Solving a differential equation using VerilogA Model
Reply #1 - Sep 23rd, 2013, 12:52am
 
Ricky Chen wrote on Sep 19th, 2013, 7:06am:
Dear All,

I need to solve a differntial eqaition in my VerilogA marco-model

The eqaution I want to solve is:-



ddt(V(alpha)) = Vx * V(in)

V(in) is the input signal ( as a function of time 't')  to the model.

Vx is read from a "table_model" at (t + V(alpha) i.e (  $(abstime) + V(alpha)  )

To solve this  I did as below:-



// define branches
branch (alpha) alpha1;
branch (alpha) alpha2;

I(alpha1) <+ -Vx * V(in);

I(alpha2) <+ ddt(V(alpha));



 The KCL at alpha forces I(alpha1) + I(alpha2) = 0  and solve the differntial equation.  
[Added:] dValpha(t)/dt = f(Valpha(t), t) * Vin(t), right?

Quote:


I went and checked the results.

At  $abstime = t1

    Vx * V(in)= x1

    V(alpha)= y1

At  $abstime = t2

    Vx * V(in)= x2

    V(alpha)= y2



I think y2 should be equal to

        y2= [ x2 * (t2 - t1) ]  + y1.
I don't think so.

Quote:
But SPECTRE is showing something different than "y2" .


Can anybody please tell where I am going wrong ?
Whether my line of thought is correct ?
or it may be some accuracy issue of Spectre lile Reltol, Vabstol,Abstol playing some rule ?

Also I solve the above differntial eqaution using MATLAB ODE45().
It is totally different from the SPECTRE result !
Did you try an "indirect branch assignment statement"?

- B O E
Back to top
 
« Last Edit: Sep 23rd, 2013, 8:22am by boe »  
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.