Manuals >Reference >Parameter Extraction Language
Print version of this Book (PDF file)
prevnext

Fundamental Concepts

The interpreter within IC-CAP can execute programs made up of statements that consist of keywords and expressions. Expressions are constructed from functions, identifiers, and operators. You enter these statements in the text editor that appears when you select Program2 or Program as the function name in the Extract/Optimize folder, or when you open the Macros folder (refer to Chapter 11, "Creating and Running Macros," in the IC-CAP User's Guide). The same interpreter is used to evaluate the expressions entered in various tables providing a consistent syntax throughout the system. Strictly speaking, the expressions appearing in tables are not statements.

Keywords

Keywords are reserved by the Parameter Extraction Language. A keyword can be one of the reserved words required for a statement, such as PRINT.

It can also be a built-in function or a built-in constant. For keyword descriptions, refer to Built-in Functions and Built-In Constants.

Keywords are entered in all uppercase or all lowercase, but not upper and lower case. For example, to call the built-in function MAX:

 MAX(ic) or 
max(ic)

Although the functions in IC-CAP's Function List can be invoked, those functions, such as RMSerror, are not language keywords. To be used in a Program, expression, or Macro, these functions must be spelled exactly as shown in the Function List.

Identifiers

Identifiers are Parameter Extraction Language variable names; they have the following properties:

    • Identifiers can be of mixed case.
    • An identifier can be any length.
    • An identifier starts with an alphabetic character or an underscore character
( _ ). It can include alphanumeric characters and underscore characters thereafter. Four notable exceptions to this are:
     A subcircuit parameter, like npn.BF, is a legitimate identifier;  a period (.)  is allowed in this case.
     A data set, like npn/dc/fgummel/ic is a legitimate identifier;   a slash (/)  is allowed in this case.
     The notations ../ and ../.. are allowed to indicate relative paths in the currently executing macro or transform for dataset access.
     In Programs and Macros, local variable names (identifiers) can end with a trailing dollar sign ($). Included for the convenience of BASIC programmers when using string variables, the only effect is that the program is easier to read. An example is: Hi$="hello world"

Numeric Precision

You can control numeric precision by setting the variables WORKING_PRECISION and/or PARAMETER_PRECISION or by using the PEL function val$().

    • PARAMETER_PRECISION
This variable controls the precision of parameters stored in the Model or DUT Parameters table, as well as the precision of parameters passed to a simulator.

    • WORKING_PRECISION
This variable controls the precision of numeric values when converted to text, but affects only those parts of a model for which the variable is defined. Depending on when and where the conversion occurs, precision can be actually lost or simply hidden. This conversion occurs in the following situations: any time the function val$() is called; the PRINT statement is used; a numeric value is assigned to a variable in the IC-CAP Variable Table; a number is displayed to the screen (e.g., in an input/output/plot definition or tabular data) or saved to a file. (Because all variables in the IC-CAP Variable Table are text by definition, assigning a numeric value to such a variable will implicitly call the val$() function.)

Although the numbers are truncated for display purposes according to the WORKING_PRECISION variable, IC-CAP uses the untruncated numbers for calculations until the file is saved. After the truncated numbers are saved in a file then reread, the truncated numbers are used in calculations. For example, if you type 1.23456 into an input field, 1.235 is displayed. However, 1.23456 is used for calculation. After the file is saved and reread, 1.235 is not only displayed but also used for calculations.

When you change the WORKING_PRECISION variable, the change is only apparent with subsequently edited or redisplayed fields.

The value of the WORKING_PRECISION variable applies to the precision of the Start/Stop/Stepsize fields of inputs, though not all instrumentation can support such resolution. Using higher precision involving these fields should be done with caution.

The range of values is 6 through 17. The default is 6.

Controlling precision through val$() calls

The function val$() has an optional second argument that can be used to control numeric precision. For example, the statement  y=val$(x,12) will convert the number x to a string using up to 12 significant digits if required. Use this form of val$() when the current value of WORKING_PRECISION is acceptable for most of the work at hand, but greater control is required for isolated instances. In those instances, the second argument of val$() can be used to override the current working precision.

The examples that follow show how the output varies based on whether or not the WORKING_PRECISION variable is defined, and how the WORKING_PRECISION variable, when defined, is overridden by using val$().


Note


When doing comparisons on real numbers, you may see unexpected results (PEL printouts are rounded, although full precision is used internally). Using the new WORKING_PRECISION variable or the val$(xxx,y) function, you can verify the actual value.


For example, consider the following PEL clause:

 x=0.39999999999
IF x < 0.4 THEN
     PRINT x;"is less than 0.4"
END IF

Since x=0.39999999999, the IF clause will be entered but it will print 0.4 is less than 0.4. To verify the actual value, change the x in the print statement to val$(x,15) . The output will then show 0.39999999999 is less than 0.4.

 PRINT val$(x,15);"is less than 0.4

Example, Scenario 1

This scenario shows the usefulness of the new argument in the val$() function.

Conditions: No WORKING_PRECISION variable is declared within current scope; var1, and var2 are variables in the Variable table within the current scope.

PEL

 x=0.1234567890123 ! implicit val$() used behind the scenes uses
var1=x            ! default working precision (6 digits)
var2=val$(x,9)    ! explicit val$() specifying 9 digits of precision
y=0+var1          ! implicit val() used on var1 to make numeric again 
z=0+var2          ! implicit val() used on var1 to make numeric again 
print "Default precision x=",x      ! default working precision used 
print "Default precision y=",y      ! default working precision used 
print "Default precision z=",z      ! default working precision used 
print "var1=",var1                  ! no conversion--var1 already text
print "var2=",var2                  ! no conversion--var2 already text
print "High precision x=",val$(x,9) ! explicit working precision 
print "High precision y=",val$(y,9) ! explicit working precision 
print "High precision z=",val$(z,9) ! explicit working precision

Output

Default precision x=  0.1235
Default precision y= 0.1235
Default precision z= 0.1235
var1= 0.1235
var2= 0.123456789
High precision x= 0.123456789
High precision y= 0.1235
High precision z= 0.123456789
Notice that y lost precision because var1 lost precision, however it is clear from the High precision lines that more information is available for x and z even though printing at the default precision did not reveal it.

Example, Scenario 2

This Scenario uses the same code as Scenario 1, except that the default working precision has been increased via the WORKING_PRECISION variable.

Conditions: WORKING_PRECISION variable in the current scope is set to 12; var1 and var2 are variables in the Variable Table within the current scope.

PEL

 x=0.1234567890123   ! implicit val$() used behind the scenes uses
var1=x              ! current working precision (12 digits)
var2=val$(x,9)      ! explicit val$() specifying 9 digits of precision
y=0+var1            ! implicit val() used on var1 to make numeric again 
z=0+var2            ! implicit val() used on var1 to make numeric again 

print "Default precision x=",x    ! current working precision used 
print "Default precision y=",y    ! current working precision used 
print "Default precision z=",z    ! current working precision used 
print "var1=",var1                ! no conversion--var1 already text
print "var2=",var2                ! no conversion--var2 already text
print "High precision x=",val$(x,9) ! explicit working precision 
print "High precision y=",val$(y,9) ! explicit working precision 
print "High precision z=",val$(z,9) ! explicit working precision

Output

Default precision x=  0.123456789012 
Default precision y= 0.123456789012
Default precision z= 0.123456789
var1= 0.123456789012
var2= 0.123456789
High precision x= 0.123456789
High precision y= 0.123456789
High precision z= 0.123456789
In this case, notice that the overriding val$() assignments actually lower the default precision since the default has been set to 12 digits via the WORKING_PRECISION variable.

Statements

This section describes how to write statements that make up Programs and Macros. The information in this section is not required to use expressions in the editor tables within IC-CAP.

Rules for Constructing Statements

As in BASIC, statements are generally contained in a single line of input. On the other hand, a quoted string can be as many lines long as needed and can contain CR-LFs (carriage return-line feeds).

Statements can be arbitrarily complex, and can use parentheses and white space to clarify precedence and improve readability.

Keywords must be all uppercase or all lowercase characters. Calls to functions in IC-CAP's Function List must be spelled exactly as they are in the Function List.

Use an exclamation mark (!) to comment out a line or any part of a line.

Available Statements and Commands

The following statements are taken from HP BASIC. They are sensitive to the use of CR-LF, and must be written as shown. For example, the ELSE keyword should be followed by nothing on the same line, although a comment (starting with ! ) could follow it. In this section, the abbreviation expr denotes an expression. Expressions are described in Expressions. The abbreviation boolean_expr denotes a boolean expression, generally 0 or 1 (1, as well as any non-zero value, is considered TRUE). For more information, refer to Boolean Expressions.

IF THEN with a single statement

 IF boolean_expr THEN statement 

IF THEN with multiple statements

 IF boolean_expr THEN 
statement1
.
.
.
statementN
END IF

IF THEN ELSE statement

 IF boolean_expr THEN 
statement1
.
.
.
statementN
ELSE
statement1
.
.
.
statementN
END IF

WHILE statement

 WHILE boolean_expr 
statement1
.
.
.
statementN
END WHILE 

GET_DATASET statement

 GET_DATASET prompt_string, variable_name
GET_DATASET prompt_string, default_string, variable_name
GET_DATASET is currently only supported by the Program2 function. An error occurs if used with a Program function or Macro. GET_DATASET can redirect a Program2 dataset or array parameter argument into a named variable. The prompt_string and optional default_string parameters are currently unused and ignored. The variable_name argument is a variable that receives the redirected Program2 parameter argument. The named variable can be a variable local to the Program2 function. After the GET_DATASET statement finishes, it returns a dataset to the named variable. Currently the named variable can not represent a global variable or variable from an IC-CAP variable table.

Example Program2 function transform using GET_DATASET:

sub_prog
{
   PRINT "enter sub_prog"

   ! re-direct a dataset parameter argument passed into this
   ! function into local variable loc_x
   GET_DATASET "", loc_x

   PRINT "loc_x == "
   PRINT loc_x

   PRINT "leave sub_prog"
   RETURN
}
Example:

! create a small dataset x
COMPLEX x[5]
i = 0
WHILE i < sizeof(x)
   x[i] = i+2 + j*(i+1)
   i=i+1
ENDWHILE

! pass a small dataset x to the Program2 function sub_prog
iccap_func("sub_prog", "Execute", x)
Output:

enter sub_prog
loc_x ==
Point   Index R:measured I:measured
   0   (1,1) 2.000000E+000 1.000000E+000
   1   (1,1) 3.000000E+000 2.000000E+000
   2   (1,1) 4.000000E+000 3.000000E+000
   3   (1,1) 5.000000E+000 4.000000E+000
   4   (1,1) 6.000000E+000 5.000000E+000
Point   Index R:simulated I:simulated
   0   (1,1) 2.000000E+000 1.000000E+000
   1   (1,1) 3.000000E+000 2.000000E+000
   2   (1,1) 4.000000E+000 3.000000E+000
   3   (1,1) 5.000000E+000 4.000000E+000
   4   (1,1) 6.000000E+000 5.000000E+000

leave sub_prog

GET_INT statement

 GET_INT prompt_string, variable_name
GET_INT prompt_string, default_string, variable_name
Uses a dialog box to request an integer input from the user, prompting with prompt_string, which should be a quoted string, an identifier, or an expression treated as an integer. Where applicable, default_string provides the user with a default answer, enabling the user to simply select OK and avoid typing any data. The prompt_string can be any valid string expression. The default_string can be any valid string expression representing an integer. The variable_name argument is a variable that receives the user's response. The variable can be an IC-CAP system variable, or a variable local to Program, Program2, or Macro. After the GET_INT statement finishes, it returns an integer value to the named variable. If the named variable is a global variable, the integer value will be stored in the variable table.

The GET_INT dialog box contains 2 buttons: CANCEL and OK. Choose CANCEL to terminate Program, Program2, or Macro immediately.

If GET_INT is used in a Program or Macro to pass parameters, all GET_INT statements should be located immediately at the start of the Program or Macro along with any other GET_INT, GET_REAL, GET_STRING or LINPUT statements. Once any other ICCAP_FUNC statement is invoked, the list of arguments is reset, thereby removing all the extra arguments from the calling ICCAP_FUNC statement. Program2 does not have this limitation.

If GET_INT is used in a Program or Macro to pass parameters, the GET_INT statement searches the passed parameter list until it finds a valid passed integer parameter argument. In the Program2 function, the GET_INT statement will only try to evaluate the next available passed function parameter as an integer value, and will error out if the next passed function parameter can not be evaluated as an integer value.

GET_REAL statement

 GET_REAL prompt_string, variable_name 
GET_REAL prompt_string, default_string, variable_name 
Uses a dialog box to request a real input from the user, prompting with prompt_string, which should be a quoted string, an identifier, or an expression treated as a real value. Where applicable, default_string provides the user with a default answer, enabling the user to simply select OK and avoid typing any data. The prompt_string can be any valid string expression. The default_string can be any valid string expression representing a real value. The variable_name argument is a variable that receives the user's response. The variable can be an IC-CAP system variable, or a variable local to Program, Program2, or Macro. After the GET_REAL statement finishes, it returns a real value to the named variable. If the named variable is a global variable, the string value will be stored in the variable table.

The GET_REAL dialog box contains 2 buttons: CANCEL and OK. Choose CANCEL to terminate Program, Program2, or Macro immediately.

If GET_REAL is used in a Program or Macro to pass parameters, all GET_REAL statements should be located immediately at the start of the Program or Macro along with any other GET_INT, GET_REAL, GET_STRING or LINPUT statements. Once any other ICCAP_FUNC statement is invoked, the list of arguments is reset, thereby removing all the extra arguments from the calling ICCAP_FUNC statement. Program2 does not have this limitation.

If GET_REAL is used in a Program or Macro to pass parameters, the GET_REAL statement searches the passed parameter list until it finds a valid passed real parameter argument. In the Program2 function, the GET_REAL statement will only try to evaluate the next available passed function parameter as a real value, and will error out if the next passed function parameter can not be evaluated as a real value.

GET_STRING statement:

See LINPUT or GET_STRING statement. GET_STRING is simply an alternate name for the LINPUT command. The new name is consistent with GET_INT, GET_REAL, and GET_DATASET.

GLOBAL_VAR statement

 GLOBAL_VAR <variable_name>
Declares a variable as a global variable in a program. This statement is most useful for the Program2 function, because the Program2 function treats all variables as local variables unless those variables are first explicitly declared as global variables using the GLOBAL_VAR statement. In the Program function, all variables can be resolved globally or locally without needing to explicitly specify which variables are global using the GLOBAL_VAR statement.

The variable_name should refer to an IC-CAP variable in a variable table. Before using a variable from a variable table in Program2, you should declare the variable as global with GLOBAL_VAR. An error will occur if an IC-CAP variable could not be found.

 GLOBAL_VAR varX
y=varX
RETURN y

ICCAP_FIND_CHILDREN statement

 ICCAP_FIND_CHILDREN "/","Model",loadedModels
Sets a variable to be the list of names of a particular child type of an IC-CAP object. This turns the variable loadedModels from a variable table into an ICCAP_ARRAY containing elements that are the names of the currently loaded models. Use the sizef() command to determine the size of the array.

Refer to the following table for valid names for the second argument given the type of the first argument.

First Argument References
Second Argument may be
/
Model
any GUI Item Table or any GUI Item
GUI Item
any model
DUT
any DUT
Setup
Any Setup
Input, Output, Transform, or Plot


Note


You should use sizeof() instead of size() because if no objects of the requested type are found, a null string ("") is returned instead of an ICCAP_ARRAY[0]. Since size() returns 1 for a null string, you would first test the result to make sure it is not a null string before using the size() command to determine the number of entries. The sizeof() function returns 0 for a variable that is not an ICCAP_ARRAY[].


ICCAP_FUNC statement

 ICCAP_FUNC (object_name, menu_function_name, dialog_answer1, ...)
Used primarily in macros for automating the operation of IC-CAP.


Note


The ICCAP_FUNC statement replaced the MENU_FUNC statement in release 5.0. For backward compatibility, macros containing the MENU_FUNC statement will still work, but new macros should be written using the ICCAP_FUNC statement.


For an example on using the ICCAP_FUNC statement, refer to Chapter 11, "Creating and Running Macros," in the IC-CAP User's Guide.

LINPUT or GET_STRING statement

 LINPUT prompt_string, variable_name 
LINPUT prompt_string, default_string, variable_name
GET_STRING prompt_string, variable_name
GET_STRING prompt_string, default_string, variable_name
Uses a dialog box to request a string input from the user, prompting with prompt_string, which should be a quoted string, an identifier, or an expression treated as a string. Where applicable, default_string provides the user with a default answer, enabling the user to simply select OK and avoid typing any data. Like prompt_string, the default_string can be any valid string expression. The variable_name argument is a variable that receives the user's response. The variable can be an IC-CAP system variable, or a variable local to the Program, Program2, or Macro. After the LINPUT or GET_STRING statement finishes, it returns a string to the named variable. This will either be the null string (""), or a string defining the text that would be typed in the LINPUT or GET_STRING dialog box. If the named variable is a global variable, the string value will be stored in the variable table. To interpret the results as a number, you must use val().

The LINPUT or GET_STRING dialog box contains 2 buttons: CANCEL and OK. Choose CANCEL to terminate Program, Program2, or Macro immediately.

If LINPUT or GET_STRING is used in a Program or Macro to pass parameters, all LINPUT or GET_STRING statements should be located immediately at the start of the Program or Macro along with any other GET_INT, GET_REAL, GET_STRING or LINPUT statements. Once any other ICCAP_FUNC statement is invoked, the list of arguments is reset, thereby removing all the extra arguments from the calling ICCAP_FUNC statement. Program2 does not have this limitation.

PRINT statement

 PRINT expr 
Writes an ASCII printout of the given expression to the Status window or location specified by a preceding PRINTER IS statement. As in HP BASIC, several arguments can be used, and these can be separated by a semicolon (;), comma  (,), or a period  (.). The semicolon separator results in no spacing between printed arguments, while the  comma separator results in a tab character. When printing multiple arguments, the ampersand (&) operator and the VAL$ function may be useful. Refer to Built-in Functions and Expressions.

PRINTER IS statement

 PRINTER IS <string>
Specifies where subsequent PRINT statements write. String specifies a path and filename for subsequent PRINT statements. A special token CRT specifies that subsequent PRINT statements write to the Status window. For example:

 PRINTER IS "/tmp/tmpfile"
 PRINT "This text is going to tmpfile"
 PRINTER IS CRT
 PRINT "This text is going to the status window"

RETURN statement

 RETURN [expr] 
Copies a data set expression into the local storage of the Transform, making the data available to Plots or other Transforms that may reference it. In both Program and Program2, it can be used to store data by including the optional argument. In a Macro, no argument can be present. In both cases, Program, Program2, or Macro terminates after this statement is executed. For example:

 Id = IS * exp(vd / NF / vt)
RETURN Id 

RETURN_VALUE statement

 RETURN_VALUE expr
Interprets expr as a single real value. If expr is a dataset, the first value will be returned. If expr is a variable, it will interpret the value as a real value. If the variable is an ICCAP_ARRAY, it will interpret the string as a number, returning the dimension of the ICCAP_ARRAY, not the first value of the array. RETURN_VALUE copies a real value from an expression into the local storage of the Transform, making the data available to Plots or other Transforms that may reference it. Both Program and Program2 terminates after this statement is executed. Use RETURN_VALUE when only a single return value is required. This will avoid IC-CAP increasing the size of the return value to the size of the setup. The RETURN_VALUE statement's returned dataset will be size 1, whereas the RETURN statement's return dataset size will be determined by the size of the setup. RETURN_VALUE is unsupported with Macros.

For example:

Id = 23.44
RETURN_VALUE Id

TUNER statement

 TUNER pname, min, initValue, max, linLogScale, cbStyle, 
cbName
where:

pname:

is a string (or variable array, refer to the section "Using Variable arrays") containing the name of the variable or parameter you want automatically adjusted each time the tuner is adjusted.

min:

is a number (or variable array, refer to the section "Using Variable arrays") that specifies the minimum end of the tuner scale.

initValue:

initValue is a number (or variable array, refer to the section "Using Variable arrays") that specifies the initial position of the slider.

max:

is a number (or variable array, refer to the section "Using Variable arrays") that specifies the maximum end of the tuner scale

linLogScale:

is a number (or variable array, refer to the section "Using Variable arrays") that specifies whether the tuner will have a log scale or not.

cbStyle:

is a number (1 or 0) that specifies whether or not the callback is called continuously as the slider moves (while the user has the mouse button pressed) or only when the slider motion is complete (when the user releases the mouse button). 1 Specifies continuous callbacks; 0 specifies endpoint callbacks.

cbName:

is a string that specifies a Macro or Transform in the same manner you would refer to a macro or transform using a ICCAP_FUNC statement. This Function will be called as indicated by cbStyle. For example, you may have a macro named cb in model m1 and you could specify this macro absolutely with "/m1/cb" or relatively by "cb" from any macro within m1.

SLIDER statement

 SLIDER pname, min, initValue, max, OKFlag, retVal
where:

pname:

is a string (or variable array, refer to the section "Using Variable arrays") containing the name of the variable or parameter you want automatically adjusted each time the tuner is adjusted.

min:

is a number (or variable array, refer to the section "Using Variable arrays") that specifies the minimum end of the tuner scale.

initValue:

initValue is a number (or variable array, refer to the section "Using Variable arrays") that specifies the initial position of the slider.

max:

is a number (or variable array, refer to the section "Using Variable arrays") that specifies the maximum end of the tuner scale

okFlag

is an expression. 0 means return as soon as the slider is adjusted; nonzero means return only when user clicks OK.

retVal

If more than one slider is specified, using arrays, retVal returns the index of the modified slider and the new value is automatically updated to the initValue array. If only one slider is specified via means other than variable arrays, retVal returns the new value of the slider.

Using Variable Arrays

To specify multiple parameters or variables for tuning, you can use variable arrays. The arguments pname, min, initValue, and max must all be variable arrays of the same dimension. (A variable array is defined by setting the value of any variable in a variable table to ICCAP_ARRAY[dim] where dim is the dimension of the array.) For example, if names, mins, maxs, and currs were all variable arrays of dimension 4, and names was an array of param names and mins was an array of min values, etc, the statement

 TUNER names,mins,currs,maxs,0,1,"mycallback" 

would invoke a TUNER with 4 sliders on it, one for each parameter in the names array.


Note


Clicking OK on the tuner returns control to the Macro; clicking CANCEL on the tuner aborts the macro currently running.


You can set and access n-dimensional variable arrays. If you set the arrays

 a=ICCAP_ARRAY[2]
a[0]=ICCAP_ARRAY[2]

you can then access and set a[0][1] in PEL.

UPDATE_EXPLICIT,

UPDATE_MANUAL,

UPDATE_AUTO,

UPDATE_EXTRACT, and

UPDATE_OPTIMIZE statements

Tell IC-CAP when to automatically run a Program. These statements do not affect the Program, as can be seen in the following examples:

 UPDATE_EXPLICIT   !suppress all auto-execution of the 
                  !transform
UPDATE_MANUAL     !suppress all auto-execution of the
                  !transform except during an optimization
UPDATE_AUTO       !auto-execute the transform if a data set
                  !input changes
UPDATE_OPTIMIZE   !auto-execute upon selection of the 
                   !Optimize menu function
UPDATE_EXTRACT    !auto-execute upon selection of the 
                   !Extract menu function 


Note


UPDATE_MANUAL will auto-execute a transform during an optimization only if it is a dependency on the simulated target of the optimization.


Use only 1 statement per Program and place the statement first in the Program. They have no effect in a macro because macros are never automatically executed by IC-CAP. For more information about the automatic execution of Programs, refer to "Automatic Transform Execution" in the User's Guide.

COMPLEX statement

 COMPLEX <array_name>.<type>.<matrix_dimensions>[size_expr] 
Declares a temporary variable as an array. The individual points of such an array can be manipulated, after which the RETURN statement can be used to save the contents. The array_name and size_expr arguments must be provided. The type specifier and matrix_dimensions specifier are optional. The matrix_dimensions can be either literal or an expression in ( ) up to 9999. Only a square matrix is currently supported.

The following examples demonstrate the various forms that the COMPLEX statement can take. For information on understanding the use of the M, S, and B specifiers, refer to "Measured, Simulated, and Common Data" in the IC-CAP User's Guide. (These specifiers identify whether space is allocated for measured, simulated, both measured and simulated, or for data to be considered common.) Data Types explains the M, S, and B specifiers. The matrix dimensions specifier should be equal to 22 for 2-port data. For DC data sets it is simplest to omit it; this results in a default value of 11 (1x1 data) suitable for DC, CV, TDR and other non-2-port data sets.

 COMPLEX tmp_array[30+5] ! Common data; 35 complex points; 
                        !indexed 0 to 34 
COMPLEX tmp_array.M[35] ! Measured data 
COMPLEX tmp_array.S[35] ! Simulated data 
COMPLEX tmp_array.B[35] ! Both measured and simulated data 
                        ! is allocated
COMPLEX t_arr.22[30+5]  ! Common data; 35 2x2 (i.e. 2-port)
                        !points 
COMPLEX t_arr.M.22[35] ! Measured data; 35 2x2 points 
COMPLEX t_arr.S.22[35] ! Simulated data; 35 2x2 points 
COMPLEX t_arr.B.22[35] ! Both measured and simulated data is
                       ! allocated
COMPLEX t_arr.B.1212[35] ! 12x12 matrix
COMPLEX t_arr.B.(r*10+c)[35] ! r, c up to 9x9
COMPLEX t_arr.B.(r*100+c)[35] ! r, c up to 99x99
After an array is declared using COMPLEX, all elements have a value of 0. Refer to Assignment for a description of how to modify elements within the array. Examples of data set access are provided in Data Types. Those examples also apply to accessing the temporary arrays declared by COMPLEX and the points within them.

The COMPLEX statement is not always necessary when working with arrays. In many cases, assignment and other operations can be done implicitly on an array-wide basis. For example, the following statements produce the average of two 2-port S-parameter data sets:

 x = (S1+S2) / 2
RETURN x 
! or, simply,
RETURN (S1+S2) / 2 
When individual points in the array require differing and non-trivial manipulations (thus making it necessary to assign to them on a point-wise basis), use the COMPLEX statement. Typical applications are filtering noise from data or producing a new data set that contains only a subset of another data set.

Assignment

Assignment is an important statement for complicated computations that require temporary variables or perform extractions. An assignment statement consists of a simple identifier on the left, an = sign, and any allowed expression to the right. It is possible to declare temporary arrays (using COMPLEX) and to assign values to individual points within these arrays.


Note


A single  equal sign (=)  is used to indicate assignment; a double equal sign (==)  is used to test for equality. HP BASIC uses = for both.


The valid forms for assignment are as follows:

 tempvar = <any expression> 
<Model parameter> = <REAL expression> 
<DUT parameter> = <REAL expression> 
<IC-CAP system variable> = <REAL expression>
<tmp_array>.<type>.<row_and_column>[index_expr] = <REAL or
COMPLEX expression> 

In the last case, some fields are optional. The following examples show every legitimate case and demonstrate all valid forms of assignment.

BF = ic[0]//ib[0]

Assigns the bjt Model parameter BF to the ratio of 2 points (ic[0] and ib[0]).

AREA = 1.2              

Assigns (in a bjt Model) a value to the DUT parameter AREA.

npn2.BF = 100

Assigns a value to the Model parameter npn2.BF, if the current Model possesses such a parameter. Failing that, it assigns a value to a BF parameter in another Model named npn2.

npn2/dc.AREA = 100

Assigns a value to the DUT parameter AREA, within the DC DUT of a Model named npn2.

TNOM = 25

TNOM is generally defined as an IC-CAP system variable. Here it is assigned a value of 25.

x = 4

Declares x a temporary variable and assigns an integer. Recommended for loop counters. The maximum integer that you can set is 2147483647 (MAXINT). If you attempt to assign an integer in excess of MAXINT, unreported overflow errors will occur and the actual integer assigned will not be the value you attempted to assign. If you wish to use numbers larger than MAXINT, specify using a .0 at the end of the number (see x = 4.0) or use engineering notation.

x = 4.0

Declares x a temporary variable and assigns a double precision floating point number. Not recommended for loop counters due to roundoff errors.

x = ic//ib

Declares x a temporary variable and assigns it to the ratio of the 2 data sets (ic and ib). Refer to Expressions for an explanation of the double slash (//).

x = S.21

Declares x a temporary variable and assigns to it all the 21 (forward transmission) data within a 2-port data set named S.

x = S.M.21

Declares x a temporary variable and assigns to it all the measured 21 (forward transmission) data within a 2-port data set named S.

x = ic or
x = ic.m or
x = ic.s

Declares x a temporary variable and assigns to it the data within an Output named ic. If ic only has measured data, only measured data is assigned to x. If ic only has simulated data, only simulated data is assigned to x. If ic has both measured and simulated data, both are assigned to x. If x is not the correct size for the requested data, x resizes to accommodate the data on the right side.

x.m = ic or
x.m = ic.s or
x.m = ic.m

If x has never been assigned or was assigned some value other than a temporary dataset, adding .m to left side has no effect. See x=ic, x=ic.s, x=ic.m. If x was previously defined as a temporary dataset, assigns to its measured array the data within an output named ic. If ic contains just simulated data or if the right side is ic.s, x receives just the simulated data in its measured array. If ic contains common or measured data or if the right side is ic.m, x receives that data in its measured array. If x contains preexisting simulated data, that simulated data is not changed. If x is not the correct size for the requested data, an error occurs.

x.s = ic or
x.s = ic.s or
x.s = ic.m

If x has never been assigned or was assigned some value other than a temporary dataset, adding .s to left side has no effect. See x=ic, x=ic.s, x=ic.m. If x was previously defined as a temporary dataset, assigns to its simulated array the data within an output named ic. If ic contains just simulated data or if the right side is ic.s, x receives just the simulated data in its simulated array. If ic contains common or measured data or if the right side is ic.m, x receives that data in its simulated array. If x contains preexisting measured data, that measured data is not changed. If x is not the correct size for the requested data, an error occurs.

The following statements demonstrate assignment to points in temporary arrays. They require prior use of the COMPLEX statement to declare the temporary array appearing to the left of the equal sign (=). An array index i is assumed in each case to be an integer or integer expression. It should have a value between 0 and size-1, where size was established in a COMPLEX statement.

 tmp_array.M[i] = 2+2 ! Measured data point assigned value of
                     ! 4
tmp_array.S[i] = 2+2 ! Simulated data point assigned value
                     ! of 4
tmp_array.B[i] = 2+2 ! Measured and simulated data points
                     ! are BOTH assigned
tmp_array_x[i] = 2+2 ! Common or measured data point
                     ! assigned value of 4
tmparr.M.21[i] = 2+j5 ! Measured '21' data point receives
                      ! complex
tmparr.S.21[i] = 7+20 ! Simulated '21' data point receives 
                      ! real
tmparr.B.21[i] = 2+j5 ! Measured and simulated '21' data
                      ! points are BOTH assigned
tmparr_x.21[i] = 2+j5 ! Common or measured '21' data point
                      ! receives complex

The following assignment statements are not valid:

 COMPLEX x.m[size(beta.m)] 
x.m = beta.m ! left-side expression must be simple 
             ! identifier, or individual point 
S = S + S
where S is an existing IC-CAP data set. You cannot overwrite an existing data set in this manner. (However, you could establish an IC-CAP data set with identical data using RETURN S+S .)

 tmp_array[i] = S[i] ! not valid if S[i] is non-scalar (for 
                    ! example, 2-port data) 

Data Types

This section describes the primitive data types supported in expressions, Programs, and Macros. These types of data represent the simplest possible expressions.

Because IC-CAP automatically assigns data types, it is not necessary to declare a data type for a variable. Thus, to declare and initialize a temporary variable in a Program Transform or Macro, assign a value to it. For example, entering tempvarx = S.m.21[3] automatically makes tempvarx a complex entity (S is assumed to be 2-port data). The variable tempvarx is known only to the Transform program being defined and is discarded when the program finishes. IC-CAP recognizes and operates on the following data types:

real (or double)    For example:

 2.0, 2e-6, and 2.0k.

complex    Engineering and scientific notation are accepted in any mix. For example:

 2+j2, 2+j*2, and 2.05meg-j1.0e6.

pure imaginary    j*2, j2, j, and j*1meg.

matrix    The expression S.M[0] is a matrix example if S is 2-port data.

Model and DUT Parameters    These are scalar real numbers. When IC-CAP encounters such an identifier (BF for example), it searches for a match in the following order until one is found:

1 DUT level parameter
2 Model level parameter
3 Setup level parameter
4 DUT level variable
5 Model level variable
6 System level variable
7 Datasets

Model parameters can be used in, or assigned to, expressions.

For example:

 BF = 100 
x = 2 * BF 
npn1.BF = 100 !BF in another Model 
npn1/dc.AREA=1 !AREA in another DUT

IC-CAP variables    Refer to Model Parameters for a description of how IC-CAP resolves the meaning of symbol names. Like Model Parameters, system variables can be used in, or assigned to, expressions. They have one enhanced capability not shared by the parameters—a string can be assigned to them. For example,

 EXTR_MODEL="opamp"
Do not attempt to enter an expression when editing an IC-CAP system variable table. This will not be evaluated when you later reference the variable. If the system variable is used in a numeric expression, it is safest to enter only a single number in the system variable table. To obtain the text contents of a system variable, use the following:

 VAL$(EXTR_MODEL)
where EXTR_MODEL is a system variable.

data set    Arrays of matrices of complex numbers. In the most complex case (2-port S-parameter measured and simulated data), data sets hold an array of measured matrices and an array of simulated matrices. (Refer to "Measured, Simulated, and Common Data" in the IC-CAP User's Guide.) IC-CAP entities considered to be data sets are Inputs, Outputs, and Transforms. The syntax for accessing all or part of a data set is described in the following paragraphs. Temporary arrays, such as those declared by the COMPLEX statement, can also be accessed using the syntax in the examples.

In the following examples of data set access, S denotes an existing data set of 2-port data; IC denotes an existing DC data set. Both data sets are type B (both)—they contain measured and simulated data.


Note


These examples are valid for reading data in a temporary array in a Program or Macro, and for reading data in an IC-CAP data set. However, choices are more limited when assigning to (writing to) temporary arrays; also, no assignment can be done directly into IC-CAP data sets (outside of the RETURN statement). For details regarding assignment statement, refer to Assignment.


IC.M                

Produces a data set containing only measured data.

IC.S

Produces a data set containing only simulated data. M (measured), S (simulated), and B(both) act as keywords and can be specified in either uppercase or lowercase.

IC.B or IC

Produces a data set containing both measured and simulated data.

S[2] or S.M[2]

Produces a matrix of measured data. It is the third matrix in S.M, the first being S[0]. An expression can be substituted for 2. In the first case, the system selects measured data by default. Since 2 selects the third matrix, 0 would select the first matrix. This is consistent with HP BASIC, in which OPTION BASE 0 is the default when accessing array elements. The last matrix in S.M can be accessed with the built-in function SIZE: S[size(S)-1]. Results are undefined if you attempt to use indices that are negative or are beyond the end of the data set.

IC[0] or IC.M[0]

Produces a real number that is the first point in IC's measured data. An expression can be substituted for 0. Note: Omitting the .M extension (IC[0]) defaults to measured data only, NOT both measured and simulated data.

S.s[2]

Produces a matrix of simulated data that is the third point (the first is S.s[0]). An expression can be substituted for 2.

S.21 S.0201 S.9181 S.(row*10+column) S.(row*100+column)

 

Produces a measured and simulated data set with complex data. The term .21 specifies that the data at row 2, column 1 is to be extracted from data set S (this would be the data corresponding to the forward transfer coefficient). The term .21 can be expressed either literally or by an expression in parentheses ( ) up to 9999. (Note that S.21 and S.0201 are equivalent.) For data sets with more than 9 rows or columns, use the 4-digit row-column specification, for example, S.9902 (row 99, column 2).

S.21[0]

Produces a complex number. M (measured) is assumed by default. The result is the data for row 2, column 1 of S's first measured data matrix. An expression can be substituted for 0.

S.S.21[2]

Produces the same result as above, but for simulated rather than measured data.

IC-CAP also has some limited string manipulation capabilities. The following are examples of the string type (note the 2 alternatives for including quotation marks in a string):

 "hello world"
"IC-CAP says 'hello world' "
'IC-CAP says "hello world" '

The following is an example of a string used in a statement:

 PRINT "hello world"

Assign to x as follows:

 x = "hello"

and x will be of type string.

Built-in Functions

The functions described in this section are built into the Parameter Extraction Language. They can be entered in all uppercase or all lowercase, as in HP BASIC.

Some are duplicated in the IC-CAP Function List, like log. Some functions were built in for efficiency with scalar data (the Function List has functions designed to operate best on data sets). Other built-in functions are for programming convenience, such as size and system$.


Note


A function applied to a data set, unless otherwise noted, generates a new data set in which the specified function has been applied to every point. However, the functions max, min, and size each return single numbers only.


abs

Absolute value of a single real number or magnitude of a complex number.

array_copy(x,yout)

Returns 0 if the ICCAP_ARRAY x is copied successfully to the ICCAP_ARRAY yout. For example:

 abc="ICCAP_ARRAY[6]"
abc[0]="foo"
abc[1]=1.235
abc[2]=2.33
abc[3]="foo"
abc[4]=3
abc[5]=-10.23919

! abc = {"foo", 1.235, 2.33, "foo", 3, -10.23919}

fgh="ICCAP_ARRAY[1]"
fgh[0]="hello"

! fgh = {"hello"}
print array_equal_str(abc, fgh)

print array_copy(abc, fgh)

! abc = {"foo", 1.235, 2.33, "foo", 3, -10.23919}
! fgh = {"foo", 1.235, 2.33, "foo", 3, -10.23919}

print array_equal_str(abc, fgh)

Output:

 0
0
1

Example:

 fgh="ICCAP_ARRAY[2]"
fgh[0]="ICCAP_ARRAY[3]"
fgh[0][0]="foo"
fgh[0][1]=1.235
fgh[0][2]=2.33
fgh[1]="ICCAP_ARRAY[2]"
fgh[1][0]=0
fgh[1][1]= "ICCAP_ARRAY[4]"
fgh[1][1][0]="fee"
fgh[1][1][1]=-10.23919
fgh[1][1][2]=3
fgh[1][1][3]="foo"

array_copy(abc, fgh)

Result:

 abc="ICCAP_ARRAY[2]"
abc[0]="ICCAP_ARRAY[3]"
abc[0][0]="foo"
abc[0][1]=1.235
abc[0][2]=2.33
abc[1]="ICCAP_ARRAY[2]"
abc[1][0]=0
abc[1][1]= "ICCAP_ARRAY[4]"
abc[1][1][0]="fee"
abc[1][1][1]=-10.23919
abc[1][1][2]=3
abc[1][1][3]="foo"

Example:

 array_copy(abc[1], fgh)

Result:

 fgh="ICCAP_ARRAY[2]"
fgh[0]=0
fgh[1]= "ICCAP_ARRAY[4]"
fgh[1][0]="fee"
fgh[1][1]=-10.23919
fgh[1][2]=3
fgh[1][3]="foo"

Example:

 array_copy(abc[0], fgh[1][3])

Result:

 fgh="ICCAP_ARRAY[2]"
fgh[0]=0
fgh[1]= "ICCAP_ARRAY[4]"
fgh[1][0]="fee"
fgh[1][1]=-10.23919
fgh[1][2]=3
fgh[1][3]="ICCAP_ARRAY[3]"
abc[1][3][0]="foo"
abc[1][3][1]=1.235
abc[1][3][2]=2.33

array_equal_num(x,y[,prec])

Returns 1 if the ICCAP_ARRAY x elements have the same double values as the corresponding elements of ICCAP_ARRAY y. Returns 0 if the ICCAP_ARRAY x and ICCAP_ARRAY y are not equivalent. The 3rd optional argument prec can be used to specify the double precision to compare the input arrays x and y with when determining their equivalency. For example:

 abc="ICCAP_ARRAY[4]"
abc[0]=-4.23321
abc[1]=1.235
abc[2]=21
abc[3]=-10.23919

! abc = {-4.23321, 1.235, 21, -10.23919}

abc2="ICCAP_ARRAY[5]"
abc2[0]=-4.23321
abc2[1]=1.235
abc2[2]=21
abc2[3]=-10.23919
abc2[4]=0.3422

! abc = {-4.23321, 1.235, 21, -10.23919, 0.3422}

abc3="ICCAP_ARRAY[4]"
abc3[0]=-4.23321
abc3[1]=1.235
abc3[2]=21
abc3[3]=-10.24

! abc3 = {-4.23321, 1.235, 21, -10.24}

print array_equal_num(abc,  abc2, 3)
print array_equal_num(abc,  abc3, 2)
print array_equal_num(abc,  abc3, 5)
print array_equal_num(abc2, abc3, 3)

Output:

 0
1
0
0

array_equal_str(x,y)

Returns 1 if the ICCAP_ARRAY x elements have the same string values as the corresponding elements of ICCAP_ARRAY y. Returns 0 if the ICCAP_ARRAY x and ICCAP_ARRAY y are not equivalent. For example:

 abc="ICCAP_ARRAY[4]"
abc[0]="foo"
abc[1]=1.235
abc[2]="foo2"
abc[3]=-10.23919

! abc = {"foo", 1.235, "foo2", -10.23919}

abc2="ICCAP_ARRAY[5]"
abc2[0]="foo"
abc2[1]=1.235
abc2[2]="foo2"
abc2[3]=-10.23919
abc2[4]="foo3"

! abc2 = {"foo", 1.235, "foo2", -10.23919, "foo3"}

abc3="ICCAP_ARRAY[4]"
abc3[0]="foo"
abc3[1]=1.235
abc3[2]="foo2"
abc3[3]=-10.23919

! abc3 = {"foo", 1.235, "foo2", -10.23919}

print array_equal_str(abc, abc2)
print array_equal_str(abc, abc3)
print array_equal_str(abc2, abc3)

Output:

 0
1
0

array_insert_at(x,y [,pos])

Returns 0 if successful and ICCAP_ARRAY x will be modified to include the data y inserted into the data array at the optional 3rd argument integer index pos. If the 3rd argument pos is not specified, the data y will be appended to the end of the ICCAP_ARRAY data array x. For example:

 abc="ICCAP_ARRAY[5]"
abc[0]=1
abc[1]=2
abc[2]=3
abc[3]=3
abc[4]=12

print array_insert_at(abc,55,6)
! abc = {1,2,3,3,12}
print array_insert_at(abc,43,5)
! abc = {1,2,3,3,12,43}
print array_insert_at(abc,23.33,0)
! abc = {23.33,1,2,3,3,12,43}
print array_insert_at(abc,-55.34)
! abc = {23.33,1,2,3,3,12,43, -55.34}
print array_insert_at(abc,"foo",2)
! abc = {23.33,1,"foo",2,3,3,12, 43,-55.34}

Output:

 -1
0
0
0
0

array_remove_all(x,y[,prec])

Returns 0 if the value y is found and removed in the array x. Returns -1 if unsuccessful. The ICCAP_ARRAY x will be updated to no longer contain all elements found in the array with the value y. If value y is a double value, then the optional 3rd argument prec can be used to set what precision the function will use to search for the double value y in the array x. For example:

 abc="ICCAP_ARRAY[6]"
abc[0]="foo"
abc[1]=1.235
abc[2]=2.33
abc[3]="foo"
abc[4]=3
abc[5]=-10.23919

! abc = {"foo", 1.235, 2.33, "foo", 3, -10.23919}

print array_remove_all(abc, "unknown" )
! abc = {"foo", 1.235, 2.33, "foo", 3, -10.23919}

print array_remove_all(abc, "5")
! abc = {"foo", 1.235, 2.33, "foo", 3, -10.23919}

print array_remove_all(abc, "3")
! abc = {"foo", 1.235, 2.33, "foo", -10.23919}

print array_remove_all(abc, 2.33)
! abc = {"foo", 1.235, "foo", -10.23919}

print array_remove_all(abc, -10.239, 3)
! abc = {"foo", 1.235, "foo"}

print array_remove_all(abc, "foo")
! abc = {1.235}

Output:

 -1
-1
0
0
0
0

array_remove_at(x,pos)

Returns 0 if successful and the dataset, complex 1x1 array, or ICCAP_ARRAY x with the data removed from the data array at argument integer index pos. For example:

 abc="ICCAP_ARRAY[4]"
abc[0]=1
abc[1]=2
abc[2]="foo"
abc[3]=3
! abc = {1, 2, foo, 3}

print array_remove_at(abc, 2)
! abc = {1, 2, 3}

print array_remove_at(abc, 1)
! abc = {1, 3}

print array_remove_at(abc, 0)
! abc = {3}

print array_remove_at(abc, 0)
! abc = ""
! abc is no longer an ICCAP_ARRAY

Output:

 0
0
0
0

array_remove_first(x,y[,prec])

Returns the integer position of the first occurrence of value y that is found in the array x and removed, or returns -1 if unsuccessful. The ICCAP_ARRAY x will be updated to no longer contain the first element found in the array to contain the value y on return. If value y is a double value, then the optional 3rd argument prec can be used to set what precision the function will use to search for the double value y in the array x for removal. For example:

 abc="ICCAP_ARRAY[6]"
abc[0]="foo"
abc[1]=1.235
abc[2]=2.33
abc[3]="foo"
abc[4]=3
abc[5]=-10.23919

! abc = {"foo", 1.235, 2.33, "foo", 3, -10.23919}

print array_remove_first(abc, "unknown" )
! abc = {"foo", 1.235, 2.33, "foo", 3, -10.23919}

print array_remove_first(abc, "5")
! abc = {"foo", 1.235, 2.33, "foo", 3, -10.23919}

print array_remove_first(abc, "3")
! abc = {"foo", 1.235, 2.33, "foo", -10.23919}

print array_remove_first(abc, 2.33)
! abc = {"foo", 1.235, "foo", -10.23919}

print array_remove_first(abc, -10.239, 3)
! abc = {"foo", 1.235, "foo"}

print array_remove_first(abc, "foo")
! abc = {1.235, "foo"}

Output:

 -1
-1
4
2
3
0

array_remove_last(x,y[,prec])

Returns the integer position of the last occurrence of value y that is found in the array x and removed, or returns -1 if unsuccessful. The ICCAP_ARRAY x will be updated to no longer contain the last element found in the array to contain the value y on return. If value y is a double value, then the optional 3rd argument prec can be used to set what precision the function will use to search for the double value y in the array x for removal. For example:

 abc="ICCAP_ARRAY[6]"
abc[0]="foo"
abc[1]=1.235
abc[2]=2.33
abc[3]="foo"
abc[4]=3
abc[5]=-10.23919

! abc = {"foo", 1.235, 2.33, "foo", 3, -10.23919}

print array_remove_last(abc, "unknown" )
! abc = {"foo", 1.235, 2.33, "foo", 3, -10.23919}

print array_remove_last(abc, "5")
! abc = {"foo", 1.235, 2.33, "foo", 3, -10.23919}

print array_remove_last(abc, "3")
! abc = {"foo", 1.235, 2.33, "foo", -10.23919}

print array_remove_last(abc, 2.33)
! abc = {"foo", 1.235, "foo", -10.23919}

print array_remove_last(abc, -10.239, 3)
! abc = {"foo", 1.235, "foo"}

print array_remove_last(abc, "foo")
! abc = {"foo", 1.235}

Output:

 -1
-1
4
2
3
2

array_reorder (x,idxarr)

Given an ICCAP_ARRAY x of values and an ICCAP_ARRAY idxarr of indices, this function reorders the elements of the ICCAP_ARRAY x using the array of indices idxarr. Returns 0 if array was successfully reordered. For example:

 abc="ICCAP_ARRAY[4]"
abc[0]=-4.23321
abc[1]=1.235
abc[2]=21
abc[3]=-10.23919

! abc = {-4.23321, 1.235, 21, -10.23919}

idxabc="ICCAP_ARRAY[4]"
idxabc[0]=2
idxabc[1]=3
idxabc[2]=0
idxabc[3]=1

print array_reorder(abc, idxabc)

! abc = {21, -10.23919, -4.23321, 1.235}

Output:

 0 

array_rsort_num (x, prec[, idxArr])

Given an ICCAP_ARRAY x and no 3rd optional argument idxArr, this function will sort the ICCAP_ARRAY x in descending order using the given double precision, specified by the 2nd argument prec. The precision will be used to compare the array elements' double values during the sorting operation. If the 3rd optional argument idxArr is specified, then the ICCAP_ARRAY x will not be sorted but instead the function will return idxArr as an ICCAP_ARRAY with an array of sorted indices. Returns 0 if successful. For example:

 abc="ICCAP_ARRAY[4]"
abc[0]=-4.23321
abc[1]=1.235
abc[2]=21
abc[3]=-10.23919

! abc = {-4.23321, 1.235, 21, -10.23919}

print array_rsort_num(abc, 5)

! abc = {21, 1.2345, -4.23321, -10.23919}

abc2="ICCAP_ARRAY[4]"
abc2[0]=-4.23321
abc2[1]=1.235
abc2[2]=21
abc2[3]=-10.23919

! abc2 = {-4.23321, 1.235, 21, -10.23919}

idxabc2=""
! idxabc2 = 

print array_rsort_num(abc2, 5, idxabc2)

! abc2 = {-4.23321, 1.235, 21, -10.23919}
! idxabc2 = {2, 1, 0, 3}

Output:

 0
0

array_rsort_str (x[, idxArr])

Given an ICCAP_ARRAY x and no 2nd optional argument idxArr, this function sorts the ICCAP_ARRAY x in descending order comparing the array elements' string values. If the optional 2nd argument idxArr is specified, then the ICCAP_ARRAY x will not be sorted but instead the function returns idxArr as an ICCAP_ARRAY with an array of sorted indices. Returns 0 if successful. For example:

 abc="ICCAP_ARRAY[4]"
abc[0]="foo"
abc[1]="fee"
abc[2]="foo2"
abc[3]="faa"

! abc = {"foo", "fee", "foo2", "faa"}

print array_rsort_str(abc)

! abc = {"foo2", "foo", "fee", "faa"}

abc2="ICCAP_ARRAY[4]"
abc2[0]="foo"
abc2[1]="fee"
abc2[2]="foo2"
abc2[3]="faa"

! abc2 = {"foo", "fee", "foo2", "faa"}

idxabc2=""
! idxabc2 = 

print array_rsort_str(abc2, idxabc2)

! abc2 = {"foo", "fee", "foo2", "faa"}
! idxabc2 = {2, 0, 1, 3}

Output:

 0
0

array_sort_num (x, prec[, idxArr])

Given an ICCAP_ARRAY x and no 3rd optional argument idxArr, this function sorts the ICCAP_ARRAY x in ascending order using the given double precision, specified by the 2nd argument prec. The precision will be used to compare the array elements' double values during the sorting operation. If the 3rd optional argument idxArr is specified, then the ICCAP_ARRAY x will not be sorted but instead the function returns idxArr as an ICCAP_ARRAY with an array of sorted indices. Returns 0 if successful. For example:

 abc="ICCAP_ARRAY[4]"
abc[0]=-4.23321
abc[1]=1.235
abc[2]=21
abc[3]=-10.23919

! abc = {-4.23321, 1.235, 21, -10.23919}

print array_sort_num(abc, 5)

! abc = {-10.23919, -4.23321, 1.2345, 21}

abc2="ICCAP_ARRAY[4]"
abc2[0]=-4.23321
abc2[1]=1.235
abc2[2]=21
abc2[3]=-10.23919

! abc2 = {-4.23321, 1.235, 21, -10.23919}

idxabc2=""
! idxabc2 = 

print array_sort_num(abc2, 5, idxabc2)

! abc2 = {-4.23321, 1.235, 21, -10.23919}
! idxabc2 = {3, 0, 1, 2}

Output:

 0
0

array_sort_str (x[, idxArr])

Given an ICCAP_ARRAY x and no 2nd optional argument idxArr, this function sorts the ICCAP_ARRAY x in ascending order comparing the array elements' string values. If the optional 2nd argument idxArr is specified, then the ICCAP_ARRAY x will not be sorted but instead the function returns idxArr as an ICCAP_ARRAY with an array of sorted indices. Returns 0 if successful. For example:

 abc="ICCAP_ARRAY[4]"
abc[0]="foo"
abc[1]="fee"
abc[2]="foo2"
abc[3]="faa"

! abc = {"foo", "fee", "foo2", "faa"}

print array_sort_str(abc)

! abc = {"faa", "fee", "foo", "foo2"}

abc2="ICCAP_ARRAY[4]"
abc2[0]="foo"
abc2[1]="fee"
abc2[2]="foo2"
abc2[3]="faa"

! abc2 = {"foo", "fee", "foo2", "faa"}

idxabc2=""
! idxabc2 = 

print array_sort_str(abc2, idxabc2)

! abc2 = {"foo", "fee", "foo2", "faa"}
! idxabc2 = {3, 1, 0, 2}

Output:

 0
0

ascii$

Converts ascii-coded characters into literal characters as entered into a text box.

chr$(x)

Converts the integer x to its equivalent ASCII string character.

colsof(x)

Returns an integer number of columns in a matrix, complex array of matrix data, or a data set x. For example:

 complex def[4]
complex ghi.55[4]

print colsof(def)
print colsof(ghi)

Output:

 1
5

complex_equal(x,y [,prec])

Returns 1 if the complex_array or dataset x elements have the same complex values as the corresponding elements of complex array or dataset y. Returns 0 if x and y are not equivalent. Use the 3rd optional argument prec to specify double precision when comparing the x and y data arrays. For example:

 complex def[5]
def[0]=-3.23
def[1]=1.000
def[2]=3+j*5
def[3]=2.3+j*1
def[4]=3+j*5

!Point Index   R:common       I:common 
!    0 (1,1) -3.230000E+000  0.000000E+000
!    1 (1,1)  1.000000E+000  0.000000E+000
!    2 (1,1)  3.000000E+000  5.000000E+000
!    3 (1,1)  2.300000E+000  1.000000E+000
!    4 (1,1)  3.000000E+000  5.000000E+000

complex jkl[5]
jkl[0]=-3.23+j*6
jkl[1]=1.000+j*2
jkl[2]=3+j*5
jkl[3]=2.3+j*1
jkl[4]=3+j*5

!Point Index   R:common       I:common 
!    0 (1,1) -3.230000E+000  6.000000E+000
!    1 (1,1)  1.000000E+000  2.000000E+000
!    2 (1,1)  3.000000E+000  5.000000E+000
!    3 (1,1)  2.300000E+000  1.000000E+000
!    4 (1,1)  3.000000E+000  5.000000E+000

x=complex_copy(def)
print complex_equal(def, x)
print complex_equal(def, jkl)

Output:

 1
0

complex_insert_at(x,y [,pos])

 Returns a new complex array or dataset with the data y 
inserted into a copy of the dataset or complex array x. If pos, 
the optional 3rd argument integer position is specified, the data 
y will be inserted at the index in the copy of the dataset or 
complex array specified by the x that is returned. If the 3rd 
argument pos is not specified, the data y will be appended to 
the end of the returned copy of the data set or complex array x. 
Only 1x1 matrix complex array data or datasets are supported. 
The complex array or dataset x will not be modified by this 
function. For example:
 complex def[2]
def[0]=1.000
def[1]=2.3+j*1

!Point Index   R:common       I:common 
! 0 (1,1)  1.000000E+000  0.000000E+000
! 1 (1,1)  2.300000E+000  1.000000E+000

x=complex_insert_at(def, 3+j*5, 1)

!Point Index   R:common       I:common 
! 0 (1,1)  1.000000E+000  0.000000E+000
! 1 (1,1)  3.000000E+000  5.000000E+000
! 2 (1,1)  2.300000E+000  1.000000E+000

y=complex_insert_at(x, 443.55)

!Point Index   R:common       I:common 
! 0 (1,1)  1.000000E+000  0.000000E+000
! 1 (1,1)  3.000000E+000  5.000000E+000
! 2 (1,1)  2.300000E+000  1.000000E+000
! 3 (1,1)  4.435500E+002  0.000000E+000

z=complex_insert_at(y, "-3.23", 0)

!Point Index   R:common       I:common 
! 0 (1,1) -3.230000E+000  0.000000E+000
! 1 (1,1)  1.000000E+000  0.000000E+000
! 2 (1,1)  3.000000E+000  5.000000E+000
! 3 (1,1)  2.300000E+000  1.000000E+000
! 4 (1,1)  4.435500E+002  0.000000E+000

complex_remove_all(x,y[,prec])

Returns a copy of the dataset or complex array x with all occurrences of real value y removed, or returns just a copy of the dataset or complex array x if value y was not found. If value y is a double value, then the optional 3rd argument prec can be used to set what precision the function will use to search for the double value y in the magnitude real data of the complex array or dataset x. For example:

 complex def[5]
def[0]=-3.23
def[1]=1.000
def[2]=3+j*5
def[3]=2.3+j*1
def[4]=3+j*5

!Point Index   R:common       I:common      
!    0 (1,1) -3.230000E+000  0.000000E+000
!    1 (1,1)  1.000000E+000  0.000000E+000
!    2 (1,1)  3.000000E+000  5.000000E+000
!    3 (1,1)  2.300000E+000  1.000000E+000
!    4 (1,1)  3.000000E+000  5.000000E+000

x=complex_remove_all(def, 3+j*5)

!Point Index   R:common       I:common      
!    0 (1,1) -3.230000E+000  0.000000E+000
!    1 (1,1)  1.000000E+000  0.000000E+000
!    2 (1,1)  2.300000E+000  1.000000E+000

y=complex_remove_all(x, -3.23, 3)

!Point Index   R:common       I:common      
!    0 (1,1)  1.000000E+000  0.000000E+000
!    1 (1,1)  2.300000E+000  1.000000E+000

z=complex_remove_all(y, "2.3")

!Point Index   R:common       I:common      
!    0 (1,1)  1.000000E+000  0.000000E+000

complex_remove_at(x,pos)

Returns a copy of the dataset or complex array x with the data removed at position x in the dataset or complex array. Only 1x1 matrix complex array data or datasets are supported. The complex array or dataset x will not be modified by this function. For example:

 complex def[4]
def[0]=-3.23
def[1]=1.000
def[2]=3+j*5
def[3]=2.3+j*1

!Point Index   R:common       I:common      
!    0 (1,1) -3.230000E+000  0.000000E+000
!    1 (1,1)  1.000000E+000  0.000000E+000
!    2 (1,1)  3.000000E+000  5.000000E+000
!    3 (1,1)  2.300000E+000  1.000000E+000

x=complex_remove_at(def, 0)

!Point Index   R:common       I:common      
!    0 (1,1)  1.000000E+000  0.000000E+000
!    1 (1,1)  3.000000E+000  5.000000E+000
!    2 (1,1)  2.300000E+000  1.000000E+000

y=complex_remove_at(x, 2)

!Point Index   R:common       I:common      
!    0 (1,1)  1.000000E+000  0.000000E+000
!    1 (1,1)  3.000000E+000  5.000000E+000

z=complex_remove_at(y, 0)

!Point Index   R:common       I:common      
!    1 (1,1)  3.000000E+000  5.000000E+000

complex_remove_first(x,y[,prec])

Returns a copy of the dataset or complex array x with the first occurrence of real value y removed, or returns just a copy of the dataset or complex array x if value y was not found. If value y is a double value, then the optional 3rd argument prec can be used to set what precision the function will use to search for the double value y in the magnitude real data of the complex array or dataset x. For example:

 complex def[5]
def[0]=-3.23
def[1]=1.000
def[2]=3+j*5
def[3]=2.3+j*1
def[4]=3+j*5

!Point Index   R:common       I:common      
!    0 (1,1) -3.230000E+000  0.000000E+000
!    1 (1,1)  1.000000E+000  0.000000E+000
!    2 (1,1)  3.000000E+000  5.000000E+000
!    3 (1,1)  2.300000E+000  1.000000E+000
!    4 (1,1)  3.000000E+000  5.000000E+000

x=complex_remove_first(def, 3+j*5)

!Point Index   R:common       I:common      
!    0 (1,1) -3.230000E+000  0.000000E+000
!    1 (1,1)  1.000000E+000  0.000000E+000
!    2 (1,1)  2.300000E+000  1.000000E+000
!    3 (1,1)  3.000000E+000  5.000000E+000

y=complex_remove_first(x, -3.23, 3)

!Point Index   R:common       I:common      
!    0 (1,1)  1.000000E+000  0.000000E+000
!    1 (1,1)  2.300000E+000  1.000000E+000
!    2 (1,1)  3.000000E+000  5.000000E+000

z=complex_remove_first(y, "2.3")

!Point Index   R:common       I:common      
!    0 (1,1)  1.000000E+000  0.000000E+000
!    1 (1,1)  3.000000E+000  5.000000E+000

a=complex_remove_first(z, 3)

!Point Index   R:common       I:common      
!    0 (1,1)  1.000000E+000  0.000000E+000

complex_remove_last(x,y[,prec])

Returns a copy of the dataset or complex array x with the last occurrence of real value y removed, or returns just a copy of the dataset or complex array x if value y was not found. If value y is a double value, then the optional 3rd argument prec can be used to set what precision the function will use to search for the double value y in the magnitude real data of the complex array or dataset x. For example:

 complex def[5]
def[0]=-3.23
def[1]=1.000
def[2]=3+j*5
def[3]=2.3+j*1
def[4]=3+j*5

!Point Index   R:common       I:common      
!    0 (1,1) -3.230000E+000  0.000000E+000
!    1 (1,1)  1.000000E+000  0.000000E+000
!    2 (1,1)  3.000000E+000  5.000000E+000
!    3 (1,1)  2.300000E+000  1.000000E+000
!    4 (1,1)  3.000000E+000  5.000000E+000

x=complex_remove_last(def, 3+j*5)

!Point Index   R:common       I:common      
!    0 (1,1) -3.230000E+000  0.000000E+000
!    1 (1,1)  1.000000E+000  0.000000E+000
!    2 (1,1)  3.000000E+000  5.000000E+000
!    3 (1,1)  2.300000E+000  1.000000E+000

y=complex_remove_last(x, -3.23, 3)

!Point Index   R:common       I:common      
!    0 (1,1)  1.000000E+000  0.000000E+000
!    1 (1,1)  3.000000E+000  5.000000E+000
!    2 (1,1)  2.300000E+000  1.000000E+000

z=complex_remove_last(y, "2.3")

!Point Index   R:common       I:common      
!    0 (1,1)  1.000000E+000  0.000000E+000
!    1 (1,1)  3.000000E+000  5.000000E+000

a=complex_remove_last(z, 3)

!Point Index   R:common       I:common      
!    0 (1,1)  1.000000E+000  0.000000E+000

complex_reorder (x,idxarr)

Given a complex array or dataset x and an ICCAP_ARRAY idxarr of indices, this function creates a copy of the dataset or complex array x and reorder the elements of the copied data array using the array of indices idxarr, and then returns that reordered copy of the data array x. For example:

 complex def[5]
def[0]=-3.23
def[1]=1.000
def[2]=3+j*5
def[3]=2.3+j*1
def[4]=3+j*5

!Point Index   R:common       I:common      
!    0 (1,1) -3.230000E+000  0.000000E+000
!    1 (1,1)  1.000000E+000  0.000000E+000
!    2 (1,1)  3.000000E+000  5.000000E+000
!    3 (1,1)  2.300000E+000  1.000000E+000
!    4 (1,1)  3.000000E+000  5.000000E+000

idxdef="ICCAP_ARRAY[5]"
idxdef[0]=4
idxdef[1]=3
idxdef[2]=0
idxdef[3]=2
idxdef[4]=1

x=complex_reorder(def, idxdef)

!Point Index   R:common       I:common      
!    0 (1,1)  3.000000E+000  5.000000E+000
!    1 (1,1)  2.300000E+000  1.000000E+000
!    2 (1,1) -3.230000E+000  0.000000E+000
!    3 (1,1)  3.000000E+000  5.000000E+000
!    4 (1,1)  1.000000E+000  0.000000E+000

complex_rsort (x,prec[,idxArr])

Given a complex array or dataset x, this function creates a copy of the dataset or complex array x, then sorts the elements in descending order, and then returns the sorted copy. The 2nd argument prec is used to specify the double precision to use when comparing elements during the sorting of the data array elements. The 3rd optional argument idxArr if specified, will be returned as an ICCAP_ARRAY of sorted integer indices. For example:

 complex def[5]
def[0]=1.000
def[1]=-3.23
def[2]=3+j*5
def[3]=2.3+j*1
def[4]=3+j*5

!Point Index   R:common       I:common      
!    0 (1,1)  1.000000E+000  0.000000E+000
!    1 (1,1) -3.230000E+000  0.000000E+000
!    2 (1,1)  3.000000E+000  5.000000E+000
!    3 (1,1)  2.300000E+000  1.000000E+000
!    4 (1,1)  3.000000E+000  5.000000E+000

x=complex_rsort(def,4)

!Point Index   R:common       I:common      
!    0 (1,1)  3.000000E+000  5.000000E+000
!    1 (1,1)  3.000000E+000  5.000000E+000
!    2 (1,1)  2.300000E+000  1.000000E+000
!    3 (1,1)  1.000000E+000  0.000000E+000
!    4 (1,1) -3.230000E+000  0.000000E+000

idxdef=""
y=complex_rsort(def, 4, idxdef)

!Point Index   R:common       I:common      
!    0 (1,1)  3.000000E+000  5.000000E+000
!    1 (1,1)  3.000000E+000  5.000000E+000
!    2 (1,1)  2.300000E+000  1.000000E+000
!    3 (1,1)  1.000000E+000  0.000000E+000
!    4 (1,1) -3.230000E+000  0.000000E+000

! idxdef = {2,4,3,0,1}

complex_sort (x,prec[,idxArr])

Given a complex array or dataset x, this function creates a copy of the dataset or complex array x, and sort the elements in ascending order, and then returns that sorted copy of the complex array or dataset x. The 2nd argument prec is used to specify the double precision to use when comparing elements during the sorting of the data array elements. The 3rd optional argument idxArr, if specified, will be returned as an ICCAP_ARRAY of sorted integer indices. For example:

 complex def[5]
def[0]=1.000
def[1]=-3.23
def[2]=3+j*5
def[3]=2.3+j*1
def[4]=3+j*5

!Point Index   R:common       I:common      
!    0 (1,1)  1.000000E+000  0.000000E+000
!    1 (1,1) -3.230000E+000  0.000000E+000
!    2 (1,1)  3.000000E+000  5.000000E+000
!    3 (1,1)  2.300000E+000  1.000000E+000
!    4 (1,1)  3.000000E+000  5.000000E+000

x=complex_sort(def,4)

!Point Index   R:common       I:common      
!    0 (1,1) -3.230000E+000  0.000000E+000
!    1 (1,1)  1.000000E+000  0.000000E+000
!    2 (1,1)  2.300000E+000  1.000000E+000
!    3 (1,1)  3.000000E+000  5.000000E+000
!    4 (1,1)  3.000000E+000  5.000000E+000

idxdef=""
y=complex_sort(def, 4, idxdef)

!Point Index   R:common       I:common      
!    0 (1,1) -3.230000E+000  0.000000E+000
!    1 (1,1)  1.000000E+000  0.000000E+000
!    2 (1,1)  2.300000E+000  1.000000E+000
!    3 (1,1)  3.000000E+000  5.000000E+000
!    4 (1,1)  3.000000E+000  5.000000E+000

! idxdef = {1, 0, 3, 2, 4}

cutstr(x,y[,delimiter])

Returns the size of ICCAP_ARRAY y. Divides a string x into substrings, saving the substrings in ICCAP_ARRAY y, using either whitespace substrings (tabs, spaces, newlines) or an explicitly passed 3rd argument as a delimiter. The leading space will be ignored when using the whitespace as a delimiter.

 x="a b c"
print cutstr(x,y)
! y = {"a", "b", "c"}
 
 x="a    b c"
print cutstr(x,y)
! y = {"a", "b", "c"}
 
 x="a,b,c"
print cutstr(x,y, ",")
! y = {"a", "b", "c"}
 
 x="a,,b,c"
print cutstr(x,y, ",")
! y = {"a", "", "b", "c"}
 
 x="aspambspamc"
print cutstr(x,y, "spam")
! y = {"a", "b", "c"}

Output :

 3
3
3
4
3

dataset

Enables you to access the dataset referred to by a string. A second argument may be specified which is a variable to receive any error string normally going to a red error box.

exp

e is raised to the power specified by the argument.

fix_path$

Guarantees a path appropriate for the current architecture.

fix_path$(<path>)

Returns a string based on the passed in <path>, which is either a filename or a directory. The returned string will be the same filename or directory converted to the local architecture.

On UNIX, this converts Windows directory separators '\' to UNIX directory separators '/'. On the PC, it does the opposite and also takes care of any cygwin path dependencies.

Since IC-CAP uses the cygwin shell to execute the PEL system() and system$() commands, certain calls have cygwin dependencies. For example,

 print system$("echo $HOME")

may return something like /cygdrive/d/users/icuser, which does not have the Windows feel. Therefore, you may want to rewrite the PEL as follows:

 print fix_path$(system$("echo $HOME"))

which returns d:\users\icuser using the above example.

get_user_region_names(x,y)

Returns the size of ICCAP_ARRAY y. Returns a list of names for the user defined regions of a plot (and a plot within a multiplot).

 x = get_user_region_names("<Object>", y)

For a multiplot, specify the plot number in brackets after the object:

 x = get_user_region_names("<Object>/Multiplot[1]", y)

imag

Extracts the imaginary part of a data set, matrix, or complex number.

imaginary

Extracts the imaginary part of a data set, matrix, or complex number.

index_of(x,y,pos[,prec])

Returns the integer index of the first element found starting at position pos that has the same value as y in the ICCAP_ARRAY, dataset, or complex array x. If no elements are found in the data array x, then -1 is returned. The 2nd argument y can be a string or a double value. If value y is a double value, then the optional 4th argument prec can be used to set what precision the function will use to search for the element with the same double value y in the ICCAP_ARRAY, dataset, or complex array x. For example:

 abc="ICCAP_ARRAY[6]"
abc[0]="foo"
abc[1]=1.235
abc[2]=2.33
abc[3]="foo"
abc[4]=3
abc[5]=-10.23919

! abc = {"foo", 1.235, 2.33, "foo", 3, -10.23919}

print "ICCAP_ARRAY output:"
print index_of(abc, "unknown", 0)
print index_of(abc, 3, 0)
print index_of(abc, 3, 5)
print index_of(abc, -10.24, 0, 3)
print index_of(abc, "foo", 0)
print index_of(abc, "foo", 1)

complex def[5]
def[0]=-3.23
def[1]=1.000
def[2]=3+j*5
def[3]=2.3+j*1
def[4]=3+j*5

!Point Index   R:common       I:common      
!    0 (1,1) -3.230000E+000  0.000000E+000
!    1 (1,1)  1.000000E+000  0.000000E+000
!    2 (1,1)  3.000000E+000  5.000000E+000
!    3 (1,1)  2.300000E+000  1.000000E+000
!    4 (1,1)  3.000000E+000  5.000000E+000

print "Complex array output:"
print index_of(def, "2.3", 4)
print index_of(def, "2.3", 0)
print index_of(def, 3, 0, 4)
print index_of(def, 3, 3, 4)

Output:

ICCAP_ARRAY output:

 -1
4
-1
5
0
3

Complex array output:

 -1
3
2
4

last_index_of(x,y[,prec])

Returns the integer index of the last element that has the same value as y in the ICCAP_ARRAY, dataset, or complex array x. If no elements are found in the data array x, then -1 is returned. The 2nd argument y can be a string or a double value. If value y is a double value, then the optional 3rd argument prec can be used to set what precision the function will use to search for the element with the same double value y in the ICCAP_ARRAY, dataset, or complex array x. For example:

 abc="ICCAP_ARRAY[6]"
abc[0]="foo"
abc[1]=1.235
abc[2]=2.33
abc[3]="foo"
abc[4]=3
abc[5]=-10.23919

! abc = {"foo", 1.235, 2.33, "foo", 3, -10.23919}

print "ICCAP_ARRAY output:"
print last_index_of(abc, "unknown")
print last_index_of(abc, 3)
print last_index_of(abc, -10.24, 3)
print last_index_of(abc, "foo")

complex def[5]
def[0]=-3.23
def[1]=1.000
def[2]=3+j*5
def[3]=2.3+j*1
def[4]=3+j*5

!Point Index   R:common       I:common      
!    0 (1,1) -3.230000E+000  0.000000E+000
!    1 (1,1)  1.000000E+000  0.000000E+000
!    2 (1,1)  3.000000E+000  5.000000E+000
!    3 (1,1)  2.300000E+000  1.000000E+000
!    4 (1,1)  3.000000E+000  5.000000E+000

print "Complex array output:"
print last_index_of(def, 35.355, 4)
print last_index_of(def, "2.3")
print last_index_of(def, 3.0, 4)
print last_index_of(def, "3.00")

Output:

ICCAP_ARRAY output:

 -1
4
5
3

Complex array output:

 -1
3
4
4

log

Computes log base e.

log10 or lgt

Computes log base 10.

lookup_instr_table_val or lookup_instr_table_val_eval

Enables you to access the value of a field in an instrument options table. The first argument is the path to the table. The second argument is the field in the table (see Set Table Field Value for syntax to specify the field name). An optional third argument may be specified which is a variable to receive any error string normally going to a red error box. lookup_instr_table_val returns NUMPTS if NUMPTS is a variable in # of Points. lookup_instr_table_val_eval returns 100 (presuming NUMPTS evaluates to 100).

lookup_obj_attribute

Enables you to access the state or attributes of a plot. The first argument is the object and the second argument is the keyword. The syntax is:

 X=lookup_obj_attribute("<Object>","Keyword")

For a Multiplot, specify the plot number in brackets after the object:

 X=lookup_obj_attribute("<Object>[N]", "Keyword")

For example:

 X=lookup_obj_attribute("/my_model/ 
my_dut/my_setup/my_multiplot/ 
Multiplot[1],"UserSelectedRegion")

This example returns the coordinates of the white box that the user drew on the second plot (index=1) of the Multiplot my_multiplot.

The following table lists supported keywords.

Object
Keyword
Return Value
model
POWindowOpen
Int flag 0/1
plot
POEnable
Int flag 0/1
plot
ErrorEnable
Int flag 0/1
plot
IsErrorRelative
Int 1 is error is relative, 0 if error is absolute
plot
ErrorRegion
Data set array of 5 points
X1,x2,y1,y2, color
Color always returns 3 (green)

plot
UserRegion/<Name>
Data set array of 5 points
X1,x2,y1,y2, color

plot
PORegionNumber
Number of Plot Optimizer regions
plot
PORegion[N]
Dataset array of 4 points
X1,x2,y1,y2

plot
UserSelectedRegion (white box)
Dataset array of 6 points
Returns the coordinate of the white box:
X1,x1,y1,y2,z1,z2
Where z1,z2 are the coordinates with respect to the Y2 axis

plot
UserSelectedPoint
Dataset array of 4 points
    • selected point in the dataset
    • selected trace (0-8 with 8 being the Y2 trace)
    • selected type:
0 (transform)
1(measured)
2 (simulated)
    • selected curve
plot
NumHighlightedCurves
Number of curves that were marked highlighted via PEL function: lookup_obj_attribute(plot_str&"/Trace[i]", "NumHighlightedCurves")
( i is the index of the trace that belong to the plot "plot_str")
plot
HighlightedCurveIndex
The curve index of the highlighted curve that was marked highlighted via PEL function: lookup_obj_attribute(plot_str&"/Trace [i]/Hicurve[j]", "HighlightedCurveIndex")
( i is the index of the trace that belong to the plot plot_str, j is the index of the highlighted curve that belong to the trace plot_str&"/Trace[i]")
plot
GraphicMouseState
Returns 2 if a white box is selected
plot
XAxisDisplayType
-1 (Unknown) 0 (Linear), 1(Log) or 2 (dB)
plot
YAxisDisplayType
-1 (Unknown) 0 (Linear), 1(Log) or 2 (dB)
plot
Y2AxisDisplayType
-1 (Unknown) 0 (Linear), 1(Log) or 2 (dB)
Multiplot only
SelectedPlot
Returns selected plot

lookup_par

Enables you to access the value of a parameter referenced by a string. A second argument may be specified which is a variable to receive any error string normally going to a red error box.

lookup_table_val or lookup_table_val_eval

Enables you to access the value of a field in an input, output, plot, parameter, or optimizer table. The first argument is the path to the table. The second argument is the field in the table (see Set Table Field Value for syntax to specify the field name). An optional third argument may be specified which is a variable to receive any error string normally going to a red error box. lookup_table_val returns NUMPTS if NUMPTS is a variable in # of Points. lookup_table_val_eval returns 100 (presuming NUMPTS evaluates to 100).

lookup_var

Enables you to access the value of a variable referenced by a string. A second argument may be specified which is a variable to receive any error string normally going to a red error box.

lwc$(x)

Returns the lower case version of the string x. For example:

 print lwc$("Hello")

Output:

hello

mag or magnitude

Computes the magnitude for a complex number, or for each complex number in a matrix, data set, or data set of matrices.

max

Takes any number of arguments, as in HP BASIC. The argument list can be a mixture of scalars and data sets, and the function returns the maximum value found in any of them. This always returns a single real number, and only the real parts are considered. If matrices are received, only the 1,1 points are considered.

mdata(expr)

Returns the measured part of the argument expr.

min

Behaves like max, but returns the minimum value.

ph or phase

Computes the phase angle in radians for a complex number, or for each complex number in a matrix, data set, or data set of matrices.

real

Extracts the real part of a data set, matrix, or complex number.

rowsof(x)

Returns an integer number of rows in a matrix, complex array of matrix data, or a data set x. For example:

 complex def[4]
complex ghi.55[4]

print rowsof(def)
print rowsof(ghi)

Output:

1
5

sdata(expr)

Returns the simulated part of the argument expr.

size

Returns the number of points in a data set, which is an integer.

sizeof(x)

Returns an integer number of elements in a variable ICCAP_ARRAY, or a complex array of data, or a data set. Returns 0 if x doesn't represent a data array or if the data array is empty or both. For example:

 abc="ICCAP_ARRAY[5]"
abc[0]=1
abc[1]=2
abc[2]=3
abc[3]=3
abc[4]=12

complex def[4]
def[0]=1.000
def[1]=1+j*1
def[2]=5
def[3]=6

complex ghi.55[3]

x=1.354529

print sizeof(abc)
print sizeof(def)
print sizeof(ghi)
print sizeof(x)

Output:

5
4
3
0

sqrt

Square root function. Complex and negative quantities produce correct complex or imaginary results.

strlen(x)

Returns the number of characters in the string x. For example:

 print strlen("Hello")

Output:

5

strpos(x,y)

Returns the index of the first occurrence of substring str2 found in string str1. An optional third argument may be specified which is an integer starting position that should be greater than or equal to 1. The starting position can be used to specify the starting index within the string str1 to start searching for substring str2. For example:

 print strpos("Hello","ell")
print strpos("Hello","He")
print strpos("Hello","dog")
print strpos("Hello","l",1)
 print strpos("Hello","l",4)
 print strpos("Hello","l",5)

Output:

 2
1
0
3
4
0

strrpos(str1,str2 [,endpos])

Returns the index of the last occurrence of substring str2 found in string str1. An optional third argument may be specified which is an integer end position that should be greater than or equal to 1. The end position can be used to specify the last index within the string str1 to search for the last occurrence of substring str2, using the search range of index 1 to endpos. For example:

 print strrpos("Hello","ell")
print strrpos("Hello","He")
print strrpos("Hello","dog")
print strrpos("Hello","l",1)
print strrpos("Hello","l",4)
print strrpos("Hello","l",5)

Output:

 2
1
0
0
4
4

substr$(x,start,stop)

Extracts the substring from the start index to the stop index from the string x. The value "1" refers to the first character in the string. If stop is omitted, substr$ returns the string from start to the end of the string. For example:

 x="Hello"
print substr$(x,4)
print substr$(x,2,4)

Output:

 lo
ell

sys_path$

Guarantees a path appropriate for passing to the system$() or system() command.

sys_path$(<path>)

Returns a string based on the passed in <path>, which is either a filename or a directory. The returned string will be the same filename or directory converted to the proper format for the system$() or system() function.

Since IC-CAP uses the cygwin shell to process the PEL system$ and system calls, PC style paths may not work properly when passed as arguments to system functions.

For example, if the user's response to

 LINPUT "Enter a filename",path
print system$("ls -al " & path)

is:

foobar — the code functions properly.

/tmp/foobar — the code functions properly because IC-CAP insures /tmp and /var/tmp exist in the system call environment.

d:foobar — the code does not function properly.

However, the following rewrite

 LINPUT "Enter a filename",path
print system$("ls -al " & sys_path$(path))

insures that the system$() call actually sees /cygdrive/d/foobar even when the user types d:foobar.

system

Accepts a string argument, which is a shell command to invoke. You can employ all valid shell I/O redirection and other shell syntax within the string argument. It returns an integer, which is the exit status of the shell. If the shell command generates output, it is printed in the terminal window from which the IC-CAP program was started; refer to system$. On the PC, if a syntax error appears, turn on screen debug for additional information.

system

Accepts a string argument, which is a shell command to invoke. You can employ all valid shell I/O redirection and other shell syntax within the string argument. It returns an integer, which is the exit status of the shell. If the shell command generates output, it is printed in the terminal window from which the IC-CAP program was started; refer to system$. On the PC, if a syntax error appears, turn on screen debug for additional information.

system$

Similar to system; it captures the command's output, instead of letting it go to the terminal window. Instead of returning an integer, it returns the output that the shell command generated. For example:

 my_date$ = system$("date") ! get date
com$="echo "&my_date$&"|cut -c 5-7"
month$ = system$(com$) ! substring 5-7

On the PC, if a syntax error appears, turn on screen debug for additional information.

trim$(x,chars)

Where x is a string and chars is a string containing characters to be trimmed from x. This function trims the unwanted characters from the beginning and end of the string. The parameter for chars is optional. If chars is omitted, the default is to remove spaces from the beginning and end of the string. For example:

 x="   stuff here   "
print trim$(x)
y="////stuff here__//__//"
print trim$(y)
print trim$(y,"/_")

Output:

 stuff here
////stuff here__//__//
stiff here

upc$(x)

Returns the string x with all upper case characters. For example:

 print upc$("Hello")

Output:

 HELLO

val

Generates a number, given a string representation of a simple (not expression) integer, floating point, or complex number. For example:

 linput "give a number",x$
x = val(x$)

val$

Generates a string, given a numeric expression. In conjunction with the & operator (string concatenation), it can be useful for formatting. The optional second argument can either be an integer or a string.

    • If no optional argument is given, the conversion uses the %g printf conversion (see printf() man page for details). The number is converted with WORKING_PRECISION digits of precision. If WORKING_PRECISION is not set, 6 digits are used.
    • If the second argument is an integer, then the integer is interpreted as the number of digits of precision to use in a %g printf() conversion (see printf() man page for details).
    • If the second argument is %nnICFMT where nn are optional integers, then the number is converted to a string according to IC-CAP default conversion routine, which uses unit multipliers (e.g., 1.23e-12 is converted to 1.23p). The optional nn specifies the number of digits of precision. If nn is less than 4, it is clamped to 4. If nn is omitted, then WORKING_PRECISION digits are used, if WORKING_PRECISION is not defined, 4 digits will be used.
    • If the second argument is any other string, it should contain exactly one of %e, %E, %g, %G, or %f. See the printf() man page for optional modifiers to these formats that specify the number of digits and spacing.

Examples:

 x=1.23456789e-12 
print val$(x,"%ICFMT") ! 1.235p (Assuming WORKING_PRECISION 
not set) 
print val$(x,"%1ICFMT")! 1.235p (clamped to 4) 
print val$(x,"%8ICFMT") ! 1.2345679p (8 digits total) 
print val$(x,"abc %ICFMT") ! abc ICFMT (`abc ' on Linux) 
(uses printf syntax)
print val$(x,"%e") ! 1.234568e-012 (printf format ignores 
WORKING_PRECISION)
print val$(x,"%.3e") ! 1.235e-012 (specify 3 digits after 
decimal)
print val$(x,"The number is %+12.4g.") !The number is 
+1.235e-012. (12 positions for entire number and +)
print val$(x) ! 1.23457E-012 (6 digits of precision by 
default)
print val$(x,7) ! 1.234568E-012


Note


Real and complex scalars and data sets are accepted by all functions with the following exceptions: system, system$, and val expect to receive string data, and val$ expects a scalar number.


Built-In Constants

Several constants are recognized. Like statement names and built-in function names, these are reserved words (for example, you should not attempt to name a variable pi). The recognized constants are:

 PI  or  pi
2PI  or  2pi 
J or j (square root of -1)

prevnext