MATLAB reference: ofx

dummy link for benefit of anchor linked from external source

The ofx class is a static class to encapsulate general functions and constants for the OrcaFlex API.

Functions

DLLVersion

ofx.DLLVersion

This function returns the version number of OrcaFlex DLL being used, as a string. This function calls the C API function C_GetDLLVersion.

DLLLocation

ofx.DLLLocation

This function returns the path of the OrcaFlex DLL being used.

SetLibraryPolicy

ofx.SetLibraryPolicy(name[, value])

This function is used to specify module wide policies as listed in the C API function C_SetLibraryPolicy.

FileCreatorVersion

ofx.FileCreatorVersion(filename)

This function returns the version of OrcaFlex used to create the OrcaFlex data or simulation file identified by filename. This function calls the C API function C_GetFileCreatorVersion.

BinaryFileType

ofx.BinaryFileType(filename)

This function returns the OrcaFlex file type of the OrcaFlex file filename. The value returned is one of the OrcFxAPI constants: ofx.ftDataFile, ofx.ftStaticStateSimulationFile, ofx.ftDynamicSimulationFile. BinaryFileType calls the C API function C_GetBinaryFileType.

RestartParentFileName

ofx.RestartParentFileName(filename)

Returns the parent file name for the specified restart analysis file. If the specified file is not a restart file then [] is returned.

CreateModelParams

ofx.CreateModelParams(threadCount)

This function returns a CreateModelParams structure with the ThreadCount field set to threadCount. This represents the C API structure TCreateModelParams and is used when creating a model, see MATLAB reference: ofxModel.

Period

ofx.Period

ofx.Period(n)

ofx.Period(from, to)

This function returns a period structure that represents the C API structure TPeriod. With no parameters, the period returned is the whole simulation. If one parameter n is specified this must be either an OrcaFlex constant (ofx.pnBuildUp, ofx.pnLatestWave, ofx.pnStaticState) or a stage number. If from and to times are specified then the period returned is a specified period.

OrcaFlex special values

ofx.OrcinaDefaultReal

ofx.OrcinaDittoReal

ofx.OrcinaInfinity

ofx.OrcinaUndefinedReal

ofx.OrcinaNullReal

These functions return double values that represent special data values in OrcaFlex. See the C API documentation for: OrcinaDefaultReal, OrcinaDittoReal, OrcinaInfinity, OrcinaUndefinedReal, OrcinaNullReal.

ofx.OrcinaDefaultWord

The integer representation of data values which are displayed as ~ in OrcaFlex. See the C API documentation for OrcinaDefaultWord.

MoveObjectPoint

ofx.MoveObjectPoint(object, pointIndex)

This function returns a structure with the same fields as the C API structure TMoveObjectPoint. The object parameter is an ofxObject and pointIndex is as described in the documentation for TMoveObjectPoint.

MoveObjectSpecification

This structure is used to specify the move operation performed by MoveObjects. The structure contains the same fields as TMoveObjectSpecification and is created by a call to one of the following functions:

ofx.MoveObjectDisplacementSpecification(displacement)

ofx.MoveObjectPolarDisplacementSpecification(direction, distance)

ofx.MoveObjectNewPositionSpecification(referenceObject, referencePointIndex, newPosition)

ofx.MoveObjectHorizontalRotationSpecification(angle, centre)

ofx.MoveObjectGeneralRotationSpecification(angle, centre, axisAzimuth, axisDeclination)

Refer to the documentation of TMoveObjectSpecification for more details.

MoveObjects

ofx.MoveObjects(specification, points)

This function exposes the functionality of the OrcaFlex move selected objects wizard. The specification parameter is a MoveObjectSpecification structure and specifies how to move the points. The points parameter is a cell array of MoveObjectPoint structures containing the points which are to be moved.

MoveObjects calls the C API function C_MoveObjects.

CompoundProperties

CompoundProperties(objects[, referenceObject][, referencePoint])

Returns overall properties for a collection of objects, specified by the objects cell array. The return value is a structure containing fields corresponding to the fields of the C API type TCompoundProperties.

