Python external function examples: Current functions used elsewhere

This topic is intended to be read in conjunction with the main external function documentation, and the example source code.

This ZIP file contains all of the Python external function examples, with each example contained in the appropriately named sub-folder.

The example classes that provide current speed in our previous example can also be used for other OrcaFlex variable data. In the provided data file we link the output values from these classes to a line applied load and to winch behaviour.

This example comprises OrcaFlex data file CurrentExamplesUsedElsewhere.dat and workspace files CurrentExamplesUsedElsewhere_lines.wrk and CurrentExamplesUsedElsewhere_winches.wrk. The Python script is unchanged from the Current functions topic.

We do not make use of the final class MovingAverageSpeedAndDirection, because the methods there check for the expected current data names. If this class was used for a line applied load, or a winch payout rate, as in this file, those checks on info.DataName would fail, as should be expected.

Renaming of variables etc. within the code to match the script to the language of the domain would be strongly recommended. However, this example demonstrates that it is not essential to do so. We hope that this emphasises the freedom that you can have with external functions - they can implement general mathematical models, and then you can use those across the range of available entry points that OrcaFlex provides.

Workspace notes

The workspace for our demonstration winches presents winch velocity, and also includes a plot of the wind speed. Winch velocity shows directly the output from the external functions, because they are used to control payout rate on the winch data form. The close relationship between wind speed and wind-proportional winch 2 is clear. Winch 3 uses the moving average variable data, and you can observe both the smoothing effect and the time lag that a moving average value creates relative to the source history.

The workspace presenting line results shows dynamic x offset of each mid point for the lines in the model. There is an applied load at the middle node of each line, using one of the three different external functions. The wind speed is also shown, so that the relationship with the offsets can be noted.

Our output from OrcaFlex from lines is further removed from the external function outputs, because lines do not provide applied load results at their nodes. It is therefore useful to have viewed the winch velocities before looking at the line results, because the applied loads on the lines will match the corresponding winch velocities.

Because we show dynamic x results, we should begin by understanding the static state. The line with load from increasing speed has zero load and zero offset in statics. The variable data source initial value is zero, and this is not changed in the class Initialise method. The line with wind-proportional load has an initial value of 1.7 on the OrcaFlex variable data form, and again this is not changed in the class Initialise method. Finally the line with moving average load has an initial value of 1.7 on the OrcaFlex variable data form, but this is changed to 0.45 in the class Initialise method. These three different values explain the initial static offsets of the line catenaries along the global X direction.