5.1.1. The Simple Work Flow Pattern




The Work Flow window is used to define the Logic and Data flow for each design evaluation. During the optimisation loop this Logic will be run every time a design evaluation is needed. Before starting with the Work Flow for this simple pattern let's have a look to the canvas where the Logic and Data Flow can be laid out (see Figure 5.1, "The Work Flow window").

The Work Flow window

Figure 5.1. The Work Flow window

The window is divided into three parts:

When we start a new project, the Logic Log shows an error message (as we can see in Figure 5.1, "The Work Flow window"):

Error 150 MISSING SCHEDULER NODE

This is perfectly normal, since the project is empty: we miss not only the scheduler node, but also all the other necessary nodes that have to be implemented in a correct project definition.

Proceeding in the construction of the project, other errors will appear, marking the various phases of our work in progress.

Many components are needed in order to construct properly a project: but the order in which these components are defined is more a question of user's style or logic.

Two main flows can be found in any project: a Data Flow that is the line going from "input data" to "output data" and a Logic Flow that is the line going from the "start" to the "end" of the execution process. As we will see, these two flows intersect in the External Script node.

In this tutorial we will define first the Data Flow, since it is simpler for a new user to follow the path going from Input Variables toOutput Variables.

These Input/Output Variables can however be completed, modified, created or removed at any time during the logic creation process, as can be done with every other component.

Note:

from now on, an "RMB click" will indicate a click with the right mouse button, while an "LMB click" or simply "click" will indicate a click with the left mouse button

To place a component on the Work Flow desktop, select it by clicking on the left Tool Bar, then click on the desktop; to place many copies of the same selected component, click on the desktop as many times as the number of objects needed, while pressing the <CTRL> key.

Once a component is created, we can select it with a click, access its properties by a double click. With a RMB click a menu will pop-up menu, where we can select some actions to perform on the component:

If a component is selected and we want to leave the "component insertion mode", click on the "neutral icon" on top of the Work Flow Tool Bar.

Although the Work Flow shown in Figure 5.2, "Simplest Process Flow" is one of the simplest possible, the majority of the real word problems can be solved using this approach.

This represents the simplest way to access an external application, using an Input File for the configuration and producing an Output File containing the results.

The Work Flow is composed of two main streams:

Simplest Process Flow

Figure 5.2. Simplest Process Flow

The project for this Work Flow can be found in: .../modeFRONTIER30x/projects/testcase/simple/testSimple.prj or, if we prefer, we can rebuild it by following this short tutorial.

Building the Event Sequence

The Event Sequence (Figure 5.3, "Simplest Event Sequence") is as simple as they get.

Select from the tool bar a External Script object and place it on the Work Flow canvas.

To complete the Logic Flow for this example, we need to set a starting point and, at least, one ending point. So we need to select from the tool bar a Scheduler object and a Logic End object .

Simplest Event Sequence

Figure 5.3. Simplest Event Sequence

The new External Script object must then be configured. Double LMB click on its icon to bring up the properties editor (Figure 5.3, "Simplest Event Sequence") and do the following:

Note:

Even if not explicitly shown, all the other possible exit conditions (<>0) generate Logic Failed event.

All the error or warning messages are displayed in the Logic Log panel. These messages help the user to understand what is going on during the Work Flow building.

In this case the messages:

Error 151 SCHEDULER NOT DEFINED Scheduler

Error 155 INPUT VARIABLES ARE NOT DEFINED FOR THE SELECTED SCHEDULER Scheduler

Error 160 NO DOE DESIGN AVAILABLE DOE

Error 103 MISSING SCRIPT FILE ApplicationA

The first three errors will be fixed when we define the Scheduler and DOE properties. The fourth prompt us that there is not yet any script defined in the External Script ApplicationA.

Create the Application Script

Now we have to create the script that will perform the external tasks. The script can be very simple or more sophisticated according to the user's needs: in this case we create one simple script executing the bc (an interactive processor for a language that resembles C but provides unlimited-precision arithmetic, it takes input from any files given).

Double LMB click on the ApplicationA icon to bring up the properties editor (Figure 5.3, "Simplest Event Sequence") and do the following:

