Tidal Bladed Knowledge Base

How do I set the Peakedness parameter for JONSWAP waves via the Project API?
Category: Bladed API

Problem

Most of the wave parameters can be set in the API using code such as that in the Python example below (C# version is analogous):

  # set waves to irregular
  prj.Environment.Sea.TimeVaryingWaves.ModelType = 2
  # set spectral model type to JONSWAP
  prj.Environment.Sea.TimeVaryingWaves.IrregularWaves.WaveType = 0
  prj.Environment.Sea.TimeVaryingWaves.IrregularWaves.Height = Hs
  prj.Environment.Sea.TimeVaryingWaves.IrregularWaves.Period = Tp
    prj.Environment.Sea.TimeVaryingWaves.IrregularWaves.Peakedness = Gamma # doesn't work!
  prj.Environment.Sea.TimeVaryingWaves.IrregularWaves.RandomSeed = RandomSeed 
  prj.Environment.Sea.TimeVaryingWaves.Direction = Mdir
  print (prj.Environment.Sea.TimeVaryingWaves.IrregularWaves.Height)
  print (prj.Environment.Sea.TimeVaryingWaves.IrregularWaves.Period)
  # print (prj.Environment.Sea.TimeVaryingWaves.IrregularWaves.Peakedness) this throws an error

However, the Peakedness parameter is not handled correctly and will throw an error if you try to read it. You can set it without an error in Python, but the value won't be recognised by Bladed.

Solution

This is a known bug which will be fixed in due course. The answer is to use a different part of the API data model (the "Legacy" model).

Replace this line: 

  prj.Environment.Sea.TimeVaryingWaves.IrregularWaves.Peakedness = Gamma 

with this one:

    prj.LegacyModel.OldWAVES.fGamma = Gamma 





Keywords Peakedness; gamma; JONSWAP; irregular; waves; API