a question about PSPICE multiple variables simulation

hi,all

I want to simulate an register and another potentionometer in the same schematic. When the pot changes, the register's value will change too. I couldn't express the relation in formal equations so I must use arbitrary value pairs for the pot and the register.

How can I simulate this in pSpice? I use ORCAD/pSpice 9.1.

I can use parametric simulation but I can only simulate single variable, e.g. a potentionometer. I know I need to write some codes but i have no clue. Anybody could do me a favor or give me some examples I'd appreciate that.

Thanks.

Reply to
leelsuc
Loading thread data ...

Use a single parameter, say .PARAM Counter = 1, then step it to N in increments of 1.

Express your register and potentiometer as TABLE functions of "Counter"

THIS IS A MAJOR FLAW IN PSPICE, Charlie!!

...Jim Thompson

--
|  James E.Thompson, P.E.                           |    mens     |
|  Analog Innovations, Inc.                         |     et      |
|  Analog/Mixed-Signal ASIC\'s and Discrete Systems  |    manus    |
|  Phoenix, Arizona            Voice:(480)460-2350  |             |
|  E-mail Address at Website     Fax:(480)460-2142  |  Brass Rat  |
|       http://www.analog-innovations.com           |    1962     |
             
I love to cook with wine.      Sometimes I even put it in the food.
Reply to
Jim Thompson

Hi,

