Plugin WindLab SimulatedCorrelationTool
Revision as of 14:50, 23 January 2025 by LabRPS (talk | contribs) (Created page with "{{Plugin |Name=Simulated Correlation Tool Plugin |Description=This plugin computes the temporal correlation the simulated wind velocities. |Author=Koffi Daniel |Version=1.0 |Date=15/01/2025 |Features= Simulated Correlation Tool |RPSVersion=All }} == Introduction == This plugin computes the temporal correlation the simulated wind velocities. 1024px == Simulated Correlation Tool == This is...")
Description |
---|
This plugin computes the temporal correlation the simulated wind velocities. Plugin version: 1.0 Last modified: 15/01/2025 LabRPS version: All Author: Koffi Daniel |
Author |
Koffi Daniel |
Download |
None |
Features |
Simulated Correlation Tool |
Plugin Version |
1.0 |
Date last modified |
15/01/2025 |
LabRPS Version(s) |
All |
Default shortcut |
None |
See also |
None |
Introduction
This plugin computes the temporal correlation the simulated wind velocities.
Simulated Correlation 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.
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("SimulatedCorrelationToolPlugin") if not installResuslt: LabRPS.Console.PrintError("The installation of the simulated Correlation tool 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 simulatedCor = WindLabObjects.makeFeature("simulatedCor", sim.Name, "Simulated Correlation Tool", "Table Tool") # check if the created tool is good if not simulatedCor: LabRPS.Console.PrintError("The creation of the table tool was not successuful.\n") return None # run the tool sim.setActiveFeature(simulatedCor) simulatedCorRest = sim.tableToolCompute(velocities) # if we are in Gui mode, show plots if LabRPS.GuiUp: # LabRPS plot # GeneralToolsGui.GeneralToolsPyTool.tablePlotCurve(len(simulatedCorRest), len(simulatedCorRest[0]), simulatedCorRest, 0, 1) # Python plot import numpy import matplotlib.pyplot as plt # convert the list to numpy array array = numpy.asarray(simulatedCorRest) 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], array[:,1], color='red') ax.set_xlabel('Time Lags (s)') ax.set_ylabel('Correlation') # ax.grid(True) plt.show() checkResult()