Plugin WindLab DeodatisAndShinozuka1991

From LabRPS Documentation
Jump to navigation Jump to search

Generic plugin icon. Create your personal icon with the same name of the plugin Shinozuka and Deodatis 1991 Plugin

Description
This feature allows the user to simulates random wind velocity according to the conventional spectral representation method proposed by Masanoby Shinozuka and George Deodatis (1991).

Plugin version: 1.0
Last modified: 13/01/2025
LabRPS version: All
Author: Koffi Daniel
Author
Koffi Daniel
Download
None
Features
Shinozuka and Deodatis 1991
Plugin Version
1.0
Date last modified
13/01/2025
LabRPS Version(s)
All
Default shortcut
None
See also
None

Introduction

This feature allows the user to simulates random wind velocity according to the conventional spectral representation method proposed by Masanoby Shinozuka and George Deodatis (1991).

Plugin WindLab ShinozukaAndDeodatis1991 Screenshot 1.png

Shinozuka and Deodatis 1991

This is the only RPS feature that the plugin implements. It belongs to the simulation method group.

Feature Dependency

The features required by this feature are summarized in the following table:

Scripting

# -*- coding: utf-8 -*-
# (c) Koffi Daniel 2025

import LabRPS
import WindLab
import WindLabObjects
from LabRPS import Vector as vec
import time 

def simulate():
    # Plugin
    installResuslt = WindLab.installPlugin("DeodatisAndShinozuka1991Plugin")
    if not installResuslt:
       LabRPS.Console.PrintError("The installation the DeodatisAndShinozuka1991Plugin has failed.\n")
       return None
    
    # we need some additional feature from WindLab Plugin
    installResuslt = WindLab.installPlugin("WindLabPlugin")
    if not installResuslt:
       LabRPS.Console.PrintError("The installation the WindLabPlugin has failed.\n")
       return None
    
    # Document
    doc = LabRPS.newDocument()

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

    # Simulation points
    loc = WindLabObjects.makeFeature("SimulationPoints", "Simulation",  "Horizontal Distribution", "Location Distribution")
    if not loc:
        LabRPS.Console.PrintError("Error on creating the location distribution.\n")
        return None

    # Mean wind Profile
    mean = WindLabObjects.makeFeature("MeanSpeed", "Simulation",  "Logarithmic Law Profile", "Mean Wind Profile")
    if not mean:
        LabRPS.Console.PrintError("The creation of the mean wind profile was not successuful.\n")
        return None

    # Frequencies
    frequency = WindLabObjects.makeFeature("Frequencies", "Simulation",  "Zerva Frequency Discretization", "Frequency Distribution")   
    if not frequency:
        LabRPS.Console.PrintError("Error on creating the frequency distribution.\n")
        return None

    # Spectrum
    spectrum = WindLabObjects.makeFeature("Spectrum", "Simulation",  "Kaimal Along Wind Spectrum", "Along Wind Spectrum")
    if not spectrum:
        LabRPS.Console.PrintError("Error on creating the spectrum model.\n")
        return None
    
    # Random phase
    randomness = WindLabObjects.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 = WindLabObjects.makeFeature("SimulationMethod", "Simulation",  "Shinozuka and Deodatis (1991)", "Simulation Method")
    if not simMethod:
        LabRPS.Console.PrintError("Error on creating the simulation method.\n")
        return None
    
    # 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 WindLabGui
       import GeneralToolsGui
       WindLabGui.setActiveSimulation(sim)
       GeneralToolsGui.GeneralToolsPyTool.showArray(sim.getSimulationData().numberOfTimeIncrements, sim.getSimulationData().numberOfSpatialPosition + 1, velocities, True)

simulate()