Using a parameter in a Pspice model.

Discussion in 'General Electronics Chat' started by Andyk5, Jun 20, 2013.

  1. Andyk5

    Thread Starter New Member

    Sep 2, 2012
    3
    0
    Is this possible? As an example I set R1VAL to 10 using a parameter block. Then I edit the model of an Rbreak resistor and type
    .model Rbreak RES R={2*5} dev=1%
    I set the value of the resistor to {R1val*100} and it behaves like 1k 1% resistor. No problems up to here.
    The problems starts when I try to use the R1val parameter in the dev statement. My goal is to be able to set up parameters that can be changed which would in turn effect the dev values for the resistors. This is to be able to quickly simulate different mission enviroments with different amounts of radiation and temperature.
    So here is what I try, I type dev={R1val*2} and then run worst case analysis and the resistor does not behave like a %20 resistor. Even when I take the "math" away and just use dev={R1val}, it does not look like a %10 resistor. One of the worst case lines actually go down below zero and show negative voltage at a node that needs to be somewhere around 5V.
    On top of all this, if I use too small of a value for R1val such as 1 or 2 and then use dev={R1val}, simulation gets aborted due to " can't divide by zero" error.
    I have no idea what is going on, can some one help?
     
  2. WBahn

    Moderator

    Mar 31, 2012
    17,748
    4,796
    Uhmm.... do you think it might be because there is a difference between

    dev=1%

    and

    dev=1

    or

    dev=20

    What happens if you set

    dev=100%

    Well, 100% = 1
     
  3. Andyk5

    Thread Starter New Member

    Sep 2, 2012
    3
    0
    dev=1,dev={1}% and dev={1%},dev=2,dev={2}%,dev={2%} all return the same error message saying
    "There are no data values in section number 2. Ignoring this section."

    dev=3,dev={3}% returns a value without throwing a an error but it is way off,
    my results needs to be within %3 of 5V, and what I am getting is +5 and -10 volts. Although wrong, they both return the same value interestingly.
    dev=10, dev ={10}% and dev={2*5}% all return the same values which are 5V and -1.25V. Although wrong, it is interesting that Pspice does evaluation of the {} cell correctly since 10 = {10} = {2*5} in this case. What it is doing with that number is unknown to me but it looks like the higher the number goes, closer to zero the lower voltage gets.

    3 --> -10 10-->-1.25 20-->-.55 100-->-.102
    From this trend it looks like it will never hit 0 but will just come infinitely close to it, which means it is not applying a linear function using that number.
    I think it is having trouble with the % sign either inside or outside the curly brackets.
     
  4. WBahn

    Moderator

    Mar 31, 2012
    17,748
    4,796
    Try doing it without the % sign!

    dev=0.03

    What does that do?
     
  5. Andyk5

    Thread Starter New Member

    Sep 2, 2012
    3
    0
    Yes I figured it out yesterday actually. 0.03 with no % sign acts as the same as 3%. % sign can't be evaluated in or around the {}'s. Thank you for your reply since if I could have not figured it out on my own, you would have given me the answer by forcing me to try 0.03 :)

    This is going to be really useful.

    One thing I do not understand is why 1 or 2 don't work with the dev command like dev=1 or dev=2, but 3,4,5...works. I mean when you write dev=1, pspice should calculate %100 tolerance,2 should be %200. The way I know this is that I tested other numbers like 3,4 and 5 and they act like 300% 400% 500% tolerances. Not that this information is useful in any scenario, I am just curious.
     
Loading...