|
|
Overview |
OrcaFlex is object-oriented. To represent a marine system it creates a model object, which is simply a data structure into which OrcaFlex simulations and their results can be loaded. Within the model object, other objects are then created to represent the various things in the marine system; in particular an environment object is created to represent the seabed, sea, waves etc., and objects are created for each vessel, buoy, line, link etc. that are included in the model.
The first thing you need to do when using OrcFxAPI is call the C_CreateModel function to create the model object. This function creates the model and returns the model handle; it also creates the environment object. Having created the model you are now ready to load a simulation into the model using the C_LoadSimulation function. This creates all the other objects (vessels, buoys, lines etc.) that are included in that simulation, and reads the (often extensive) simulation results into memory, ready for results extraction.
When you use the OrcFxAPI functions you need the model handle, and also the handles of the other objects in the model, since when you call an OrcFxAPI function you need to tell it which model or object you are referring to. So you need to set up your own storage in which to store these various handles; we suggest you set up a list of object information records, each record holding the object handle, type and name. To obtain this information call C_EnumerateObjects.
Having loaded a simulation, and set up your own list of the objects in the model, you are now ready to extract time history results from the simulation. This is done using C_GetNumOfSamples, C_GetSampleTimes and C_GetTimeHistory2.
C_GetNumOfSamples tells you how many samples there are in the time histories (they all have the same number of samples); this enables you to allocate sufficient memory to store the time histories you want to extract.C_GetSampleTimes returns the array of sample times that apply to all the time histories.C_GetTimeHistory2 returns the array of values for a given time history.Finally, when you have finished extracting results, you must call C_DestroyModel; this destroys the model you created and all the objects within it.