Previous: , Up: wrstcse   [Contents][Index]

94.2 Functions and Variables for wrstcse

Function: wc_typicalvalues (expression, [num])

Returns what happens if all tolerances (that are represented by tol [n] that can vary from 0 to 1) happen to be 0.

Example:

(%i1) load("wrstcse")$
(%i2) vals: [
   R_1= 1000.0*(1+tol[1]*.01),
   R_2= 2000.0*(1+tol[2]*.01)
 ];
(%o2) [R_1 = 1000.0 (0.01 tol  + 1), 
                             1
                                    R_2 = 2000.0 (0.01 tol  + 1)]
                                                          2
(%i3) divider:U_Out=U_In*R_1/(R_1+R_2);
                                R_1 U_In
(%o3)                   U_Out = ---------
                                R_2 + R_1
(%i4) wc_typicalvalues(vals);
(%o4)             [R_1 = 1000.0, R_2 = 2000.0]
(%i5) wc_typicalvalues(subst(vals,divider));
(%o5)            U_Out = 0.3333333333333333 U_In
Function: wc_inputvalueranges (expression, [num])

Convenience function: Displays a list which parameter can vary between which values.

Example:

(%i1) load("wrstcse")$
(%i2) vals: [
   R_1= 1000.0*(1+tol[1]*.01),
   R_2= 2000.0*(1+tol[2]*.01)
 ];
(%o2) [R_1 = 1000.0 (0.01 tol  + 1), 
                             1
                                    R_2 = 2000.0 (0.01 tol  + 1)]
                                                          2
(%i3) wc_inputvalueranges(vals);
        [ R_1  min = 990.0   typ = 1000.0  max = 1010.0 ]
(%o3)   [                                               ]
        [ R_2  min = 1980.0  typ = 2000.0  max = 2020.0 ]
Function: wc_systematic (expression, [num])

Systematically introduces num values per parameter into expression and returns a list of the result. If no num is given, num defaults to 3.

See also wc_montecarlo.

Example:

(%i1) load("wrstcse")$
(%i2) vals: [
   R_1= 1000.0*(1+tol[1]*.01),
   R_2= 2000.0*(1+tol[2]*.01)
 ];
(%o2) [R_1 = 1000.0 (0.01 tol  + 1), 
                             1
                                    R_2 = 2000.0 (0.01 tol  + 1)]
                                                          2
(%i3) divider: U_Out=U_In*(R_1)/(R_1+R_2);
                                R_1 U_In
(%o3)                   U_Out = ---------
                                R_2 + R_1
(%i4) wc_systematic(subst(vals,rhs(divider)));
(%o4) [0.3333333333333334 U_In, 0.3311036789297659 U_In, 
0.3289036544850498 U_In, 0.3355704697986577 U_In, 
0.3333333333333333 U_In, 0.3311258278145696 U_In, 
0.3377926421404682 U_In, 0.3355481727574751 U_In, 
0.3333333333333333 U_In]
Function: wc_montecarlo (expression, num)

Introduces num random values per parameter into expression and returns a list of the result.

See also wc_systematic.

Example:

(%i1) load("wrstcse")$
(%i2) vals: [
   R_1= 1000.0*(1+tol[1]*.01),
   R_2= 2000.0*(1+tol[2]*.01)
 ];
(%o2) [R_1 = 1000.0 (0.01 tol  + 1), 
                             1
                                    R_2 = 2000.0 (0.01 tol  + 1)]
                                                          2
(%i3) divider: U_Out=U_In*(R_1)/(R_1+R_2);
                                R_1 U_In
(%o3)                   U_Out = ---------
                                R_2 + R_1
(%i4) wc_montecarlo(subst(vals,rhs(divider)),10);
(%o4) [0.3365488313167528 U_In, 0.3339089445851889 U_In, 
0.314651402884122 U_In, 0.3447359711624277 U_In, 
0.3294005710066001 U_In, 0.3330897542463686 U_In, 
0.3397591863729343 U_In, 0.3227030530673181 U_In, 
0.3385512773502185 U_In, 0.314764470912582 U_In]
Function: wc_mintypmax (expr, [n])

Prints the minimum, maximum and typical value of expr. If n is positive, n values for each parameter will be tried systematically. If n is negative, -n random values are used instead. If no n is given, 3 is assumed.

Example:

(%i1) load("wrstcse")$
(%i2) ratprint:false$
(%i3) vals: [
   R_1= 1000.0*(1+tol[1]*.01),
   R_2= 1000.0*(1+tol[2]*.01)
 ];
(%o3) [R_1 = 1000.0 (0.01 tol  + 1), 
                             1
                                    R_2 = 1000.0 (0.01 tol  + 1)]
                                                          2
(%i4) assume(U_In>0);
(%o4)                      [U_In > 0]
(%i5) divider:U_Out=U_In*R_1/(R_1+R_2);
                                R_1 U_In
(%o5)                   U_Out = ---------
                                R_2 + R_1
(%i6) lhs(divider)=wc_mintypmax(subst(vals,rhs(divider)));
(%o6) U_Out = [min = 0.495 U_In, typ = 0.5 U_In, 
                                                max = 0.505 U_In]
Function: wc_tolappend (list)

Appends two list of parameters with tolerances renumbering the tolerances of both lists so they don’t coincide.

Example:

(%i1) load("wrstcse")$
(%i2) val_a: [
   R_1= 1000.0*(1+tol[1]*.01),
   R_2= 1000.0*(1+tol[2]*.01)
 ];
(%o2) [R_1 = 1000.0 (0.01 tol  + 1), 
                             1
                                    R_2 = 1000.0 (0.01 tol  + 1)]
                                                          2
(%i3) val_b: [
   R_3= 1000.0*(1+tol[1]*.01),
   R_4= 1000.0*(1+tol[2]*.01)
 ];
(%o3) [R_3 = 1000.0 (0.01 tol  + 1), 
                             1
                                    R_4 = 1000.0 (0.01 tol  + 1)]
                                                          2
(%i4) wc_tolappend(val_a,val_b);
(%o4) [R_1 = 1000.0 (0.01 tol  + 1), 
                             2
R_2 = 1000.0 (0.01 tol  + 1), R_3 = 1000.0 (0.01 tol  + 1), 
                      1                             4
R_4 = 1000.0 (0.01 tol  + 1)]
                      3
Function: wc_mintypmax2tol (tolname, minval, typval, maxval)

Generates a parameter that uses the tolerance tolname that tolerates between the given values.

Example:

(%i1) load("wrstcse")$
(%i2) V_F: U_Diode=wc_mintypmax2tol(tol[1],.5,.75,.82);
                                          2
(%o2) U_Diode = (- 0.09000000000000002 tol ) + 0.16 tol  + 0.75
                                          1            1
(%i3) lhs(V_F)=wc_mintypmax(rhs(V_F));
(%o3) U_Diode = [min = 0.5, typ = 0.75, max = 0.8199999999999998]

Previous: , Up: wrstcse   [Contents][Index]