Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

how to run transient simulation with time varying resistance

Status
Not open for further replies.
Re: how to run transient simulation with time varying resist

v_c said:
I think you are getting confused about node R. That node is strictly for generating and arbitrary signal that is
supposed to give us the the value of R. Nothing else will be connected to that node.

Take a look at the attached file for a schematic of my system. What I gave was a particular application, but yes
you can use this as a subcircuit as follows.

.subckt var_res plus minus control
Gpm plus minus value={v(plus,minus)/v(control)}
Rcontrol control 0 10k
.ends var_res

so this resistor has the normal terminals plus and minus and has an extra terminal called control.
Even though control is a voltage, the subcircuit interprets this as the resistance value. So if you
put a 3V source at control, this will be a 3 ohm resistor. And this subcircuit is totally re-usable.
I think what may be confusing is the fact that the varying value of the resistance is being set
by a voltage -- there is nothing we can do about this, spice only understands voltage and current.
So just try out this subcircuit, first with a constant voltage at v(control) to see if this really works
as a resistor -- I think you will find that it works just fine. Then, you can try to put any arbitrary
voltage at the control node, whatever voltage you put there in volts will be the resistance (in ohms)
of the node from plus to minus.

Best regards,
v_c

Hi,
I hope you understand the difference between a grounded and floating resistor.

If you have a two-terminal resistor, then each of the nodes can be connected to two arbid nodes.

You have a grounded resistor from node 2 to ground and not a two-terminal resistor, that was why i was specifically asking what are the two nodes of the resistor.

The original question was how you model a time varying resistor. That resistor can be connected between vdd and output node of a resistively loaded diff pair, between output and input nodes of an opamp etc.. Hope you see the difference.
When the resistor is tied between input and output nodes of an opamp, the
current through the resistor is defined by the input and output voltages of the opamp, but whenever you vccs, you can't independently define the voltage across two nodes of your model. This is when impedances connected to the two resistor nodes (as i mentioned in my second reply) are important.

If you want a generic two-port resistor model, your model will not work.
Or maybe, can you show me some modification where you model a true two-port time-varying resistor terminal model that can be connected across any 2 nodes in a circuit.

Bharath
 

Re: how to run transient simulation with time varying resist

My model can be used as floating or grounded resistor -- just take a look at the subcircuit and please try it. Why are you bringing in a diff pair? This has nothing to do with the question asked. I do understand the difference between and grounded and floating resistor and if you just try out the file below you will see that I have used it as a grounded resistor. But there is nothing that prevents you from using it as a non-grounded resistor.

Try out the following circuit, save it as a *.cir file and simulate in PSpice.
Once you try experimenting with this you will see how this works. Don't tell me it does not work -- show me it does not work.
If you don't believe it, just search on the web and on the Cadence web site
and you will see references to stuff like this -- I did not invent this, I am just using it.

Code:
* sample circuit
Vs 1 0 30V        ; this is just a 30V dc source
Rs 1 2 5          ; 5 ohm series resistance
Xr 2 0 3 var_res  ; this is our variable resistance
Vc 3 0 10         ; this is the control voltage = 10V this makes
                  ; the variable resistance a constant 10 ohms
* subcircuit definition
.subckt var_res plus minus control
Gpm plus minus value={v(plus,minus)/v(control)}
Rcontrol control 0 10k
.ends var_res

.op
.end

OK -- tell me what kind of variable resistance that you want and the circuit and I will show you how it can be done.

Anyone else want to take a shot at agreeing/disagreeing with me?

--Vahe
 

Re: how to run transient simulation with time varying resist

v_c said:
My model can be used as floating or grounded resistor -- just take a look at the subcircuit and please try it. Why are you bringing in a diff pair? This has nothing to do with the question asked. I do understand the difference between and grounded and floating resistor and if you just try out the file below you will see that I have used it as a grounded resistor. But there is nothing that prevents you from using it as a non-grounded resistor.

