Plugin SeaLab QBlade

From LabRPS Documentation
Revision as of 13:58, 25 January 2025 by LabRPS (talk | contribs) (Created page with "{{Plugin |Name=QBlade Plugin |Description=This plugin adds the sea surface simulation functionalities of QBlade to LabRPS. |Author=Koffi Daniel |Version=1.0 |Date=21/12/2024 |Features= QBlade Methods (CE_2.0.4_a) |RPSVersion=All }} == Introduction == This plugin adds the sea surface simulation functionalities of QBlade to LabRPS. 1024px == QBlade Methods == This is the only RPS feature that...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Generic plugin icon. Create your personal icon with the same name of the plugin QBlade Plugin

Description
This plugin adds the sea surface simulation functionalities of QBlade to LabRPS.

Plugin version: 1.0
Last modified: 21/12/2024
LabRPS version: All
Author: Koffi Daniel
Author
Koffi Daniel
Download
None
Features
QBlade Methods (CE_2.0.4_a)
Plugin Version
1.0
Date last modified
21/12/2024
LabRPS Version(s)
All
Default shortcut
None
See also
None

Introduction

This plugin adds the sea surface simulation functionalities of QBlade to LabRPS.

Plugin SeaLab QBladeMethods Screenshot 1.png

QBlade Methods

This is the only RPS feature that the plugin implements. It belongs to the simulation method group. This feature allows the user to simulate sea surface as regular or irregular wave based on QBlade which is an advanced multi-physics software designed to facilitate the comprehensive aero-servo-hydro-elastic development, prototyping, simulation, and certification of wind turbines.

Feature Dependency

The features required by this feature are as follows:


Properties

  • DataTimeOffset: Time shift of the generated wave signal
  • DataWaveGeneratorType: The wave type: 0 = Times Series From File, 1 = Components From File, 2 = Single Wave, 3 = JONSWAP, 4 = ISSC, 5 = TORSETHAUGEN, 6 = OCHI-HUBBLE
  • DataLowCutOff: The minimum frequency considered in the DFT, below which wave components are discarded (approximately low-pass filtering).
  • DataHighCutOff: The maximum frequency considered in the DFT, above which wave components are discarded (approximately high-pass filtering).
  • DataSignalSamplingRate: The frequency with which data from the time series is sampled before the DFT is performed. This allows the user to reduce the number of wave components that will be generated by the DFT.
  • DataAmplitudeThreshold: The minimum wave component amplitude allowed after the DFT is performed. This allows the user to filter out wave components with insignificant amplitude and thereby helps to reduce the number of generated wave components.
  • DataSignificantWaveHeight: Height of wave train to be generated (directly linked to amplitude)
  • DataSignificantWaveAmplitude: Amplitude of the wave (directly linked to wave height)
  • DataPeakPeriod: Period of the wave (directly linked to wave frequency)
  • DataPeakFrequency: Frequency of the wave (directly linked to the wave period)
  • DataSpectralPeaks: The spectrum peak shape: 0 = Single Peak, 1 = Double Peak
  • DataAutomaticGamma: Automatic or manual definition of the spectral width parameter.
  • DataAutomaticSigma: Automatic or manual definition of the spectral width parameter.
  • DataGamma: Custom gamma value
  • DataSigma1: sigma1 value
  • DataSigma2: Sigma2 value
  • DataAutomaticOchiHubbleParameters: Custom Ochi-Hubble Parameters are used if true
  • DataSignificantWaveHeight1: The significant height 1
  • DataSignificantWaveHeight2: The significant height 2
  • DataPeakFrequency1: Peak frequency 1
  • DataPeakFrequency2: Peak frequency 2
  • DataPeakShape1: Peak shape 1
  • DataPeakShape2: Peak shape 2
  • DataDiscretizationMethod: Frequency Discretization: 0 = Equal Energy, 1 = Equal Frequency
  • DataAutomaticFrequencyRange: Use automatic frequency range
  • DataCutInFrequency: cut-in frequency
  • DataCutOutFrequency: cut-out frequency
  • DataMaximumBinWidth: Maximum frequency range of the spectrum discretization
  • DataNumberOfFrequencyBins: Resolution of frequency discretization of the energy spectrum.
  • DataRandomPhaseSeed,: The random seed assigning the wave component phase data
  • DataDirectionality: Either a unidirectional irregular wave (Single Dir) or multidirectional wave (Cos Spread) can be created
  • DataPrincipalWaveDirection: Definition of the wave direction (unidirectional spectrum) or of the principal direction of the cosine spectrum.
  • DataMaximumSpread: Definition of the width of the cosine spectrum.
  • DataSpreadingExponent: Shape defining parameter for the directional spectrum
  • DataNumberOfDirectionalBins: Resolution of angular discretization of the directional spectrum.
  • DataWidth: Grid width
  • DataLength: Grid length
  • DataWidthGridNumber: Number of point along the grid width
  • DataLengthGridNumber: Number of point along the grid length
  • DataWaterDepth: The water depth
  • DataGravity: The gravity
  • DataRequestedVariable: Computed Variable (Acceleration, Velocity or Displacement)


Scripting

import LabRPS
import SeaLab
import SeaLabObjects
from LabRPS import Vector as vec
import time 

def simulate():
    # Plugin
    installResuslt = SeaLab.installPlugin("SeaLabPlugin")
    if not installResuslt:
       LabRPS.Console.PrintError("The installation the QBladePlugin has failed.\n")
       return None

    installResuslt = SeaLab.installPlugin("QBladePlugin")
    if not installResuslt:
       LabRPS.Console.PrintError("The installation the AspasiaZervaPlugin has failed.\n")
       return None
    
    # Document
    doc = LabRPS.newDocument()

    # Simulation
    sim = SeaLabObjects.makeSimulation(doc, "Simulation")
    if not sim:
       LabRPS.Console.PrintError("The simulation does not exist.\n")
       return None

    # Simulation points
    loc = SeaLabObjects.makeFeature("SimulationPoints", "Simulation",  "Grid Points", "Location Distribution")
    if not loc:
        LabRPS.Console.PrintError("Error on creating the location distribution.\n")
        return None
    
    # Random phase
    randomness = SeaLabObjects.makeFeature("RandomPhases", "Simulation",  "Uniform Random Phases", "Randomness Provider")
    if not randomness:
        LabRPS.Console.PrintError("The creation of the randomness provider was not successuful.\n")
        return None

    # Simulation method
    simMethod = SeaLabObjects.makeFeature("SimulationMethod", "Simulation",  "QBlade Methods (CE_2.0.4_a)", "Simulation Method")
    if not simMethod:
        LabRPS.Console.PrintError("Error on creating the simulation method.\n")
        return None
    sim.Stationarity = False
    # Run simulation and output the first(0) sample
    # store starting time 
    begin = time.time() 
    velocities = sim.simulate(0)
    # store end time 
    end = time.time()
    LabRPS.Console.PrintMessage(f"Total runtime of the simulaltion is {end - begin} seconds\n")

    if LabRPS.GuiUp:
       import SeaLabGui
       import GeneralToolsGui
       SeaLabGui.setActiveSimulation(sim)
       GeneralToolsGui.GeneralToolsPyTool.showArray(sim.getSimulationData().numberOfTimeIncrements, sim.getSimulationData().numberOfSpatialPosition + 1, velocities, True)
    doc.recompute()
simulate()