LBASIC REFERENCE GUIDE (LIMS 5.0.7)
LBASIC REFERENCE
GUIDE
LIMS 5.0.7
Commands
CALL <Procedure Name>
LIMS command
Does
Calls procedure Procedure Name.
Notes
The procedure is executed till (a) RETURN statement returns the
execution back, (b) ENDPROC is encountered which is essentially the
same or (c) STOP statement stops the execution of whole process.
Under ordinary circumstances, error will also terminate all the
procedures currently being executed.
Example
This is a typical Auto procedure but this time the
results are displayed by a subroutine PrintFilled. Note that
redefinition of PrintFilled now results in change of output from
Auto.
PROC PrintFilled DEFINT i SORESETFILLED() FOR i=1 TO SONUMBERFILLED() PRINT SONEXTFILLED() NEXT i PRINT SONUMBEREMPTY()," To Go!" ERASE i ENDPROC PROC Auto WHILE SONUMBEREMPTY()>0 SOLVE CALL PrintFilled LOOP ENDPROC
See also
CHANGEDIR <Directory Name>
LBASIC (System Module) keyword
Does
Changes the current working directory to Directory Name,
which might be absolute or relative BUT shorter than 256 chars.
Notes
Currently Win32 only.
See also
CLOSETRACER Name
Output (tracer) extension keyword
Does
Closes the tracing in tracer Name
Notes
The tracer must have been opened using OPENTRACER
Example
See OPENTRACER
See also
COMPUTEFLOWS <True|False>
Solver extension keyword
Does
For vacuumed molds it sets the flag in order to compute resp. Not
to compute ‘unnecessary’ flow rates, i.e., flow rates that have to be
0. Default is FALSE (0), i.e.,faster algorithm is being used. There
is no need to change this unless for debugging purposes, i.e., one
suspects that flow rates are wrong.
Notes
New to maintenance release 4.0.02. Previously, all flow rates were
always computed in any case. Speeds up computations on vacuumed molds
by some 25% if set to default value of FALSE
When mold is not vacuumed, this constant does not have any effect.
See also
CREATEDIR <Directory Name>
LBASIC (System Module) keyword
Does
Creates the directory with name Name, which might be absolute or
relative BUT shorter than 256 chars.
Notes
Currently Win32 only.
See also
DEFDBL Variable1 [,Variable2…]
LBASIC keyword
Does
Declares variable Variable1 (and optionally Variable2
…) as a numeric value
Notes
All numeric values are stored as double. Re-declaring a variable
creates a new copy that temporarily hides the old one.
See also
DEFINT Variable1 [,Variable2…]
LBASIC keyword
Does
Declares variable Variable1 (and optionally Variable2
…) as a numeric value
Notes
All numeric values are stored as double anyway. DEFINT is
a compatibility trick. Re-declaring a variable creates a new copy
that temporarily hides the old one.
See also
DEFSTRING Variable1
[,Variable2…]
LBASIC keyword
Does
Declares variable Variable1 (and optionally Variable2
…) as a string value
Notes
Strings are stored as a variable length entity; however, their
maximal length is limited by 255 by the allocated storage.
Re-declaring a variable creates a new copy that temporarily hides the
old one.
See also
DIM Variable1(n[,m])
[,Variable2(n2[,m2]) …]
LBASIC keyword
Does
Declares variable Variable1 (and optionally Variable2
…) as a numeric array of dimension n (one dimensional) or
nxm (2 dimensional).
Notes
Only numeric arrays are allowed. Array indices are one based as
this is the way BASIC usually works. OPTION BASE is not
supported. Re-declaring a variable creates a new copy that
temporarily hides the old one.
See also
DEFINT, DEFSTRING,
DEFDBL, ERASE
DO [WHILE Exp|UNTIL Exp]
LBASIC keyword, compile only
Does
Starts a conditional or unconditional loop.
Notes
This is a part of one of four possible conditional and one
unconditional loop commands, which are: DO WHILE ex ….. LOOP,
DO UNTIL ex ….. LOOP, DO …. LOOP WHILE ex, DO
…. LOOP UNTIL ex and DO …. LOOP. Obviously, more
combination are possible. Note that UNTIL ex corresponds to
WHILE NOT(ex).
Loop (even unconditional) can be also terminated via EXITIF.
Can be used in procedure definition only.
Example
The following fragment just reads numbers from keyboard and prints
square roots. It is terminated by negative value or 0. In the first
case, however, the error is captured by EXITIF. Note that
this code has to be a part of procedure and will not run from command
line
DEFDBL Val DO INPUT Val EXITIF (Val<0) PRINT "SQRT(",Val,")=",SQRT(Val) LOOP WHILE(Val>0.0) ERASE Val
See also
ECHO [File Name]
LIMS directive
Does
Records the following input lines to file FileName. If no
argument is given, closes the current file and stops recording.
Notes
The session can be replayed by LOAD File Name. This is
useful for debugging, creating fast PROCEDURE files etc. Since it is
a directive, filename has to be constant and should not be quoted.
Also, it has to be called from command line, not from procedure.
See also
ELSE
LIMS keyword, compile only
Does
Starts alternative part of IF ex THEN …. ELSE … ENDIF
that gets executed when ex is false.
Notes
IF THEN … ELSE … ENDIF blocks can be nested and span
multiple lines of code.Can be used in procedure definition only.
Example
This version of PrintFilled will print nicer and more compact
record of each step according to the number of nodes filled within
that step–one or two node numbers if one or two nodes were filled;
two node numbers and ellipses if more than two were filled.:
PROC PrintFilled DEFINT NF SORESETFILLED() LET NF=SONUMBERFILLED() IF (NF=1) THEN PRINT SONEXTFILLED()," : ",SONUMBEREMPTY()," To Go!" ELSE IF (NF=2) THEN PRINT ,SONEXTFILLED(),SONEXTFILLED()," : ",SONUMBEREMPTY()," To Go!" ELSE PRINT ,SONEXTFILLED(),SONEXTFILLED(),"... : ",SONUMBEREMPTY()," To Go!" ENDIF ENDIF ERASE NF ENDPROC
See also
ENDIF
LBASIC keyword, compile only
Does
Terminates IF ex THEN … ENDIF or IF ex THEN …
ELSE … ENDIF block.
Notes
IF blocks can be nested. Can be used in procedure
definition only.
Example
See ELSE example
See also
ENDPROC
LIMS keyword, compile only
Does
Terminates the current procedure definition.
Notes
Compiles RETURN into the procedure code. Can be used only
in procedure definition. On successful termination of this command,
the procedure can be executed (X flag is set).
See also
ERASE <Variable1>
[,<Variable2>…]
LBASIC keyword
Does
Erases variable(s) Variable1 (and optionally Variable2
…) from memory
Notes
Any variable type can be erased. Erasing removes only the latest
definition of Variable1 etc.
See also
DEFINT, DEFSTRING,
DIM, DEFDBL
EXECUTE s1 [, s2, ….]
System extension keyword
Does
Executes external application using system function.
Command is specified in string s1, additional strings may
specify parameters or switches for the command.
Notes
The command line is created by concatenation of all string
arguments, adding single space between them. LIMS waits for the
command to finish before resuming execution. If command is a console
application, its output will be redirected to LIMS console.
Example
To list the contents of current directory into LIMS console (on
Windoze system, use ls otherwise):
EXECUTE "dir"
To list all LBASIC files, use
EXECUTE "dir", "*.lb"
or
EXECUTE "dir *.lb"
See also
EXIT
Quits LIMS.
See also
EXITIF <Exp>
LIMS keyword, compile only
Does
Terminates current DO…LOOP or FOR … NEXT
loop if Exp is true.
Notes
Provides loop termination from the middle. It is necessary for
error handling, especially as there is no GOTO statement,
but it should not be used otherwise in sake of–blah,
blah–structured programming.
Example
See DO example
See also
FICLOSE (i)
File extensions keyword
Does
Closes the file i and frees the handle for other file
requests.
Notes
Necessary if you want to re-use handle, recommendable as soon as
possible to preserve data integrity.
Example
See FIOPEN example.
See also
FIFORMAT [s]
File extensions keyword
Does
Specifies that numbers printed to files are to be formatted using
C formatting string s.
Notes
Default is “%lg” and is restored whenever the
command is called without parameter. See any C-programming text for
available formats.
See also
FIINPUT i,…
File extensions keyword
Does
Tries to read values of variables following i from file
i. The value of file handle might be given as either
immediate number or a variable. This means no expressions in
this situation. If you need one, use LET statement
before this one.
Notes
That file should have been opened for READ. Values are
expected separated by commas, whitespace or newlines. Strings have to
be quoted in double quotes and may enclose whitespace characters,
however, there is no way to put a double quote inside a string. As a
whole file extension unit this is an emergency way to deal with
imminent needs rather than a stable and comprehensive facility for
programming file handling tasks.
Note the spelling of the word: “FIINPUT” and the
“feature” restriction on i.
See also
FIOPEN i,s1,[s2]
File extensions keyword
Does
Opens file number i with name s1 for access
described by string s2. S2 can be either “R”
for read, “W” for write and “A” for write-append
access.
Notes
Case of s2 is not significant, following letters in s2
are ignored. i is a handle that should have been obtained
via FIFREEFILE(). Number of files that can be opened is
limited to 5.
Example
This subroutine prints tabulator separated values of fill time on
rectangular grid. It assumes nodes numbered by row, arranged on MxN
grid. M and N are passed as first two arguments, the third one is the
file name:
PROC PrintTSV defint M,N,i,j,k,Index defstring FName IF (ARGC<>3 OR NOT ISSTRING(ARGUMENT(3)) OR ISSTRING(ARGUMENT(2)) OR \ ISSTRING (ARGUMENT(1))) THEN CONSMESSAGE "Call As PrintCSV M,N,Filename" STOP ENDIF LET M=ARGUMENT(1) LET N=ARGUMENT(2) LET FName=ARGUMENT(3) LET Index=0; LET i=FIFREEFILE() IF ((i>5) OR (i<1)) THEN CONSMESSAGE "No More Files Available" STOP ENDIF FIOPEN i,FName FOR j=1 TO N FOR k=1 to M FIPRINT i,SOTIMETOFILL(Index) IF k<M THEN FIPRINT i,CHRS(9) ENDIF LET Index=Index+1 NEXT K FIPRINTNL i NEXT j FICLOSE i ERASE FName,M,N,i,j,k,Index ENDPROC
See also
FIPRINT i,…
File extensions keyword
Does
Prints whatever values are following file specifier i
into the file i.
Notes
This file should have been opened for WRITE or APPEND.
No extras are inserted – commas, spaces or tabs have to be printed
using string arguments (this is different than PRINT).
Example
See FIOPEN example
See also
FIPRINTNL i
File extensions keyword
Does
Prints newline into the file i.
Notes
Might work better if the file has been opened for WRITE
or APPEND.
Example
See FIOPEN example
See also
FOR Var=<Start Exp> TO <End
Exp>
LBASIC keyword, compile only
Does
Starts the FOR … NEXT counted loop
Notes
Numerical value Val is assigned value of Start Exp.
If it is larger than End Exp, loop is skipped. Otherwise
commands between FOR and corresponding NEXT are
executed, Var is incremented by 1 and loop is tried again
til Var exceeds End Exp.
Var should exist. DOWNTO or STEP
modifiers are not supported. Changing the value of Var is
possible but repulsive practice.
Example
Prints table of squares for 1 to 10:
PROC Table DEFINT i FOR i=1 TO 10 PRINT i,i*i NEXT i ERASE i ENDPROC
See also
FORGET Var1 [,Var2…]
LBASIC keyword
Does
Erases variables Var1, Var2 ….
Notes
If multiple variables with same name exist, the last one is
erased. Number of variables is limited, so procedures should clean
their mess. The type of variables is irrelevant.
See also
DEFINT, DEFDBL,
DEFSTRING, DIM
FORMAT [s]
LBASIC keyword
Does
Sets the format of numerical values printed to correspond to C
formatting string s.
Notes
Check your C text for formats. If s is missing, default
is used.
Example
Prints several precisions of a number PI:
PRINT PI FORMAT "%12.6lg" PRINT PI FORMAT "%16.10lg" PRINT PI FORMAT PRINT PI
See also
HELP Topics
LIMS Directive
Does
Displays help for Topics if available. This command opens the reference
in default HTML browser. Topics can be one of the LBASIC keywords. If no help for
this topics is available, the file is opened at beginning
Notes
Directive — no quotes or expressions. Implemented since 5.0.3, but system dependent.
See also
HINT Topics
LIMS Directive
Does
Displays short help for Topics if available. Otherwise displays topics list.
Topics can be one of the LBASIC keywords or a few categories (HINT will list them).
The information is displayed in console.
Notes
Directive — no quotes or expressions. Implemented since 5.0.3, system independent.
See also
IF Exp THEN
LIMS keyword, compile only
Does
Starts IF … THEN … ELSE … ENDIF or IF … THEN … ENDIF
construct
Notes
Expression should evaluate to numeric value; 0 is taken to be
false, non-zero to be true. Nesting is possible. For simple value
selection, function IFF() might be used.
Example
See ELSE example.
See also
IGNOREERR Proc1
LIMS directive
Does
Sets Proc1 attributes to ignore errors within the
procedure.
Notes
Ordinarily, error triggers abortion of the program. Within
ignoreerr procedure, however, execution continues with next
statement. The error number is, however, present and may be recovered
by LASTERR() function. 0 means proper execution. May cause
problems with breaking program execution.
Example
Procedure Annoy is forcing user to get a file name till
it is successfully read. It assumes that “Auto” format
selection works, i.e., the file name extension will work. Note that
there might be unhandled errors occurring in this procedure.
PROC Annoy DEFSTRING Name DO Name=GETFILENAME("Input File to be Read","") SETINTYPE "AUTO" READ Name LOOP WHILE LASTERR() ENDPROC IGNOREERR Annoy
See also
INPUT V1,….
LBASIC keyword
Does
Reads value into variable(s) V1 etc. from console.
Notes
Whether keyboard or file is read depends on LOAD
statements preceding INPUT. One value per line is expected,
either number or string, depending on variable type.
Example
Procedure Browse reads node number and displays
information about the node as long as the number is valid. To abort,
input -1:
PROC Browse DEFINT i DO INPUT i EXITIF ( (i<0) OR (i>=SONUMBERNODES) ) PRINT "Node",i," : p=",SOPRESSURE(i)," Fill=",SOFILLFACTOR(i) LOOP ENDPROC
See also
LET Var1=Exp
LBASIC keyword.
Does
Assigns value of Exp to variable Var1.
Notes
Variable Var1 might be string, numerical value or
specified array element. Exp should evaluate to appropriate
type. Unlike most BASIC dialects LET is not optional but
required. Multiple assignments are not possible either.
See also
DEFDBL, DEFSTRING,
DEFINT, DIM, ERASE
LOAD [<File Name>]
LBASIC directive
Does
Loads file File Name as if it were typed from command
line. If file name is missing, opens “file open” dialog box
to select one.
Notes
If file File Name does not exist, it tries File
Name.lb. Loaded files can be nested. File config.lim
from the current directory is actually loaded every time LIMS is
started. Can be use to replay sessions, if proper ECHO
command was given.
Since it is directive, do not quote the strings.
See also
LOOP [WHILE Exp|UNTIL Exp]
LBASIC keyword, compile only
Does
Ends DO … LOOP block.
Notes
Both conditional and unconditional forms are supported. With WHILE
the looping takes place only if Exp is true (non zero), with
UNTIL if it is false (0). Unconditional LOOP jumps
always to the corresponding DO.
Example
See DO example.
See also
DO, EXITIF
MARK
LBASIC Directive
Does
Marks (increases mark number) current state of procedures and
variables. Used in conjunction with RELEASE to restore the
state of interpreter after loading and running strange
scripts/procedures
Example
MARK REM Loading strange version of auto LOAD ns_7 AUTO RELEASE REM Back to our normal auto LOAD auto
Notes
The MARK–RELEASE operation wipes out any new
variables and procedures created after MARK. It can not
restore the values in variables defined prior to MARKing. It
also cannot ressurect procedures and variables explicitly FORGETed
or ERASEd after MARK.
The directives were created to avoid naming conflicts between
procedure names and possible variable space overflow.
See Also
RELEASE, FORGET,
ERASE
MESSAGE s
Console extension keyword
Does
Displays string s on console as a message appropriate for
given interface.
Notes
s can be any string expression.
See also
NEWWIDOW
Console extension keyword
Does
Switches interpret input and output (i.e., PRINT and
INPUT) to a different window if the system supports it.
Notes
Even if there is a teletype window, this statement has some subtle
effects. Most importantly, LOADing files will no longer
influence INPUT. There is only one extra window available,
repeated calls do nothing.
See also
NEXT Var
LBASIC keyword, compile only
Does
Terminates FOR … NEXT loop.
Notes
It has to have a corresponding FOR statement with
appropriate variable.
Example
See FOR example
See also
OLDWINDOW
Console extension keyword
Does
Switches interpret input and output (i.e., PRINT and
INPUT) to the same window as LIMS system uses.
Notes
Even if there is a teletype window, this statement has some subtle
effects. Most importantly, LOADing files will influence
INPUT again. It is meaningful only if NEWWINDOW was
executed.
See also
OPENTRACER Name, Type, Value, Node
Tracer extensions keyword
Does
Starts tracing of Value at Node
Notes
Name is a string that identifies tracer (needed for
CLOSETRACER, too). For file output it is name of the file.
Type determines tracer type. 1 means file, 2 means screen.
Value determines what is traced. 1 is pressure, 2 is fill
factor, 3 is flowrate. Value of 0 means that node numbers
being filled are traced. Node is the node number.
Since version 4.2, thermal and cure values may be traced as well,
assuming that thermal solution is possible and enabled. In this case,
additional values of Type are 4 for mid-plane temperature, 5
for top temperature, 6 for bottom temperature and 7 for cure value.
Example
The following will open files to record state of node Gate
(Numeric value). Code fragment:
OPENTRACER "Gatepres",1,1,Gate OPENTRACER "Gateflow",1,3,Gate REM Do as you wish here CLOSETRACER "Gatepres" CLOSETRACER "Gateflow"
See also
PRESCAN <File name>[,<File Type>]
Input keyword
Does
Checks file File name for validity and obtains some
useful information.
Notes
File type is optional string specifying type of the file,
in case SETINTYPE information or file name extension is
wrong. Information is available in PS…() functions after
PRESCAN is called.
See also
READ, SETINTYPE,
PSISOK(), PSISTHERMAL(),
PSNUMBERNODES(), PSNUMBERELEMS()
PRINT Var1, …
LBASIC keyword
Does
Prints values of whatever expressions are following to screen.
Notes
Expressions should be in comma separated, optionally bracketed,
list. For numerical values, format is influenced by last FORMAT
command issued.
Example
Procedure NI will print information concerning node passed as
argument to it:
PROC NI DEFINT i LET i=ARGUMENT(1) PRINT "Node(",i,"):" PRINT "p=",SOPRESSURE(i),"Fill=",SOFILLFACTOR(i),"Flow=",SOFLOWRATE(i) ERASE i ENDPROC
See also
PROC <Proc Name>
LBASIC keyword, interpret only
Does
Starts definition of procedure Proc Name
Notes
Whatever follows PROC prior to ENDPROC is, with
exception of directives, going to be compiled into that procedure.
The compiled code can be run by typing Proc Name or CALL
ing it, either from command line or from another procedure.
Example
This example just saves some typing. Procedure will set the input
format to auto and then load the file mentioned–without quotes–on
its command line:
PROC RE SETINTYPE "AUTO" READ ARGSTRING() ENDPROC
See also
PROTECT Procname
LBASIC directive
Does
Sets erase protection for procedure Procname.
Notes
No way to revert this thing. Procname becomes a system
command after this.
See Also
QUIT
LBASIC directive
Does
Quits LIMS system
Notes
Directive! Not useful to terminate procedures!
See Also
LBASIC (System extension) keyword
Does
Sets the seed for the next pseudorandom sequence. If Seed
is omitted, the value of system timer is used.
Notes
By specifying the same Seed you should obtain the same random
number sequence. If RANDOMIZE is not called prior to first evaluation
of RANDOM(), RANDOMIZE is called implicitly prior to this evaluation.
There might be a problem if the host system does not provide system
timer. Then RANDOMIZE without seed would generate always the same
sequence.
See Also
READ [<File Name>[,<File Type>]]
Input extension keyword
Does
Reads File Name into solver.
Notes
File Type allows to specify a format the file is in, in
case it does not end in proper extension (.in or .dmp) or a different
input format was set using the SETINTYPE. If file name is
not provided, standard “file open” dialog box will pop up.
Example
This will read crap.in as a dump file (LIMS 4 format),
regardless of extension that is default for LIMS 3.x input files:
READ "crap.in", "DMP"
See Also
REGAPPEND Name,Type,i1,i2….
Does
Creates a region with name Name and type given by the first
letter in Type. Type in as much as you want, can be “Element”,
“Node” or “Gate”.
Notes
The “gate” region is just a node region restricted to
gate setting.
If region with Name exists, listed nodes or elements are
appended to it, assuming that the type matches!
See Also
REGCREATE, REGEXCLUDE,
REGREMOVE
REGCREATE Name,Type,i1,i2….
Does
Creates a region with name Name and type given by the first
letter in Type. Type in as much as you want, can be “Element”,
“Node” or “Gate”
Notes
The “gate” region is just a node region restricted to
gate setting.
If region with Name exists, command fails.
Example
REGCREATE "bottom","elems",1,2,3,4,5,6,7,8,9,10,11,12,13,14 SCALEPERM("bottom",10)
See Also
REGAPPEND, REGEXCLUDE,
REGREMOVE
REGEXCLUDE Name,Type,i1,i2….
Does
Searches for a region with name Name and type given by the
first letter in Type. If it is found, entities i1, i2 … are
removed from the list. If entity is not in, nothing happens, if
region remains empty after exclusion, it is removed.
Notes
If Name does not exist, command fails.
See Also
REGCREATE, REGAPPEND,
REGREMOVE
REGIONS Wildcard
Does
Directive that will list the defined regions and their type.
Notes
Wildcards are really very simple. Star at the end expands into any
string. Thus “*” matches all. No comparison is done after
*, so “*a” matches all as well. Otherwise it behaves like
WORDS ore VARS, so no quotes or expressions around wildcard.
REGLOAD FileName, Wildcard, Append
Does
Loads all regions matching Wildcard from file FileName
into the active
region list. If append is non-zero, existing file
is appended to existing
regions, otherwise those are erased first.
Notes
The file format is repetition of the following block:
Name Type Count <data 5 numbers per line>
Type is really established using the first letter only.
As of version 5.0, the format is much more flexible. Essentially,
each block consists of name line (name followed by whatever user
wishes – it is not read), type line (where only first non-white space
character matters), count line (where the first number matters) and a
set of lines containing numbers – 1 or more per line. White space and
empty lines should not matter any longer (They used to fail reading
in 4.2). Note that regions are still saved in the format described
above and this format is used by GUI as well.
Wildcards are really very simple. Star at the end expands into any
string. Thus “*” matches all. No comparison is done after
*, so “*a” matches all as well. Otherwise it behaves like
WORDS ore VARS, so no quotes or expressions around wildcard.
See Also
REGREMOVE Wildcard
Does
Removes any region whose name matches the wildcard string
Wildcard.
Notes
Wildcards are really very simple. Star at the end expands into any
string. Thus “*” matches all. No comparison is done after
*, so “*a” matches all as well.
See Also
REGCREATE, REGAPPEND,
REGEXCLUDE
REGSAVE FileName, Wildcard, Append
Does
Saves all regions matching Wildcard into file FileName.
If Append is non-zero, existing file is appended to, otherwise
it is truncated.
Notes
The file format is repetition of the following block:
Name Type Count <data 5 numbers per line>
Type is really established using the first letter only.
Wildcards are really very simple. Star at the end expands into any
string. Thus “*” matches all. No comparison is done after
*, so “*a” matches all as well. Otherwise it behaves like
WORDS ore VARS, so no quotes or expressions around wildcard.
See Also
RELEASE
LBASIC Directive
Does
Restores the state of procedures and variables to the state
“recorded” by MARK. Brings the state of interpreter
after loading and running strange scripts/procedures into normal
Example
See MARK example.
Notes
The MARK–RELEASE operation wipes out any new
variables and procedures created after MARK. It can not
restore the values in variables defined prior to MARKing. It
also cannot ressurect procedures and variables explicitly FORGETed
or ERASEd after MARK.
The directives were created to avoid naming conflicts between
procedure names and possible variable space overflow.
See Also
REM
LBASIC command
Does
Nothing
Notes
Useful to insert remarks as it ignores arguments and comment out
code.
Example
REM This line does nothing REM PRINT "And this will not print"
RESETFILLED
Solver extension keyword
Does
Resets the queue of filled/emptied node indices to beginning.
Notes
The solver can fill more than one node in a time step. The indices
of filled nodes are available to user via SONEXTFILLED() and
SONEXTEMPTIED() functions. However, this functions read each
node once; next call returns next node index or -1 if no other node
is available. If RESETFILLED is issued, next call to this
functions will return first filled/emptied node again.
Example
Procedure that prints all filled nodes. RESETFILLED is
needed just in case the caller already tinkered with the indices.
Demonstrates also handling of indices without counter (opposite to
tutorial):
PROC Filled DEFINT i RESETFILLED DO LET i=SONEXTFILLED() EXITIF (i=-1) PRINT i LOOP ERASE i ENDPROC
See Also
SONEXTFILLED(), SONEXTEMPTIED(),
SONUMBERFILLED()
RETURN
LBASIC keyword
Does
Terminates current procedure and returns to caller.
Notes
ENDPROC really compiles RETURN to the end of
currently defined procedure; there is no need to use it unless
several exit points are desirable. Generally, it is considered good
programming practice to avoid multiple entry/exit points.
Example
Rather silly one:
PROC tst PRINT "Got Here " RETURN PRINT "You will not see this" ENDPROC
See Also
SCALEPERM ElNumber, Factor1 [, Factor2[,
Factor 3]]
Solver extension keyword
Does
Scales permeability within element ElNumber by Factor1.
If Factor2 or Factor 3 are given, scaling is
anisotropic – by Factor1 in major principal direction, by
Factor2 in the second largest one, and — if the element is
3D — by Factor3 in the last principal direction.
Notes
Element region name can be used instead of element number.
Negative scaling or scaling to 0 is not permitted. You can not
specify more factors than is the dimension of element(s) to be
scaled. Be very careful to build regions from elements of same
dimension!
If anisotropic scaling is used, there must be two or three
distinct principal values of permeability. Otherwise, command fails.
Also, the major and minor principal directions might switch places
if the minor principal permeability is scaled to be bigger than the
major one. This has the effect that in some cases scaling by
reciprocal values of Factor1 and Factor2 does not
revert the permeability to the original state!
If an error occurs (nonexisting element, 0 scaling, etc.) solver’s
state is not changed.
Example
To reduce permeability by 10% throughout the mold:
... DEFINT i .... FOR i=1 TO SONUMBERELEMS() SCALEPERM i,0.90 NEXT i ...
This might be used to accommodate changes of viscosity due to resin
reacting with time etc., but such generally some expertise is
required to use this command.
See also
SCALETHICK ElNumber, ThScale [, VfScale,
Kscale]
Solver extension keyword
Does
Scales thickness of element ElNumber by factor ThScale.
If optional parameters are given, volume fraction and permeability
are scaled independently by factors of VfScale and Kscale
respectively. Otherwise, VfScale is taken to be 1/ThScale
and Kscale to be ThScale2, which
corresponds to usual physical reality, i.e., the volume of
reinforcement being constant and flow governed by lubrication
theory..
Notes
Element region name can be used instead of element number.
For 1D (bar) element the command scales cross section. For 3D
element it fails.
Many things can go wrong with this command! If error occurs, no
change happened.
Physically, as of release 4.0.03 this command is proper only if
the associated control volumes are empty. If the volumes contain
resin, no attempt is made to satisfy the continuity. Note that in
such a case the change in thickness can not occur instantly as this
command assumes, due to viscous nature of the flow.
See also
SELECTSTRING Prompt, String1
[,String2…]
Console extension keyword
Does
Displays proper selection menu to allow user to pick from strings
String 1 etc., Prompt is used for title of this
menu.
Notes
Does not return value. Use function SELECTEDSTRING()
to get users choice. This is a result of calling conventions for
functions — no variable number of arguments.
See Also
SETELEMDATA (Element,DataIndex,Value)
Does
Sets property determined by DataIndex within the element
Element to Value if possible. Connectivity can not be
changed.
Possible Index Table
1 | Type (1=Triangle, 2= Quadrangle, 3=Tetrahedron, 4=Wedge, 5= Brick, 6= 1D Bar) (GET only) |
2 | Thickness |
3 | Fiber volume fraction |
4 | Preform conductivity k |
5 | Preform Alfa |
10 | Permeability Kxx (x aligned with two first nodes in element) |
11 | Permeability Kxy |
12 | Permeability Kyy (y orthogonal to x, into the element) |
13 | Permeability Kzz (z orthogonal to x,y, into the element) |
14 | Permeability Kzx |
15 | Permeability Kyz |
20 | Temperature at top surface |
21 | Boundary condition coefficient (BCC) at top surface |
22 | Temperature at bottom surface |
23 | Boundary condition coefficient (BCC) at bottom surface |
24 | Temperature of preform |
100 | Number of nodes (2, 3, 4, 6 or 8 now) (GET only) |
101 | First node (GET only) |
102 | Second Node (GET only) |
103 | Possibly third Node (GET only) |
104 | Possibly fourth node (GET only), etc. |
Notes
Element region name can be used instead of element number.
Some settings are ignored, some violate physics.
Performance suffers by using general SET… command. Instead, use
specific commands like SETPERM whenever
possible.
The boundary conditions on the upper and lower surface is
determined from equation (? stands for top or bot, n is outer
normale):
dT/dn+BCC?.(T-T?)=0
See Also
SETFILLFACTOR Node,<Fill factor>
Solver extension keyword
Does
Sets fill factor of node Node to Fill factor.
Notes
Fill factor should be between 0 and 1. May be useful for resetting
some action or opening vents in filled parts.
Example
Clear the mold (may wreak havoc on gates if any open):
PROC Clear DEFINT i FOR i=0 TO SONUMBERNODES() SETFILLFACTOR i,0.0 NEXT i ERASE i ENDPROC
See Also
SETGATE Node, Type, Val [,Val2|Cure]
[,Cure|T][,T]
Solver extension keyword
Does
Opens gate/vent at node Node. Type of the gate is
specified by Type, Val and possibly Val2,
Cure and T parameters.
Notes
Node or gate region name can be used instead of element number.
Type may be (1) Pressure (2) Flow rate (3) Temperature
(4) Cure (5) Vent and (6) Mixed or, (0) for no gate (close existing).
Val gives pressure for vent or pressure gate, flow rate for
flow rate gate, temperature or cure value for appropriate gates. It
is ignored for “no gate” and may be ommitted. In case of
mixed gate, Val2 is used in
Flow rate = Val + Val2.Pressure.
relation in mixed gate. In cases of inlet gates (pressure, flow
rate, mixed) values of cure and temperature (T) might follow
directly to avoid repeating calls
Fill factor is set to 1 for inlets and not changed for vents. If
this is not what you want, use SETFILLFACTOR in parallel.
Example
gate switching:
SETGATE OldGate,0,0 SETGATE NewGate,1,500000,0.0,273.0
or
SETGATE NewGate,1,500000 SETGATE NewGate,5,0.0 SETGATE NewGate,4,273.0
See Also
SETFILLFACTOR, SETORIGPRESSURE
SETGLOBALTEMP(T)
Does
Sets the global temperature for cure-only solution to T.
SETINTYPE s
Input extension keyword
Does
Sets expected input format to s.
Notes
Currently, five or six types are supported. “IN” is a
LIMS 3.x input file, “DMP” is a LIMS 4 text dump file,
“BND” is LIMS 4 binary dump file, “GMSH” is GNUMesh mesh file and “AUTO”
switches according to the file name extension. The optional sixth
type, “MEM” reads data from BinPad, a shared memory area,
provided by another application via lcmaster.dll and lcbinpad.dll.
This is possible only on Win 32 platform and must be enable during
compilation.
See Also
SETMESSAGELEVEL n
Input extension keyword. New to 4.1.
Does
In slave version of LIMS it sets the amount of information various
messages send out to the master. In interactive version it just sets
proper internal variables. N has to be 0, 1 or 2, with the
following meaning:
0 |
No communication, dialogs (GETFILENAME(), etc.)fail, MESSAGE returns success but is ignored. INPUT also fails. |
1 |
The same as above, but notification string is sent to master. |
2 |
Interactive mode, notification strings and dialog text are sent, master must respond. |
Notes
LIMS behavior is influenced only in the slave version but
variables are set in interactive version too (debugging?). For more
details, see LIMSCOMM Programming Guide
See Also
SETOUTPUTLEVEL, GETMESSAGELEVEL()
SETMODE(n)
Does
Sets solution mode to isothermal (n=0), cure-only (n=1) or full
temperature-cure-flow (n=2).
Notes
It is only easy to go to simpler mode. Adding cure, and especially
the temperature solution to the problem is likely to leave you with
insufficiently specified problem and you will have to specify extra
boundary conditions, etc.. Also, when going to cure-only mode from
non-isothermal mode, do not forget to set the global temperature.
In 3D problems, non-isothermal solution is not available (and
cure-only is untested).
To include temperature but not cure you will have to set inlet
cure to zero and reaction to zero, by giving proper table or setting
Kamal parameters A1 and A2 to 0. The solution
for cure is not skipped anyway, but if you are using iterative solver
it will only run a single iteration, thus saving you some time.
See Also
SETNODALDATA(Node,NData_Index,Value)
Does
Sets the property designated by NData_Index of node Node
to Value.
Possible Index Table
1 | X coordinate |
2 | Y coordinate |
3 | Z coordinate |
10 | Pressure |
11 | Flow rate |
12 | Fill factor |
13 | Time to fill |
14 | Cure |
15 | Midplane temperature |
16 | Top temperature |
17 | Bottom temperature |
50 | Gate type (0 for none, see SETGATE) |
51 | First gate parameter |
52 | Second gate parameter |
53 | Gate cure |
54 | Gate temperature |
100 | Number of elements the node is in (Can not set) |
101 | First element (Can not set) |
102 | Second element (Can not set) |
103+ | Additional elements (Can not set) |
Notes
Node region name can be used instead of element number.
Use with care. Some indices are ignored for set, some other might
cause violation of fundamental physical principles and some, being
results, have no influence whatsoever.
Use proper one-purpose commands whenever possible.
Using generic “SET” command may drastically reduce
performance!
See Also
SETORIGPRES Pres
Solver extension keyword
Does
Sets the pressure in mold cavity to Pres.
Notes
Once a pressure is set, more complex algorithm is used for void
tracking etc. As long as no vents were opened and this is not
specified, mold is supposed to be perfectly vacuumed. If vent is
opened or original pressure set, this state is violated.
See Also
SETOUTPUTLEVEL n
Input extension keyword. New to 4.1.
Does
In slave version of LIMS it sets the amount of information PRINT
command send out to the master. In interactive version it just sets
proper internal variables. N has to be 0, 1 or 2, with the
following meaning:
0 |
All printouts are discarded. |
1 |
Printouts going to NEWWINDOW console are sent to master, the rest (OLDWINDOW console) is discarded. |
2 |
Everyting printed goes to master. |
Notes
Functional only in the slave mode binary but variable value is
maintained even in interactive version (debugging?). For more
details, see LIMSCOMM Programming Guide
See Also
SETMESSAGELEVEL, SILENT,
GETOUTPUTLEVEL()
SETOUTTYPE s
Output extension keyword
Does
Sets the format for subsequent WRITE operation to s.
Notes
Recognized types are “MESH” for LIMS 3.x mesh file,
“HIST” for data in LIMS 3.x history file, “DUMP”
for LIMS 4 text dump file (can be read in), “TPLT” for
TECPLOT 7 format, “NEUT” for PATRAN 2.5 neutral file and
“PRES” for PATRAN 2.5 result file. In 4.1, additional types
are “BIND” for LIMS 4 binary dump – faster but non-portable
version than the text based “DUMP” and – optionally –
“MEMO” which writes data to shared memory provided by
lcmaster.dll and lcbinpad.dll from within another application. Needles
to say, that is Win32 only feature and must be enabled during
compilation.From 5.0.7, “GMSH” allows output for GNUMesh open source package.
Example
See WRITE example
See Also
SETPERM ElNumber|Region, CSFlag, Kxx[, Kxy,
Kyy[, Kzx, Kyz, Kzz ]]
Solver extension keyword
Does
Sets the permeability of element number ElNumber or all
elements within region Region to Kxx, Kxy,
Kyy, etc., depending on element dimension. The coordinates
for permeability components are specified by CSFlag. :
CSFlag |
Coordinate System |
0 |
Element coordinate system. This one is constructed using first two nodes for x axis, first and third for y axis (orthogonalized) and, for 3D elements, first and last for z axis (orthogonalized). This is the C.S. LIMS uses internally, so no transforms are needed. Since the node numbering may be uncertain, it is best suited for isotropic permeability only. |
1 |
Global coordinate system (x,y for 2D, x,y,z for 3D elements). Permeability is transformed into element C.S. internally. |
2 |
User specified coordinate system. The axes are specified using SETREFAXIS command prior to SETPERM. Default values are x-y-z coordinate axes. Permeability is transformed into element C.S. internally. |
Notes
Dimension of element(s) and number of permeability components
should match.
The specified C.S should be appropriate for the element (i.e.,
parallel for 2D elements).
For 1D elements C.S. does not matter.
Also, note that permeability has to be a positive definite tensor.
This is checked by the program, as the solver might fail if this is
not the case. If this assumption is violated, error occurs and
element state is not changed.
See also
SCALEPERM, SCALETHICK,
SETTHICK, SETREFAXIS
SETREFAXIS Axis, X, Y, Z
This command sets the internal coordinate system used with SETPERM
command. Axis is integer that specifies which axis is to be
set (1=x, 2=y and 3=z). X, Y and Z are
components of the directional vector in global Coordinates
Notes
Vector is normalized internally. However, user must take care that
the coordinate system he or she specifies is orthogonal, otherwise
strange things will happen.
See also
SETTEMPBC
(Elem,Ttop,BCCtop,Tbot,BCCbot,Tpref)
Does
sets the thermal boundary conditions at element Elem. Tpref
is temperature of preform, Ttop, BCCtop, Tbot
and BCCbot provide the boundary conditions on the upper and
lower surface by (? stands for top or bot, n is outer normale):
dT/dn+BCC?.(T-T?)=0
Notes
Element region name can be used instead of element number.
Note that the preform temperature works only for empty
elements. Also, to use this meaningfully, the solution mode should be
set to 2.
See Also
SETTEMPSOLVER UseIter [,Tolerance]
Solver extension keyword
Does
Selects iterative (UseIter is nonzero) or direct solver.
Optional parameter Tolerance gives the tolerance used to stop
iterations.
Notes
The tolerance is the euclidean norm of correction over the
euclidean norm of result (relative). The default values are iterative
solver and tolerance 10-4. The iterative solver is somehow
faster than the direct in many cases. Also, if you set the cure
reaction to 0 — and this can be done only by adjusting the
parameters in equation or table — it will skip the cure computation
in one step, as the system is now homogenous. Overall, you may have
your computations running three times faster with iterative solver.
If there are problems with convergence and warnings are enabled,
you get the warning. Direct solver should be used in such a case.
See Also
SETTHICK ElNumber, NewH [, NewVf]
Solver extension keyword
Does
Sets the thickness of element ElNumber to NewH.
If NewVf is omitted, the volume fraction is scaled to keep
the reinforcement volume constant, otherwise it is changed to new
value NewVf.
Notes
Element region name can be used instead of element number.
Many things might go wrong here!. Error check should capture
nonexistent elements and improper volume fraction. If error occurs,
no changes were made to solver internal data.
The elements associated control volumes should be empty, otherwise
continuity of flow is violated in a serious manner.
If permeability is to be set too, use SETPERM.
The usage of SETTHICK might extract heavy performance penalty.
See also
SETPERM, SCALETHICK,
SCALEPERM
SETTIME Time
Solver extension keyword
Does
Sets the current time in simulation.
Notes
Simulation deals with relative time. When LIMS is loaded, time is
0. Then it is always incremented with each filling step. Set it to 0
between problems.
See Also
SILENT <Switch>
LBASIC keyword
Does
If Switch is true, disables PRINT. Otherwise
enables it.
Notes
This is useful if procedure prints some text you do not wish to
see, say tracing information. Do not forget to re-enable it
afterwards. Works even in the interactive version, not just the slave
one!
Example
SILENT 1 CALL NI 10 REM Guess what you will see .... SILENT 0
See Also
WARNINGS
SLEEP(n)
LBASIC (System extension) keyword
Does
Suspends program for n millisconds (better than those endless
loops and PRINTs).
Notes
Currently Win32 only. This keyword should help to
synchronize slave version with master.
SOLVE
Solver extension keyword.
Does
Solves the problem. If it can fill or empty a node within certain
time limits (cca. 10E9 sec.), it will do so and advance flow. If not,
error is given and no progress is computed.
Notes
Does not allow the very worst things, like filling full mold with
no vents. Time is incremented.
Example
Standard one which fills the mold:
PROC Auto DO WHILE SONUMBEREMPTY>0 SOLVE LOOP ENDPROC
See Also
SPAWN s1 [, s2, ….]
System extension keyword
Does
Executes external application without waiting for its results.
Command is specified in string s1, additional strings may
specify parameters or switches for the command.
Notes
The command has been currently implemented for Windows 32 only, as
this OS does not know how to start application on background from
command line.
The command line is created by concatenation of all string
arguments, adding single space between them. LIMS continues execution
immediately. If the command is a console application, it will be
given new console window. LIMS console.
Example
To start external editor
SPAWN "notepad.exe"
unless you have better editor.
See also
STOP
LBASIC keyword
Does
Stops program execution
Notes
Terminates whole hierarchy of currently running procedures with
error message
See Also
UPDATEPQ
Solver extension keyword.
Does
Solves the problem but does not advance flow or time. both
pressures and flowrates are updated.
Notes
This is an experimental feature used to iterate pressure dependent
material properties. It is bound to be very slow to do
anything with such an iteration, so stick to SOLVE if you can.
See Also
VARS [Letters]
LBASIC directive
Does
Lists Variables beginning with Letters
Notes
If there is no Letters argument, lists all variables. Do
not quote Letters.
See Also
WARNINGS Switch
SOLVER Extensions
Does
Allows/disallows using warnings and switches in solver.
Notes
Basically, if something might go wrong, solver puts up a warning
message and waits for user to decide. This happens especially if the
nodes get emptied. WARNINGS 0 will stop annoying qustions at
the price of lesser robustness.
Example
WARNINGS 0 CALL AUTO WARNINGS 1
See Also
WORDS [Letters]
LBASIC directive
Does
Lists defined procedures
Notes
Tries to list procedures beginning with Letters. If no
Letters are given, lists all.
See Also
WRITE [<File name>[,Mode]]
Output extensions keyword
Does
Writes output file File name. If no file name is given,
opens standard dialog box for selection.
Notes
File type is preselected through SETOUTTYPE. Mode
can be used to select how the file is written. Default value of 1
overwrites existing files. Value of 2 will append the date to
existing files and value of 3 will abort with error if file exists,
mimicking the brain-dead behavior of previous versions.
Example
Writes LIMS 3 – like history:
SETOUTTYPE "MESH" WRITE "HISTORY",1 SETOUTTYPE "HIST" WRITE "HISTORY",2
See Also
Functions
x, resp. x1 etc. stands for numbers, i,
resp. i1 stands for integer value and s or s1
etc represents string value. Unless stated otherwise, functions
return numerical value. True/false means non-zero or zero, according
to usual evaluation rules.
It is always error to call function with wrong number of arguments
and usually an error if a wrong type is supplied.
-(x)
Returns negative of x.
ABS(x)
Returns absolute value of x.
ACOS(x)
Returns inverse cosine of x in radians. x should
be between -1 and 1, results between 0 and .
ARGC()
Returns a number of arguments passed into function, error on
command line
ARGSTRING()
Returns the command line passed to procedure as a string. No
parsing is provided. Can be used in procedures only, not from command
line.
ARGUMENT(i)
Returns a value of i-th argument passed to the procedure.
Can be either number or a string. Error if fewer than i
arguments passed or when used from command line.
ASIN(x)
Returns inverse sine of its argument, x, in radians.
Argument should range from -1 to 1, result will be between -/2 and
/2.
ATAN(x)
Returns inverse tan of its argument, x, in radians.
Argument is unlimited, result will be between -/2 and /2.
AVERAGE(x1,x2)
Returns an arithmetic average of x1 and x2.
CHRS(x)
Returns a string containing character of code x.
Allowable range varies with system, however, only first 127
characters are standard to all “ASCII” sets.
COS(x)
Returns cosine of its argument, result will be between -1 and 1.
Argument in radians.
EXP(x)
Returns e to x-th power. Result will be positive, x
is limited by the range of double precision numbers.
FIFREEFILE()
Returns index of next free file to be used for FIOPEN
etc.. This is a file extension. Will be 1 to 5, 0 for none available.
FLOOR(f)
Returns the largest integer smaller than f.
GETDIR()
Returns string value of current working directory if it fits to
256 chars.
See Also
GETELEMDATA(Elem,DataIndex)
Returns anything you want to know about element Elem. The
value is specified by DataIndex.
Allowable Index Values
1 | Type (1=Triangle, 2= Quadrangle, 3=Tetrahedron, 4=Wedge, 5= Brick, 6= 1D Bar) (GET only) |
2 | Thickness |
3 | Fiber volume fraction |
4 | Preform conductivity k |
5 | Preform Alfa |
10 | Permeability Kxx (x aligned with two first nodes in element) |
11 | Permeability Kxy |
12 | Permeability Kyy (y orthogonal to x, into the element) |
13 | Permeability Kzz (z orthogonal to x,y, into the element) |
14 | Permeability Kzx |
15 | Permeability Kyz |
20 | Temperature at top surface |
21 | Boundary condition coefficient (BCC) at top surface |
22 | Temperature at bottom surface |
23 | Boundary condition coefficient (BCC) at bottom surface |
24 | Temperature of preform |
100 | Number of nodes (2, 3, 4, 6 or 8 now) (GET only) |
101 | First node (GET only) |
102 | Second Node (GET only) |
103 | Possibly third Node (GET only) |
104 | Possibly fourth node (GET only), etc. |
Notes
-1 or 0 is returned (the function never fails) if nonexistent data
is requested. Example might be request for temperature boundary
condition in isothermal mode. For some data, -1 or 0 can be a valid
value. In such a case you are at your own.
Even in isothermal mode there might be previously set
non-isothermal data, and these will be returned if asked for. Be
careful and do not assume that you are solving for temperature if
boundary conditions are set.
The boundary conditions on the upper and lower surface is
determined from equation (? stands for top or bot, n is outer
normale):
dT/dn+BCC?.(T-T?)=0
See Also
GETFILENAME(s1,s2,d)
Returns a string value selected from filename selection element.
S1 is a prompt, s2 wildcard used for selection if
supported by the interface. The last argument, d, is an
integer describing mode the file should be opened in, as open
and save dialog boxes usually differ. The possible values
are:
0 |
Open for reading |
1 |
Open for writing, zap existing file if any |
2 |
Open for writting, append to an existing file if any (Append) |
GETMESSAGELEVEL()
New to 4.1.
Returns the number describing message level, i.e., how much
interactive communication with user is possible. Valid always, but
really meaningful only for the slave version.
See also
GETNODALDATA(Node,NData_Index)
Returns anything you want to know about any node (Node),
including the element connectivity. The value you want is specified
by a numerical index NData_Index.
Allowable Index Values
1 | X coordinate |
2 | Y coordinate |
3 | Z coordinate |
10 | Pressure |
11 | Flow rate |
12 | Fill factor |
13 | Time to fill |
14 | Cure |
15 | Midplane temperature |
16 | Top temperature |
17 | Bottom temperature |
50 | Gate type (0 for none, see SETGATE) |
51 | First gate parameter |
52 | Second gate parameter |
53 | Gate cure |
54 | Gate temperature |
100 | Number of elements the node is in |
101 | First element |
102 | Second element |
103+ | Additional elements |
Notes
-1 or 0 is returned (the function never fails) if nonexistent data
is requested. Example might be request for temperature value in
isothermal mode. For some data, -1 or 0 can be a valid value. In such
a case you are at your own.
Even in isothermal mode there might
be previously set non-isothermal data, and these will be returned if
asked for. Be careful and do not assume that you are solving for cure
if gate specifies one.
Gate data, if any, are accessible via NODE
number not by any special gate/vent function set.
See Also
GETNUMBER(s)
New to maintenance release 4.0.3.
Returns a number user typed into something like a dialog box. S
is used as a prompt in the dialog box. Might be used instead of
INPUT. Console extension, useful only in GUI environment.
GETOUTPUTLEVEL()
New to 4.1.
Returns the number describing output level, i.e., how much of the
LBASIC output is visible to master. Valid always, but really
meaningful only for the slave version.
See also
GETSTRING(s)
New to maintenance release 4.0.3.
Returns a string user typed into something like a dialog box. S
is used as a prompt in the dialog box. Might be used instead of
INPUT. Console extension, useful only in GUI environment.
GETSYSTEMDATA (Index)
Returns any information about currently loaded problem. Data is
selected by Index.
Possible Index Values
1 | Number of nodes |
2 | Number of elements |
3 | True number of gates |
4 | Number of vents |
5 | Number of filled nodes |
6 | Number of empty nodes |
10 | Mode (0=isothermal, 1=cure, 2=cure&temperature) |
11 | Current time |
12 | Is vented |
13 | Global temperature (Mode=1 only) |
20 | Number of 1D Elements |
21 | Number of 2D Elements |
22 | Number of 3D Elements |
Notes
Some of these data are available by calling other functions.
IFF(x1,x2,x3)
Arithmetic if. If x1 evaluates to non-zero (true),
returns x2, otherwise x3.
INSTRING(s1,s2)
Returns the first location of s2 within s1. -1
means not found. This will be a zero based value.
INT(f)
Returns numerical value of f rounded to nearest integer.
ISDEFINED(s)
Checks for definition of variable or procedure with name in s.
Returns 0 if the identifier is not defined, 1 if it is a procedure, 2
for number, 3 for string and 4 for array. If it is both a procedure
and variable, 1 is returned. For multiple variables with the same
name, the information about the last one (visible) is returned. May
be useful for conditional definitions and includes.
ISGUISTYLE()
Returns true/false depending whether the user interface supports
true dialogs, message boxes etc.
ISINTERACTIVE()
Returns true/false depending whether the current lims console is
meant to have a user at it or to be run by a program (slave version).
ISSTRING(?)
Returns true/false depending whether the argument is string or
not. Useful to sort out arguments without triggering error.
LASTERR()
Returns the value of global “error number” variable.
This is basically useful only if you try to create IGNOREERR
procedures or if you use conditional interpretation #IF in
your sources. 0 should mean no error.
LCASE(s)
Returns the string s converted to
lowercase letters.
LEN(s)
Returns length of string s. Should be 0
to 255.
LN(x)
Returns natural (base e) logarithm of x.
x should be positive value.
LOG(x)
Returns base 10 logarithm of x. x should be
positive.
MIDS(s,i1,i2)
Returns substring from string s, spanning characters i1
to i2, 1-based.
NOT(x)
Returns logical negation of x, i.e., 1 for x
being 0, 0 otherwise.
PI()
Returns value of .
PSISOK()
Returns logical value, true if last PRESCAN worked, zero
otherwise.
PSISTHERMAL()
Returns logical value, true if last PRESCANned file
contains a non-isothermal problem worked, zero otherwise.
PSNUMBERELEMS()
Returns number of elements in the last PRESCANned file.
PSNUMBERNODES()
Returns number of nodes in the last PRESCANned file.
RANDOM()
Returns next pseudo-random number in sequence.
See Also
SELECTEDSTRING()
Returns the selection number from last SELECTSTRING
command.
SIN(x)
Returns the value of sine of x. Argument in radians.
Result should be between -1 and 1.
SOBOTTEMP(Node)
Gives the temperature at bottom plane at node. Valid only if the
solution mode is 2.
See Also
SOCLOSESTNODE(x1,x2,x3,Tolerance)
This is a solver extension function. Returns index of node closest
to the coordinates (x1,x2,x3). Tolerance is a limit
on how close the node might be. If the distance between requested
coordinates and found node is bigger than Tolerance,
function returns -1.
Example
This allows to set the pressure gate of 500kPa at the point
closest to the origin, regardless of mesh. 1000 m is used to escape
problems with realistic tolerance:
LET i=SOCLOSESTNODE(0,0,0,1000) IF i < 0 THEN PRINT "That is far!" ELSE SETGATE i,1,500000 ENDIF
SOCPTEMP(Node)
Gives the temperature at midplane at node. Works only if solution
mode is 2.
See Also
SOCURE(Node)
Gives the cure at node. Valid only if mode is 1 or 2
See Also
SOCURRENTTIME()
This is a solver extension function. Returns current time as seen
by solver.
See also
SOFILLFACTOR(i)
This is a solver extension function. Returns fill factor of node
i.
SOFLOWRATE(i)
This is a solver extension function. Returns flow rate through the
node (control volume) i. Should be about 0 unless there is a
gate or the volume is not completely filled.
SONEXTEMPTIED()
This is a solver extension function. Returns index of next node
emptied during the last step. The function value steps through all
the nodes emptied and finally, when all have been returned, returns
-1. There are no emptied nodes if mold is vacuumed, but they may
appear if voids at finite pressure are created.
See also
SONEXTFILLED()
This is a solver extension function. Returns index of next node
filled during the last step. The function value steps through all the
nodes emptied and finally, when all have been returned, returns -1.
See also
SONODECOORD(i1,i2)
This is a solver extension function. Returns coordinate of node
i1. Coordinate to return is specified by i2: 1 is
x, 2 y and 3 z.
SONUMBERELEMS()
This is a solver extension function. Returns number of elements in
the system currently loaded into solver.
SONUMBEREMPTIED()
This is a solver extension function. Returns number of nodes
emptied during last step, i.e., execution of last SOLVE.
SONUMBEREMPTY()
This is a solver extension function. Returns number of empty nodes
in the system currently loaded into solver.
SONUMBERFILLED()
This is a solver extension function. Returns number of nodes
filled during last step, i.e., execution of last SOLVE.
SONUMBERGATES()
This is a solver extension function. Returns number of gates
(minus vents) in the system currently loaded into solver.
SONUMBERNODES()
This is a solver extension function. Returns number of nodes in
the system currently loaded into solver.
SONUMBERVENTS()
This is a solver extension function. Returns number of vents in
the system currently loaded into solver.
SOPOROUSVOL(Node)
Gives the empty volume (i.e., minus reinforcement) at a given
node.
SOPRESSURE(i)
This is a solver extension function. Returns pressure at node i.
This might be of importance even if the node is not filled, as the
pressure of air bubble is returned.
SOTIMETOFILL(i)
This is a solver extension function. Returns time to fill node i,
assuming it has been already filled. LIMS 3 used to initialize this
time to large value, LIMS 4 initializes it to 0 and this is the value
returned if node is not filled.
SOTOPTEMP(Node)
Gives the temperature at top plane at node. Valid only if mode is
2.
See Also
SQRT(x)
Returns square root of argument x. x should be
nonnegative.
STR(x)
Returns string representing the value of x. String is
cropped as tightly as possible, but it gives up to 6 decimal places
if needed.
SYSTIME()
Returns number of seconds since the program was started. It allows
benchmarking the performance and slowing down the simulation
to actual flow speed if needed.
TAN(x)
Returns tangent of argument x. Argument in radians.
UCASE(s)
Returns string S converted to upper case.
VAL(s)
Returns value of expression in string S.
Value can be either a string or a numerical value. String S
is interpreted as any expression in the program. Consequently it can
use variables and functions, not just numerical digits as in common
BASICs. Similar behavior as Sinclair BASIC.
Example
DEFSTRING Fn LET Fn="sin(x)*cos(x)" DO PRINT "Enter value of x:" INPUT x PRINT "Fn(",x," )=",VAL(Fn) LOOP
Obviously, the great advantage is that the string Fn can be
input by user as well.
VERSION()
Returns a version number of the LIMS. For 4.2.0 it would be
4.0200, i.e., major, minor in two digits and build in two digits. For
5.0.0 it is 5.0000
YESORNO(s)
This is console extension. Asks user question given in string s,
returns reply (TRUE for ‘yes’, FALSE for ‘no’)
Operators
Operators are actually implemented as functions. They all have two
operands and the calling convention is a usual infix. Only “+”
and “=” can be applied to string values.
a1 + a2
Returns a sum of its arguments. For numbers it is algebraic sum,
for strings concatenation.
x1 – x2
Returns difference of numerical arguments
x1 / x2
Returns ratio of numerical arguments. x2 should be
nonzero.
x1 * x2
Returns product of numerical arguments.
x1 ^ x2
Returns x1 to x2 power. x1 should be
positive; algorithm is not smart enough to tell integer powers that
might take negative base.
a1 = a2
Returns 1 if a1 is equal a2, 0 otherwise.
Strings are allowed, but both operands have to be strings. If string
containing number is to be compared with number, use VAL()
to convert string to number.
x1 < x2
Returns 1 if x1 is less than x2, 0 otherwise.
x1 <= x2
Returns 1 if x1 is less or equal to x2, 0
otherwise.
x1 “<> x2
Returns 1 if x1 is not equal to x2, 0 otherwise.
x1 =”>= x2
Returns 1 if x1 is bigger or equal to x2, 0
otherwise.x1 x2
x1 “> x2
Returns 1 if x1 is bigger than x2, 0 otherwise.
x1 AND x2
Returns logical product of arguments, i.e, 1 if both x1
and x2 are nonzero, 0 otherwise.
x1 DIV x2
Returns integer ratio of x1 and x2. Argument x2
should be nonzero.
x1 MOD x2
Returns modulus (remainder) of x1 and x2.
Argument x2 should be nonzero.
x1 OR x2
Returns logical sum of arguments, i.e, 1 if either x1 or
x2 are nonzero, 0 otherwise.
Conditional
Compilation/Interpreting Directives
Currently there are three directives (or one?) to allow for
conditional interpretation. These are:
#IF expression
Starts conditional interpretation. If expression is false, it
skips lines till matching #ELSE or #ENDIF is found.
#ELSE
This starts the alternative branch. Lines beyond this point till
matching #ENDIF are only interpreted if expression in #IF
was false.
#ENDIF
Terminates the conditional interpretation block.
Example
The intended use is primarily to avoid duplicating loads, as these
trigger errors. Thus, the file to load auto procedure might
look like:
#IF ISDEFINED("AUTO") <> 1 PROC Auto REM Load it ... ENDPROC #ELSE DEFINT Ans LET Ans=YESORNO ("Procedure AUTO is already loaded. Replace? ") #IF Ans FORGET Auto PROC Auto REM Load it ... ENDPROC #ENDIF ERASE Ans #ENDIF
Operator Precedence Table
The operators and functions are evaluated in the following order:
-
Constants (quoted strings,
numbers, functions with no arguments) -
Array dereferencing
-
Functions with arguments
-
Unary minus
-
Power ‘^’
-
Multiplication, Division, Modulo
-
Addition, substraction
-
Comparison
-
NOT
-
AND
- OR
If two operators have the same precedence, they are evaluated left
to right. Use brackets to enforce desired evaluation order and
improve readability.
List of Reserved Identifiers
BO means binary operator
UO means unary operator (same as F1)
PD means pre-processor directive
IK means directive
K means LBASIC keyword
CK means compile only LBASIC keyword
EK means keyword supplied by an extension, i.e., by LIMS
Fn means function of n arguments
EFn means extension function of n arguments
T means other token, usually valid only in very special settings
(required or understood by some keyword)
Recent Comments