Try out the following circuit, save it as a *.cir file and simulate in PSpice.
Once you try experimenting with this you will see how this works.
If you don't believe it, just search on the web and on the Cadence web site
and you will see references to stuff like this -- I did not invent this, I am just using it.

Code:
* sample circuit
Vs 1 0 30V        ; this is just a 30V dc source
Rs 1 2 5          ; 5 ohm series resistance
Xr 2 0 3 var_res  ; this is our variable resistance
Vc 3 0 10         ; this is the control voltage = 10V this makes
                  ; the variable resistance a constant 10 ohms
* subcircuit definition
.subckt var_res plus minus control
Gpm plus minus value={v(plus,minus)/v(control)}
Rcontrol control 0 10k
.ends var_res

.op
.end

This is the difference between a grounded and a floating resistor :

A grounded resistor is a single terminal device. One end of it is always (note the always) connected to ground. If this model is used in a bigger circuit, it can be connected in a bigger circuit in only one node. The other node * cannot * be used.

A floating resistor is a two-terminal device. When you use a resistor in a circuit, ie, when you design a circuit using the resistor, you should be able to connect it across any two nodes in a circuit. The two nodes can be any nodes - high impedance nodes, low impedance nodes , supply nodes etc.

Now, is this difference of using the resistor model in a bigger circuit clear?

When you model a resistor, the intent is to be able to use it in a bigger circuit, simulating the model standalone is * NOT * the purpose of the model.

Now, where are the places you would be using a resistor - take your pick - I just chose two specific examples - load resistor in a differential pair (one end is connected to VDD, other end to output of the diff pair),. The second example i chose to illustrate my point was a feedback resistor in an opamp, where one terminal is connected to input and second terminal is connected to output of an opamp. Both these examples require you to have a floating two-terminal resistor, not a one-terminal grounded resistor.

Now, what are the two nodes of the resistor in your model which i can use to connect to other nodes in a bigger cirucit ? A model's utility is to be able to use it in a bigger circuit, otherwise it is useless. I always see only a grounded one-terminal, not a generic two-terminal resistor in this model.

You replies never specify cleary what are the two nodes of the resistor in your model? Specify that point, then we can discuss this further, otherwise we seem to going around in circles.

Bharath
 

Re: how to run transient simulation with time varying resist

The subcircuit definition is very generic and the resistor nodes of the generic model are 'plus' and 'minus' -- you can connect these where you want them.
If you want you can put one at ground. This is very clear when you look at the
definition in the .subckt statement. So 'plus' and 'minus' are just placeholders
in the generic subcircuit model -- when I actually use the model I used nodes 1 and 2 for these nodes.

I have a new circuit below where I am now using the variable resistor in series
from node 1 to node 2. This resistor is not grounded and the circuit works just fine.
Since the control voltage is 10V the subcircuit Xr will behave as a 10 ohm resistor from node 1 to node 2.

* sample circuit
Vs 1 0 30V ; this is just a 30V dc source
Xr 1 2 3 var_res ; this is our variable resistance
RL 2 0 5
Vc 3 0 10 ; this is the control voltage = 10V this makes
; the variable resistance a constant 10 ohms

* subcircuit definition
.subckt var_res plus minus control
Gpm plus minus value={v(plus,minus)/v(control)}
Rcontrol control 0 10k
.ends var_res

.op
.end

I think you were getting confused with my use of the generic model. I always used the model with a ground at one end -- so maybe this was a poor choice to illustrate the use of a floating resistor! However, the generic model which is in the subcircuit definition is completely arbitrary and does not need to have one node at ground.
Also note that I am using a constant control voltage Vc here just to illustrate the point -- if you make Vc vary with time the variable resistor is obviously vary with time.
 

hello,
i like this topic, i think it is a correct model , there is nothing to make the resistance grounded , i think the simulator just use I=g*Vctrl , and from what i c is that v_c used g = a certain value dependent on the Vsource"time varying sine" and Vctrl as V on the same current controlled source ,
while a time varying resistance has I=V(R)/R,and R is equal to 1/g which makes the two circuits the same thing exactly.
 

