Contents
- Index
Edit variables / $Parameter
From version 5.9 ATPDraw supports an internal parser (TbcParser) as an alternative to $PARAMETERS and Pocket Calculator (PCVP) of ATP. The following differences apply:
With the internal parser all data can be changed except extended data in XFMR, BCTRAN and LCC components. This applies also to data used in internal calculations (Param flag not used), for instance length in LCC section (_LCC) components, RL, and RLC line models.
6 character limit on all variables (not 5 as with the $PARAMETER implementation).
Period '.' in/after numerical values are not needed.
Nested variables allowed (no error message) but previous values used.
SEQ6 function replaced by SEQS
Different logical operators; =, <, >,<=, >=, <>, &, |, ! instead of .EQ., .LT., .GT., .LE., .GE., .NE., .AND., .OR., .NOT., respectively.
Power operators '^' (preferred) and '**' (replace by '^')
The special syntax @[ and @FILE are maintained without restrictions on the number of elements.
The ATP is executed separately for each run (KNT = simulation number) so the total simulation time becomes longer. However multi-core CPUs could be utilized since ATP is ran in separate threads.
Single parameter functions:
ABS, SQR, SQRT, LOG, LOG10, SIGN, DEG, RAD, INVRS(x)=1/x, RECIP(x)=1/x, FLOOR, CEIL, TRUNC, RND, RANDOM
SIN, COS, TAN, COTAN, ASIN, ACOS, ATAN, SINH, COSH, TANH, ASINH, ACOSH, ATANH
Two parameter functions:
POW(base, exp), INTPOW(base,exp), MIN, MAX, MOD, LOGN(base, value) , ATAN2(y,x) {atan(y/x) in 4 quadrants}, HYPOT(x,y)=sqrt(x*x+y*y)
Three parameter function:
IF(bool, true, false)
Resident variables:
PI, KNT {simulation number; 1, 2...}
The internal parser is selected in ATP|Settings/Variables below the number of simulations (or in the Sidebar). The internal parser calculates the data values before executing ATP. For multiple runs ATP is thus executed in sequence utilizing multi-threading. On a multi-core machine this option could even be faster than ATP's PCVP sequential method. The internal parser will produce a *.log file (same name and folder as the case) that contains information of the actual data sent as parameters for each run. For this feature to work smoothly the user should execute ATP in Hidden mode with the direct method and avoid bat-files (see ATP connection Wizard, F10). With the internal parser ATP is executed many times and any diagnosis window will pop up and block the computer. For _LCC line length variations turn JMarti diagnosis off and for GNU-ATP edit graphics.aux and set NODISK=1.
Variables (using ATP's parser PCVP) was introduced in ATPDraw 3.0. The user is allowed to specify a 5-character text string instead of a data value in the component dialog box. A value is then assigned to this text string under the Variables tag of the ATP settings dialog box. In order to allow a variable for the data value its Param property must be set to unity under Edit Definitions|Data. In cases where the data value is used in calculations in the component (for instance the phase angle of a 3-phase AC source) variables are not allowed and the default value is in such cases used instead. Variables are also allowed for Models. If Number of simulations is larger than unity a POCKET CALCULATOR VARIES PARAMETERS card will be inserted and the simulation is repeated this number of times. The current simulation number is then available as the parameter 'KNT'. Under LIS Suppress the value of IOPCVP is set: 0: No LIS-file suppression, 1: Writes only extreama and parameters, 2: Writes only extrema, 3: Writes just the KNT information. IOPCVP must be zero for the Optimization or the WriteMinMax module to work.
The text strings (variables) specified by the user appear to the left and the user now has to assign data values for variables. This is done in free format in the column to the right. All the specifications in Variables are declared as intermediate variables and the flag '$$' is automatically added at the end. The variables used in the circuit are then assigned to these variables and ATPDraw automatically adds underscore characters to obtain the maximum resolution. A variable 'RES' used for both high and low precision resistances will thus be declared twice (highest precision declared first) with 13 and 3 underscore characters added, respectively. The intermediate variable is renamed 'RESI' (character 'I' for intermediate added). This process is hidden, however, but the result is seen in the final ATP file under the $Parameter declaration. You can also define intermediate variables ($$ is automatically added to the value field if the variable is not used in the circuit). Do not use underscore characters in the name of variables.
IMPORTANT! for the PCVP method:
Since only floting point numbers are supported by ATP always use a period '.' after a number in the value field.
Several special new features are introduced in ATPDraw 5.5p2.
VALUE=
@[a b c d e ... ]
@FILE FileName Col
@LIN Lo Hi
@LOG Lo Hi
@POW Lo Hi P
@EXP Lo Hi P
MyVar=@[a b c d e f g]
First run (KNT=1): MyVar=a
Second run (KNT=2): MyVar=b
...
Seventh run and beyond (KNT >=7): MyVar=g
etc.
The characters '@[' are used to identify this format. Space or comma can be used to separate the numbers (integer or floating point).
MyVar=@FILE FileName Col
'@FILE' is the keyword, FileName is the name of a text file assumed stored in the ResultDirectory (same as final ATP file) (enclose the file name within " " if it contains space), and Col is an optional parameter identifying which column in the text file to use.
The text file can have integer or floating point values in free format space or comma separated:
34.5, 45.234567 1.23e-3
2 3, 4
If Col is not specified the first column of the file is loaded. The length of the file does not need the match the chosen Number of Simulations.
First run (KNT=1): MyVar=First value of column Col (Col=2 -> 45.234567)
Second run (KNT=2): MyVar=Second value of column Col (Col=2 -> 3.0)
etc.
Both the '@[' and '@FILE' syntax requires a lot of intermediate variables. They both use the same implementation approach as shown below.
MyVar=@LIN Lo Hi
'@LIN' is the keyword. Creates a linear space. MyVar=a*(KNT-1)+b
MyVar=@LOG Lo Hi
'@LOG' is the keyword. Create a logarithmic space. MyVar=10**(a*(KNT-1)+b)
MyVar=@POW Lo Hi P
'@POW' is the keyword. MyVar = a*(KNT-1)**P+b
MyVar=@EXP Lo Hi P
'@EXP' is the keyword. MyVar = a*P**(KNT-1)+b
If P ='e' this is replaced by exp(1)
a and b are calculated based on Lo and Hi: First run (KNT=1) MyVar=Lo, Last run (KNT=Number of Simulations) MyVar=Hi.
This last last four options could easily be managed directly be the user.
Example of input of variables are shown in the figure below. All variables are declared as intermediate so that referencing is allowed. The variable MYVAR must be declared before RES which must come infront of CAP. The resulting $PARAMETER cards in the ATP file are shown after the figure. The logical summing style below will at some point be replace by the new SELECT feature of ATP's $PARAMETERS introduced in 2011. This will allow a larger number of variables. With the Internal parser mode this syntax, with its restrictions, is not used.

$PARAMETER
F01001=(KNT.EQ.1.)*2.3 $$ {Special outcome of the '@[' or '@FILE' specification:
F01002=(KNT.EQ.2.)*4.6 $$ {Fyyxxx: F=Factor, yy=array number (1-99 supported), xxx=index number (1-999 supported).
F01003=(KNT.EQ.3.)*5.3 $$
F01004=(KNT.EQ.4.)*2. $$
F01005=(KNT.GE.5.)*3.1 $$
MYVARI=F01001+F01002+F01003+F01004+F01005 $$ {In case of more that 9 items, intermediate variables Pyyzzz are introduced
RESI =4.5*MYVARI $$ {'I' added to 'RES' to mark intermediate variable name
CAPI =12.3/RESI*KNT $$ {RESI automatically substituted for RES here. KNT=Simulation number 1..5
MODVARI =2.3 $$ {Simple/Normal value assignment
RES_____________=RESI {High precision RES declared first
RES___=RESI {Low precision RES comes next
MODVAR__=MODVARI {Model data variable 8-character default resolution, modify the Digits property.
CAP_____________=CAPI {High precision capacitance
BLANK $PARAMETER
If you change the names in the left side column this will affect the text strings (variables) specified in the components. You will be request about what action to take. In the example below the user has change the variable RES to R. Thus the variable RES used in some component is now longer assinged. The user now has three options: He can reset the variable RES to zero or the default value (from the support file) or he can choose select parameter and then decide which of the variables MYVAR, CAP, MODVAR to replace RES.