User Tools

Site Tools


example:macro

This is an old revision of the document!


Macros

ACS-SASSI generates a large amount of data that tends to be processed using repetitive tasks. Due to the ridged command structure and the way data is stored in Prep it was impossible to create commands to do these tasks. This was the reason for the Batch Menu and why the options therein were added in Prep 2.3.0. This worked well for some options however it was obvious that other batch options were highly inefficient. The Submodeler commands do not have the same constraints that limited the ability of Prep to access and modify the data that required the addition of the batch functionality. For this reason, many new commands have been introduced that replace the batch functionality in the Submodeler.

While these new commands fix the inefficiency of some of the batch options, it does not reduce the burden of the user to create and verify a file to do these operations. Some batch files need to cover hundreds or thousands of operations on data generated by the simulation Modules. This is the reason the why Macros have been introduced.

A Macro in ACS-SASSI is a specially formatted *.pre file that has variables. Macro variables are defined by a positive integer number that is encapsulated with dollar signs (example $1$, $2$ … ,$10293$). Macros are loaded into the Submodeler with the use of the LOADMACRO command. The user can then call the macro by using the MACRO Command. When the user calls the macro command the variables are replaced by the arguments given to the instruction. The integer in the variable is directly related to the argument number in the command.

Macros can be as simple or complex as the user wishes. There is no command limitations on what a macro contains including calls to other macros. It is suggested that a Macro not use the LOADMACRO command because the repeated call to LOADMACRO will hurt performance if the same data is being loaded repeatedly. All macro names will be translated to all upper case letters therefore Node and NODE will be the same macro. There is a 50 character limit on the macro name and a 3000 character limit on what each variable can contain. Each command Line in the macro is also limited to 3000 characters. There is no limit on the number of variable that one macro can have. A Macro can have the same name as a command however this does not overwrite the Submodeler command.

Example(s)

Basic Example

 
* Node-Macro.pre A Simple example Macro
N,1,$1$,$2$,$3$ 
* MacroTest Pre will be equivalent to N,1,13.52,15,100.25
LoadMacro,Node,.\Node-Macro.pre
Macro,Node,13.52,15,100.25

Graphing Example

* SRSS-macro.pre
* Load 3 lines SRSS data and output result to a file 
* and capture image of all the lines on the graph
READSPEC,$1$,1,1
READSPEC,$2$,1,2
READSPEC,$3$,1,3
SRSS,4,1,2,3
WRITESPEC,$4$,4 
* Capture images.
SPECPLOT,1,2,3,4
CAPTUREPLOT,$4$.png
CLOSEPLOT
* SRSS_folder.pre
* Create SRSS files for all nodes in the model
LOADMACRO,SRSS,SRSS-macro.pre
MACRO,SRSS,Node1x.rs,Node1y.rs,Node1z.rs,Node1srss.rs
MACRO,SRSS,Node2x.rs,Node2y.rs,Node2z.rs,Node2srss.rs
MACRO,SRSS,Node3x.rs,Node3y.rs,Node3z.rs,Node3srss.rs
MACRO,SRSS,Node4x.rs,Node4y.rs,Node4z.rs,Node4srss.rs
                        ...
MACRO,SRSS,Node5214x.rs,Node5214y.rs,Node5214z.rs,Node5214srss.rs
example/macro.1371825204.txt.gz · Last modified: 2013/06/21 10:33 by phil