The Designer's Guide Community
Forum
Welcome, Guest. Please Login or Register. Please follow the Forum guidelines.
Apr 19th, 2024, 8:30pm
Pages: 1
Send Topic Print
wreal: modeling current and voltage in one port. How to approach/idealize ??? (Read 6467 times)
Zorro
Community Member
***
Offline



Posts: 63

wreal: modeling current and voltage in one port. How to approach/idealize ???
Sep 14th, 2015, 3:01am
 
Hello Community,

I have a question about how to approach the situation described in the subject of this thread.

I have already read this thread:
http://www.designers-guide.org/Forum/YaBB.pl?num=1262766115

So  it is clear to me (as Andrew Beckett wrote) that:

1. It's just that you can't model both voltage and current together, because the wreal represents a signal flow representation.

2. Yes, of course, you can have wreal_current and wreal_voltage disciplines in the same design - but a single node cannot be both (that's what I meant when I said that they can't be used together).

This is the situation. I have a block (DUT) which has an inout pin, let's call it vout.
The pin vout is connected to another block which is actually sinking current. See picture 1.

A very basic representation of what I need to model is described below. See picture 2.
If Isink=0, then vout=vmax (initially)
As Isink increases, the value of vout is reduced.
If Isink=Imax then vout=vmin, which is the minimum value expected for vout

If Isink increases to a value higher than Imax, then vout will go to zero and this also causes Isink to go to zero or in other words no current can be sinked if vout=0

Any idea/suggestion about how to approach this using only wreal?
The modeling approach can be simplified as desired.

The limitation is that I cannot add a new pin to represent for example the current separately and make vout react to it.

Thank you.
Back to top
 
« Last Edit: Sep 14th, 2015, 4:49am by Zorro »  
View Profile   IP Logged
Zorro
Community Member
***
Offline



Posts: 63

Re: wreal: modeling current and voltage in one port. How to approach/idealize/
Reply #1 - Sep 14th, 2015, 3:03am
 
picture 1
Back to top
 

picture_1.png
View Profile   IP Logged
Zorro
Community Member
***
Offline



Posts: 63

Re: wreal: modeling current and voltage in one port. How to approach/idealize/
Reply #2 - Sep 14th, 2015, 3:03am
 
Picture 2
Back to top
 

picture_2_001.png
View Profile   IP Logged
boe
Community Fellow
*****
Offline



Posts: 615

Re: wreal: modeling current and voltage in one port. How to approach/idealize ???
Reply #3 - Sep 15th, 2015, 4:23am
 
Zotto,
you could use an "out of module reference" to get access to the load current in the DUT.
- B O E
Back to top
 
 
View Profile   IP Logged
Zorro
Community Member
***
Offline



Posts: 63

Re: wreal: modeling current and voltage in one port. How to approach/idealize ???
Reply #4 - Sep 15th, 2015, 7:25am
 
Hi boe,

thank you for your feedback.

I will show you what I am doing. I don't know if this is what you are suggesting.

I was thinking about different approaches to solve the problem described above.

After reading some literature it became clear to me that when using wreal you have to sacrify "something" (either voltage or current for this particular example) and
make an abstract representation of how that part that you are not going to explicitly model affects the behavior of the device.

In this case, I decided that the pin "vout" will represent the voltage. The current at the load will be represented in an "abstract" manner.

In the DUT I included the code below. This is a first approach just to show how the output voltage will react to the external current.

Code inside the DUT:

wreal iload;

real vout_var;

always @(iload) begin

     if (iload > 100m) begin
           vout_var = 0.0;
     end else begin
           vout_var = 1.0;
     end

end



In my testbench I instantiate the DUT.

Code inside the Testbench

     real slope = 1.0;

     always #(2n*1e12) begin

           iload_ctrl      = iload_ctrl + slope*5m;
           
           if (iload_ctrl>200m) begin
                 slope = -1.0;
           end else if (iload_ctrl<0) begin
                 slope = +1.0;            
           end      
     end            
           
     assign      dut.iload = iload_ctrl;



Now if I run a simulation I can see how the voltage at pin vout reacts to the abstract representation of the "external current". See Picture 3 and Picture 4.

That external current is of course not connected to the pin vout, but this is the abstraction that I am using in order to represent the dependency vout = f(iload)

Is this similar to what you are suggesting? If not, could you please explain more in detail?

Thank you!
Zorro.
Back to top
 
 
View Profile   IP Logged
Zorro
Community Member
***
Offline



Posts: 63

Re: wreal: modeling current and voltage in one port. How to approach/idealize ???
Reply #5 - Sep 15th, 2015, 7:28am
 
Picture 3.
Back to top
 

picture_3.PNG
View Profile   IP Logged
Zorro
Community Member
***
Offline



Posts: 63

Re: wreal: modeling current and voltage in one port. How to approach/idealize ???
Reply #6 - Sep 15th, 2015, 7:28am
 
Picture 4.
Back to top
 

picture_4.PNG
View Profile   IP Logged
boe
Community Fellow
*****
Offline



Posts: 615

Re: wreal: modeling current and voltage in one port. How to approach/idealize ???
Reply #7 - Sep 16th, 2015, 8:16am
 
Zorro wrote on Sep 15th, 2015, 7:25am:
Hi boe,

thank you for your feedback.
...
     assign      dut.iload = iload_ctrl;
...
Is this similar to what you are suggesting? If not, could you please explain more in detail?

Thank you!
Zorro.
Yes, this kind of assignment is what I wanted to suggest.
- B O E
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.