I have to learn a new software....:( I also want to use ORCAD optimizer function to get better performance. Dear Jim, could you please write a simple code for me to follow? e.g. two pots in a closed-loop circuit. Thank you in advance.

I know they upgrade pSpice with a "parametric plotter" in ver. 10.X, but mine is v9.2.

thanksthanks t t t h h h h h a athanksa a a n n n n k k k k k s s s s s

Kev> > > >

Reply to
leelsuc

Well, if he needed to have these guys vary independently, then he can use Advanced Analysis, and do a multi-parameter simulation. (I know you haven't played with this, Jim, since it is sorta hard to do from Schematics. There have to be a FEW advantages for using Capture and Concept... 8-) ) However, in this case, they need to be linked, since the pot value and the register value are linked, so he needs to just have a defined relationship. I have often had a single parameter defined in a PARAM, and have the second defined as an expression. Since this is a register/counter/pot relationship, this implies an analog to digital conversion, tricky in an expression. I would probably build in a circuit to do the ADC for me, or DAC if setting the register made more sense.

Charlie

Reply to
Charlie Edmondson

That's why I suggested TABLE... avoids an expression between parameters, but I've resorted to that way as well :-(

...Jim Thompson

--
|  James E.Thompson, P.E.                           |    mens     |
|  Analog Innovations, Inc.                         |     et      |
|  Analog/Mixed-Signal ASIC\'s and Discrete Systems  |    manus    |
|  Phoenix, Arizona            Voice:(480)460-2350  |             |
|  E-mail Address at Website     Fax:(480)460-2142  |  Brass Rat  |
|       http://www.analog-innovations.com           |    1962     |
             
I love to cook with wine.      Sometimes I even put it in the food.
Reply to
Jim Thompson

[snip]

I only design microchips so I don't use optimizer, though I use sensitivity analysis occasionally.

...Jim Thompson

--
|  James E.Thompson, P.E.                           |    mens     |
|  Analog Innovations, Inc.                         |     et      |
|  Analog/Mixed-Signal ASIC\'s and Discrete Systems  |    manus    |
|  Phoenix, Arizona            Voice:(480)460-2350  |             |
|  E-mail Address at Website     Fax:(480)460-2142  |  Brass Rat  |
|       http://www.analog-innovations.com           |    1962     |
             
I love to cook with wine.      Sometimes I even put it in the food.
Reply to
Jim Thompson

Indeed. It gives me the opportunity to point out that in SuperSpice you can go:

R1: 10k 3k 8k C2: 1n 2n 5n 6n L1: 5u 7u 10u

and SS will run every combination of all the values and plot them all in one go!

Kevin Aylward snipped-for-privacy@anasoft.co.uk

formatting link
SuperSpice, a very affordable Mixed-Mode Windows Simulator with Schematic Capture, Waveform Display, FFT's and Filter Design.

Reply to
Kevin Aylward

Werll, heres an A/D

..SUBCKT Analog8BitAtoD_XN _ssi_pin_d8 _ssi_pin_d7 _ssi_pin_d6 _ssi_pin_d5 _ssi_pin_d4 _ssi_pin_d3 _ssi_pin_d2 _ssi_pin_d1 ain_p _ssi_pin_aref _ssi_pin_dref

  • _SS_Symbol [C:\Program Files\AnaSoft\SuperSpice\system\MixedMode.ssm] [Analog8BitAtoD]
* *This model can be distributed provided this notice remains *copyright (c) Kevin Aylward, 2004, snipped-for-privacy@anasoft.co.uk *This is an analog A to D
  • d0 is lsb. aref is the +/-vin range. dref is the digital output level e.g. 5V supplies
  • output and input is referanced to 0V.
  • boffset ain 0 v=v(ain_p)/2 + v(_ssi_pin_aref)/2
  • b1 _ssi_pin_d1 0 v=u(v(ain) - v(_ssi_pin_aref)/2 ) * v(_ssi_pin_dref) b2p 2p 0 v=v(ain) - v(_ssi_pin_d1) *v(_ssi_pin_aref)/v(_ssi_pin_dref)/2
  • b2 _ssi_pin_d2 0 v=u( v(2p ) - v(_ssi_pin_aref)/4)*v(_ssi_pin_dref) b3p 3p 0 v=v(2p) - v(_ssi_pin_d2) *v(_ssi_pin_aref)/v(_ssi_pin_dref)/4
  • b3 _ssi_pin_d3 0 v=u( v(3p ) - v(_ssi_pin_aref)/8)*v(_ssi_pin_dref) b4p 4p 0 v=v(3p) - v(_ssi_pin_d3) *v(_ssi_pin_aref)/v(_ssi_pin_dref)/8
  • b4 _ssi_pin_d4 0 v=u( v(4p ) - v(_ssi_pin_aref)/16)*v(_ssi_pin_dref) b5p 5p 0 v=v(4p) - v(_ssi_pin_d4) *v(_ssi_pin_aref)/v(_ssi_pin_dref)/16
  • b5 _ssi_pin_d5 0 v=u( v(5p ) - v(_ssi_pin_aref)/32)*v(_ssi_pin_dref) b6p 6p 0 v=v(5p) - v(_ssi_pin_d5) *v(_ssi_pin_aref)/v(_ssi_pin_dref)/32
  • b6 _ssi_pin_d6 0 v=u( v(6p ) - v(_ssi_pin_aref)/64)*v(_ssi_pin_dref) b7p 7p 0 v=v(6p) - v(_ssi_pin_d6) *v(_ssi_pin_aref)/v(_ssi_pin_dref)/64 b7 _ssi_pin_d7 0 v=u( v(7p ) - v(_ssi_pin_aref)/128)*v(_ssi_pin_dref) b8p 8p 0 v=v(7p) - v(_ssi_pin_d7)
*v(_ssi_pin_aref)/v(_ssi_pin_dref)/128
  • b8 _ssi_pin_d8 0 v=u( v(8p ) - v(_ssi_pin_aref)/256)*v(_ssi_pin_dref)
  • ..ends

Its a successive approximation without a clock.!

Tyhee is a working example in SS.

and the D/A

..SUBCKT Analog8BitDtoA_XN _ssi_pin_d0 _ssi_pin_d1 _ssi_pin_d2 _ssi_pin_d3 _ssi_pin_d4 _ssi_pin_d5 _ssi_pin_d6 _ssi_pin_d7 aout _ssi_pin_aref _ssi_pin_dref

  • _SS_Symbol [C:\Program Files\AnaSoft\SuperSpice\system\MixedMode.ssm] [Analog8BitDtoA]
* *This model can be distributed provided this notice remains *copyright (c) Kevin Aylward, 2004, snipped-for-privacy@anasoft.co.uk *This is an analog D to A
  • d0 is lsb. aref is the +/-vout range. dref is the digital switch point, e.g. 2.5 on 5V supplies
  • output and input is referanced to 0V.
  • The 1/512 is 1/2 lsb offset to provide for symetrical swings etc...
  • b1 aout 0 v= 2*v(_ssi_pin_aref) *
  • ( (u( v(_ssi_pin_d0) - v(_ssi_pin_dref)) + u( v(_ssi_pin_d1) - v(_ssi_pin_dref))*2 + u( v(_ssi_pin_d2) - v(_ssi_pin_dref))*4 + u( v(_ssi_pin_d3) - v(_ssi_pin_dref))*8
  • + u( v(_ssi_pin_d4) - v(_ssi_pin_dref))*16 + u( v(_ssi_pin_d5) - v(_ssi_pin_dref))*32 + u( v(_ssi_pin_d6) - v(_ssi_pin_dref))*64 + u( v(_ssi_pin_d7) - v(_ssi_pin_dref))*128
  • ) /256 - 0.5 + 1/512) ..ends

Kevin Aylward snipped-for-privacy@anasoft.co.uk

formatting link
SuperSpice, a very affordable Mixed-Mode Windows Simulator with Schematic Capture, Waveform Display, FFT's and Filter Design.

Reply to
Kevin Aylward

there is no such a "look-up table" in ORCAD pspice A/D 9.2. I've spent three days on studing advanced simulation by pspice and draw a conclusion:

....write two sub circuit files and define the two registers as two function of a parameter, e.g. a counter N, respectively, then do simulation. this is silly 'coz I must solve the LMS interpolation to find coefficients of equations by using somekind of maths software package. e.g. IDL, Matlab. then go back to ORCAD.

The ORCAD optimizer is garbage, don't try to learn, it'll waste your time.

okey, it's concluded.

Reply to
leelsuc

What are you running on, a contraband copy? You'll find Etable, Gtable and just plain "Table" in the PSpice Users Guide.

That's alright, optimizers are for amateurs ;-)

...Jim Thompson

--
|  James E.Thompson, P.E.                           |    mens     |
|  Analog Innovations, Inc.                         |     et      |
|  Analog/Mixed-Signal ASIC\'s and Discrete Systems  |    manus    |
|  Phoenix, Arizona            Voice:(480)460-2350  |             |
|  E-mail Address at Website     Fax:(480)460-2142  |  Brass Rat  |
|       http://www.analog-innovations.com           |    1962     |
             
I love to cook with wine.      Sometimes I even put it in the food.
Reply to
Jim Thompson

I READ GTABLE/ETABLE BUT I DON'T KNOW HOW TO PLAY IT.

I RUN SVBKSB (I.E. singular value backsubstitution) UP TO 4RD ORDER TO CAL. COEFFICIENTS. IT WORKS WELL. 3RD ORDER IS ENOUGH.

IF YOU HAVE TIME, JUST SHOW US SOME EXAMPLE CODES OF HOW TO USE GTABLE/ETABLE FOR AN ANALOG REGISTER.

THANKS.

Reply to
leelsuc

No "codes" to it, just fill in the x,y values... "x" = input, "y" = output.

And knock-off the all-caps!

...Jim Thompson

--
|  James E.Thompson, P.E.                           |    mens     |
|  Analog Innovations, Inc.                         |     et      |
|  Analog/Mixed-Signal ASIC\'s and Discrete Systems  |    manus    |
|  Phoenix, Arizona            Voice:(480)460-2350  |             |
|  E-mail Address at Website     Fax:(480)460-2142  |  Brass Rat  |
|       http://www.analog-innovations.com           |    1962     |
             
I love to cook with wine.      Sometimes I even put it in the food.
Reply to
Jim Thompson

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.