Re: how to run transient simulation with time varying resist

To verify my claims (and the fact that they are universally used), take a look at
this article which not only shows you how to model a variable resistor but other passive devices (in part 2 and 3 of the article)

**broken link removed**
**broken link removed** (PDF version of part 1)

The only caveat with this is that you have to be able to read and understand spice netlists. The 1u that is added to the denominator is to make sure that if you make the control voltage equal to zero, there is no division by zero errors. The funny thing is he also uses a grounded resistor as his example, but the model will allow for non-grounded resistors.
 

Re: how to run transient simulation with time varying resist

v_c said:
To verify my claims (and the fact that they are universally used), take a look at
this article which not only shows you how to model a variable resistor but other passive devices (in part 2 and 3 of the article)

h**p://powerelectronics.com/mag/power_spice_analog_behavioral/
h**p://powerelectronics.com/mag/503PET07.pdf (PDF version of part 1)

The only caveat with this is that you have to be able to read and understand spice netlists. The 1u that is added to the denominator is to make sure that if you make the control voltage equal to zero, there is no division by zero errors. The funny thing is he also uses a grounded resistor as his example, but the model will allow for non-grounded resistors.

I'm sure the model can be used for grounded resistors, but I'm still not convinced about floating resistors (ie, the impedance behavior between any two nodes). I will attach schematic and results of a simulation I did long ago to come to that conclusion.

The attached schematic shows a simple resistive loaded differential pair. In the first circuit on the left, you see vccs connected as a load resistor, but on the right the amplifier has an actual resistor.
DC shows the exact results (you can see DC node voltages in the schematic), but AC shows different results.
The resistor value is 5K and g of VCCS is (1/5000). DC gain and DC node voltages of both are the same. Tail current is 100 uA , gm and rds of all 4 NMOS are the same (gm = 382 uA/V, rds = 1.2 MOhms).
DC gain of both is the same, but if you look at the AC plot of the VCCS load resistor amplifier, it has a zero, but the amplifier with the actual load resistor has a pole. If the imedance behavior of a floating resistor is the same as the actual resistor, how can the AC sweep be so different?

I don't think there is anything wrong in the AC simulation as DC conditions match exactly. So, my conclusion was that with respect to impedance, these two are not similar.
Maybe this is a special case of anamoly, but I haven't been able to give a proper explanation for it till now.

Extra note : The AC sweeps match for resistor value of 10 K and g value of 1/(10K), but they are different for the 5K case. I'm still not sure that the impedance matches properly in case of a floating resistor.

Attachments :

circuit1.jpg - actual circuit schematic
circuit2.jpg - Results of AC sweep

Bharath
 

Re: how to run transient simulation with time varying resist

I understand your schematic but I agree that the results don't make sense.
I don't have access to the cadence simulator but I tried to simulate a differential amplifier in the same spirit as your circuits to see if there is something funny going on. I put together a BJT amp with 3 cases (1) resistive loads and resistive current source, (2) G-source based resistor and resistive current source and (3) G-source based resistor and ideal current source. This was done in PSpice and I plotted the differential gain for all three circuits. All give the same results (see the attached JPEG files).

I noticed that you use the same gate signals and same power (vpwr) for both -- I don't think this should be an issue, but maybe you can try to simulate each circuit by itself to make sure there is nothing else going on.

Best regards,
v_c
 

Re: how to run transient simulation with time varying resist

I repeated the analysis with LTSpice and the results are consistent as before. It does not seem to matter if we use a constant 1k resistor or if we implement it with a voltage controlled current source (G-source) with gain of 0.001 (1milli mho) which should be equivalent to a 1k resistor. Attached are the simulation schematic and waveforms, with measurements made in the same manner as before.

Best regards,
v_c
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top