Back to Forums
5 posts / 0 new
Last post
#1 Jul 9, 2021
Vitali
Offline
Last seen: 3 weeks 1 hour ago
Joined: 2021-07-09 03:35

ERROR(ORPSIM-16318): Missing or invalid expression -> Resistor Value with Supply as an input

Hello,

i basically want to change the value of the resistor over time, to simulate an MR Sensor.

with LTSpice No Problem see below: resisor gets multipied with sine source

now i struggle with pspice to get the same job done -> i want later include my pspice model in matlab for post processing as well to speed up the requency of the resistor change.

i tried several syntax for R2 {}, also now i included a current source to have the same dimensions (R=U/I). but nothing worked so far. i've spend already hours and searched the world wide web.... nothing. Maybe some of you guys can give me a hint. -> would be great to have the same formula like {2k+1k*V(V2)} for R2. Hopefully this is only a syntax error. if i put for R2 {10k-5k} everything works. But with voltage as input-> there is an error

* Profile Libraries :
* Local Libraries :
* From [PSPICE NETLIST] section of U:\cdssetup\OrCAD_PSpice\17.2.0\PSpice.ini file:
.lib "nom.lib" 

*Analysis directives: 
.TRAN  0 1 0 1m 
.OPTIONS ADVCONV
.PROBE64 V(alias(*)) I(alias(*)) W(alias(*)) D(alias(*)) NOISE(alias(*)) 
.INC "..\SCHEMATIC1.net" 

**** INCLUDING SCHEMATIC1.net ****
* source TEST
V_V1         V1 0 5
R_R2         V1 OUT  {1k+1K+V(V2)/I(I_I1)}  
---------------------$
ERROR(ORPSIM-16318): Missing or invalid expression
R_R3         OUT 0  5k  
V_V2         V2 0  AC 0
+SIN 0 1 2 0 0 0
I_I1         I1 0 DC 1A  

**** RESUMING Sim1.cir ****
.END

 

 

Wed, 2021-07-14 01:19
AshishG
AshishG's picture
Offline
Last seen: 5 hours 2 min ago
Joined: 2021-06-29 09:20

Hi,

To model a non linear resistor or voltage controlled resistor in pspice you can directly use the part "ZX" from ANL_MISC.olb library.

It is a subckt whose defination can be found out in anl_misc.lib also stated below.

.subckt zx 1 2 3 4 5
  eout   4 6 poly(2) (1,2) (3,0) 0 0 0 0 1
  fcopy  0 3 vsense 1
  rin    1 2 1G
  vsense 6 5 0
.ends

In image shown below, V4 will be multiplied with the Resistance value provided for R2.

Between Pin 4 and pin 5 you will get required resistance value based on  V4 and R2 input.
zx.PNG

Hope it will help.

 

Wed, 2021-07-14 04:02 (Reply to #2)
Vitali
Offline
Last seen: 3 weeks 1 hour ago
Joined: 2021-07-09 03:35

Hello Ashish,

thank you very much.

i also tried this one out. Multiplikation works.

But how i can take the floating Z output to make a summation/ subtraction with "R5" and "R6"

if I do it like that, it works, but the amplitudes are wrong:

 

Is there a shorter way like that: R5: Value = {5k+1.5k*V3} -> V3 is Sine voltage.

Wed, 2021-07-14 09:04
AshishG
AshishG's picture
Offline
Last seen: 5 hours 2 min ago
Joined: 2021-06-29 09:20

Hello Vitali,

In pspice there is no shorter way like you mentioned  R5: Value = {5k+1.5k*V3} -> V3 is Sine voltage.

But I assume the performing addition and subtraction will work in the way shown below

It wll be a 2 step process

Step 1-->For addition just put the resistor in series with Z impedance 

Step2 -->For subtraction also put the resistor in series with Z impedance ( having source  interchanged to negative pin)

zx1.PNG

This will give correct amplitude for both addition and subtraction.

 

Wed, 2021-07-14 09:25
Vitali
Offline
Last seen: 3 weeks 1 hour ago
Joined: 2021-07-09 03:35

Holy Moly! It worked!!

Thank you very much.

i would never thought of that complex setup ;)

V6 i didn't use since i could also take V4 as input X2 Pin 2.

Thanks again :)

now you made one person more happy -> You can add an additional stroke on your tally sheet regarding "how many people made i happy" :)

 

Download PSpice and try it for free! Download Free Trial
Cadence