Editing the Macro

The macro file is a regular text file containing Java code that can be edited and customized to suit your task.

For example, if you want to change the number of iterations that the batch job runs from 1 to 1000. Open the .java file in your favorite text editor and look for a line that looks something like:

simulation_0.getSimulationIterator().step(1);

and change the iteration count to whatever you need:

simulation_0.getSimulationIterator().step(1000);

or better still, use the run function:

simulation_0.getSimulationIterator().run();

Save the file and close it. Some examples of other typical edits are:

  • Loading in a different case file
  • Adding loops to change properties to simulate a rotor being spun up to speed
  • Varying properties as a function of time

Path names in java macros can be made relative to the java file using the resolvePath function (see the Java API for details). It is also possible to edit the macro so that it pauses to prompt you for input.

You can also exclude graphics code from the macro.

You can design a macro to prompt you for input at a given point in the simulation process.

This feature gives you the powerful capability of automating some parts of a simulation while having real-time discretion over settings in other parts.