No Slide Title
IntroductionSession aimed at demonstrating Python being used for
OrcaFlex automation:Whats it all about? Typical UsesWhy
Python?Examples of:Pre-processing, Post-processingDesign
OptimisationSlide #www.orcina.comOrcaFlex User Group, 2013Python
Automation1Whats it all about?A means to efficiently automate
tasks:Excel Spreadsheet = 1st choice for most tasksOrcFxAPI
OrcaFlex Application Program InterfacePython, MATLAB, C++,
Delphi
Slide #www.orcina.comOrcaFlex User Group, 2013Python
Automation2Whats it all about?The first option most people think of
when it comes to OrcaFlex automation is, not surprisingly, the
Excel spreadsheet. This spreadsheet is supplied with the software
and is set up with in-built macros to make your pre and post
processing tasks more efficient and less error prone. For those of
you that use the spreadsheet extensively, there is nothing wrong
with using this method. It is a robust, efficient, easy to use
option that is, and will continue to be, the primary automation
facility that we promote for use with OrcaFlex.
However as good as the spreadsheet is, we recognise that it has
some limitations. There are some tasks that you just cannot do with
the spreadsheet. In addition, some OrcaFlex users simply dont want
to use the spreadsheet for a variety of reasons.
To cater for this, OrcaFlex comes with a programming interface,
called OrcFxAPI (short for OrcaFlex Application Program Interface).
OrcFxAPI is a Windows dynamic link library (DLL) that is installed
when you install OrcaFlex. The programming interface provides a
doorway into OrcaFlex, through which you can pass data. So you can
use the API to drive OrcaFlex from outside of the User Interface.
This means being able to set data items, run simulations, extract
results etc. without actually opening OrcaFlex.
You can link to the DLL using programing languages such as
Python, MATLAB, C++ and Delphi. You can also link to it using other
languages, with a bit of extra work. We recommend using the Python
or MATLAB interfaces for automation and scripting tasks.
Why Python?Scripting language, automatic compile stepClean
syntaxEasy to learnComprehensive standard libraryWell documentedIts
free
Slide #www.orcina.comOrcaFlex User Group, 2013Python
Automation3Typical UsesFour key ways to use Python with
OrcaFlex:Pre-processingPost-processingAs an optimization /
parameter study toolAs an External Function
http://www.orcina.com/Support/index.php
Slide #www.orcina.comOrcaFlex User Group, 2013Python
Automation4Example#1: Pre-ProcessingUsed to efficiently generate
multiple load casesExcel vs Python exampleParticularly useful when
there are decisions to be made as part of the automation
processSuper-quick when changes are required
Slide #www.orcina.comOrcaFlex User Group, 2013Python
Automation5
Example#1: Pre-ProcessingThis example:8x weather directions2x
wave periods2x conditions (SOL & EOL)2x vessel offsets
(moorings intact & one line broken)=64 load cases
Slide #www.orcina.comOrcaFlex User Group, 2013Python
Automation6
Example#1: Pre-ProcessingVariables:Wave & current
directionsWave period (& stage durations)Vessel initial X &
Y positionVessel heading7x line sections line types to change
=large batch script table.Slide #www.orcina.comOrcaFlex User
Group, 2013Python Automation7
Example#2: Post-ProcessingUsed to extract complex results:
Slide #www.orcina.comOrcaFlex User Group, 2013Python
Automation8Example#2: Post-ProcessingThe task we want Python to do
is: -At each sample time:Get the Crane Tips GZ-Velocity, X and Y
results.Use the X and Y results to get the Environment's
Z-Velocity. Calculate the relative velocity & log
extremes.Slide #www.orcina.comOrcaFlex User Group, 2013Python
Automation9Example#3: OptimisationUsing OrcaFlex as a statics
calculation engine:Simple example to demonstrate the ideaUsing
multiple static calculations to iterate towards a solutionHuge time
savings over doing the task manually
Slide #www.orcina.comOrcaFlex User Group, 2013Python
Automation10Example#3: Optimisationfsolve (calcDepth,
initialLength)
Finds solutions to equations of the form f(x)=0, given a
starting estimateThe equation we want to solve is:f(x) = towfish z
position target depth = 0
calcDepthis the one dimensional function f(x)initialLengthis the
starting valueSlide #www.orcina.comOrcaFlex User Group, 2013Python
Automation11Further InformationUGM examples on www.orcina.com
soonOrcFxAPI Help:
www.orcina.com/SoftwareProducts/OrcaFlex/Documentation/Python
tutorials: http://docs.python.orgLearning Python book by Mark
Lutz
Questions?
Slide #www.orcina.comOrcaFlex User Group, 2013Python
Automation12