Configuring Components

Each component stores its own internal configuration using properties, some of which are defined for all components and some of which are specific to how that component wants or needs to store the information defining how it is to be used in the model.

Configuring a Component

In either case (general or specific properties), the configuration of the component can be edited using the ComponentAPI from the com.engineous.sdk.component package.

ComponentAPI compAPI = comp.getAPI();

The ComponentAPI interface provides generic set/get/add/call methods that take in a String for the item on which you are operating and different forms of arguments. All components at least provide access to the general component properties (e.g., description, timeout, number of retries, affinities, database lookup setting, etc.). Some components may provide a specialized implementation of the interface to edit the component-specific configuration settings for the component.

The item keywords for the general properties that can be set are:

  • affinity Set/get an affinity setting by also sending in the "type" of affinity you are setting/getting—"type" must be one of "station", "os", "osname", "osversion", "group", "other".

  • dblookupmode Set/get the database lookup mode using one of the DBLU_FILTER* constants in DtComponent.

  • delay Set/get the delay to occur before execution in seconds.

  • description Set/get the description for this component.

  • keepexecutiondir Set/get the setting for whether or not to keep the execution directory after execution.

  • numretries Set/get the number of times execution of this component should be retried if it fails.

  • rundirectory Set/get the run directory to be used for this component.

  • timeout Set/get the timeout setting for this component in seconds.

Examples

compAPI.set("affinity", "station", "MyMachine");
compAPI.set("dblookupmode", DtComponent.DBLU_FILTER_ALL);
compAPI.set("timeout", 500);
compAPI.apply();

To permanently apply any changes you have made in the model using the ComponentAPI, you must call the apply() method on the API object.

Component-specific configuration properties, if available, can be set or accessed this same way if the component provides the specific item keywords. For SIMULIA components, any available component-specific item keywords and how they can be used in conjunction with the ComponentAPI methods are documented in the corresponding section of the Isight Component Guide for that component.

Example: Calculator Component

ComponentAPI calculatorAPI = calculatorComp.getAPI();
String calc1 = "a=b+c";
String calc2 = "e=f+g[3]";
calculatorAPI.set("expression", calc1);
calculatorAPI.add("calculation", calc2);
calculatorAPI.apply();

This will result in the calculator component being configured to execute the two calculations specified sequentially (because the second one was added to the expression using the "add" method).

Saving a Model

If desired, you can save the model you are building/editing to a file.

OutputStream savedFile = new
FileOutputStream("C:\\MyNewModel.zmf");
modelMgr.saveZippedModel(savedFile);

saveZippedModel() closes the stream.