Properties are reported with respect to the axes of the referenceObject and referencePoint. If these parameters are omitted then the default reference object and point are used, as described in the documentation for the C API function C_GetCompoundProperties.

If the referenceObject parameter is specified, it must be a member of objects. The referencePoint parameter is a string whose possible values are described in the documentation for the C API function C_GetCompoundProperties.

ExchangeObjects

ofx.ExchangeObjects(object1, object2)

Changes the order in which objects appear in their containing list by exchanging them. This function can be used to implement sorting functions that can re-order objects in a model according to, for example, their names.

ExchangeObjects calls the C API function C_ExchangeObjects.

CalculateMooringStiffness

ofx.CalculateMooringStiffness(vessels)

Calculates the mooring stiffness for the specified vessels. The vessels parameter must be a cell array containing one or more vessel objects. The vessel objects must all be part of the same model. The model must be in the statics completed state.

The stiffness is returned in a $6N \times 6N$ array, where $N$ is the number of vessels specified.

ReadPanelMesh

result = ofx.ReadPanelMesh(filename, format[, scale][, bodyNumber][, importDryPanels])

Imports the panel mesh file named filename.

The format parameter specifies the format of the panel mesh file, and can be one of the following:

The scale parameter is used to scale the imported vertices. This is useful when you wish to convert between different length units. Pass 1 to import the mesh without scaling. If the parameter is omitted then no scaling is performed.

The bodyNumber parameter is used to specify the body to import, in the case where the mesh file contains multiple bodies. If the parameter is omitted, then a value of 1 is used.

The importDryPanels parameter determines whether or not all panels will be imported (that is both wet diffracting panels and dry panels), or just the panels that are specified as being wet. If the parameter is omitted, then a value of true is used.

The return value is an object with structure with fields panels and symmetry. Panels is an array containing the panel vertices. Symmetry contains the symmetry defined in the panel mesh file and is one of ofx.msNone, ofx.msXZ, ofx.msYZ or ofx.msXZYZ. Symmetry is not defined for ofx.mfWamitFdf, ofx.mfNemohDat, ofx.mfSesamFem, ofx.mfGmshMsh and ofx.mfWavefrontObj format meshes and a value of ofx.msNone is returned in these cases.

SaveWamitGdfPanelMesh

ofx.SaveWamitGdfPanelMesh(filename, panels, header, ulen, grav, isX, isY)

Saves a panel mesh as a WAMIT GDF file, whose name is specified by the filename parameter.

The panels are defined by an array containing the panel vertices. This has shape [N 4 3] where $N$ is the number of panels.

The remaining parameters define additional information to be written to the file alongside the panels, as described in the C API structure TWamitGdfHeader.

SaveWamitGdfPanelMeshMem

result = ofx.SaveWamitGdfPanelMeshMem(panels, header, ulen, grav, isX, isY)

Saves a panel mesh as a WAMIT GDF file, returning it as an array of bytes.

The remaining parameters are treated the same way as for the SaveWamitGdfPanelMesh method.

TimeHistorySpecification

TimeHistorySpecification(modelObject, varName[, objectExtra])

Returns a structure that describes a single time history variable. This function is used to create structure arrays to pass to GetMultipleTimeHistories.

GetMultipleTimeHistories

GetMultipleTimeHistories(specification[, period])

Returns time histories for the specified results variables. The columns of the returned array correspond to the time axis, and each specified variable is a row in the array. Using this function is usually more efficient than making multiple calls to TimeHistory.

specification is a structure array where each element is a time history specification obtained by calling TimeHistorySpecification. period is a Period structure, if omitted the default is used (see MATLAB interface: Results).

For example, the following code extracts position time histories for all points on on a line object:

arclengths = line.RangeGraphXaxis('X');

varNames = { 'X', 'Y', 'Z' };

index = 1;

for arclengthIndex = 1:length(arclengths)

for varIndex = 1:length(varNames)

spec(index) = ofx.TimeHistorySpecification(line, varNames{varIndex}, ...

ofx.oeArcLength(arclengths(arclengthIndex)));

