The Designer's Guide Community
Forum
Welcome, Guest. Please Login or Register. Please follow the Forum guidelines.
Jul 16th, 2024, 10:29pm
Pages: 1
Send Topic Print
battery model (Read 9521 times)
grosser
Community Member
***
Offline



Posts: 57

battery model
Sep 06th, 2007, 1:33pm
 
hello

i am working on the veriloga battery model proposed by prof. Mora in the article

http://www.rincon-mora.com/publicat/journals/tec05_batt_modl.pdf

I am beginer and have some problems in implementing that in veriloga.

In the attached schematics there is battery model with nodes.

I did it as follows

module battery(minus, plus, vref);
inout minus, plus, vref;
electrical minus,plus,vref;

electrical vsoc,v1,v2,v3;

parameter real Rdis=10M;
parameter cap=0.015;
real C,capS,capL,vtemp;


analog begin

    @(initial_step) begin
    vtemp =1;
    end
   
    V(vsoc,vref) <+ vtemp;
   
    C=3600*cap;
    capS=-752.9*limexp(-13.51*V(vsoc,vref))+703.6;
    capL=-6056*limexp(-27.12*V(vsoc,vref))+4475;

    I(vsoc,vref) <+ V(vsoc,vref)/Rdis;
    I(vsoc,vref) <+ ddt(C*V(vsoc,vref));
    I(vsoc,vref) <+ I(minus,v1);
   
    V(v1,minus) <+ -1.031*limexp(-35*V(vsoc,vref))+3.685+0.2156*V(vsoc,vref)-0.1178*pow(V(vsoc,vref
),2)+0.3201*pow(V(vsoc,vref),3);
    I(v1,v2) <+ V(v1,v2)/(0.1562*limexp(-24.37*V(vsoc,vref))+0.07446);
   
    I(v2,v3) <+ V(v2,v3)/(0.3208*limexp(-29.14*V(vsoc,vref)));
    I(v2,v3) <+ ddt(capS);
   
    I(v3,plus) <+ V(v3,plus)/(6.603*limexp(-155.2*V(vsoc,vref))+0.04984);
    I(v3,plus) <+ ddt(capL);
   
end


there is one problem, the model is not working Smiley

can you advice anything?

regards
Back to top
 
 
View Profile   IP Logged
Geoffrey_Coram
Senior Fellow
******
Offline



Posts: 1999
Massachusetts, USA
Re: battery model
Reply #1 - Sep 7th, 2007, 6:05am
 
grosser wrote on Sep 6th, 2007, 1:33pm:
    @(initial_step) begin
    vtemp =1;
    end
   
    V(vsoc,vref) <+ vtemp;


This code has no effect; you contribute to the voltage but later contribute to the current I(vsoc,vref).  You can't set both I and V, and Verilog-A's rules say that the last contribution type wins (see "value retention" in the LRM).

You probably need to use a nodeset to set the initial capacitor voltage.
Back to top
 
 

If at first you do succeed, STOP, raise your standards, and stop wasting your time.
View Profile WWW   IP Logged
grosser
Community Member
***
Offline



Posts: 57

Re: battery model
Reply #2 - Sep 7th, 2007, 6:14am
 
let's forget about initial block for a while

it also doesn't work without it. the problem is i'm doing it quite intuitially. the ground at the schematic on the left is vref in the code.

i don't see the problem which happens here
Back to top
 
 
View Profile   IP Logged
Geoffrey_Coram
Senior Fellow
******
Offline



Posts: 1999
Massachusetts, USA
Re: battery model
Reply #3 - Sep 10th, 2007, 7:58am
 
What simulation are you trying to run?  From your initial_step code, it looked like maybe you were trying to simulate an initially charged battery.  I didn't read the paper: is it supposed to be able to model the battery being charged?  

If the battery is initially discharged -- which is one time=0 solution to the equations you've written -- then you won't get a very interesting simulation.
Back to top
 
 