Note:

It is always recommended to test the script in our normal shell environment, if its performances are as we expected it will do the same inside modeFRONTIERTM

Application Script Editor

Figure 5.4. Application Script Editor

The Application Script Editor (Figure 5.5, "Searching the script"), as in the most used text editors, has a set of simple actions that will let us load, save, and edit our external scripts or batch files. However when we press the Ok button the loaded script will be stored inside the project.

If we have already prepared and tested the script and we want to load it into modeFRONTIERTM do the following:

For this tutorial an example of script can be found in: .../modeFRONTIER30x/projects/testcase/simple/ApplicationA.sh

Searching the script

Figure 5.5. Searching the script

At this point the Logic Log display only error messages relative to DOE and Scheduler. However we have completed only the Event Sequence part of the Work Flow. The Data Flow part, will describe in the following paragraphs, how the input data are handled and transformed for the correct use by the external application. As well as how the application's output data are extracted and used by modeFRONTIERTM in the optimisation loop.

The Data Flow: Merging Input Variables into the Input File

Create two Input Variables selecting the objects from the palette on the left and place them on the Work Flow desktop.

The Input Variables objects must then be configured.

Double LMB click on the Input Variable icon to bring up the properties editor (Figure 5.6, "the Process Flow desktop with input variables placed") and do the following:

Repeat the previous actions for the other Input Variables to complete the input variables set up.

All the properties can be viewed or edited using the Summary | Input Variables panel as well (Figure 5.6, "the Process Flow desktop with input variables placed").

the Process Flow desktop with input variables placed

Figure 5.6. the Process Flow desktop with input variables placed

Create the Input File selecting the relative object from the palette on the left and place them on the Work Flow desktop.

The Input File object must then be configured.

Double LMB click on the Input File icon to bring up the properties editor (Figure 5.7, "the Process Flow desktop with input variables and input file placed") and do the following:

the Process Flow desktop with input variables and input file placed

Figure 5.7. the Process Flow desktop with input variables and input file placed

The Logic Log panel is now showing a new error:

Error 104 MISSING TEMPLATE FILE inA.dat

Error 105 MISMATCH BETWEEN TEMPLATE FILE AND INPUT inA.dat

The next step is to create the template file for the Input File inA.dat. The operation can be carried out loading an existing inA.dat file using the Open button in the Input File properties. The action will bring up a File Chooser Dialog (Figure 5.8, "Selecting template input file") and an example of inA.dat template file for this tutorial can be found in:

.../modeFRONTIER30x/projects/testcase/simple/inA.dat

Selecting template input file

Figure 5.8. Selecting template input file

When the suitable file is located on the file system click on the Open button to load it inside the Template Input Editor (Figure 5.9, "Insert an Input Variable in the input file"). In the lower part of the Template Input Editor a list of all the linked input variables is shown.

To define how an Input Variable is going to be inserted into the template file during the optimisation loop do the follow:

Insert an Input Variable in the input file

Figure 5.9. Insert an Input Variable in the input file

Selecting a number format

Figure 5.10. Selecting a number format

Repeat until all Input Variables are properly linked to the Input File, the result of those actions are a set of new tags inserted in the original inA.dat file (Figure 5.11, "All Input Variables are inserted").

Check out the format to make sure number format is like the following:

  <VAR name="x" format="0.000000"/>
  <VAR name="y" format="0.000000"/>

During the optimisation loop the tags will be substituted with the Input Variables numerical values using the specified format.

All Input Variables are inserted

Figure 5.11. All Input Variables are inserted

Note:

pay attention to the check boxes close to the variable names. As the input variable insertion process progresses, the system marks checked every variable correctly inserted

Note:

the system will not allow the insertion of variables if special characters are included into the selected string. The end-of-line is also a special character, the number must be precisely selected!

When everything seems correctly configured click on the Ok button to accept all changes.

The Data Flow: Mining the Output Variables from The Output Files

This section describes how to extract the Output Variables from the Output Files generated by the ApplicationA.

Create two Output Variables selecting the objects from the palette on the left and place them on the Work Flow desktop.