index = index + 1;

end

end

period = ofx.Period(0, 10800);

values = ofx.GetMultipleTimeHistories(spec, period);

GetMultipleTimeHistoriesCollated

GetMultipleTimeHistoriesCollated(specification[, period][, restartModels])

Returns time histories for the specified results variables, that fall within the specified period, collated for the specified restart models. The columns of the returned array correspond to the time axis, and each specified variable is a row in the array. Using this function is usually more efficient than making multiple calls to TimeHistoryCollated.

specification is a structure array where each element is a time history specification obtained by calling TimeHistorySpecification.

If period is omitted then all sample times are returned. For a specified period, a value of ofx.OrcinaDefaultReal for from or to means the first sample of the first model or the last sample of the last model, respectively.

The restartModels argument is an array of integer indices specifying which models are to be included. You can use restartFileNames to obtain the file names of the models in the restart chain, and also the length of the restart chain. If restartModels is omitted, then all models in the restart chain are included.

PanelPressureParameters

ofx.PanelPressureParameters(IncludeHydrostaticPressure, IncludeDiffractionPressure, IncludeRadiationPressure)

This function returns a panelPressureParameters structure that represents the C API structure TPanelPressureParameters. With no parameters, the returned panelPressureParameters structure includes all pressure components.

See also PanelPressureTimeHistory, TPanelPressureParameters.

Vector

ofx.Vector

ofx.Vector(x, y, z)

ofx.Vector(array)

The Vector function returns a structure with fields X, Y, Z that represents the C API structure TVector. The parameters are three numeric values x, y and z or a scalar array. If no parameters are given then the function returns a zero vector.

Object extra functions

These functions return a structure that represents the C API structure TObjectExtra2. See the documentation on this function for the values required for the object extra fields. The following functions are for OrcaFlex objects requiring position data. Here the args parameters are used to create a Vector structure (see ofx.Vector):

ofx.oeEnvironment(args)

ofx.oeVessel(args)

ofx.oeBuoy(args)

ofx.oeConstraint(args)

Object extra functions for lines are below. To set an object extra field such as Theta, ClearanceLineName or RadialPos then modify the appropriate field of the structure returned by these functions:

ofx.oeEndA

ofx.oeEndB

ofx.oeTouchdown

ofx.oeNodeNum(NodeNum)

ofx.oeArcLength(ArcLength)

Object extra functions for other OrcaFlex object types:

ofx.oeWing(WingName)

ofx.oeWinch(WinchConnectionPoint)

For line supports results:

ofx.oeSupport(SupportIndex[, SupportedLineName])

For turbine results:

ofx.oeTurbine(BladeIndex[, ArcLength])

ofx.oeTurbineEndA(BladeIndex)

ofx.oeTurbineEndB(BladeIndex)

For Morison element results:

ofx.oeMorisonElement(ElementIndex, ArcLength)

For vessel air gap results:

ofx.oeAirGap(RigidBodyPos, SeaSurfaceScalingFactor)

An empty instance of the ObjectExtra structure can be created using the function:

ofx.ObjectExtra

The fields of the ObjectExtra structure can then be set individually. For example, to return a range graph of line clearance, between Line1 and Line2:

objectExtra = ofx.ObjectExtra

objectExtra.ClearanceLineName = 'Line2'

rangeGraph = model('Line1').RangeGraph('Line clearance', objectExtra)

ArclengthRange functions

These functions return an ArclengthRange structure that represents the C API structure TArclengthRange:

ofx.arEntireRange

ofx.arSpecifiedArclengths(FromArclength, ToArclength)

ofx.arSpecifiedSections(FromSection, ToSection)

ExtremeStatistics

ofx.ExtremeStatistics(values, sampleInterval)

This function returns an ofxExtremeStatistics object, see also the C API documentation for C_OpenExtremeStatistics.

RayleighStatisticsSpecification

ofx.RayleighStatisticsSpecification([ExtremesToAnalyse])

