diff --git a/ROSCO/rosco_registry/rosco_types.yaml b/ROSCO/rosco_registry/rosco_types.yaml index f3ac8ddd..577008f3 100644 --- a/ROSCO/rosco_registry/rosco_types.yaml +++ b/ROSCO/rosco_registry/rosco_types.yaml @@ -12,6 +12,13 @@ default_types: size: 0 # Use this if the type IS an array (size:3 --> REAL(8), BldPitch(3)) allocatable: False equals: + float: &float + type: float + description: + dimension: # Use this if a higher-dimensional allocatable array (dimension:(:,:) --> REAL(8), DIMESION(:,:), ALLOCATABLE) + size: 0 # Use this if the type IS an array (size:3 --> REAL(8), BldPitch(3)) + allocatable: False + equals: character: &character type: character description: @@ -1093,7 +1100,7 @@ ZMQ_Variables: ExtControlType: avrSWAP: - <<: *c_float + <<: *float description: The swap array- used to pass data to and from the DLL controller [see Bladed DLL documentation] allocatable: True dimension: (:) diff --git a/ROSCO/rosco_registry/write_registry.py b/ROSCO/rosco_registry/write_registry.py index 05baaa8d..22ae079f 100644 --- a/ROSCO/rosco_registry/write_registry.py +++ b/ROSCO/rosco_registry/write_registry.py @@ -125,7 +125,7 @@ def write_roscoio(yfile): file.write(" TYPE(PerformanceData), INTENT(INOUT) :: PerfData\n") file.write(" TYPE(ErrorVariables), INTENT(INOUT) :: ErrVar\n") file.write(" TYPE(ZMQ_Variables), INTENT(INOUT) :: zmqVar\n") - file.write(" REAL(C_FLOAT), INTENT(IN) :: avrSWAP(*)\n") + file.write(" REAL(ReKi), INTENT(IN) :: avrSWAP(*)\n") file.write(" INTEGER(IntKi), INTENT(IN) :: size_avcOUTNAME\n") file.write(" CHARACTER(size_avcOUTNAME-1), INTENT(IN) :: RootName \n") file.write(" \n") @@ -336,6 +336,15 @@ def read_type(param): f90type += ', DIMENSION(:), ALLOCATABLE' elif param['dimension']: f90type += ', DIMENSION{}'.format(param['dimension']) + elif param['type'] == 'float': + f90type = 'REAL(ReKi)' + if param['allocatable']: + if param['dimension']: + f90type += ', DIMENSION{}, ALLOCATABLE'.format(param['dimension']) + else: + f90type += ', DIMENSION(:), ALLOCATABLE' + elif param['dimension']: + f90type += ', DIMENSION{}'.format(param['dimension']) elif param['type'] == 'character': f90type = 'CHARACTER' if param['length']: diff --git a/ROSCO/src/Controllers.f90 b/ROSCO/src/Controllers.f90 index 8e54b586..121d188a 100644 --- a/ROSCO/src/Controllers.f90 +++ b/ROSCO/src/Controllers.f90 @@ -262,7 +262,7 @@ SUBROUTINE YawRateControl(avrSWAP, CntrPar, LocalVar, objInst, zmqVar, DebugVar, ! TODO: The constant offset implementation is sort of circular here as a setpoint is already being defined in SetVariablesSetpoints. This could also use cleanup USE ROSCO_Types, ONLY : ControlParameters, LocalVariables, ObjectInstances, DebugVariables, ErrorVariables, ZMQ_Variables - REAL(C_FLOAT), INTENT(INOUT) :: avrSWAP(*) ! The swap array, used to pass data to, and receive data from, the DLL controller. + REAL(ReKi), INTENT(INOUT) :: avrSWAP(*) ! The swap array, used to pass data to, and receive data from, the DLL controller. TYPE(ControlParameters), INTENT(INOUT) :: CntrPar TYPE(LocalVariables), INTENT(INOUT) :: LocalVar diff --git a/ROSCO/src/DISCON.F90 b/ROSCO/src/DISCON.F90 index 1e5e5421..e27b06b8 100644 --- a/ROSCO/src/DISCON.F90 +++ b/ROSCO/src/DISCON.F90 @@ -44,7 +44,7 @@ SUBROUTINE DISCON(avrSWAP, aviFAIL, accINFILE, avcOUTNAME, avcMSG) BIND (C, NAME !REAL(ReKi), INTENT(IN) :: from_SC(*) ! DATA from the super controller !REAL(ReKi), INTENT(INOUT) :: to_SC(*) ! DATA to the super controller -REAL(C_FLOAT), INTENT(INOUT) :: avrSWAP(*) ! The swap array, used to pass data to, and receive data from, the DLL controller. +REAL(ReKi), INTENT(INOUT) :: avrSWAP(*) ! The swap array, used to pass data to, and receive data from, the DLL controller. INTEGER(C_INT), INTENT(INOUT) :: aviFAIL ! A flag used to indicate the success of this DLL call set as follows: 0 if the DLL call was successful, >0 if the DLL call was successful but cMessage should be issued as a warning messsage, <0 if the DLL call was unsuccessful or for any other reason the simulation is to be stopped at this point with cMessage as the error message. CHARACTER(KIND=C_CHAR), INTENT(IN ) :: accINFILE(NINT(avrSWAP(50))) ! The name of the parameter input file CHARACTER(KIND=C_CHAR), INTENT(IN ) :: avcOUTNAME(NINT(avrSWAP(51))) ! OUTNAME (Simulation RootName) diff --git a/ROSCO/src/ExtControl.f90 b/ROSCO/src/ExtControl.f90 index 2a398cda..17d821e4 100644 --- a/ROSCO/src/ExtControl.f90 +++ b/ROSCO/src/ExtControl.f90 @@ -26,6 +26,7 @@ MODULE ExtControl USE Functions USE ROSCO_Types USE SysSubs + USE Constants IMPLICIT NONE @@ -35,7 +36,9 @@ MODULE ExtControl SUBROUTINE BladedDLL_Legacy_Procedure ( avrSWAP, aviFAIL, accINFILE, avcOUTNAME, avcMSG ) BIND(C) USE, INTRINSIC :: ISO_C_Binding - REAL(C_FLOAT), INTENT(INOUT) :: avrSWAP (*) !< DATA + USE Constants + + REAL(ReKi), INTENT(INOUT) :: avrSWAP (*) !< DATA INTEGER(C_INT), INTENT(INOUT) :: aviFAIL !< FLAG (Status set in DLL and returned to simulation code) CHARACTER(KIND=C_CHAR), INTENT(IN) :: accINFILE (*) !< INFILE CHARACTER(KIND=C_CHAR), INTENT(INOUT) :: avcOUTNAME(*) !< OUTNAME (in:Simulation RootName; out:Name:Units; of logging channels) @@ -54,7 +57,7 @@ SUBROUTINE ExtController(avrSWAP, CntrPar, LocalVar, ExtDLL, ErrVar) TYPE(ExtControlType), INTENT(INOUT) :: ExtDLL - REAL(C_FLOAT), INTENT(INOUT) :: avrSWAP(*) ! The swap array, used to pass data to, and receive data from the DLL controller. + REAL(ReKi), INTENT(INOUT) :: avrSWAP(*) ! The swap array, used to pass data to, and receive data from the DLL controller. ! Temporary variables ! CHARACTER(1024), PARAMETER :: ExtDLL_InFile = '/Users/dzalkind/Tools/ROSCO/Test_Cases/IEA-15-240-RWT-UMaineSemi/ServoData/DISCON-UMaineSemi.IN' diff --git a/ROSCO/src/ROSCO_IO.f90 b/ROSCO/src/ROSCO_IO.f90 index 8ad72098..a46db3fd 100644 --- a/ROSCO/src/ROSCO_IO.f90 +++ b/ROSCO/src/ROSCO_IO.f90 @@ -196,7 +196,7 @@ SUBROUTINE ReadRestartFile(avrSWAP, LocalVar, CntrPar, objInst, PerfData, RootNa TYPE(PerformanceData), INTENT(INOUT) :: PerfData TYPE(ErrorVariables), INTENT(INOUT) :: ErrVar TYPE(ZMQ_Variables), INTENT(INOUT) :: zmqVar - REAL(C_FLOAT), INTENT(IN) :: avrSWAP(*) + REAL(ReKi), INTENT(IN) :: avrSWAP(*) INTEGER(IntKi), INTENT(IN) :: size_avcOUTNAME CHARACTER(size_avcOUTNAME-1), INTENT(IN) :: RootName diff --git a/ROSCO/src/ROSCO_Types.f90 b/ROSCO/src/ROSCO_Types.f90 index 115458ec..96067b6c 100644 --- a/ROSCO/src/ROSCO_Types.f90 +++ b/ROSCO/src/ROSCO_Types.f90 @@ -332,7 +332,7 @@ MODULE ROSCO_Types END TYPE ZMQ_Variables TYPE, PUBLIC :: ExtControlType - REAL(C_FLOAT), DIMENSION(:), ALLOCATABLE :: avrSWAP ! The swap array- used to pass data to and from the DLL controller [see Bladed DLL documentation] + REAL(ReKi), DIMENSION(:), ALLOCATABLE :: avrSWAP ! The swap array- used to pass data to and from the DLL controller [see Bladed DLL documentation] END TYPE ExtControlType END MODULE ROSCO_Types \ No newline at end of file diff --git a/ROSCO_toolbox/ofTools/fast_io/FAST_writer.py b/ROSCO_toolbox/ofTools/fast_io/FAST_writer.py index c3f45edf..6df98654 100644 --- a/ROSCO_toolbox/ofTools/fast_io/FAST_writer.py +++ b/ROSCO_toolbox/ofTools/fast_io/FAST_writer.py @@ -1293,13 +1293,13 @@ def write_ServoDyn(self): f.write('{:<22} {:<11} {:}'.format(self.fst_vt['ServoDyn']['AfC_Phase'], 'AfC_phase', '- Phase relative to the blade azimuth (0 is vertical) for for cosine cycling of flap signal (deg) [used only with AfCmode==1]\n')) f.write('---------------------- STRUCTURAL CONTROL ---------------------------------------\n') f.write('{:<22} {:<11} {:}'.format(self.fst_vt['ServoDyn']['NumBStC'], 'NumBStC', '- Number of blade structural controllers (integer)\n')) - f.write('{!s:<22} {:<11} {:}'.format('"' + '" "'.join(self.fst_vt['ServoDyn']['BStCfiles']) + '"', 'BStCfiles', '- Name of the file for blade tuned mass damper (quoted string) [unused when CompNTMD is false]\n')) + f.write('{!s:<22} {:<11} {:}'.format('"' + ''.join(self.fst_vt['ServoDyn']['BStCfiles']) + '"', 'BStCfiles', '- Name of the file for blade tuned mass damper (quoted string) [unused when CompNTMD is false]\n')) f.write('{:<22} {:<11} {:}'.format(self.fst_vt['ServoDyn']['NumNStC'], 'NumNStC', '- Number of nacelle structural controllers (integer)\n')) - f.write('{!s:<22} {:<11} {:}'.format('"' + '" "'.join(self.fst_vt['ServoDyn']['NStCfiles']) + '"', 'NStCfiles', '- Name of the file for nacelle tuned mass damper (quoted string) [unused when CompNTMD is false]\n')) + f.write('{!s:<22} {:<11} {:}'.format('"' + ''.join(self.fst_vt['ServoDyn']['NStCfiles']) + '"', 'NStCfiles', '- Name of the file for nacelle tuned mass damper (quoted string) [unused when CompNTMD is false]\n')) f.write('{:<22} {:<11} {:}'.format(self.fst_vt['ServoDyn']['NumTStC'], 'NumTStC', '- Number of tower structural controllers (integer)\n')) - f.write('{!s:<22} {:<11} {:}'.format('"' + '" "'.join(self.fst_vt['ServoDyn']['TStCfiles']) + '"', 'TStCfiles', '- Name of the file for tower tuned mass damper (quoted string) [unused when CompNTMD is false]\n')) + f.write('{!s:<22} {:<11} {:}'.format('"' + ''.join(self.fst_vt['ServoDyn']['TStCfiles']) + '"', 'TStCfiles', '- Name of the file for tower tuned mass damper (quoted string) [unused when CompNTMD is false]\n')) f.write('{:<22} {:<11} {:}'.format(self.fst_vt['ServoDyn']['NumSStC'], 'NumSStC', '- Number of sbustructure structural controllers (integer)\n')) - f.write('{!s:<22} {:<11} {:}'.format('"' + '" "'.join(self.fst_vt['ServoDyn']['SStCfiles']) + '"', 'SStCfiles', '- Name of the file for sbustructure tuned mass damper (quoted string) [unused when CompNTMD is false]\n')) + f.write('{!s:<22} {:<11} {:}'.format('"' + ''.join(self.fst_vt['ServoDyn']['SStCfiles']) + '"', 'SStCfiles', '- Name of the file for sbustructure tuned mass damper (quoted string) [unused when CompNTMD is false]\n')) f.write('---------------------- CABLE CONTROL ---------------------------------------- \n') f.write('{:<22} {:<11} {:}'.format(self.fst_vt['ServoDyn']['CCmode'], 'CCmode', '- Cable control mode {0- none, 4- user-defined from Simulink/Labview, 5- user-defineAfC_phased from Bladed-style DLL}\n')) f.write('---------------------- BLADED INTERFACE ---------------------------------------- [used only with Bladed Interface]\n') diff --git a/ROSCO_toolbox/sim.py b/ROSCO_toolbox/sim.py index 54e3df62..7ea930cd 100644 --- a/ROSCO_toolbox/sim.py +++ b/ROSCO_toolbox/sim.py @@ -140,7 +140,7 @@ def sim_ws_series(self, t_array, ws_array, rotor_rpm_init=10, init_pitch=0.0, gen_torque[i], bld_pitch[i], nac_yawrate[i] = self.controller_int.call_controller(turbine_state) # Calculate the power - gen_power[i] = gen_speed[i] * gen_torque[i] + gen_power[i] = gen_speed[i] * gen_torque[i] * self.turbine.GenEff / 100 # Calculate the nacelle position nac_yaw[i] = nac_yaw[i-1] + nac_yawrate[i] * dt @@ -181,7 +181,7 @@ def sim_ws_series(self, t_array, ws_array, rotor_rpm_init=10, init_pitch=0.0, ax.grid() ax = axarr[3] ax.plot(self.t_array, self.gen_power/1000) - ax.set_ylabel('Gen Power (W)') + ax.set_ylabel('Gen Power (kW)') ax.grid() ax = axarr[4] ax.plot(self.t_array, self.bld_pitch*rad2deg) diff --git a/ROSCO_toolbox/turbine.py b/ROSCO_toolbox/turbine.py index e97d7203..0d965abc 100644 --- a/ROSCO_toolbox/turbine.py +++ b/ROSCO_toolbox/turbine.py @@ -163,7 +163,22 @@ def load_from_fast(self, FAST_InputFile,FAST_directory, FAST_ver='OpenFAST',dev_ fast = self.fast = InputReader_OpenFAST() fast.FAST_InputFile = FAST_InputFile fast.FAST_directory = FAST_directory - fast.execute() + + fast.read_MainInput() + fast.read_ElastoDyn() + + + fast.read_AeroDyn15() + + fast.read_ServoDyn() + fast.read_DISCON_in() + + + if fast.fst_vt['Fst']['CompHydro'] == 1: # SubDyn not yet implimented + fast.read_HydroDyn() + + # fast.read_AeroDyn15() + # fast.execute() # Use Performance tables if defined, otherwise use defaults if txt_filename: diff --git a/docs/source/install.rst b/docs/source/install.rst index 29a71620..12029399 100644 --- a/docs/source/install.rst +++ b/docs/source/install.rst @@ -104,6 +104,7 @@ On Mac/Linux, standard compilers are generally available without any additional .. code-block:: bash conda install m2w64-toolchain libpython + conda install cmake make # if Windows users would like to install these in anaconda environment Once the CMake and the required compilers are downloaded, the following code can be used to compile ROSCO. @@ -199,7 +200,8 @@ Please follow the following steps to install the ROSCO tool-chain. You should do cd ROSCO conda install compilers # (Mac/Linux only) conda install m2w64-toolchain libpython # (Windows only) - conda install -y wisdem + conda env config vars set FC=gfortran # Sometimes needed for Windows + conda install -y wisdem=3.5.0 python setup.py install --compile-rosco 3. Clone and Install the ROSCO toolbox without ROSCO