diff --git a/ROSCO/rosco_registry/rosco_types.yaml b/ROSCO/rosco_registry/rosco_types.yaml index fd692313..79e02e14 100644 --- a/ROSCO/rosco_registry/rosco_types.yaml +++ b/ROSCO/rosco_registry/rosco_types.yaml @@ -92,6 +92,10 @@ ControlParameters: <<: *integer description: output every this many steps + n_DT_ZMQ: + <<: *integer + description: Send measurements to ZMQ after this many time steps + # Filters F_LPFType: <<: *integer @@ -1000,9 +1004,6 @@ LocalVariables: RotSpeedF: <<: *real description: Filtered LSS (generator) speed [rad/s]. - VS_RefSpd: - <<: *real - description: Generator speed set point of torque controller [rad/s] PC_RefSpd: <<: *real description: Generator speed set point of pitch controller [rad/s] diff --git a/ROSCO/rosco_registry/write_wfc_interface.py b/ROSCO/rosco_registry/write_wfc_interface.py index c2f06eff..67790aa2 100644 --- a/ROSCO/rosco_registry/write_wfc_interface.py +++ b/ROSCO/rosco_registry/write_wfc_interface.py @@ -85,7 +85,7 @@ def write_zmq_f90(wfc_int_yaml): f.write("#endif\n") f.write("\n") f.write(" ! Communicate if threshold has been reached\n") - f.write(" IF (ABS(MODULO(LocalVar%Time, CntrPar%ZMQ_UpdatePeriod)) < LocalVar%DT * CntrPar%ZMQ_UpdatePeriod .OR. LocalVar%iStatus == -1) THEN\n") + f.write(" IF ( MOD(LocalVar%n_DT, CntrPar%n_DT_ZMQ) == 0 .OR. LocalVar%iStatus == -1 ) THEN\n") f.write(" ! Collect measurements to be sent to ZeroMQ server\n") ## Write measurements diff --git a/ROSCO/src/ROSCO_Types.f90 b/ROSCO/src/ROSCO_Types.f90 index 0b5b7a00..c6c7a80b 100644 --- a/ROSCO/src/ROSCO_Types.f90 +++ b/ROSCO/src/ROSCO_Types.f90 @@ -13,6 +13,7 @@ MODULE ROSCO_Types INTEGER(IntKi) :: Echo ! 0 - no Echo, 1 - Echo input data to .echo REAL(DbKi) :: DT_Out ! Output time step INTEGER(IntKi) :: n_DT_Out ! output every this many steps + INTEGER(IntKi) :: n_DT_ZMQ ! Send measurements to ZMQ after this many time steps INTEGER(IntKi) :: F_LPFType ! Low pass filter on the rotor and generator speed {1 - first-order low-pass filter, 2 - second-order low-pass filter}, [rad/s] REAL(DbKi) :: F_LPFCornerFreq ! Corner frequency (-3dB point) in the first-order low-pass filter, [rad/s] REAL(DbKi) :: F_LPFDamping ! Damping coefficient [used only when F_FilterType = 2] diff --git a/ROSCO/src/ReadSetParameters.f90 b/ROSCO/src/ReadSetParameters.f90 index 41112d1b..94edf423 100644 --- a/ROSCO/src/ReadSetParameters.f90 +++ b/ROSCO/src/ReadSetParameters.f90 @@ -567,6 +567,7 @@ SUBROUTINE ReadControlParameterFileSub(CntrPar, LocalVar, accINFILE, accINFILE_s ! DT_Out CntrPar%n_DT_Out = NINT(CntrPar%DT_Out / LocalVar%DT) + CntrPar%n_DT_ZMQ = NINT(CntrPar%ZMQ_UpdatePeriod / LocalVar%DT) ! Fix Paths (add relative paths if called from another dir, UnEc) @@ -836,6 +837,11 @@ SUBROUTINE CheckInputs(LocalVar, CntrPar, avrSWAP, ErrVar, size_avcMSG) ErrVar%aviFAIL = -1 ErrVar%ErrMsg = 'DT_Out must be a factor of DT in OpenFAST' ENDIF + + IF (ABS(CntrPar%ZMQ_UpdatePeriod - Localvar%DT * CntrPar%n_DT_ZMQ) > 0.001_DbKi) THEN + ErrVar%aviFAIL = -1 + ErrVar%ErrMsg = 'ZMQ_UpdatePeriod must be a factor of DT in OpenFAST' + ENDIF !------- CONTROLLER FLAGS ------------------------------------------------- ! F_LPFType diff --git a/ROSCO/src/ZeroMQInterface.f90 b/ROSCO/src/ZeroMQInterface.f90 index 1fa96897..9a3c1d19 100644 --- a/ROSCO/src/ZeroMQInterface.f90 +++ b/ROSCO/src/ZeroMQInterface.f90 @@ -30,7 +30,7 @@ end subroutine zmq_client #endif ! Communicate if threshold has been reached - IF (ABS(MODULO(LocalVar%Time, CntrPar%ZMQ_UpdatePeriod)) < LocalVar%DT * CntrPar%ZMQ_UpdatePeriod .OR. LocalVar%iStatus == -1) THEN + IF ( MOD(LocalVar%n_DT, CntrPar%n_DT_ZMQ) == 0 .OR. LocalVar%iStatus == -1 ) THEN ! Collect measurements to be sent to ZeroMQ server turbine_measurements(1) = LocalVar%ZMQ_ID turbine_measurements(2) = LocalVar%iStatus diff --git a/ROSCO_toolbox/utilities.py b/ROSCO_toolbox/utilities.py index bb831c17..1b8b2abe 100644 --- a/ROSCO_toolbox/utilities.py +++ b/ROSCO_toolbox/utilities.py @@ -276,7 +276,7 @@ def write_DISCON(turbine, controller, param_file='DISCON.IN', txt_filename='Cp_C file.write('!------- ZeroMQ Interface ---------------------------------------------------------\n') file.write('"{}" ! ZMQ_CommAddress - {} \n'.format(rosco_vt['ZMQ_CommAddress'],input_descriptions['ZMQ_CommAddress'])) file.write('{:<11f} ! ZMQ_UpdatePeriod - {}\n'.format(rosco_vt['ZMQ_UpdatePeriod'],input_descriptions['ZMQ_UpdatePeriod'])) - file.write('{:<11d} ! ZMQ_ID - {}\n'.format(rosco_vt['ZMQ_ID'],input_descriptions['ZMQ_ID'])) + file.write('{:<11d} ! ZMQ_ID - {}\n'.format(int(rosco_vt['ZMQ_ID']),input_descriptions['ZMQ_ID'])) file.write('\n') file.write('!------- Cable Control ---------------------------------------------------------\n') file.write('{:<11d} ! CC_Group_N - {}\n'.format(len(rosco_vt['CC_GroupIndex']), input_descriptions['CC_Group_N'])) diff --git a/Test_Cases/BAR_10/BAR_10_DISCON.IN b/Test_Cases/BAR_10/BAR_10_DISCON.IN index 841b6272..935199ea 100644 --- a/Test_Cases/BAR_10/BAR_10_DISCON.IN +++ b/Test_Cases/BAR_10/BAR_10_DISCON.IN @@ -1,5 +1,5 @@ ! Controller parameter input file for the BAR_10 wind turbine -! - File written using ROSCO version 2.8.0 controller tuning logic on 10/18/23 +! - File written using ROSCO version 2.8.0 controller tuning logic on 11/17/23 !------- SIMULATION CONTROL ------------------------------------------------------------ 1 ! LoggingLevel - {0: write no debug files, 1: write standard output .dbg-file, 2: LoggingLevel 1 + ROSCO LocalVars (.dbg2) 3: LoggingLevel 2 + complete avrSWAP-array (.dbg3)} @@ -180,7 +180,8 @@ !------- ZeroMQ Interface --------------------------------------------------------- "tcp://localhost:5555" ! ZMQ_CommAddress - Communication address for ZMQ server, (e.g. "tcp://localhost:5555") -2.000000 ! ZMQ_UpdatePeriod - Call ZeroMQ every [x] seconds, [s] +1.000000 ! ZMQ_UpdatePeriod - Update period at zmq interface to send measurements and wait for setpoint [sec.] +0 ! ZMQ_ID - Integer identifier of turbine !------- Cable Control --------------------------------------------------------- 1 ! CC_Group_N - Number of cable control groups diff --git a/Test_Cases/IEA-15-240-RWT-UMaineSemi/DISCON-UMaineSemi.IN b/Test_Cases/IEA-15-240-RWT-UMaineSemi/DISCON-UMaineSemi.IN index 1f0f571b..33e8ef94 100644 --- a/Test_Cases/IEA-15-240-RWT-UMaineSemi/DISCON-UMaineSemi.IN +++ b/Test_Cases/IEA-15-240-RWT-UMaineSemi/DISCON-UMaineSemi.IN @@ -1,5 +1,5 @@ ! Controller parameter input file for the IEA-15-240-RWT-UMaineSemi wind turbine -! - File written using ROSCO version 2.8.0 controller tuning logic on 10/18/23 +! - File written using ROSCO version 2.8.0 controller tuning logic on 11/17/23 !------- SIMULATION CONTROL ------------------------------------------------------------ 2 ! LoggingLevel - {0: write no debug files, 1: write standard output .dbg-file, 2: LoggingLevel 1 + ROSCO LocalVars (.dbg2) 3: LoggingLevel 2 + complete avrSWAP-array (.dbg3)} @@ -180,7 +180,8 @@ !------- ZeroMQ Interface --------------------------------------------------------- "tcp://localhost:5555" ! ZMQ_CommAddress - Communication address for ZMQ server, (e.g. "tcp://localhost:5555") -2.000000 ! ZMQ_UpdatePeriod - Call ZeroMQ every [x] seconds, [s] +1.000000 ! ZMQ_UpdatePeriod - Update period at zmq interface to send measurements and wait for setpoint [sec.] +0 ! ZMQ_ID - Integer identifier of turbine !------- Cable Control --------------------------------------------------------- 1 ! CC_Group_N - Number of cable control groups diff --git a/Test_Cases/MHK_RM1/MHK_RM1_DISCON.IN b/Test_Cases/MHK_RM1/MHK_RM1_DISCON.IN index 704f4409..20fa795c 100644 --- a/Test_Cases/MHK_RM1/MHK_RM1_DISCON.IN +++ b/Test_Cases/MHK_RM1/MHK_RM1_DISCON.IN @@ -1,5 +1,5 @@ ! Controller parameter input file for the MHK_RM1_Floating wind turbine -! - File written using ROSCO version 2.8.0 controller tuning logic on 10/18/23 +! - File written using ROSCO version 2.8.0 controller tuning logic on 11/17/23 !------- SIMULATION CONTROL ------------------------------------------------------------ 2 ! LoggingLevel - {0: write no debug files, 1: write standard output .dbg-file, 2: LoggingLevel 1 + ROSCO LocalVars (.dbg2) 3: LoggingLevel 2 + complete avrSWAP-array (.dbg3)} @@ -180,7 +180,8 @@ !------- ZeroMQ Interface --------------------------------------------------------- "tcp://localhost:5555" ! ZMQ_CommAddress - Communication address for ZMQ server, (e.g. "tcp://localhost:5555") -2.000000 ! ZMQ_UpdatePeriod - Call ZeroMQ every [x] seconds, [s] +1.000000 ! ZMQ_UpdatePeriod - Update period at zmq interface to send measurements and wait for setpoint [sec.] +0 ! ZMQ_ID - Integer identifier of turbine !------- Cable Control --------------------------------------------------------- 1 ! CC_Group_N - Number of cable control groups diff --git a/Test_Cases/NREL-5MW/DISCON.IN b/Test_Cases/NREL-5MW/DISCON.IN index 7c4aacb1..40c55719 100644 --- a/Test_Cases/NREL-5MW/DISCON.IN +++ b/Test_Cases/NREL-5MW/DISCON.IN @@ -1,5 +1,5 @@ ! Controller parameter input file for the NREL-5MW wind turbine -! - File written using ROSCO version 2.8.0 controller tuning logic on 10/18/23 +! - File written using ROSCO version 2.8.0 controller tuning logic on 11/17/23 !------- SIMULATION CONTROL ------------------------------------------------------------ 1 ! LoggingLevel - {0: write no debug files, 1: write standard output .dbg-file, 2: LoggingLevel 1 + ROSCO LocalVars (.dbg2) 3: LoggingLevel 2 + complete avrSWAP-array (.dbg3)} @@ -180,7 +180,8 @@ !------- ZeroMQ Interface --------------------------------------------------------- "tcp://localhost:5555" ! ZMQ_CommAddress - Communication address for ZMQ server, (e.g. "tcp://localhost:5555") -2.000000 ! ZMQ_UpdatePeriod - Call ZeroMQ every [x] seconds, [s] +1.000000 ! ZMQ_UpdatePeriod - Update period at zmq interface to send measurements and wait for setpoint [sec.] +0 ! ZMQ_ID - Integer identifier of turbine !------- Cable Control --------------------------------------------------------- 1 ! CC_Group_N - Number of cable control groups diff --git a/Test_Cases/NREL_2p8_127/NREL-2p8-127_DISCON.IN b/Test_Cases/NREL_2p8_127/NREL-2p8-127_DISCON.IN index 229e388f..3f6722e9 100644 --- a/Test_Cases/NREL_2p8_127/NREL-2p8-127_DISCON.IN +++ b/Test_Cases/NREL_2p8_127/NREL-2p8-127_DISCON.IN @@ -1,5 +1,5 @@ ! Controller parameter input file for the NREL-2p8-127 wind turbine -! - File written using ROSCO version 2.8.0 controller tuning logic on 10/18/23 +! - File written using ROSCO version 2.8.0 controller tuning logic on 11/17/23 !------- SIMULATION CONTROL ------------------------------------------------------------ 2 ! LoggingLevel - {0: write no debug files, 1: write standard output .dbg-file, 2: LoggingLevel 1 + ROSCO LocalVars (.dbg2) 3: LoggingLevel 2 + complete avrSWAP-array (.dbg3)} @@ -180,7 +180,8 @@ !------- ZeroMQ Interface --------------------------------------------------------- "tcp://localhost:5555" ! ZMQ_CommAddress - Communication address for ZMQ server, (e.g. "tcp://localhost:5555") -2.000000 ! ZMQ_UpdatePeriod - Call ZeroMQ every [x] seconds, [s] +1.000000 ! ZMQ_UpdatePeriod - Update period at zmq interface to send measurements and wait for setpoint [sec.] +0 ! ZMQ_ID - Integer identifier of turbine !------- Cable Control --------------------------------------------------------- 1 ! CC_Group_N - Number of cable control groups