|
|
Batch script: Examples of setting data |
| Warning: | Support for batch script is maintained solely for historical reasons. The preferred way to specify variations on a base data file is to use text data files, specifically variation models. The OrcaFlex spreadsheet offers a facility to generate these text data files. |
The Select command is probably the most difficult script command to use. To help understand how it works we present some examples of its use.
For many objects the script commands for setting data take the form:
The object name is most easily found in the model browser. The data name is found by opening the relevant data form, selecting the required data item and pressing F7.
Some examples of this procedure follow:
| Note: | The name "3D buoy1" needs to be enclosed in quotes because it contains a space. If the name contains a double quote and spaces then it should be enclosed with single quotes. |
Some data in OrcaFlex appear in tables. For example consider the structure page of the line data form which specifies how a line is made up of a number of sections. Each section is specified by its line type, length etc. The following example sets the number of sections of the line to be 2 and then sets data for both sections in turn.
Note that we use blank lines to lay out the script. This is not essential but makes reading the script easier.
Data which appear in tables are always set using this indexed notation. Having stated this rule, we immediately break it in the following section!
These data are set by first selecting the type by name and then assigning the data:
On the line types data form there is an option to view the data for all line types at once or to view by individual line type. When viewing for all line types at once, the data appear in tables with one row per line type. However, these data must be set by first selecting the type by name and then assigning the data. You cannot set line type data using index notation.
Similar rules apply to clump type data and to flex joint type data.
These data are also set by first selecting the type by name and then assigning the data. For example:
Data found on the general data form can be set as follows:
Data found on the environment data form can be set as follows:
For data specific to a particular wave train you must first select the environment and then select the particular wave train. This makes use of the alternative syntax for Select which is Select <ObjectType> <ObjectName>. For a wave train you replace <ObjectType> with Wave and replace <ObjectName> with the name of the wave train as defined on the environment data form. For example:
You may also use the syntax Select <ObjectType>Index <ObjectIndex>, where <ObjectIndex> is the index of the required wave train in the list held by the environment and displayed on the environment data form. For instance, if the wave train named "Swell from SW" is the first in the list and "Local wind sea" is the second, then the following script would have exactly the same effect as the previous example:
Note that this index, as other indices in batch script, is 1-based: the first entry in the list has index 1.
Objects can be shown and hidden using a boolean data item named Hidden.
For the environment, to show and hide the sea, seabed, sky and wind, use boolean data items named SeaHidden, SeabedHidden, SkyHidden and WindHidden, respectively.
Objects can be locked and unlocked using a boolean data item named Locked.
Browser groups can be expanded and collapsed using a boolean data item named Expanded.
To modify existing post calculation actions they must first be selected. The example below shows how to modify the script file name for the post calculation action named Action3:
To modify existing user defined results they must first be selected. The example below shows how to modify the script file name for the user defined result named Result3:
Multiple current data sets can be defined. Again this requires the alternative syntax for select using either name or index, as shown below:
Some vessel type data are set in a straightforward manner as follows:
However, the majority of vessel type data require that you also specify to which draught the data apply:
To set data for displacement RAOs, wave load RAOs, wave drift QTFs and sum frequency QTFs you must also specify to which type of RAO the data apply. For example:
Note that the data names RAOOriginX etc are the same in each case, but different data are set depending on which type of RAOs has been selected.
In addition, when setting RAO table data (for displacement RAOs, wave load RAOs and wave drift QTFs) you must specify to which direction the data apply. You may specify either the index of the direction in the list of all directions for that type, or the value of the direction. For example:
However, it is worth pointing out that situations where you would wish to specify RAO table data in a batch script are rare. It is much more likely that you would import these data into OrcaFlex from some external source and then save it as part of the base case data file.
Some multibody group data are set in a straightforward manner as follows:
To set the stiffness data you must first select the body:
To set the added mass and damping data you must select the period or frequency (by either index or value) and the row/column body:
The fact that it is possible to set these data through batch script does not necessarily make it a good idea to do so! These data are exceedingly unwieldy to manipulate in batch script. Should you find yourself doing so, it might be prudent to look for a more elegant solution to your problem.
Setting P-y model data is complicated because each depth must be selected before the model data can be accessed. Selection may be by value (SelectedDepthBelowSeabedFrom) or index (SelectedDepthBelowSeabedIndex).
SHEAR7 data ownership is divided between the SHEAR7 object and line objects. The SHEAR7 version, output file options and S-N curve data are owned by the SHEAR7 object:
To access the S-N curve table requires that the curve is selected first, either by name or by index:
SHEAR7 whole line data and stress concentration factors are accessed through a line object:
The SHEAR7 hydrodynamic and structural section data apply to a line section, so the index of the section is required:
To edit penetrator data, the penetrator locations data set must first be selected either by name or by index:
Code checks data ownership is divided between the code checks object and line type objects. Model-wide data items are owned by the code checks object:
The per line type code check data are just like any other line type data:
Data for variable data sources can be set from the batch script, although once again we feel it is unlikely that you would need to do this often. The procedure for setting variable data sources is illustrated below:
Note that IndependentValue and DependentValue are the data names for the X and Y columns of the variable data source. If, for example, you are setting data for a bending stiffness data source, then IndependentValue denotes curvature and DependentValue denotes bend moment.
The line type wizard can be used from batch script. First of all you must select the line type and set its wizard data. Once this is complete the wizard is invoked using the InvokeWizard command:
The plasticity wizard can be used from batch script. First of all you must select the bend stiffness variable data source and set its wizard data. Once this is complete the wizard is invoked using the InvokeWizard command:
The line setup wizard can be used from batch script using the InvokeLineSetupWizard command. The input data should be set before invoking. These data are owned by a variety of different objects. The model-wide data (e.g. calculation mode and convergence parameters) are owned by the general object. The line-specific data are owned by each individual line. The following script illustrates this:
The all objects data form allows connection data to be specified as polar coordinates. The data appear in a table containing all connections in the model. However, the data still belong to each individual object and the appearance of a table of data is purely presentational. This means that to set the data you must first select the individual object and then set the data, as illustrated below:
For objects with multiple connections, an index must be specified to identify the connection. For lines and links an index of 1 means end A and an index of 2 means end B. For winches the index identifies the winch connection point. For turbines, index 1 means the turbine connection, index 2 means the end A tower connection, and index 3 means the end B tower connection.
For any object that supports object tags, the tags can be edited like this:
If a tag with that name is already defined by the object, its value will be modified; otherwise, a new tag will be added.
Drawing colour data items can be set through batch script in a variety of ways. The simplest is to use the pre-defined colours:
The full list of pre-defined colours is: Black, Maroon, Green, Olive, Navy, Purple, Teal, Gray, Silver, Red, Lime, Yellow, Blue, Fuchsia, Aqua, MoneyGreen, SkyBlue, Cream, MedGray and White.
If you want more control over the colour then you can specify an RGB value as an integer. The following example has the same effect as the previous one:
Using decimal values for RGB value is impractical. Instead a neat trick is to specify the colour as a hexadecimal value by prefixing it with a \$ sign:
This sets the colours to red, green and blue respectively. Each pair of hex digits controls the amount of red, green and blue, in the order \$BBGGRR. So red is \$0000FF, green is \$00FF00, blue is \$FF0000, white is \$FFFFFF and black is \$000000. A value of \$C0C0C0 gives a light grey and \$808080 produces a darker grey.
Fatigue analysis data are quite simple in the script. The only complication is that you must select S-N and T-N curves before assigning their data. As usual, you may select them either by their name or their index.