NREL / ROSCO

A Reference Open Source Controller for Wind Turbines
https://rosco.readthedocs.io/en/latest/
Apache License 2.0
112 stars 92 forks source link

regarding FAST_reader.py #259

Open iman-tepsco opened 1 year ago

iman-tepsco commented 1 year ago

I have two questions regarding _FASTreader.py.

If the platform has more than one body, say two, and the model incorporates coupling between the bodies, the values for NBody and NBodyMod in HydroDyn will be two and one, respectively. In this scenario, AddF0 is a 12X1 vector (rather than a 6X1), while AddCLin, AddBLin, and AddBQuad are 12X12 matrices (rather than 6X6). The dimensions of AddF0 are correctly understood by _FASTreader.py, but it appears to fall short of recognizing the dimensions of AddCLin, AddBLin, and AddBQuad, which may result in an error for such platforms.

According to lines no. 1684-1693 of _FASTreader.py:

`

    if self.fst_vt['HydroDyn']['NBodyMod'] == 1:
        self.fst_vt['HydroDyn']['AddF0']         = [float(f.readline().strip().split()[0]) for i in range(6*NBody)]
    elif self.fst_vt['HydroDyn']['NBodyMod'] > 1:
        self.fst_vt['HydroDyn']['AddF0']         = [[float(idx) for idx in f.readline().strip().split()[:NBody]] for i in range(6)]
    else:
        raise Exception("Invalid value for fst_vt['HydroDyn']['NBodyMod']")

    self.fst_vt['HydroDyn']['AddCLin']       = np.array([[float(idx) for idx in f.readline().strip().split()[:6]] for i in range(6)])
    self.fst_vt['HydroDyn']['AddBLin']       = np.array([[float(idx) for idx in f.readline().strip().split()[:6]] for i in range(6)])
    self.fst_vt['HydroDyn']['AddBQuad']      = np.array([[float(idx) for idx in f.readline().strip().split()[:6]] for i in range(6)])`

I believe the issue is resolved if it is changed to the following:

`

    if self.fst_vt['HydroDyn']['NBodyMod'] == 1:
        self.fst_vt['HydroDyn']['AddF0']         = [float(f.readline().strip().split()[0]) for i in range(6*NBody)]
        self.fst_vt['HydroDyn']['AddCLin']       = np.array([[float(idx) for idx in f.readline().strip().split()[:6*NBody]] for i in range(6*NBody)])
        self.fst_vt['HydroDyn']['AddBLin']       = np.array([[float(idx) for idx in f.readline().strip().split()[:6*NBody]] for i in range(6*NBody)])
        self.fst_vt['HydroDyn']['AddBQuad']      = np.array([[float(idx) for idx in f.readline().strip().split()[:6*NBody]] for i in range(6*NBody)])
    elif self.fst_vt['HydroDyn']['NBodyMod'] > 1:
        self.fst_vt['HydroDyn']['AddF0']         = [[float(idx) for idx in f.readline().strip().split()[:NBody]] for i in range(6)]
        self.fst_vt['HydroDyn']['AddCLin']       = np.array([[float(idx) for idx in f.readline().strip().split()[:6]] for i in range(6)])
        self.fst_vt['HydroDyn']['AddBLin']       = np.array([[float(idx) for idx in f.readline().strip().split()[:6]] for i in range(6)])
        self.fst_vt['HydroDyn']['AddBQuad']      = np.array([[float(idx) for idx in f.readline().strip().split()[:6]] for i in range(6)])
    else:
        raise Exception("Invalid value for fst_vt['HydroDyn']['NBodyMod']")`

Based on the foregoing, I have the following questions:

  1. Is my comprehension correct?
  2. Is there anything we need to adjust in other files that use _self.fstvt? (For instance, is _self.fstvt['HydroDyn']['AddCLin'] regarded a 6X6 matrix in other files.)

Thank you very much for your time in advance.

Iman

dzalkind commented 1 year ago

Hi Iman,

I think your interpretation is correct.

More information about the HydroDyn inputs can be found here: https://openfast.readthedocs.io/en/main/source/user/hydrodyn/input_files.html

I've been wrestling with this same part of the FAST_reader/writer as well over in this repo, but it may have not made it's way into ROSCO yet. Our approaches look similar.

Best, Dna

iman-tepsco commented 1 year ago

Hi Dna,

Thank you for your reply.

So my understanding appears to be logical.

I have not yet tracked the program to see how _self.fstvt['HydroDyn']['AddCLin'], self.fst_vt['HydroDyn']['AddBLin'], and _self.fstvt['HydroDyn']['AddBQuad'] are utilized. I only need to know if their dimensions are calculated or if they are assumed to be 6X6 by default.

I would appreciate your response in advance.

Iman

dzalkind commented 1 year ago

Hi Iman,

If more than one potential body is being modeled, it is not 6x6. It is like your proposed code suggests.

Best, Dan