If at first you do succeed, STOP, raise your standards, and stop wasting your time.
View Profile WWW   IP Logged
Geoffrey_Coram
Senior Fellow
******
Offline



Posts: 1999
Massachusetts, USA
Re: battery model
Reply #4 - Sep 10th, 2007, 8:03am
 
Also, the limexp functions are quite complicated, I can't get any intuition about what's really supposed to happen.  You should probably try simplifying the model -- eg, do you understand the model well enough to turn it into a simple battery with internal series resistance?  Then add the other features, like the increase in resistance as the charge decreases, and make sure each works like you expect before adding the next.
Back to top
 
 

If at first you do succeed, STOP, raise your standards, and stop wasting your time.
View Profile WWW   IP Logged
grosser
Community Member
***
Offline



Posts: 57

Re: battery model
Reply #5 - Sep 10th, 2007, 1:03pm
 
Geoffrey_Coram wrote on Sep 10th, 2007, 7:58am:
What simulation are you trying to run?  From your initial_step code, it looked like maybe you were trying to simulate an initially charged battery.  I didn't read the paper: is it supposed to be able to model the battery being charged?  


i am doing a transient one. yes, firstly the battery is fully charged (Vsoc should be 1 initially)
Back to top
 
 
View Profile   IP Logged
grosser
Community Member
***
Offline



Posts: 57

Re: battery model
Reply #6 - Sep 10th, 2007, 1:05pm
 
Geoffrey_Coram wrote on Sep 10th, 2007, 8:03am:
Also, the limexp functions are quite complicated, I can't get any intuition about what's really supposed to happen.  You should probably try simplifying the model -- eg, do you understand the model well enough to turn it into a simple battery with internal series resistance?  Then add the other features, like the increase in resistance as the charge decreases, and make sure each works like you expect before adding the next.


these functions describe transient response of the specific measured battery. it was extracted from measurment results so it looks like it looks.

thanks
Back to top
 
 
View Profile   IP Logged
Geoffrey_Coram
Senior Fellow
******
Offline



Posts: 1999
Massachusetts, USA
Re: battery model
Reply #7 - Sep 11th, 2007, 6:07am
 
grosser wrote on Sep 10th, 2007, 1:05pm:
these functions describe transient response of the specific measured battery. it was extracted from measurment results so it looks like it looks.


OK, you've completely missed my point.  You've got a very complicated model that you say "doesn't work."  I'm suggesting that you remove some of the complications to see if you can get something that shows *qualitatively* the right behavior -- even if it doesn't exactly match your measurement -- so you can see where the problem lies.  This is a fundamental idea for debugging models.
Back to top
 
 

If at first you do succeed, STOP, raise your standards, and stop wasting your time.
View Profile WWW   IP Logged
Geoffrey_Coram
Senior Fellow
******
Offline



Posts: 1999
Massachusetts, USA
Re: battery model
Reply #8 - Sep 11th, 2007, 6:13am
 
grosser wrote on Sep 10th, 2007, 1:03pm:
Geoffrey_Coram wrote on Sep 10th, 2007, 7:58am:
What simulation are you trying to run?  From your initial_step code, it looked like maybe you were trying to simulate an initially charged battery.  I didn't read the paper: is it supposed to be able to model the battery being charged?  


i am doing a transient one. yes, firstly the battery is fully charged (Vsoc should be 1 initially)


Your model is incapable of simulating this situation, in which the battery starts out charged.

Your initial_step code doesn't work because of value retention (did you look that up in the LRM like I suggested?).  If you just take it out ("let's forget about initial block for a while") then the simulation will start with a discharged battery, and presumably it just stays discharged during your simulation.

You need to find a way to start the battery charged; you might be able to use
 if (analysis("ic"))
or you might need to use a nodeset/initial condition specific to your simulator.
Back to top
 
 

If at first you do succeed, STOP, raise your standards, and stop wasting your time.
View Profile WWW   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.