Plugin WindLab CorrelationErgodicity
Description |
---|
This plugin assesses the ergodicity of the simulated wind velocities in terms of temporal correlation. Plugin version: 1.0 Last modified: 2024-04-15 LabRPS version: All Author: Koffi Daniel |
Author |
Koffi Daniel |
Download |
None |
Features |
Correlation Ergodicity Check Tool |
Plugin Version |
1.0 |
Date last modified |
2024-04-15 |
LabRPS Version(s) |
All |
Default shortcut |
None |
See also |
None |
Introduction
This plugin assesses the ergodicity of the simulated wind velocity by analyzing its temporal correlation. It calculates the temporal correlation of the simulated wind velocity and compares it with the temporal correlation derived from the target power spectral density function used to simulate the wind velocities.
Correlation Ergodicity Check Tool
This is the only RPS feature that the plugin implements. It belongs to the table tool group. This feature uses the simulated wind velocity to compute the temporal correlation. Therefore, you need to make sure you simulate random wind velocity first. You can also import the wind velocity from file. Note that if you use the mouse (GUI mode) to run this feature, you have to make sure the active window is the window containing the wind velocity data for which you want to compute the temporal correlation.
Properties
- DatafftPointsNumber: This number of DFT points used during the computation.
- DataWindowLength: The length of the window used to divide the two wind processes into segments and perform windowing.
- DataOverLap: The number of overlapped samples, specified as a positive integer.
- DataWindowType: This is the type of windowing.
Scripting
import LabRPS import WindLabObjects import WindLabGui import WindLab import GeneralToolsGui # Before you run this macro, simulation must be run and there must be a table containing the simulated wind velocities. def checkResult(): # Install the correlation checking tool installResuslt = WindLab.installPlugin("CorrelationErgodicityPlugin") if not installResuslt: LabRPS.Console.PrintError("The installation of the Correlation Ergodicity Plugin has failed.\n") return None # Get the active simulation which as this time has been run already. sim = WindLabGui.getActiveSimulation() # get the simulation data as list assuming that a wind simulation is run and # the result is shown in an AlphaPlot table called "table". Please, edit this table name # according to the name of the table where your simulated data are stored. velocities = GeneralToolsGui.GeneralToolsPyTool.getTableByName("table") # create the correlation checking tool CorrelationErgo = WindLabObjects.makeFeature("CorrelationErgo", sim.Name, "Correlation Ergodicity Check Tool", "Table Tool") # check if the created tool is good if not CorrelationErgo: LabRPS.Console.PrintError("The creation of the table tool was not successuful.\n") return None # run the tool sim.setActiveFeature(CorrelationErgo) CorrelationErgoRest = sim.tableToolCompute(velocities) f = sim.getSimulationData().numberOfFrequency - 1 # if we are in Gui mode, show plots if LabRPS.GuiUp: import numpy import matplotlib.pyplot as plt # convert the list to numpy array array = numpy.asarray(CorrelationErgoRest) locationJ = sim.LocationIndexJ + 1 locationK = sim.LocationIndexK + 1 str1 = "{:d}".format(locationJ) str2 = " and {:d}".format(locationK) str = "Correlation between Locations " + str1 + str2 fig, ax = plt.subplots() ax.set_title(str) ax.plot(array[0:f,0], array[0:f,1], color='red') ax.plot(array[:,2], array[:,3], color='blue', linestyle='dashed') ax.set_xlabel('Time Lags (s)') ax.set_ylabel('Correlation') # ax.grid(True) plt.legend(["Target", "Simulated"], loc="upper right", frameon=False) plt.show() checkResult()