The first Output Variable objects must then be configured. Double LMB click on the Output Variable icon to bring up the properties editor and change its name in o1.

Press Ok button when finished. Repeat the actions for the second Output Variable calling it o2.

All the properties can be viewed or edited using the Summary | Output Variables panel as well.

Create now an Output File selecting the relative object from the palette on the left and place them on the Work Flow desktop.

The Output File object must then be configured.

Double LMB click on the Output File icon to bring up the properties editor (Figure 5.12, "Linking output file to the application and to output variables") and do the following:

After the variables are connected the modeFRONTIERTM Work Flow should look like the following figure (Figure 5.12, "Linking output file to the application and to output variables"):

Linking output file to the application and to output variables

Figure 5.12. Linking output file to the application and to output variables

A new error message in the Logic Log window show that we have not define any Mining Rules for the Output Variables o1 and o2.

Error 108 MISSING MINING RULE(S) IN OUTPUT FILE outA.dat

The Mining Rule is a rule which defines the way the Output Variable is extracted from the Output File. To apply a Mining Rule to an Output Variable inside the modeFRONTIERTM Work Flow do the follow (Figure 5.13, "Open File dialog"):

Open File dialog

Figure 5.13. Open File dialog

The loaded file outA.dat is displayed by the Template Output Editor window as well as all Output Variables previously defined are shown in the grid below the text (Figure 5.14, "Setting Absolute position").

Setting Absolute position

Figure 5.14. Setting Absolute position

To define the Mining Rule associated to an Output variable do the follow:

Repeat until all Output Variables are properly associated with a Mining Rule, the result of those operations is a list of rules (Figure 5.15, "All Output Variables are extracted") that will be used by modeFRONTIERTM to extract data from the Output Files during the simulation loop.

In particular the following rules:

NAME=o1,TYPE=ABSOLUTE,ROW=1,COL=1 for the o2

NAME=o2,TYPE=ABSOLUTE,ROW=2,COL=1 for the o1

Shows that the value of the variable o1 is extracted from the "first row and first column" of the Output File outA.dat, the out2's value is extracted from the "second row and first column" of the Output File outA.dat.

All Output Variables are extracted

Figure 5.15. All Output Variables are extracted

Note:

As the Output Variable mining process progresses, the system marks checked every variable correctly mined, until all are done

Now we can click on the Ok button to accept all changes, the Work Flow desktop should look like in Figure 5.16, "The Process Flow after the output variable mining process".

The Process Flow after the output variable mining process

Figure 5.16. The Process Flow after the output variable mining process

The Work Flow logic is now completed, and a DOE based exploration of the design space can be performed. However an optimisation loop requires the definition of the set of "Goals" as well as the DOE and Scheduler set-up to be complete.

Defining the Goals

The user has to define a set of goals to be achieved during the optimisation loop. In our example some Objectives are defined for this problem:

To implement these "Goals" in the Work Flow, we link two Objectives objects to our Output Variables:
Every Objective can be edited, as we have done for the other components using its Properties Dialog. Double LMB click on a Objective icon to bring up the properties editor (Figure 5.17, "Objective Properties window") and do the following:

Objective Properties window

Figure 5.17. Objective Properties window

Repeat the operations with other Objective object, see Figure 5.18, "Objective Properties window".

Objective Properties window

Figure 5.18. Objective Properties window

Finally the Logic is completed and the Work Flow desktop should look like in Figure 5.2, "Simplest Process Flow". Now the logic is laid down correctly and can be used in a complete optimisation loop.

Now we have to define DOE and Scheduler properties.

Double LMB click on the icon to bring up the DOE properties editor and do the following:

DOE Properties window

Figure 5.19. DOE Properties window

Double LMB click on the icon to bring up the Scheduler properties editor and do the following:

DOE Properties window

Figure 5.20. DOE Properties window

Now the project is ready to run.

Note:

No error or warning messages should appear in the logic log, no objects should have a yellow border!

If we are not sure to have correctly built this project a tested copy is already available in .../modeFRONTIER30x/projects/testcase/simple/testSimple.prj


Return to modeFRONTIER Index