This function returns a structure which represents the C API structure TExtremeStatisticsSpecification for a Rayleigh distribution. The ExtremesToAnalyse parameter should be ofx.exUpperTail or ofx.exLowerTail, if omitted then ofx.exUpperTail is the default.

LikelihoodStatisticsSpecification

ofx.LikelihoodStatisticsSpecification(Distribution, Threshold, DeclusterPeriod[, ExtremesToAnalyse])

This function returns a structure which represents the C API structure TExtremeStatisticsSpecification for a Weibull or Generalised Pareto distribution. The distribution field should specify ofx.evdWeibull or ofx.evdGPD. If the ExtremesToAnalyse parameter is omitted the default is ofx.exUpperTail.

RayleighStatisticsQuery

ofx.RayleighStatisticsQuery(stormDurationHours, riskFactor)

This function returns a structure which represents the C API structure TExtremeStatisticsQuery for a Rayleigh distribution.

LikelihoodStatisticsQuery

ofx.LikelihoodStatisticsQuery(stormDurationHours, confidenceLevel)

This function returns a structure which represents the C API structure TExtremeStatisticsQuery for a Weibull or Generalised Pareto distribution.

TimeSeriesStatistics

ofx.TimeSeriesStatistics(values, sampleInterval)

This function returns a structure with the same fields as the C API structure TTimeSeriesStatistics. The values parameter is an array of values, and sampleInterval is the time interval in seconds between the values. See the C API documentation for C_CalculateTimeSeriesStatistics.

EmpiricalDistribution, RainflowHalfCycles, UnorderedRainflowHalfCycles, RainflowAssociatedMean, Rratio, SpectralDensity

ofx.EmpiricalDistribution(values)

ofx.RainflowHalfCycles(values)

ofx.UnorderedRainflowHalfCycles(values)

ofx.RainflowAssociatedMean(values)

ofx.Rratio(range, associatedMean)

ofx.SpectralDensity(times, values[, fundamentalFrequency])

These functions are called by the ofxObject methods with the same names to return time history summary results, but these functions can be also be called directly. You must provide a time history of values in the values parameter. For the Rratio function you provide cycle ranges and their associated mean values. For the SpectralDensity function the times parameter contains the sample times corresponding to the values provided. See EmpiricalDistribution, RainflowHalfCycles, UnorderedRainflowHalfCycles, RainflowAssociatedMean and SpectralDensity.

CycleHistogramBins

ofx.CycleHistogramBins(halfCycleRanges, binSize=None)

This function is called by the CycleHistogramBins method of ofxObject to return rainflow cycle bins, but this function can be also be called directly. You must provide a list of half cycle ranges in the halfCycleRanges parameter which will typically be the result of a call to RainflowHalfCycles. binSize determines the width of each bin. The first bin covers the range 0 to binSize, the second bin covers the range binSize to 2*binSize, etc. If binSize is omitted then OrcaFlex chooses a default bin size based on the range of the data and the total number of cycles.

The return value is a structure array containing the cycle bins. The structure array fields are named Value and Count, corresponding to the fields of the C API type TCycleBin.

AnalyseExtrema

ofx.AnalyseExtrema(values)

This function is called by the AnalyseExtrema method of ofxObject, but can be called directly, passing a list of values in the values parameter.

FindLocalExtrema

ofx.FindLocalExtrema(values)

This function returns the indices of all local extrema in the time series values.

FrequencyDomainMPM

ofx.FrequencyDomainMPM(stormDuration, StdDev, Tz)

Calculates the most probable maximum for a frequency domain result. This function is called by the FrequencyDomainMPM method of OrcaFlexObject, but can be called directly, passing the storm duration, standard deviation, and mean up-crossing period. The storm duration and mean up-crossing period must be specified in the same units of time, and the value returned has the same units as the standard deviation.

The value returned is the Rayleigh extremes MPM given by σ[2ln(T/Tz)]½ where σ is the standard deviation and T is the storm duration.

DisableModule

ofx.DisableModule(module)

Disables the OrcaFlex module identified by the module constant module which should be ofx.moduleDynamics. This function must be called before creating a model, for more details see the C API function C_DisableModule.