diff --git a/docs/OtherSupporting/OpenFAST_Algorithms/OpenFAST_Algorithms.pdf b/docs/OtherSupporting/OpenFAST_Algorithms/OpenFAST_Algorithms.pdf index bfc1297884..5d48814716 100644 Binary files a/docs/OtherSupporting/OpenFAST_Algorithms/OpenFAST_Algorithms.pdf and b/docs/OtherSupporting/OpenFAST_Algorithms/OpenFAST_Algorithms.pdf differ diff --git a/docs/OtherSupporting/OpenFAST_Algorithms/OpenFAST_Algorithms.tex b/docs/OtherSupporting/OpenFAST_Algorithms/OpenFAST_Algorithms.tex index 1e891a7c30..8fbc455f9f 100644 --- a/docs/OtherSupporting/OpenFAST_Algorithms/OpenFAST_Algorithms.tex +++ b/docs/OtherSupporting/OpenFAST_Algorithms/OpenFAST_Algorithms.tex @@ -197,7 +197,7 @@ \section{Input-Output Relationships} \State$\mathit{u\_IceF\_tmp} \gets \Call{TransferMeshMotions}{y\_SD}$ \State$\mathit{u\_IceD\_tmp(:)} \gets \Call{TransferMeshMotions}{y\_SD}$ \State$\mathit{u\_HD\_tmp} \gets \Call{TransferMeshMotions}{y\_ED,y\_SD}$ - \State$\mathit{u\_SrvD\_tmp} \gets \Call{TransferMeshMotions}{y\_ED,y\_SD}$\footnote{Only if using ServoDyn Structural control with platform TMD.} + \State$\mathit{u\_SrvD\_tmp} \gets \Call{TransferMeshMotions}{y\_BD,y\_ED,y\_SD}$\footnote{Only if using ServoDyn Structural control.} \State$\mathit{u\_SD\_tmp} \gets \! \begin{aligned}[t] & \Call{TransferMeshMotions}{\mathit{y\_ED}} \\ @@ -215,7 +215,7 @@ \section{Input-Output Relationships} & \mathit{y\_SD}, \mathit{u\_SD\_tmp}, \\ & \mathit{y\_MAP}, \mathit{u\_MAP\_tmp}, \\ & \mathit{y\_FEAM},\mathit{u\_FEAM\_tmp},\\ - & \mathit{y\_SrvD},\mathit{u\_SrvD\_tmp}\footnote{Only if using ServoDyn Structural control with platform TMD.} ) % SrvD%PtfmStC only + & \mathit{y\_SrvD},\mathit{u\_SrvD\_tmp}\footnote{Only if using ServoDyn Structural control.} ) % SrvD%PtfmStC only \end{aligned}$ \State @@ -267,7 +267,7 @@ \section{Input-Output Relationships} \State $\mathit{u\_FEAM} \gets \Call{TransferMeshMotions}{\mathit{y\_ED}}$ \State $\mathit{u\_IceF} \gets \Call{TransferMeshMotions}{\mathit{y\_SD}}$ \State $\mathit{u\_IceD(:)} \gets \Call{TransferMeshMotions}{\mathit{y\_SD}}$ - \State $\mathit{u\_SrvD} \gets \Call{TransferMeshMotions}{\mathit{y\_ED,y\_SD}}$\footnote{Only if using ServoDyn Structural control with platform TMD.} % For SrvD%PtfmStC + \State $\mathit{u\_SrvD} \gets \Call{TransferMeshMotions}{\mathit{y\_BD,y\_ED,y\_SD}}$\footnote{Only if using ServoDyn Structural control.} % For SrvD%PtfmStC \EndProcedure \end{algorithmic} @@ -352,7 +352,7 @@ \section{Solve Option 2 Improvements} \State $\mathit{y\_IfW} \gets \Call{IfW\_CalcOutput}{\mathit{u\_IfW}$ and other $\mathit{IfW}$ data structures$}$ \State \State $\mathit{u\_AD}($InflowWind only$) \gets \Call{TransferOutputsToInputs}{\mathit{y\_IfW}}$ -\State $\mathit{u\_SrvD} \gets \Call{TransferOutputsToInputs}{\mathit{y\_ED},\mathit{y\_BD},\mathit{y\_IfW}}$ +\State $\mathit{u\_SrvD} \gets \Call{TransferOutputsToInputs}{\mathit{y\_BD},\mathit{y\_ED},\mathit{y\_IfW},\mathit{y\_SD}}$ \State $\Call{AD\_UpdateStates}{\mathit{p\_AD},\mathit{u\_AD},\mathit{x\_AD},\mathit{xd\_AD},\mathit{z\_AD}}$ \State $\Call{SrvD\_UpdateStates}{\mathit{p\_SrvD},\mathit{u\_SrvD},\mathit{x\_SrvD},\mathit{xd\_SrvD},\mathit{z\_SrvD}}$ \State diff --git a/docs/source/user/api_change.rst b/docs/source/user/api_change.rst index 83772f4361..236b41ade7 100644 --- a/docs/source/user/api_change.rst +++ b/docs/source/user/api_change.rst @@ -18,6 +18,13 @@ Added in OpenFAST dev --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Module Line Flag Name Example Value ============================================= ==== =============== ======================================================================================================================================================================================================== +ServoDyn 60 AeroControlSec ---------------------- AERODYNAMIC FLOW CONTROL -------------------------------- +ServoDyn 61 AfCmode 0 AfCmode - Airfoil control mode {0: none, 1: cosine wave cycle, 4: user-defined from Simulink/Labview, 5: user-defined from Bladed-style DLL} (switch) +ServoDyn 61 AfC_Mean 0 AfC_Mean - Mean level for cosine cycling or steady value (-) [used only with AfCmode==1] +ServoDyn 61 AfC_Amp 0 AfC_Amp - Amplitude for cosine cycling of flap signal (-) [used only with AfCmode==1] +ServoDyn 61 AfC_Phase 0 AfC_Phase - Phase relative to the blade azimuth (0 is vertical) for cosine cycling of flap signal (deg) [used only with AfCmode==1] +ServoDyn 74 CablesSection ---------------------- CABLE CONTROL ------------------------------------------- +ServoDyn 75 CCmode 0 CCmode - Cable control mode {0: none, 4: user-defined from Simulink/Labview, 5: user-defined from Bladed-style DLL} (switch) HydroDyn driver 6 WtrDens 1025 WtrDens - Water density (kg/m^3) HydroDyn driver 7 WtrDpth 200 WtrDpth - Water depth (m) HydroDyn driver 8 MSL2SWL 0 MSL2SWL - Offset between still-water level and mean sea level (m) [positive upward] diff --git a/docs/source/user/servodyn-stc/ExampleFiles/NRELOffshrBsline5MW_ServoDyn_StC.dat b/docs/source/user/servodyn-stc/ExampleFiles/NRELOffshrBsline5MW_ServoDyn_StC.dat deleted file mode 100644 index cd42f824f3..0000000000 --- a/docs/source/user/servodyn-stc/ExampleFiles/NRELOffshrBsline5MW_ServoDyn_StC.dat +++ /dev/null @@ -1,94 +0,0 @@ -------- STRUCTURAL CONTROL (StC) INPUT FILE ---------------------------- -Input file for tuned mass damper, module by Matt Lackner, Meghan Glade, and Semyung Park (UMass) ----------------------- SIMULATION CONTROL -------------------------------------- -True Echo - Echo input data to .ech (flag) ----------------------- StC DEGREES OF FREEDOM ---------------------------------- - 2 StC_DOF_MODE - DOF mode (switch) {0: No StC or TLCD DOF; 1: StC_X_DOF, StC_Y_DOF, and/or StC_Z_DOF (three independent StC DOFs); 2: StC_XY_DOF (Omni-Directional StC); 3: TLCD; 4: Prescribed force/moment time series} -true StC_X_DOF - DOF on or off for StC X (flag) [Used only when StC_DOF_MODE=1] -true StC_Y_DOF - DOF on or off for StC Y (flag) [Used only when StC_DOF_MODE=1] -FALSE StC_Z_DOF - DOF on or off for StC Z (flag) [Used only when StC_DOF_MODE=1] ----------------------- StC LOCATION ------------------------------------------- [relative to the reference origin of component attached to] - 0 StC_P_X - At rest X position of StC (m) - 0 StC_P_Y - At rest Y position of StC (m) - 75 StC_P_Z - At rest Z position of StC (m) ----------------------- StC INITIAL CONDITIONS --------------------------------- [used only when StC_DOF_MODE=1 or 2] - 1 StC_X_DSP - StC X initial displacement (m) [relative to at rest position] - 1 StC_Y_DSP - StC Y initial displacement (m) [relative to at rest position] - 0 StC_Z_DSP - StC Z initial displacement (m) [relative to at rest position; used only when StC_DOF_MODE=1 and StC_Z_DOF=TRUE] ----------------------- StC CONFIGURATION -------------------------------------- [used only when StC_DOF_MODE=1 or 2] - 10 StC_X_PSP - Positive stop position (maximum X mass displacement) (m) - -10 StC_X_NSP - Negative stop position (minimum X mass displacement) (m) - 10 StC_Y_PSP - Positive stop position (maximum Y mass displacement) (m) - -10 StC_Y_NSP - Negative stop position (minimum Y mass displacement) (m) - 10 StC_Z_PSP - Positive stop position (maximum Z mass displacement) (m) [used only when StC_DOF_MODE=1 and StC_Z_DOF=TRUE] - -10 StC_Z_NSP - Negative stop position (minimum Z mass displacement) (m) [used only when StC_DOF_MODE=1 and StC_Z_DOF=TRUE] ----------------------- StC MASS, STIFFNESS, & DAMPING ------------------------- [used only when StC_DOF_MODE=1 or 2] - 20000 StC_X_M - StC X mass (kg) [must equal StC_Y_M for StC_DOF_MODE = 2] - 20000 StC_Y_M - StC Y mass (kg) [must equal StC_X_M for StC_DOF_MODE = 2] - 0 StC_Z_M - StC Z mass (kg) [used only when StC_DOF_MODE=1 and StC_Z_DOF=TRUE] - 20000 StC_XY_M - StC XY mass (kg) [used only when StC_DOF_MODE=2] - 28000 StC_X_K - StC X stiffness (N/m) - 28000 StC_Y_K - StC Y stiffness (N/m) - 0 StC_Z_K - StC Z stiffness (N/m) [used only when StC_DOF_MODE=1 and StC_Z_DOF=TRUE] - 2800 StC_X_C - StC X damping (N/(m/s)) - 2800 StC_Y_C - StC Y damping (N/(m/s)) - 0 StC_Z_C - StC Z damping (N/(m/s)) [used only when StC_DOF_MODE=1 and StC_Z_DOF=TRUE] - 15000 StC_X_KS - Stop spring X stiffness (N/m) - 15000 StC_Y_KS - Stop spring Y stiffness (N/m) - 0 StC_Z_KS - Stop spring Z stiffness (N/m) [used only when StC_DOF_MODE=1 and StC_Z_DOF=TRUE] - 10000 StC_X_CS - Stop spring X damping (N/(m/s)) - 10000 StC_Y_CS - Stop spring Y damping (N/(m/s)) - 0 StC_Z_CS - Stop spring Z damping (N/(m/s)) [used only when StC_DOF_MODE=1 and StC_Z_DOF=TRUE] ----------------------- StC USER-DEFINED SPRING FORCES ------------------------- [used only when StC_DOF_MODE=1 or 2] -False Use_F_TBL - Use spring force from user-defined table (flag) - 17 NKInpSt - Number of spring force input stations ----------------------- StC SPRING FORCES TABLE -------------------------------- [used only when StC_DOF_MODE=1 or 2] - X F_X Y F_Y Z F_Z - (m) (N) (m) (N) (m) (N) --6.0000000E+00 -4.8000000E+06 -6.0000000E+00 -4.8000000E+06 -6.0000000E+00 -4.8000000E+06 --5.0000000E+00 -2.4000000E+06 -5.0000000E+00 -2.4000000E+06 -5.0000000E+00 -2.4000000E+06 --4.5000000E+00 -1.2000000E+06 -4.5000000E+00 -1.2000000E+06 -4.5000000E+00 -1.2000000E+06 --4.0000000E+00 -6.0000000E+05 -4.0000000E+00 -6.0000000E+05 -4.0000000E+00 -6.0000000E+05 --3.5000000E+00 -3.0000000E+05 -3.5000000E+00 -3.0000000E+05 -3.5000000E+00 -3.0000000E+05 --3.0000000E+00 -1.5000000E+05 -3.0000000E+00 -1.5000000E+05 -3.0000000E+00 -1.5000000E+05 --2.5000000E+00 -1.0000000E+05 -2.5000000E+00 -1.0000000E+05 -2.5000000E+00 -1.0000000E+05 --2.0000000E+00 -6.5000000E+04 -2.0000000E+00 -6.5000000E+04 -2.0000000E+00 -6.5000000E+04 - 0.0000000E+00 0.0000000E+00 0.0000000E+00 0.0000000E+00 0.0000000E+00 0.0000000E+00 - 2.0000000E+00 6.5000000E+04 2.0000000E+00 6.5000000E+04 2.0000000E+00 6.5000000E+04 - 2.5000000E+00 1.0000000E+05 2.5000000E+00 1.0000000E+05 2.5000000E+00 1.0000000E+05 - 3.0000000E+00 1.5000000E+05 3.0000000E+00 1.5000000E+05 3.0000000E+00 1.5000000E+05 - 3.5000000E+00 3.0000000E+05 3.5000000E+00 3.0000000E+05 3.5000000E+00 3.0000000E+05 - 4.0000000E+00 6.0000000E+05 4.0000000E+00 6.0000000E+05 4.0000000E+00 6.0000000E+05 - 4.5000000E+00 1.2000000E+06 4.5000000E+00 1.2000000E+06 4.5000000E+00 1.2000000E+06 - 5.0000000E+00 2.4000000E+06 5.0000000E+00 2.4000000E+06 5.0000000E+00 2.4000000E+06 - 6.0000000E+00 4.8000000E+06 6.0000000E+00 4.8000000E+06 6.0000000E+00 4.8000000E+06 ----------------------- StructCtrl CONTROL -------------------------------------------- [used only when StC_DOF_MODE=1 or 2] - 0 StC_CMODE - Control mode (switch) {0:none; 1: Semi-Active Control Mode; 2: Active Control Mode} - 1 StC_SA_MODE - Semi-Active control mode {1: velocity-based ground hook control; 2: Inverse velocity-based ground hook control; 3: displacement-based ground hook control 4: Phase difference Algorithm with Friction Force 5: Phase difference Algorithm with Damping Force} (-) - 0 StC_X_C_HIGH - StC X high damping for ground hook control - 0 StC_X_C_LOW - StC X low damping for ground hook control - 0 StC_Y_C_HIGH - StC Y high damping for ground hook control - 0 StC_Y_C_LOW - StC Y low damping for ground hook control - 0 StC_Z_C_HIGH - StC Z high damping for ground hook control [used only when StC_DOF_MODE=1 and StC_Z_DOF=TRUE] - 0 StC_Z_C_LOW - StC Z low damping for ground hook control [used only when StC_DOF_MODE=1 and StC_Z_DOF=TRUE] - 0 StC_X_C_BRAKE - StC X high damping for braking the StC (Don't use it now. should be zero) - 0 StC_Y_C_BRAKE - StC Y high damping for braking the StC (Don't use it now. should be zero) - 0 StC_Z_C_BRAKE - StC Z high damping for braking the StC (Don't use it now. should be zero) [used only when StC_DOF_MODE=1 and StC_Z_DOF=TRUE] ----------------------- TLCD --------------------------------------------------- [used only when StC_DOF_MODE=3] - 7.9325 L_X - X TLCD total length (m) - 6.5929 B_X - X TLCD horizontal length (m) - 2.0217 area_X - X TLCD cross-sectional area of vertical column (m^2) - 0.913 area_ratio_X - X TLCD cross-sectional area ratio (vertical column area divided by horizontal column area) (-) - 2.5265 headLossCoeff_X - X TLCD head loss coeff (-) - 1000 rho_X - X TLCD liquid density (kg/m^3) - 3.5767 L_Y - Y TLCD total length (m) - 2.1788 B_Y - Y TLCD horizontal length (m) - 1.2252 area_Y - Y TLCD cross-sectional area of vertical column (m^2) - 2.7232 area_ratio_Y - Y TLCD cross-sectional area ratio (vertical column area divided by horizontal column area) (-) - 0.6433 headLossCoeff_Y - Y TLCD head loss coeff (-) - 1000 rho_Y - Y TLCD liquid density (kg/m^3) ----------------------- PRESCRIBED TIME SERIES --------------------------------- [used only when StC_DOF_MODE=4] - 0 PrescribedForcesCoord- Prescribed forces are in global or local coordinates (switch) {1: global; 2: local} -"TimeForceSeries.dat" PrescribedForcesFile - Time series force and moment (7 columns of time, FX, FY, FZ, MX, MY, MZ) -------------------------------------------------------------------------------- - diff --git a/docs/source/user/servodyn-stc/ExampleFiles/NRELOffshrBsline5MW_StC.dat b/docs/source/user/servodyn-stc/ExampleFiles/NRELOffshrBsline5MW_StC.dat index cd42f824f3..f504cb8d8f 100644 --- a/docs/source/user/servodyn-stc/ExampleFiles/NRELOffshrBsline5MW_StC.dat +++ b/docs/source/user/servodyn-stc/ExampleFiles/NRELOffshrBsline5MW_StC.dat @@ -15,6 +15,7 @@ FALSE StC_Z_DOF - DOF on or off for StC Z (flag) [Used only when StC_ 1 StC_X_DSP - StC X initial displacement (m) [relative to at rest position] 1 StC_Y_DSP - StC Y initial displacement (m) [relative to at rest position] 0 StC_Z_DSP - StC Z initial displacement (m) [relative to at rest position; used only when StC_DOF_MODE=1 and StC_Z_DOF=TRUE] +"none" StC_Z_PreLd - StC Z pre-load (N) {"gravity" to offset for gravity load; "none" or 0 to turn off} [used only when StC_DOF_MODE=1 and StC_Z_DOF=TRUE] ---------------------- StC CONFIGURATION -------------------------------------- [used only when StC_DOF_MODE=1 or 2] 10 StC_X_PSP - Positive stop position (maximum X mass displacement) (m) -10 StC_X_NSP - Negative stop position (minimum X mass displacement) (m) @@ -63,7 +64,8 @@ False Use_F_TBL - Use spring force from user-defined table (flag) 5.0000000E+00 2.4000000E+06 5.0000000E+00 2.4000000E+06 5.0000000E+00 2.4000000E+06 6.0000000E+00 4.8000000E+06 6.0000000E+00 4.8000000E+06 6.0000000E+00 4.8000000E+06 ---------------------- StructCtrl CONTROL -------------------------------------------- [used only when StC_DOF_MODE=1 or 2] - 0 StC_CMODE - Control mode (switch) {0:none; 1: Semi-Active Control Mode; 2: Active Control Mode} + 0 StC_CMODE - Control mode (switch) {0:none; 1: Semi-Active Control Mode; 4: Active Control Mode through Simulink (not available); 5: Active Control Mode through Bladed interface} + 0 StC_CChan - Control channel group (1:10) for stiffness and damping (StC_[XYZ]_K, StC_[XYZ]_C, and StC_[XYZ]_Brake) [used only when StC_DOF_MODE=1 or 2, and StC_CMODE=4 or 5] 1 StC_SA_MODE - Semi-Active control mode {1: velocity-based ground hook control; 2: Inverse velocity-based ground hook control; 3: displacement-based ground hook control 4: Phase difference Algorithm with Friction Force 5: Phase difference Algorithm with Damping Force} (-) 0 StC_X_C_HIGH - StC X high damping for ground hook control 0 StC_X_C_LOW - StC X low damping for ground hook control @@ -88,7 +90,7 @@ False Use_F_TBL - Use spring force from user-defined table (flag) 0.6433 headLossCoeff_Y - Y TLCD head loss coeff (-) 1000 rho_Y - Y TLCD liquid density (kg/m^3) ---------------------- PRESCRIBED TIME SERIES --------------------------------- [used only when StC_DOF_MODE=4] - 0 PrescribedForcesCoord- Prescribed forces are in global or local coordinates (switch) {1: global; 2: local} + 1 PrescribedForcesCoord- Prescribed forces are in global or local coordinates (switch) {1: global; 2: local} "TimeForceSeries.dat" PrescribedForcesFile - Time series force and moment (7 columns of time, FX, FY, FZ, MX, MY, MZ) ------------------------------------------------------------------------------- diff --git a/docs/source/user/servodyn-stc/StC_Theory.rst b/docs/source/user/servodyn-stc/StC_Theory.rst index 5a09ad6356..ea6608f380 100644 --- a/docs/source/user/servodyn-stc/StC_Theory.rst +++ b/docs/source/user/servodyn-stc/StC_Theory.rst @@ -408,11 +408,12 @@ The external forces :math:`\vec{F}_{_{TMD_Z/O_N}}` are given by F_{X_{_{TMD_Z/O_N}}} + m_z a_{_{G_X/O_N}} \\ F_{Y_{_{TMD_Z/O_N}}} + m_z a_{_{G_Y/O_N}} \\ - c_z \dot{z}_{_{TMD_Z/P_N}} - k_z z_{_{TMD_Z/P_N}} - + m_z a_{_{G_Z/O_N}} + F_{ext_z} + F_{StopFrc_{Z}} + + m_z a_{_{G_Z/O_N}} + F_{ext_z} + F_{StopFrc_{Z}} + F_{Z_{PreLoad}} \end{array} \right] - +where :math:`F_{Z_{PreLoad}}` is a spring pre-load to shift the neutral position +when gravity acts upon the mass for the :math:`TMD_Z`. :math:`TMD_Z` is fixed to frame :math:`N` in the :math:`x` and :math:`y` directions so that @@ -466,7 +467,7 @@ Therefore :math:`\ddot{z}_{_{TMD_Z/P_N}}` is governed by the equations + \dot{\phi}_{_{N/O_N}}^2-\frac{k_z}{m_z}) z_{_{TMD_Z/P_N}} - (\frac{c_z}{m_z}) \dot{z}_{_{TMD_Z/P_N}} -\ddot{z}_{_{P/O_N}} + a_{_{G_Z/O_N}}\\ - &+ \frac{1}{m_z} (F_{ext_Z} + F_{StopFrc_{Z}}) + &+ \frac{1}{m_z} (F_{ext_Z} + F_{StopFrc_{Z}} + F_{Z_{PreLoad}}) \end{aligned} :label: EOM_Zz @@ -575,15 +576,16 @@ and .. math:: B(\vec{u}) = \left[ - \begin{array}{c} + \begin{array}{l} 0 \\ -\ddot{x}_{_{P/O_N}}+a_{_{G_X/O_N}} + \frac{1}{m_x} ( F_{ext_X} + F_{StopFrc_{X}}) \\ 0 \\ -\ddot{y}_{_{P/O_N}}+a_{_{G_Y/O_N}} + \frac{1}{m_y} (F_{ext_Y}+ F_{StopFrc_{Y}}) \\ 0 \\ - -\ddot{z}_{_{P/O_N}}+a_{_{G_Z/O_N}} + \frac{1}{m_z} (F_{ext_Z}+ F_{StopFrc_{Z}}) + -\ddot{z}_{_{P/O_N}}+a_{_{G_Z/O_N}} + \frac{1}{m_z} (F_{ext_Z}+ F_{StopFrc_{Z}} + F_{Z_{PreLoad}}) \end{array} \right] + :label: Bu The inputs are coupled to the state variables, resulting in A and B as :math:`f(\vec{u})`. @@ -612,13 +614,14 @@ The output includes reaction forces corresponding to .. math:: \begin{aligned} \vec{F}_{_{P_G}} = R^T_{_{N/G}} & \left[ - \begin{array}{c} + \begin{array}{l} k_x {x}_{_{TMD/P_N}} + c_x \dot{x}_{_{TMD/P_N}} - F_{StopFrc_{X}} - F_{ext_x} - F_{X_{_{TMD_Y/O_N}}} - F_{X_{_{TMD_Z/O_N}}} \\ k_y {y}_{_{TMD/P_N}} + c_y \dot{y}_{_{TMD/P_N}} - F_{StopFrc_{Y}} - F_{ext_y} - F_{Y_{_{TMD_X/O_N}}} - F_{Y_{_{TMD_Z/O_N}}} \\ - k_z {z}_{_{TMD/P_N}} + c_z \dot{z}_{_{TMD/P_N}} - F_{StopFrc_{Z}} - F_{ext_z} - F_{Z_{_{TMD_X/O_N}}} - F_{Z_{_{TMD_Y/O_N}}} + k_z {z}_{_{TMD/P_N}} + c_z \dot{z}_{_{TMD/P_N}} - F_{StopFrc_{Z}} - F_{ext_z} - F_{Z_{_{TMD_X/O_N}}} - F_{Z_{_{TMD_Y/O_N}}} - F_{Z_{PreLoad}} \end{array} \right] \end{aligned} + :label: OutputForces and @@ -664,6 +667,20 @@ where :math:`\Delta x` is the distance the mass has traveled beyond the stop position and :math:`k_S` and :math:`c_S` are large stiffness and damping constants. + +.. _SrvD-StCz-PreLoad: + +Pre-Load Forces +~~~~~~~~~~~~~~~ + +The extra force :math:`F_{Z_{PreLoad}}` is added to the output forces as a +method to shift the at rest position of the TMD_Z when gravity is acting on it. +This is particularly useful for substructure mounted StCs when very large masses +with soft spring constants are used. This appears in the term +:math:`\vec{F}_{_{TMD_Z/O_N}}` and in eq equations of motion given by :eq:`Bu` +and resulting forces in :eq:`OutputForces`. + + Code Modifications ================== diff --git a/docs/source/user/servodyn-stc/StC_input.rst b/docs/source/user/servodyn-stc/StC_input.rst index 447df7ee19..e62ed91075 100644 --- a/docs/source/user/servodyn-stc/StC_input.rst +++ b/docs/source/user/servodyn-stc/StC_input.rst @@ -160,6 +160,15 @@ StC Initial Conditions StC Z initial displacement *[relative to at rest position; used only when* **StC_DOF_MODE==1** *and* **StC_Z_DOF==TRUE** *]* +**StC_Z_PreLd** [N] + + StC Z spring preload. Either a direct value for the spring preload in + Newtons, or **"gravity"** for pre-loading spring to shift the at rest + position of the StC Z mass when gravity is acting on it using + :math:`F_{Z_{PreLoad}} = M_Z * G`, or **"none"** to disable spring pre-load. + See :numref:`SrvD-StCz-PreLoad` for details of implementation. + *[used only when* **StC_DOF_MODE=1** and **StC_Z_DOF=TRUE** *]* + StC Configuration ----------------- diff --git a/docs/source/user/servodyn/BladedExInterface.png b/docs/source/user/servodyn/BladedExInterface.png new file mode 100644 index 0000000000..eeb9beb229 Binary files /dev/null and b/docs/source/user/servodyn/BladedExInterface.png differ diff --git a/docs/source/user/servodyn/ExtendedBladedInterface.rst b/docs/source/user/servodyn/ExtendedBladedInterface.rst new file mode 100644 index 0000000000..c2b46ef43f --- /dev/null +++ b/docs/source/user/servodyn/ExtendedBladedInterface.rst @@ -0,0 +1,26 @@ +.. _exbladed: + +Extended Bladed Interface +========================= + +The Bladed style DLL controller interface was extended to allow for a +significant number of new channels arranged in channel groups in reserved +ranges. This is shown in :numref:`fig:BlEx` below. + +.. figure:: BladedExInterface.png + :alt: Channel scheme for extension to the Bladed DLL interface. + :name: fig:BlEx + :width: 100.0% + + Channel scheme for extension to the Bladed DLL interface. + + +The ServoDyn summary file contains a summary of all DLL inteface channels in +use, as well as blocks of channels that are reserved. + +.. container:: + :name: SrvDSum + + .. literalinclude:: SrvD--Ex.sum + :language: none + diff --git a/docs/source/user/servodyn/SrvD--Ex.sum b/docs/source/user/servodyn/SrvD--Ex.sum new file mode 100644 index 0000000000..22a4d1d0ea --- /dev/null +++ b/docs/source/user/servodyn/SrvD--Ex.sum @@ -0,0 +1,161 @@ + Legacy Bladed DLL interface channel usage by SrvD: + + --> indicates from SrvD to DLL + <-- indicates from DLL to SrvD + <-> indicates from bidirectional + Record # Description + -------- ----------- + 1 --> Status flag set as follows: 0 if this is the first call, 1 for all subsequent time steps, -1 if this is the final call at the end of the simulation (-) + 2 --> Current time (sec) [t in single precision] + 3 --> Communication interval (sec) + 4 --> Blade 1 pitch angle (rad) [SrvD input] + 5 --> Below-rated pitch angle set-point (rad) [SrvD Ptch_SetPnt parameter] + 6 --> Minimum pitch angle (rad) [SrvD Ptch_Min parameter] + 7 --> Maximum pitch angle (rad) [SrvD Ptch_Max parameter] + 8 --> Minimum pitch rate (most negative value allowed) (rad/s) [SrvD PtchRate_Min parameter] + 9 --> Maximum pitch rate (rad/s) [SrvD PtchRate_Max parameter] + 10 --> 0 = pitch position actuator, 1 = pitch rate actuator (-) [must be 0 for ServoDyn] + 11 --> Current demanded pitch angle (rad) [I am sending the previous value for blade 1 from the DLL, in the absence of any more information provided in Bladed documentation] + 12 --> Current demanded pitch rate (rad/s) [always zero for ServoDyn] + 13 --> Demanded power (W) [SrvD GenPwr_Dem parameter from input file] + 14 --> Measured shaft power (W) [SrvD input] + 15 --> Measured electrical power output (W) [SrvD calculation from previous step; should technically be a state] + 16 --> Optimal mode gain (Nm/(rad/s)^2) [if torque-speed table look-up not selected in input file, use SrvD Gain_OM parameter, otherwise use 0 (already overwritten in Init routine)] + 17 --> Minimum generator speed (rad/s) [SrvD GenSpd_MinOM parameter] + 18 --> Optimal mode maximum speed (rad/s) [SrvD GenSpd_MaxOMp arameter] + 19 --> Demanded generator speed above rated (rad/s) [SrvD GenSpd_Dem parameter] + 20 --> Measured generator speed (rad/s) [SrvD input] + 21 --> Measured rotor speed (rad/s) [SrvD input] + 22 --> Demanded generator torque above rated (Nm) [SrvD GenTrq_Dem parameter from input file] + 23 --> Measured generator torque (Nm) [SrvD calculation from previous step; should technically be a state] + 24 --> Measured yaw error (rad) [SrvD input] + 25 --> Start of below-rated torque-speed look-up table (Lookup table not in use) + 26 --> No. of points in torque-speed look-up table (-) [SrvD DLL_NumTrq parameter]: + 27 --> Hub wind speed (m/s) [SrvD input] + 28 --> Pitch control: 0 = collective, 1 = individual (-) [SrvD Ptch_Cntrl parameter] + 29 --> Yaw control: 0 = yaw rate control, 1 = yaw torque control (-) [must be 0 for ServoDyn] + 30 --> Blade 1 root out-of-plane bending moment (Nm) [SrvD input] + 31 --> Blade 2 root out-of-plane bending moment (Nm) [SrvD input] + 32 --> Blade 3 root out-of-plane bending moment (Nm) [SrvD input] + 33 --> Blade 2 pitch angle (rad) [SrvD input] + 34 --> Blade 3 pitch angle (rad) [SrvD input] + 35 <-- Generator contactor (-) [sent to DLL at the next call] + 36 <-> Shaft brake status (-) [sent to DLL at the next call; anything other than 0 or 1 is an error] + 37 --> Nacelle yaw angle from North (rad) + 41 <-- demanded yaw actuator torque [this output is ignored since record 29 is set to 0 by ServoDyn indicating yaw rate control] + 45 <-- Demanded pitch angle (Collective pitch) (rad) + 47 <-- Demanded generator torque (Nm) + 48 <-- Demanded nacelle yaw rate (rad/s) + 49 --> Maximum number of characters in the "MESSAGE" argument (-) [size of ErrMsg argument plus 1 (we add one for the C NULL CHARACTER)] + 50 --> Number of characters in the "INFILE" argument (-) [trimmed length of DLL_InFile parameter plus 1 (we add one for the C NULL CHARACTER)] + 51 --> Number of characters in the "OUTNAME" argument (-) [trimmed length of RootName parameter plus 1 (we add one for the C NULL CHARACTER)] + 53 --> Tower top fore-aft acceleration (m/s^2) [SrvD input] + 54 --> Tower top side-to-side acceleration (m/s^2) [SrvD input] + 55 <-- UNUSED: Pitch override [anything other than 0 is an error in ServoDyn] + 56 <-- UNUSED: Torque override [anything other than 0 is an error in ServoDyn] + 60 --> Rotor azimuth angle (rad) [SrvD input] + 61 --> Number of blades (-) [SrvD NumBl parameter] + 62 --> Maximum number of values which can be returned for logging (-) [set to 300] + 63 <-- Number logging channels + 64 --> Maximum number of characters which can be returned in "OUTNAME" (-) [set to 12601 (including the C NULL CHARACTER)] + 65 <-- Number of variables returned for logging [anything greater than MaxLoggingChannels is an error] + 69 --> Blade 1 root in-plane bending moment (Nm) [SrvD input] + 70 --> Blade 2 root in-plane bending moment (Nm) [SrvD input] + 71 --> Blade 3 root in-plane bending moment (Nm) [SrvD input] + 73 --> Rotating hub My (GL co-ords) (Nm) [SrvD input] + 74 --> Rotating hub Mz (GL co-ords) (Nm) [SrvD input] + 75 --> Fixed hub My (GL co-ords) (Nm) [SrvD input] + 76 --> Fixed hub Mz (GL co-ords) (Nm) [SrvD input] + 77 --> Yaw bearing My (GL co-ords) (Nm) [SrvD input] + 78 --> Yaw bearing Mz (GL co-ords) (Nm) [SrvD input] + 82 --> Nacelle roll acceleration (rad/s^2) [SrvD input] -- this is in the shaft (tilted) coordinate system, instead of the nacelle (nontilted) coordinate system + 83 --> Nacelle nodding acceleration (rad/s^2) [SrvD input] + 84 --> Nacelle yaw acceleration (rad/s^2) [SrvD input] -- this is in the shaft (tilted) coordinate system, instead of the nacelle (nontilted) coordinate system + 95 --> Reserved (SrvD customization: set to SrvD AirDens parameter) + 96 --> Reserved (SrvD customization: set to SrvD AvgWindSpeed parameter) + 109 --> Shaft torque (=hub Mx for clockwise rotor) (Nm) [SrvD input] + 117 --> Controller state [always set to 0] + 120 <-- Airfoil command, blade 1 + 121 <-- Airfoil command, blade 2 + 122 <-- Airfoil command, blade 3 + 129 --> Maximum extent of the avrSWAP array: 3300 + + Legacy Bladed DLL interface with Extended avrSWAP + channel usage by SrvD: + + --> indicates from SrvD to DLL + <-- indicates from DLL to SrvD + Record # Requested by Description + -------- --------------------- ----------- + 1000 --> Version of extended avrSWAP: 1 + 1001 --> General channel group -- Platform motion -- Displacement TDX (m) + 1002 --> General channel group -- Platform motion -- Displacement TDY (m) + 1003 --> General channel group -- Platform motion -- Displacement TDZ (m) + 1004 --> General channel group -- Platform motion -- Displacement RDX (rad) + 1005 --> General channel group -- Platform motion -- Displacement RDY (rad) + 1006 --> General channel group -- Platform motion -- Displacement RDZ (rad) + 1007 --> General channel group -- Platform motion -- Velocity TVX (m/s) + 1008 --> General channel group -- Platform motion -- Velocity TVY (m/s) + 1009 --> General channel group -- Platform motion -- Velocity TVZ (m/s) + 1010 --> General channel group -- Platform motion -- Velocity RVX (rad/s) + 1011 --> General channel group -- Platform motion -- Velocity RVY (rad/s) + 1012 --> General channel group -- Platform motion -- Velocity RVZ (rad/s) + 1013 --> General channel group -- Platform motion -- Acceleration TAX (m/s^2) + 1014 --> General channel group -- Platform motion -- Acceleration TAY (m/s^2) + 1015 --> General channel group -- Platform motion -- Acceleration TAZ (m/s^2) + 1016 --> General channel group -- Platform motion -- Acceleration RAX (rad/s^2) + 1017 --> General channel group -- Platform motion -- Acceleration RAY (rad/s^2) + 1018 --> General channel group -- Platform motion -- Acceleration RAZ (rad/s^2) + 2000 --> Ending index for the non-lidar measurements channel block + 2001 --> Starting index for the lidar measurements channel block + 2500 --> Ending index for the lidar measurements channel block + 2501 <-- Starting index for the lidar control channel block + 2600 <-- Ending index for the lidar control channel block + 2601 <-- MoorDyn Cable control channel group 1 -- DeltaL + 2602 <-- MoorDyn Cable control channel group 1 -- DeltaLdot + 2603 <-- Cable control channel group 2 -- DeltaL + 2604 <-- Cable control channel group 2 -- DeltaLdot + 2605 <-- MoorDyn Cable control channel group 3 -- DeltaL + 2606 <-- MoorDyn Cable control channel group 3 -- DeltaLdot + 2800 <-- Ending index for the cable control channel block + 2801 --> StC control channel group 1 -- StC_Disp_X + 2802 --> StC control channel group 1 -- StC_Disp_Y + 2803 --> StC control channel group 1 -- StC_Disp_Z + 2804 --> StC control channel group 1 -- StC_Vel_X + 2805 --> StC control channel group 1 -- StC_Vel_Y + 2806 --> StC control channel group 1 -- StC_Vel_Z + 2807 <-- StC control channel group 1 -- StC_Stiff_X (override spring constant) + 2808 <-- StC control channel group 1 -- StC_Stiff_Y (override spring constant) + 2809 <-- StC control channel group 1 -- StC_Stiff_Z (override spring constant) + 2810 <-- StC control channel group 1 -- StC_Damp_X (override damping constant) + 2811 <-- StC control channel group 1 -- StC_Damp_Y (override damping constant) + 2812 <-- StC control channel group 1 -- StC_Damp_Z (override damping constant) + 2813 <-- StC control channel group 1 -- StC_Brake_X (braking force) + 2814 <-- StC control channel group 1 -- StC_Brake_Y (braking force) + 2815 <-- StC control channel group 1 -- StC_Brake_Z (braking force) + 2816 <-- StC control channel group 1 -- StC_Force_X (additional force) + 2817 <-- StC control channel group 1 -- StC_Force_Y (additional force) + 2818 <-- StC control channel group 1 -- StC_Force_Z (additional force) + 2819 <-- StC control channel group 1 -- Reserved for future + 2820 <-- StC control channel group 1 -- Reserved for future + 2821 --> SStC2 StC control channel group 2 -- StC_Disp_X + 2822 --> SStC2 StC control channel group 2 -- StC_Disp_Y + 2823 --> SStC2 StC control channel group 2 -- StC_Disp_Z + 2824 --> SStC2 StC control channel group 2 -- StC_Vel_X + 2825 --> SStC2 StC control channel group 2 -- StC_Vel_Y + 2826 --> SStC2 StC control channel group 2 -- StC_Vel_Z + 2827 <-- SStC2 StC control channel group 2 -- StC_Stiff_X (override spring constant) + 2828 <-- SStC2 StC control channel group 2 -- StC_Stiff_Y (override spring constant) + 2829 <-- SStC2 StC control channel group 2 -- StC_Stiff_Z (override spring constant) + 2830 <-- SStC2 StC control channel group 2 -- StC_Damp_X (override damping constant) + 2831 <-- SStC2 StC control channel group 2 -- StC_Damp_Y (override damping constant) + 2832 <-- SStC2 StC control channel group 2 -- StC_Damp_Z (override damping constant) + 2833 <-- SStC2 StC control channel group 2 -- StC_Brake_X (braking force) + 2834 <-- SStC2 StC control channel group 2 -- StC_Brake_Y (braking force) + 2835 <-- SStC2 StC control channel group 2 -- StC_Brake_Z (braking force) + 2836 <-- SStC2 StC control channel group 2 -- StC_Force_X (additional force) + 2837 <-- SStC2 StC control channel group 2 -- StC_Force_Y (additional force) + 2838 <-- SStC2 StC control channel group 2 -- StC_Force_Z (additional force) + 2839 <-- SStC2 StC control channel group 2 -- Reserved for future + 2840 <-- SStC2 StC control channel group 2 -- Reserved for future + 3000 <-- Ending index for the StC control channel block diff --git a/docs/source/user/servodyn/index.rst b/docs/source/user/servodyn/index.rst index 670e16701a..1ec43cf0bd 100644 --- a/docs/source/user/servodyn/index.rst +++ b/docs/source/user/servodyn/index.rst @@ -21,4 +21,4 @@ ServoDyn Users Guide :maxdepth: 2 input.rst - + ExtendedBladedInterface.rst diff --git a/docs/source/user/servodyn/input.rst b/docs/source/user/servodyn/input.rst index 428c08ed0d..6fb3e43352 100644 --- a/docs/source/user/servodyn/input.rst +++ b/docs/source/user/servodyn/input.rst @@ -283,6 +283,61 @@ Nacelle-yaw Control Final yaw angle for override yaw maneuvers +.. _SrvD-AfC-inputs: + +Aerodynamic Flow Control +~~~~~~~~~~~~~~~~~~~~~~~~ + +**AfCmode** [switch] + + Airfoil control mode {0: none, 1: sine wave cycle, 4: user-defined from + Simulink/Labview, 5: user-defined from Bladed-style DLL} + +**AfC_Mean** [-] + + Mean level for cosine cycling or steady value *[used only with* + **AfCmode==1** *]* + +**AfC_Amp** [-] + + Amplitude for cosine cycling of flap signal *[used only with* + **AfCmode==1** *]* + +**AfC_Phase** [deg] + + Phase relative to the blade azimuth (0 is vertical) for cosine cycling of + flap signal *[used only with* **AfCmode==1** *]* + +When **AfCmode==1**, the signal for the airfoil flow control is set by the +expression *AfC_Mean + p%AfC_Amp*cos( Azimuth + AfC_phase)* where the azimuth +is the azimuth of that particular blade (azimuth=0 is considered vertical). + + +.. _SrvD-CableControl-inputs: + +Cable Control +~~~~~~~~~~~~~ + +Control of cable elements specified in either the MoorDyn or SubDyn modules can +be controlled through ServoDyn by a Bladed-style controller. Each cable +receives a pair of controller channels, one for the requested cable length +change (DeltaL), and one for the cable length rate of change (DeltaLdot). The +channel assignments are requested by the modules with the cable elements +(MoorDyn and/or SubDyn at present), and mapped to the appropriate control +channel. A summary of which module requested the channels is available in the +summary file output from ServoDyn. Up to 100 channel groups may be requested +when linking to a DLL, or 20 channel groups when linking to Simulink. + +**CCmode** [switch] + + Cable control mode {0: none, 4: user-defined from Simulink/Labview, 5: + user-defined from Bladed-style DLL}. + + Each cable control channel group consists of a channel for DeltaL (requested + cable length change) and a channel for DeltaLdot (cable length change + rate) from the controller/Simulink interface. + + .. _SrvD-StC-inputs: Structural Control @@ -443,7 +498,10 @@ Output **SumPrint** [flag] - Print summary data to .sum *(currently unused)* + Print summary data to .sum. This file contains a summary of the + inputs, and will give a detailed list of the communication channels with a + Bladed-style controller when used. This information may be helpful in + debugging a controller, or verifying how ServoDyn is configured. **OutFile** [-] @@ -468,7 +526,7 @@ ServoDyn. Enter one or more lines containing quoted strings that in turn contain one or more output parameter names. Separate output parameter names by any combination of commas, semicolons, spaces, and/or tabs. If you prefix a parameter name with a minus sign, “-”, underscore, “_”, or -the characters “m” or “M”, ServooDyn will multiply the value for that +the characters “m” or “M”, ServoDyn will multiply the value for that channel by –1 before writing the data. The parameters are written in the order they are listed in the input file. ServoDyn allows you to use multiple lines so that you can break your list into meaningful groups diff --git a/docs/source/user/subdyn/theory.rst b/docs/source/user/subdyn/theory.rst index d65b61f034..5ca5917d4d 100644 --- a/docs/source/user/subdyn/theory.rst +++ b/docs/source/user/subdyn/theory.rst @@ -625,7 +625,7 @@ of the element writes :math:`\boldsymbol{f}_e=\boldsymbol{K}_e\boldsymbol{u}+\boldsymbol{f}_{e,0}`, with: -.. math:: +.. math:: :label: StiffnessMatrixCable \begin{aligned} \begin{bmatrix} @@ -664,7 +664,7 @@ with: 0\\ 1\\ \end{bmatrix} - \label{eq:StiffnessMatrixCable}\end{aligned} + \end{aligned} The relation above is expressed in the element coordinate system. The stiffness matrix and force vector are transferred to the global system @@ -706,26 +706,50 @@ with :math:`L_e` the *undisplaced* length of the element (not Controlled pretension cable ^^^^^^^^^^^^^^^^^^^^^^^^^^^ -The controller updates the value of :math:`\Delta L` at each time step, -which effectively changes the pretension properties of the cable. The -quantity :math:`\Delta L` is the change in restlength if the cable had -no pretension. Since cable extension beyond the element length -(:math:`L_e`) is not allowed in SubDyn, :math:`\Delta L` is limited to -negative values. - -At a given time, the restlength of the cable is :math:`L_r(t)` (instead +The controller changes the rest length of the cable at each time step, effectively changing the pretension properties of the cable. +At a given time, the restlength of the cable is :math:`L_r(t)=L_e + \Delta L` (instead of :math:`L_0`), and the pretension force is :math:`T(t)` (instead of -:math:`T_0`). The pretension force is then given as: +:math:`T_0`). The pretension force is given as: -.. math:: +.. math:: :label: tensionUnsteady + + \begin{aligned} + T(t)= E A \frac{-\Delta L(t)}{L_r(t)} = E A \frac{-\Delta L(t)}{L_e + \Delta L(t)} + \end{aligned} + +At :math:`t=0`, when no controller action is present, the pretension force and length are: + +.. math:: :label: tensionZero \begin{aligned} - T(t)= E A \frac{-\Delta L_r(t)}{L_r(t)} = E A \frac{-\Delta L_r(t)}{L_e + \Delta L(t)} - ,\quad T(0) =T_0= E A \frac{-\Delta L_0}{L_e + \Delta L_0} ,\quad - \Delta L(0) = \Delta L_0\end{aligned} + \Delta L(0) = \Delta L_0 = \frac{-L_e T_0}{EA+T_0} + \end{aligned} + + +The quantity :math:`\Delta L` is the change in restlength, and it is given as: + +.. math:: :label: DeltaLTot + \begin{aligned} + \Delta L(t) = \Delta L_0 + \Delta L_c(t) + \end{aligned} + +where :math:`\Delta L_c` is the change of length prescribed by the controller, and :math:`\Delta L_0` +is the change of length attributed to the initial pretension. This choice is such that the controller input is nominally 0. Cable extension beyond the element length +(:math:`L_e`) is not allowed in SubDyn, therefore :math:`\Delta L` is limited to +negative values (:math:`L_r=L_e+\Delta L <= L_e`). +The tension force at a given time is given by inserting :eq:`DeltaLTot` into :eq:`tensionUnsteady`: + +.. math:: + + \begin{aligned} + T(t)=- E A \frac{\Delta L_0 + \Delta L_c }{L_e + \Delta L_0 + \Delta L_c} + \end{aligned} + + +In the following we provide details on the implementation and the approximation introduced. The “equations of motions” for a cable element are written: .. math:: @@ -733,28 +757,27 @@ The “equations of motions” for a cable element are written: \begin{aligned} \boldsymbol{M}_e\boldsymbol{\ddot{u}}_e&= \boldsymbol{f}_e\end{aligned} -If the pretension force is constant, equal to :math:`T_0` then the -element force is: +If the pretension force is constant (equal to :math:`T_0`), and additional external loads are neglected, then the element force is: -.. math:: +.. math:: :label: CstCableA \begin{aligned} \boldsymbol{f}_e=\boldsymbol{f}_e (t,T_0) &=-\boldsymbol{K}_c(T_0) \boldsymbol{u}_e + \boldsymbol{f}_c(T_0)+ \boldsymbol{f}_g - \label{eq:CableEqMotionT0}\end{aligned} + \end{aligned} where :math:`\boldsymbol{f}_c(T_0)` and :math:`\boldsymbol{K}_c(T_0)` -are given in . If the pretension force is varying with time +are given in :eq:`StiffnessMatrixCable`. If the pretension force is varying with time (:math:`T=T(t)`), then the force is: -.. math:: +.. math:: :label: VaryingCableA \begin{aligned} - \boldsymbol{f}_e (t) =-\boldsymbol{K}_c(T) \boldsymbol{u}_e + \boldsymbol{f}_c(T)+ \boldsymbol{f}_g - \label{eq:VaryingCableA}\end{aligned} + \boldsymbol{f}_e (t) =-\boldsymbol{K}_c(T) \boldsymbol{u}_e + \boldsymbol{f}_c(T)+ \boldsymbol{f}_g + \end{aligned} -where is evaluated with :math:`\epsilon=\frac{T}{EA}` and -:math:`L=\frac{L_e}{1+\epsilon}`. We seek to express , as a correction -term added to the equation of a constant pretension cable (i.e. , with +where :eq:`VaryingCableA` is evaluated with :math:`\epsilon=\frac{T}{EA}` and +:math:`L=\frac{L_e}{1+\epsilon}`. We seek to express :eq:`VaryingCableA`, as a correction +term added to the equation of a constant pretension cable (i.e. :eq:`CstCableA`, with :math:`T(0)=T_0`). We add :math:`\pm\boldsymbol{f}_e(t,T_0)` to , leading to: diff --git a/glue-codes/fast-farm/CMakeLists.txt b/glue-codes/fast-farm/CMakeLists.txt index 2c2e31b758..40507fc30c 100644 --- a/glue-codes/fast-farm/CMakeLists.txt +++ b/glue-codes/fast-farm/CMakeLists.txt @@ -51,6 +51,10 @@ if (${_compiler_id} STREQUAL "GNU" AND ${_build_type} STREQUAL "RELEASE") # https://gcc.gnu.org/onlinedocs/gcc/Debugging-Options.html set_source_files_properties(src/FAST_Farm_Types.f90 src/FASTWrapper_Types.f90 PROPERTIES COMPILE_FLAGS "-fno-var-tracking -fno-var-tracking-assignments") endif() +if (${_compiler_id} MATCHES "^INTEL" AND ${_build_type} STREQUAL "RELEASE" AND NOT WIN32) + # Compilation hangs on FAST_Farm_Types.f90 with -O3 on linux (on some hardware) + set_source_files_properties(src/FAST_Farm_Types.f90 PROPERTIES COMPILE_FLAGS "-O2") +endif() install(TARGETS FAST.Farm RUNTIME DESTINATION bin) diff --git a/glue-codes/simulink/examples/OpenLoop.mdl b/glue-codes/simulink/examples/OpenLoop.mdl index 47faf19de9..b095d5d39f 100644 --- a/glue-codes/simulink/examples/OpenLoop.mdl +++ b/glue-codes/simulink/examples/OpenLoop.mdl @@ -1,17 +1,36 @@ Model { Name "OpenLoop" - Version 7.9 - MdlSubVersion 0 + Version 10.2 + SavedCharacterEncoding "UTF-8" + ModelUUID "c2f82333-5217-4aa7-87da-1a63338d3a31" GraphicalInterface { NumRootInports 0 NumRootOutports 0 ParameterArgumentNames "" - ComputedModelVersion "1.87" + ComputedModelVersion "18.1" NumModelReferences 0 NumTestPointedSignals 0 + NumProvidedFunctions 0 + NumRequiredFunctions 0 + NumResetEvents 0 + HasInitializeEvent 0 + HasTerminateEvent 0 + PreCompExecutionDomainType "Unset" + IsExportFunctionModel 0 + IsArchitectureModel 0 + IsAUTOSARArchitectureModel 0 + NumParameterArguments 0 + NumExternalFileReferences 0 + OrderedModelArguments 1 } - SavedCharacterEncoding "windows-1252" - SaveDefaultBlockParams on + LogicAnalyzerPlugin "on" + SLCCPlugin "on" + DiagnosticSuppressor "on" + AnimationPlugin "on" + slcheck_filter_plugin "on" + WebScopes_FoundationPlugin "on" + NotesPlugin "on" + EnableAccessToBaseWorkspace on ScopeRefreshTime 0.035000 OverrideScopeRefreshTime on DisableAllScopes off @@ -21,22 +40,209 @@ Model { MinMaxOverflowArchiveMode "Overwrite" FPTRunName "Run 1" MaxMDLFileLineLength 120 + LastSavedArchitecture "maci64" + Object { + $PropName "BdWindowsInfo" + $ObjectID 1 + $ClassName "Simulink.BDWindowsInfo" + Object { + $PropName "WindowsInfo" + $ObjectID 2 + $ClassName "Simulink.WindowInfo" + IsActive [1] + Location [0.0, 23.0, 1920.0, 1177.0] + Object { + $PropName "ModelBrowserInfo" + $ObjectID 3 + $ClassName "Simulink.ModelBrowserInfo" + Visible [1] + DockPosition "Left" + Width [50] + Height [50] + Filter [9] + Minimized "Off" + } + Object { + $PropName "ExplorerBarInfo" + $ObjectID 4 + $ClassName "Simulink.ExplorerBarInfo" + Visible [1] + } + Array { + Type "Simulink.EditorInfo" + Dimension 9 + Object { + $ObjectID 5 + IsActive [1] + IsTabbed [1] + ViewObjType "SimulinkTopLevel" + LoadSaveID "0" + Extents [1532.0, 948.0] + ZoomFactor [2.0] + Offset [-154.18033050411486, 29.935041285346472] + SceneRectInView [-154.18033050411486, 29.935041285346472, 766.0, 474.0] + } + Object { + $ObjectID 6 + IsActive [0] + IsTabbed [0] + ViewObjType "SimulinkSubsys" + LoadSaveID "59" + Extents [1532.0, 948.0] + ZoomFactor [1.0] + Offset [-667.30078125, -417.0] + SceneRectInView [-667.30078125, -417.0, 1532.0, 948.0] + } + Object { + $ObjectID 7 + IsActive [0] + IsTabbed [0] + ViewObjType "SimulinkSubsys" + LoadSaveID "67" + Extents [1532.0, 948.0] + ZoomFactor [1.0] + Offset [-664.390625, -417.0] + SceneRectInView [-664.390625, -417.0, 1532.0, 948.0] + } + Object { + $ObjectID 8 + IsActive [0] + IsTabbed [0] + ViewObjType "SimulinkSubsys" + LoadSaveID "64" + Extents [1532.0, 948.0] + ZoomFactor [1.0] + Offset [-664.390625, -417.0] + SceneRectInView [-664.390625, -417.0, 1532.0, 948.0] + } + Object { + $ObjectID 9 + IsActive [0] + IsTabbed [0] + ViewObjType "SimulinkSubsys" + LoadSaveID "2" + Extents [1532.0, 948.0] + ZoomFactor [2.43] + Offset [-42.067949459876559, 49.8325744774116] + SceneRectInView [-42.067949459876559, 49.8325744774116, 630.45267489711932, 390.12345679012344] + } + Object { + $ObjectID 10 + IsActive [0] + IsTabbed [0] + ViewObjType "SimulinkSubsys" + LoadSaveID "32" + Extents [1532.0, 948.0] + ZoomFactor [1.0] + Offset [-685.04296875, -417.0] + SceneRectInView [-685.04296875, -417.0, 1532.0, 948.0] + } + Object { + $ObjectID 11 + IsActive [0] + IsTabbed [0] + ViewObjType "SimulinkSubsys" + LoadSaveID "20" + Extents [1532.0, 948.0] + ZoomFactor [1.0] + Offset [-608.5078125, -394.5] + SceneRectInView [-608.5078125, -394.5, 1532.0, 948.0] + } + Object { + $ObjectID 12 + IsActive [0] + IsTabbed [0] + ViewObjType "SimulinkSubsys" + LoadSaveID "25" + Extents [1532.0, 948.0] + ZoomFactor [1.0] + Offset [-613.23828125, -392.0] + SceneRectInView [-613.23828125, -392.0, 1532.0, 948.0] + } + Object { + $ObjectID 13 + IsActive [0] + IsTabbed [0] + ViewObjType "SimulinkSubsys" + LoadSaveID "16" + Extents [1532.0, 948.0] + ZoomFactor [1.0] + Offset [-667.30078125, -417.0] + SceneRectInView [-667.30078125, -417.0, 1532.0, 948.0] + } + PropName "EditorsInfo" + } + Array { + Type "Simulink.DockComponentInfo" + Dimension 2 + Object { + $ObjectID 14 + Type "GLUE2:PropertyInspector" + ID "Property Inspector" + Visible [0] + CreateCallback "" + UserData "" + Floating [0] + DockPosition "Right" + Width [640] + Height [480] + Minimized "Unset" + } + Object { + $ObjectID 15 + Type "Simulink:Editor:ReferencedFiles" + ID "Referenced Files" + Visible [0] + CreateCallback "" + UserData "{\"filterShowRefModels\":\"true\",\"filterShowRefSubs\":\"true\",\"filterShowOnlyDirtyFiles\":\"false\"}\n" + Floating [0] + DockPosition "Left" + Width [640] + Height [480] + Minimized "Unset" + } + PropName "DockComponentsInfo" + } + WindowState "AAAA/wAAAAD9AAAAAgAAAAAAAAFdAAAD8fwCAAAABPsAAAAWAEQAbwBjAGsAVwBpAGQAZwBlAHQAMwEAAAAxAAAB+AAAA" + "AAAAAAA+wAAABYARABvAGMAawBXAGkAZABnAGUAdAA0AAAAAAD/////AAAAAAAAAAD7AAAAUgBHAEwAVQBFADIAIAB0AHIAZQBlACAAYwBvAG0Ac" + "ABvAG4AZQBuAHQALwBHAEwAVQBFADIAIAB0AHIAZQBlACAAYwBvAG0AcABvAG4AZQBuAHQBAAAAeQAAA/EAAABrAP////sAAABgAFMAaQBtAHUAb" + "ABpAG4AawA6AEUAZABpAHQAbwByADoAUgBlAGYAZQByAGUAbgBjAGUAZABGAGkAbABlAHMALwBSAGUAZgBlAHIAZQBuAGMAZQBkACAARgBpAGwAZ" + "QBzAAAAAAD/////AAAAjwD///8AAAABAAAAAAAAAAD8AgAAAAH7AAAAVABHAEwAVQBFADIAOgBQAHIAbwBwAGUAcgB0AHkASQBuAHMAcABlAGMAd" + "ABvAHIALwBQAHIAbwBwAGUAcgB0AHkAIABJAG4AcwBwAGUAYwB0AG8AcgAAAAAA/////wAAAawA////AAAGIgAAA/EAAAABAAAAAgAAAAEAAAAC/" + "AAAAAA=" + Array { + Type "Cell" + Dimension 0 + PropName "PersistedApps" + } + WindowUuid "50197adc-b428-4ab1-b54b-7cf3d2b2bff5" + } + BDUuid "5050cd19-51a4-48d7-a579-c2deedb80d0b" + } + HideAutomaticNames on + SequenceViewerTimePrecision 3 + SequenceViewerHistory 1000 Created "Mon Feb 09 16:59:21 2004" Creator "bjonkman" UpdateHistory "UpdateHistoryNever" ModifiedByFormat "%" - LastModifiedBy "bjonkman" + LastModifiedBy "aplatt" ModifiedDateFormat "%" - LastModifiedDate "Thu Feb 26 12:27:50 2015" - RTWModifiedTimeStamp 346852301 - ModelVersionFormat "1.%" - ConfigurationManager "None" + LastModifiedDate "Tue Mar 02 16:31:47 2021" + RTWModifiedTimeStamp 536603500 + ModelVersionFormat "%" SampleTimeColors off SampleTimeAnnotations off LibraryLinkDisplay "none" WideLines off ShowLineDimensions off ShowPortDataTypes off + ShowAllPropagatedSignalLabels off + PortDataTypeDisplayFormat "AliasTypeOnly" + ShowEditTimeErrors on + ShowEditTimeWarnings on + ShowEditTimeAdvisorChecks off + ShowPortUnits off ShowDesignRanges off ShowLoopsOnError on IgnoreBidirectionalLines off @@ -44,17 +250,34 @@ Model { ShowTestPointIcons on ShowSignalResolutionIcons on ShowViewerIcons on - SortedOrder off - ExecutionContextIcon off + VariantCondition off ShowLinearizationAnnotations on + ShowVisualizeInsertedRTB on + ShowMarkup on BlockNameDataTip off BlockParametersDataTip off BlockDescriptionStringDataTip off + BlockVariantConditionDataTip off ToolBar on StatusBar on BrowserShowLibraryLinks off + FunctionConnectors off BrowserLookUnderMasks off + MultiThreadCoSim "on" SimulationMode "normal" + SILPILModeSetting "automated" + SILPILSystemUnderTest "topmodel" + SILPILSimulationModeTopModel "normal" + SILPILSimulationModeModelRef "normal" + SimTabSimulationMode "normal" + CodeVerificationMode "software-in-the-loop (sil)" + PauseTimes "5" + NumberOfSteps 1 + SnapshotBufferSize 10 + SnapshotInterval 10 + NumberOfLastSnapshots 0 + EnablePacing off + PacingRate 1 LinearizationMsg "none" Profile off ParamWorkspaceSource "MATLABWorkspace" @@ -62,26 +285,31 @@ Model { AccelTemplateMakefile "accel_default_tmf" AccelMakeCommand "make_rtw" TryForcingSFcnDF off - RecordCoverage off - CovPath "/" - CovSaveName "covdata" - CovMetricSettings "dw" - CovNameIncrementing off - CovHtmlReporting on - CovForceBlockReductionOff on - covSaveCumulativeToWorkspaceVar on - CovSaveSingleToWorkspaceVar on - CovCumulativeVarName "covCumulativeData" - CovCumulativeReport off - CovReportOnPause on - CovModelRefEnable "Off" - CovExternalEMLEnable off + Object { + $PropName "DataLoggingOverride" + $ObjectID 16 + $ClassName "Simulink.SimulationData.ModelLoggingInfo" + model_ "OpenLoop" + Array { + Type "Cell" + Dimension 1 + Cell "OpenLoop" + PropName "logAsSpecifiedByModels_" + } + Array { + Type "Cell" + Dimension 1 + Cell "" + PropName "logAsSpecifiedByModelsSSIDs_" + } + } ExtModeBatchMode off ExtModeEnableFloating on ExtModeTrigType "manual" ExtModeTrigMode "normal" ExtModeTrigPort "1" ExtModeTrigElement "any" + ExtModeTrigSignalOutputPortIndex 0 ExtModeTrigDuration 1000 ExtModeTrigDurationFloating "auto" ExtModeTrigHoldOff 0 @@ -97,27 +325,33 @@ Model { ExtModeSkipDownloadWhenConnect off ExtModeLogAll on ExtModeAutoUpdateStatusClock on - BufferReuse on + VariantFading on ShowModelReferenceBlockVersion off ShowModelReferenceBlockIO off + OrderedModelArguments on Array { Type "Handle" Dimension 1 Simulink.ConfigSet { - $ObjectID 1 - Version "1.12.0" + $ObjectID 17 + Version "20.1.0" + DisabledProps [] + Description "" Array { Type "Handle" - Dimension 8 + Dimension 9 Simulink.SolverCC { - $ObjectID 2 - Version "1.12.0" + $ObjectID 18 + Version "20.1.0" + DisabledProps [] + Description "" + Components [] StartTime "0.0" StopTime "TMax" AbsTol "auto" + AutoScaleAbsTol on FixedStep "DT" InitialStep "auto" - MaxNumMinSteps "-1" MaxOrder 5 ZcThreshold "auto" ConsecutiveZCsStepRelTol "10*128*eps" @@ -128,25 +362,32 @@ Model { MinStep "auto" MaxConsecutiveMinStep "1" RelTol "1e-3" - SolverMode "Auto" - EnableConcurrentExecution off + EnableMultiTasking on ConcurrentTasks off - Solver "ode4" SolverName "ode4" SolverJacobianMethodControl "auto" ShapePreserveControl "DisableAll" ZeroCrossControl "UseLocalSettings" ZeroCrossAlgorithm "Nonadaptive" AlgebraicLoopSolver "TrustRegion" + SolverInfoToggleStatus off + IsAutoAppliedInSIP off SolverResetMethod "Fast" PositivePriorityOrder off AutoInsertRateTranBlk off SampleTimeConstraint "Unconstrained" InsertRTBMode "Whenever possible" + SampleTimeProperty [] + DecoupledContinuousIntegration off + MinimalZcImpactIntegration off + ODENIntegrationMethod "ode3" } Simulink.DataIOCC { - $ObjectID 3 - Version "1.12.0" + $ObjectID 19 + Version "20.1.0" + DisabledProps [] + Description "" + Components [] Decimation "1" ExternalInput "[t, u]" FinalStateName "xFinal" @@ -156,7 +397,7 @@ Model { LoadExternalInput off LoadInitialState off SaveFinalState off - SaveCompleteFinalSimState off + SaveOperatingPoint off SaveFormat "Array" SignalLoggingSaveFormat "ModelDataLogs" SaveOutput off @@ -164,6 +405,9 @@ Model { SignalLogging on DSMLogging on InspectSignalLogs off + VisualizeSimOutput on + StreamToWorkspace off + StreamVariableName "streamout" SaveTime off ReturnWorkspaceOutputs off StateSaveName "xout" @@ -175,13 +419,17 @@ Model { OutputTimes "[]" ReturnWorkspaceOutputsName "out" Refine "1" + LoggingToFile off + DatasetSignalFormat "timeseries" + LoggingFileName "out.mat" + LoggingIntervals "[-inf, inf]" } Simulink.OptimizationCC { - $ObjectID 4 - Version "1.12.0" + $ObjectID 20 + Version "20.1.0" Array { Type "Cell" - Dimension 8 + Dimension 9 Cell "BooleansAsBitfields" Cell "PassReuseOutputArgsAs" Cell "PassReuseOutputArgsThreshold" @@ -190,55 +438,82 @@ Model { Cell "OptimizeModelRefInitCode" Cell "NoFixptDivByZeroProtection" Cell "UseSpecifiedMinMax" + Cell "EfficientTunableParamExpr" PropName "DisabledProps" } + Description "" + Components [] BlockReduction on BooleanDataType on ConditionallyExecuteInputs on - InlineParams off - UseIntDivNetSlope off + DefaultParameterBehavior "Tunable" + UseDivisionForNetSlopeComputation "off" + GainParamInheritBuiltInType off UseFloatMulNetSlope off + DefaultUnderspecifiedDataType "double" UseSpecifiedMinMax off InlineInvariantSignals off OptimizeBlockIOStorage on BufferReuse on EnhancedBackFolding off + CachingGlobalReferences off + GlobalBufferReuse on StrengthReduction off + AdvancedOptControl "" ExpressionFolding on BooleansAsBitfields off BitfieldContainerType "uint_T" + BitwiseOrLogicalOp "Same as modeled" EnableMemcpy on MemcpyThreshold 64 PassReuseOutputArgsAs "Structure reference" + PassReuseOutputArgsThreshold 12 ExpressionDepthLimit 2147483647 - FoldNonRolledExpr on LocalBlockOutputs on RollThreshold 5 - SystemCodeInlineAuto off StateBitsets off DataBitsets off - UseTempVars off + ActiveStateOutputEnumStorageType "Native Integer" ZeroExternalMemoryAtStartup on ZeroInternalMemoryAtStartup on InitFltsAndDblsToZero off NoFixptDivByZeroProtection off EfficientFloat2IntCast off EfficientMapNaN2IntZero on - OptimizeModelRefInitCode off LifeSpan "inf" MaxStackSize "Inherit from target" BufferReusableBoundary on - SimCompilerOptimization "Off" + SimCompilerOptimization "off" AccelVerboseBuild off - ParallelExecutionInRapidAccelerator on + OptimizeBlockOrder "off" + OptimizeDataStoreBuffers on + BusAssignmentInplaceUpdate on + DifferentSizesBufferReuse off + UseRowMajorAlgorithm off + OptimizationLevel "level2" + OptimizationPriority "Balanced" + OptimizationCustomize on + LabelGuidedReuse off + MultiThreadedLoops off + DenormalBehavior "GradualUnderflow" + EfficientTunableParamExpr off } Simulink.DebuggingCC { - $ObjectID 5 - Version "1.12.0" + $ObjectID 21 + Version "20.1.0" + Array { + Type "Cell" + Dimension 1 + Cell "UseOnlyExistingSharedCode" + PropName "DisabledProps" + } + Description "" + Components [] RTPrefix "error" ConsistencyChecking "none" ArrayBoundsChecking "none" SignalInfNanChecking "none" + StringTruncationChecking "error" SignalRangeChecking "none" ReadBeforeWriteMsg "UseLocalSettings" WriteAfterWriteMsg "UseLocalSettings" @@ -261,12 +536,12 @@ Model { IgnoredZcDiagnostic "warning" SolverPrmCheckMsg "none" InheritedTsInSrcMsg "warning" - DiscreteInheritContinuousMsg "warning" MultiTaskDSMMsg "warning" MultiTaskCondExecSysMsg "none" MultiTaskRateTransMsg "error" SingleTaskRateTransMsg "none" TasksWithSamePriorityMsg "warning" + ExportedTasksRateTransMsg "none" SigSpecEnsureSampleTimeMsg "warning" CheckMatrixSingularityMsg "none" IntegerOverflowMsg "warning" @@ -282,117 +557,190 @@ Model { UnderSpecifiedDataTypeMsg "none" UnnecessaryDatatypeConvMsg "none" VectorMatrixConversionMsg "none" - InvalidFcnCallConnMsg "error" - FcnCallInpInsideContextMsg "Enable All" + FcnCallInpInsideContextMsg "warning" SignalLabelMismatchMsg "none" UnconnectedInputMsg "warning" UnconnectedOutputMsg "warning" UnconnectedLineMsg "warning" + UseOnlyExistingSharedCode "error" SFcnCompatibilityMsg "none" - FrameProcessingCompatibilityMsg "warning" + FrameProcessingCompatibilityMsg "error" UniqueDataStoreMsg "none" BusObjectLabelMismatch "warning" RootOutportRequireBusObject "warning" AssertControl "UseLocalSettings" - EnableOverflowDetection off + AllowSymbolicDim on + RowMajorDimensionSupport off ModelReferenceIOMsg "none" ModelReferenceMultiInstanceNormalModeStructChecksumCheck "error" ModelReferenceVersionMismatchMessage "none" ModelReferenceIOMismatchMessage "none" - ModelReferenceCSMismatchMessage "none" UnknownTsInhSupMsg "warning" ModelReferenceDataLoggingMessage "warning" + ModelReferenceNoExplicitFinalValueMsg "none" ModelReferenceSymbolNameMessage "warning" ModelReferenceExtraNoncontSigs "error" StateNameClashWarn "warning" - SimStateInterfaceChecksumMismatchMsg "warning" - SimStateOlderReleaseMsg "error" + OperatingPointInterfaceChecksumMismatchMsg "warning" + NonCurrentReleaseOperatingPointMsg "error" + ChecksumConsistencyForSSReuse "none" + PregeneratedLibrarySubsystemCodeDiagnostic "warning" + MatchCodeGenerationContextForUpdateDiagram "none" InitInArrayFormatMsg "warning" - StrictBusMsg "None" + StrictBusMsg "ErrorLevel1" BusNameAdapt "WarnAndRepair" NonBusSignalsTreatedAsBus "none" - LoggingUnavailableSignals "error" + SymbolicDimMinMaxWarning "warning" + LossOfSymbolicDimsSimulationWarning "warning" + LossOfSymbolicDimsCodeGenerationWarning "error" + SymbolicDimsDataTypeCodeGenerationDiagnostic "error" BlockIODiagnostic "none" SFUnusedDataAndEventsDiag "warning" SFUnexpectedBacktrackingDiag "warning" SFInvalidInputDataAccessInChartInitDiag "warning" SFNoUnconditionalDefaultTransitionDiag "warning" SFTransitionOutsideNaturalParentDiag "warning" - SFUnconditionalTransitionShadowingDiag "warning" + SFUnreachableExecutionPathDiag "warning" + SFUndirectedBroadcastEventsDiag "warning" + SFTransitionActionBeforeConditionDiag "warning" + SFOutputUsedAsStateInMooreChartDiag "error" + SFTemporalDelaySmallerThanSampleTimeDiag "warning" + SFSelfTransitionDiag "warning" + SFExecutionAtInitializationDiag "none" + SFMachineParentedDataDiag "warning" + IntegerSaturationMsg "warning" + AllowedUnitSystems "all" + UnitsInconsistencyMsg "warning" + AllowAutomaticUnitConversions on + RCSCRenamedMsg "warning" + RCSCObservableMsg "warning" + ForceCombineOutputUpdateInSim off + UnitDatabase "" + UnderSpecifiedDimensionMsg "none" + DebugExecutionForFMUViaOutOfProcess off + ArithmeticOperatorsInVariantConditions "warning" + VariantConditionMismatch "none" } Simulink.HardwareCC { - $ObjectID 6 - Version "1.12.0" + $ObjectID 22 + Version "20.1.0" + DisabledProps [] + Description "" + Components [] ProdBitPerChar 8 ProdBitPerShort 16 ProdBitPerInt 32 ProdBitPerLong 32 + ProdBitPerLongLong 64 ProdBitPerFloat 32 ProdBitPerDouble 64 ProdBitPerPointer 32 + ProdBitPerSizeT 32 + ProdBitPerPtrDiffT 32 ProdLargestAtomicInteger "Char" ProdLargestAtomicFloat "None" ProdIntDivRoundTo "Undefined" ProdEndianess "Unspecified" ProdWordSize 32 ProdShiftRightIntArith on + ProdLongLongMode off ProdHWDeviceType "32-bit Generic" TargetBitPerChar 8 TargetBitPerShort 16 TargetBitPerInt 32 TargetBitPerLong 32 + TargetBitPerLongLong 64 TargetBitPerFloat 32 TargetBitPerDouble 64 TargetBitPerPointer 32 + TargetBitPerSizeT 32 + TargetBitPerPtrDiffT 32 TargetLargestAtomicInteger "Char" TargetLargestAtomicFloat "None" TargetShiftRightIntArith on + TargetLongLongMode off TargetIntDivRoundTo "Undefined" TargetEndianess "Unspecified" TargetWordSize 32 - TargetTypeEmulationWarnSuppressLevel 0 TargetPreprocMaxBitsSint 32 TargetPreprocMaxBitsUint 32 TargetHWDeviceType "Specified" TargetUnknown on ProdEqTarget on + UseEmbeddedCoderFeatures on + UseSimulinkCoderFeatures on + HardwareBoardFeatureSet "EmbeddedCoderHSP" } Simulink.ModelReferenceCC { - $ObjectID 7 - Version "1.12.0" + $ObjectID 23 + Version "20.1.0" + DisabledProps [] + Description "" + Components [] UpdateModelReferenceTargets "IfOutOfDateOrStructuralChange" + EnableRefExpFcnMdlSchedulingChecks on CheckModelReferenceTargetMessage "error" EnableParallelModelReferenceBuilds off ParallelModelReferenceErrorOnInvalidPool on ParallelModelReferenceMATLABWorkerInit "None" ModelReferenceNumInstancesAllowed "Multi" PropagateVarSize "Infer from blocks in model" + ModelDependencies "" ModelReferencePassRootInputsByReference on ModelReferenceMinAlgLoopOccurrences off PropagateSignalLabelsOutOfModel off SupportModelReferenceSimTargetCustomCode off } Simulink.SFSimCC { - $ObjectID 8 - Version "1.12.0" - SFSimEnableDebug on - SFSimOverflowDetection on + $ObjectID 24 + Version "20.1.0" + DisabledProps [] + Description "" + Components [] + SimCustomSourceCode "" + SimCustomHeaderCode "" + SimCustomInitializer "" + SimCustomTerminator "" + SimReservedNameArray [] + SimUserSources "" + SimUserIncludeDirs "" + SimUserLibraries "" + SimUserDefines "" + SimCustomCompilerFlags "" + SimCustomLinkerFlags "" SFSimEcho on - SimBlas on SimCtrlC on - SimExtrinsic on SimIntegrity on SimUseLocalCustomCode off SimParseCustomCode on - SimBuildMode "sf_incremental_build" + SimAnalyzeCustomCode off + SimGenImportedTypeDefs off + ModelFunctionsGlobalVisibility "on" + CompileTimeRecursionLimit 50 + EnableRuntimeRecursion on + MATLABDynamicMemAlloc on + MATLABDynamicMemAllocThreshold 65536 + CustomCodeFunctionArrayLayout [] + DefaultCustomCodeFunctionArrayLayout "NotSpecified" + CustomCodeUndefinedFunction "UseInterfaceOnly" + CustomCodeGlobalsAsFunctionIO off + SimTargetLang "C" + GPUAcceleration off + SimGPUMallocThreshold 200 + SimGPUStackLimitPerThread 1024 + SimGPUErrorChecks off + SimGPUCustomComputeCapability "" + SimGPUCompilerFlags "" + SimDLTargetLibrary "mkl-dnn" + SimDLAutoTuning on } Simulink.RTWCC { $BackupClass "Simulink.RTWCC" - $ObjectID 9 - Version "1.12.0" + $ObjectID 25 + Version "20.1.0" Array { Type "Cell" - Dimension 9 + Dimension 16 Cell "IncludeHyperlinkInReport" Cell "GenerateTraceInfo" Cell "GenerateTraceReport" @@ -402,52 +750,103 @@ Model { Cell "GenerateWebview" Cell "GenerateCodeMetricsReport" Cell "GenerateCodeReplacementReport" + Cell "PortableWordSizes" + Cell "GenerateMissedCodeReplacementReport" + Cell "GenerateErtSFunction" + Cell "CreateSILPILBlock" + Cell "CodeExecutionProfiling" + Cell "CodeProfilingSaveOptions" + Cell "CodeProfilingInstrumentation" PropName "DisabledProps" } + Description "" SystemTargetFile "grt.tlc" + HardwareBoard "None" + ShowCustomHardwareApp off + ShowEmbeddedHardwareApp off + TLCOptions "" GenCodeOnly off MakeCommand "make_rtw" GenerateMakefile on + PackageGeneratedCodeAndArtifacts off + PackageName "" TemplateMakefile "grt_default_tmf" + PostCodeGenCommand "" GenerateReport off - SaveLog off RTWVerbose on RetainRTWFile off + RTWBuildHooks [] ProfileTLC off TLCDebug off TLCCoverage off TLCAssert off - ProcessScriptMode "Default" - ConfigurationMode "Optimized" - ConfigAtBuild off RTWUseLocalCustomCode off RTWUseSimCustomCode off + CustomSourceCode "" + CustomHeaderCode "" + CustomInclude "" + CustomSource "" + CustomLibrary "" + CustomDefine "" + CustomBLASCallback "" + CustomLAPACKCallback "" + CustomFFTCallback "" + CustomInitializer "" + CustomTerminator "" + Toolchain "Automatically locate an installed toolchain" + BuildConfiguration "Faster Builds" + CustomToolchainOptions [] IncludeHyperlinkInReport off LaunchReport off + PortableWordSizes off + CreateSILPILBlock "None" + CodeExecutionProfiling off + CodeExecutionProfileVariable "executionProfile" + CodeProfilingSaveOptions "SummaryOnly" + CodeProfilingInstrumentation "off" + SILDebugging off TargetLang "C" + GenerateGPUCode "None" IncludeBusHierarchyInRTWFileBlockHierarchyMap off - IncludeERTFirstTime on GenerateTraceInfo off GenerateTraceReport off GenerateTraceReportSl off GenerateTraceReportSf off GenerateTraceReportEml off - GenerateCodeInfo off GenerateWebview off GenerateCodeMetricsReport off GenerateCodeReplacementReport off - RTWCompilerOptimization "Off" + GenerateMissedCodeReplacementReport off + RTWCompilerOptimization "off" + ObjectivePriorities [] + RTWCustomCompilerOptimizations "" CheckMdlBeforeBuild "Off" - CustomRebuildMode "OnUpdate" + SharedConstantsCachingThreshold 1024 + GPUKernelNamePrefix "" + GPUDeviceID -1 + GPUMallocMode "discrete" + GPUMallocThreshold 200 + GPUStackLimitPerThread 1024 + GPUcuBLAS on + GPUcuSOLVER on + GPUcuFFT on + GPUErrorChecks off + GPUComputeCapability "3.5" + GPUCustomComputeCapability "" + GPUCompilerFlags "" + DLTargetLibrary "none" + DLAutoTuning on + DLArmComputeVersion "19.05" + DLArmComputeArch "unspecified" Array { Type "Handle" Dimension 2 Simulink.CodeAppCC { - $ObjectID 10 - Version "1.12.0" + $ObjectID 26 + Version "20.1.0" Array { Type "Cell" - Dimension 21 + Dimension 28 Cell "IgnoreCustomStorageClasses" Cell "IgnoreTestpoints" Cell "InsertBlockDesc" @@ -469,110 +868,157 @@ Model { Cell "CustomSymbolStrTmpVar" Cell "CustomSymbolStrMacro" Cell "ReqsInCode" + Cell "BlockCommentType" + Cell "InternalIdentifier" + Cell "CustomSymbolStrModelFcn" + Cell "CustomSymbolStrUtil" + Cell "CustomSymbolStrEmxType" + Cell "CustomSymbolStrEmxFcn" + Cell "CustomUserTokenString" PropName "DisabledProps" } + Description "" + Components [] + Comment "" ForceParamTrailComments off GenerateComments on + CommentStyle "Auto" IgnoreCustomStorageClasses on IgnoreTestpoints off - IncHierarchyInIds off MaxIdLength 31 PreserveName off PreserveNameWithParent off ShowEliminatedStatement off - IncAutoGenComments off + OperatorAnnotations off SimulinkDataObjDesc off SFDataObjDesc off MATLABFcnDesc off - IncDataTypeInIds off MangleLength 1 + SharedChecksumLength 8 CustomSymbolStrGlobalVar "$R$N$M" - CustomSymbolStrType "$N$R$M" + CustomSymbolStrType "$N$R$M_T" CustomSymbolStrField "$N$M" CustomSymbolStrFcn "$R$N$M$F" + CustomSymbolStrModelFcn "$R$N" CustomSymbolStrFcnArg "rt$I$N$M" CustomSymbolStrBlkIO "rtb_$N$M" CustomSymbolStrTmpVar "$N$M" CustomSymbolStrMacro "$R$N$M" + CustomSymbolStrUtil "$N$C" + CustomSymbolStrEmxType "emxArray_$M$N" + CustomSymbolStrEmxFcn "emx$M$N" + CustomUserTokenString "" + CustomCommentsFcn "" DefineNamingRule "None" + DefineNamingFcn "" ParamNamingRule "None" + ParamNamingFcn "" SignalNamingRule "None" + SignalNamingFcn "" InsertBlockDesc off InsertPolySpaceComments off SimulinkBlockComments on + BlockCommentType "BlockPathComment" + StateflowObjectComments on MATLABSourceComments off EnableCustomComments off + InternalIdentifierFile "" + InternalIdentifier "Shortened" InlinedPrmAccess "Literals" ReqsInCode off UseSimReservedNames off + ReservedNameArray [] + EnumMemberNameClash "error" } Simulink.GRTTargetCC { $BackupClass "Simulink.TargetCC" - $ObjectID 11 - Version "1.12.0" + $ObjectID 27 + Version "20.1.0" Array { Type "Cell" - Dimension 16 + Dimension 19 Cell "GeneratePreprocessorConditionals" Cell "IncludeMdlTerminateFcn" - Cell "CombineOutputUpdateFcns" + Cell "PreserveStateflowLocalDataDimensions" Cell "SuppressErrorStatus" Cell "ERTCustomFileBanners" Cell "GenerateSampleERTMain" Cell "GenerateTestInterfaces" Cell "ModelStepFunctionPrototypeControlCompliant" Cell "CPPClassGenCompliant" - Cell "MultiInstanceERTCode" + Cell "PortableWordSizes" Cell "PurelyIntegerCode" Cell "SupportComplex" Cell "SupportAbsoluteTime" Cell "SupportContinuousTime" Cell "SupportNonInlinedSFcns" - Cell "PortableWordSizes" + Cell "GenerateAllocFcn" + Cell "ExistingSharedCode" + Cell "RemoveDisableFunc" + Cell "RemoveResetFunc" PropName "DisabledProps" } + Description "" + Components [] TargetFcnLib "ansi_tfl_table_tmw.mat" TargetLibSuffix "" TargetPreCompLibLocation "" - CodeReplacementLibrary "ANSI_C" + GenFloatMathFcnCalls "NOT IN USE" + TargetLangStandard "C89/C90 (ANSI)" + CodeReplacementLibrary "None" UtilityFuncGeneration "Auto" - ERTMultiwordTypeDef "System defined" - CodeExecutionProfiling off - ERTMultiwordLength 256 + MultiwordTypeDef "System defined" MultiwordLength 2048 + DynamicStringBufferSize 256 GenerateFullHeader on + InferredTypesCompatibility off + ExistingSharedCode "" GenerateSampleERTMain off GenerateTestInterfaces off - IsPILTarget off ModelReferenceCompliant on ParMdlRefBuildCompliant on CompOptLevelCompliant on ConcurrentExecutionCompliant on IncludeMdlTerminateFcn on - GeneratePreprocessorConditionals "Disable all" CombineOutputUpdateFcns off CombineSignalStateStructs off + GroupInternalDataByFunction off SuppressErrorStatus off - ERTFirstTimeCompliant off IncludeFileDelimiter "Auto" ERTCustomFileBanners off SupportAbsoluteTime on LogVarNameModifier "rt_" MatFileLogging on - MultiInstanceERTCode off + CodeInterfacePackaging "Nonreusable function" + PurelyIntegerCode off SupportNonFinite on SupportComplex on - PurelyIntegerCode off SupportContinuousTime on SupportNonInlinedSFcns on + RemoveDisableFunc off + RemoveResetFunc off SupportVariableSizeSignals off - EnableShiftOperators on ParenthesesLevel "Nominal" - PortableWordSizes off + CastingMode "Nominal" + MATLABClassNameForMDSCustomization "Simulink.SoftwareTarget.GRTCustomization" ModelStepFunctionPrototypeControlCompliant off - CPPClassGenCompliant off + CPPClassGenCompliant on AutosarCompliant off + MDXCompliant off GRTInterface on + GenerateAllocFcn off + UseToolchainInfoCompliant on + GenerateSharedConstants on + CoderGroups [] + AccessMethods [] + LookupTableObjectStructAxisOrder "1,2,3,4,..." + LUTObjectStructOrderExplicitValues "Size,Breakpoints,Table" + LUTObjectStructOrderEvenSpacing "Size,Breakpoints,Table" + ArrayLayout "Column-major" + UnsupportedSFcnMsg "error" + ERTHeaderFileRootName "$R$E" + ERTSourceFileRootName "$R$E" + ERTDataFileRootName "$R_data" UseMalloc off ExtMode off ExtModeStaticAlloc off @@ -580,39 +1026,91 @@ Model { ExtModeStaticAllocSize 1000000 ExtModeTransport 0 ExtModeMexFile "ext_comm" + ExtModeMexArgs "" ExtModeIntrfLevel "Level1" RTWCAPISignals off RTWCAPIParams off RTWCAPIStates off RTWCAPIRootIO off GenerateASAP2 off + MultiInstanceErrorCode "Error" } PropName "Components" } } + SlCovCC.ConfigComp { + $ObjectID 28 + Version "20.1.0" + DisabledProps [] + Description "Simulink Coverage Configuration Component" + Components [] + Name "Simulink Coverage" + CovEnable off + CovScope "EntireSystem" + CovIncludeTopModel on + RecordCoverage off + CovPath "/" + CovSaveName "covdata" + CovCompData "" + CovMetricSettings "dw" + CovFilter "" + CovHTMLOptions "" + CovNameIncrementing off + CovForceBlockReductionOff on + CovEnableCumulative on + CovSaveCumulativeToWorkspaceVar on + CovSaveSingleToWorkspaceVar on + CovCumulativeVarName "covCumulativeData" + CovCumulativeReport off + CovSaveOutputData on + CovOutputDir "slcov_output/$ModelName$" + CovDataFileName "$ModelName$_cvdata" + CovReportOnPause on + CovModelRefEnable "off" + CovModelRefExcluded "" + CovExternalEMLEnable off + CovSFcnEnable on + CovBoundaryAbsTol 1e-05 + CovBoundaryRelTol 0.01 + CovUseTimeInterval off + CovStartTime 0 + CovStopTime 0 + CovMcdcMode "Masking" + } PropName "Components" } Name "Configuration" CurrentDlgPage "Solver" - ConfigPrmDlgPosition [ 520, 285, 1400, 915 ] + ConfigPrmDlgPosition [ 520, 285, 1400, 915 ] + ExtraOptions "" } PropName "ConfigurationSets" } Simulink.ConfigSet { $PropName "ActiveConfigurationSet" - $ObjectID 1 + $ObjectID 17 + } + Object { + $PropName "DataTransfer" + $ObjectID 29 + $ClassName "Simulink.GlobalDataTransfer" + DefaultTransitionBetweenSyncTasks "Ensure deterministic transfer (maximum delay)" + DefaultTransitionBetweenAsyncTasks "Ensure data integrity only" + DefaultTransitionBetweenContTasks "Ensure deterministic transfer (minimum delay)" + DefaultExtrapolationMethodBetweenContTasks "None" } ExplicitPartitioning off BlockDefaults { ForegroundColor "black" BackgroundColor "white" DropShadow off - NamePlacement "normal" + NameLocation "bottom" FontName "Helvetica" FontSize 10 FontWeight "normal" FontAngle "normal" ShowName on + HideAutomaticName on BlockRotation 0 BlockMirror off } @@ -626,7 +1124,12 @@ Model { FontSize 10 FontWeight "normal" FontAngle "normal" + MarkupType "model" UseDisplayTextAsClickCallback off + AnnotationType "note_annotation" + FixedHeight off + FixedWidth off + Interpreter "off" } LineDefaults { FontName "Helvetica" @@ -634,6 +1137,25 @@ Model { FontWeight "normal" FontAngle "normal" } + MaskDefaults { + SelfModifiable "off" + IconFrame "on" + IconOpaque "opaque" + RunInitForIconRedraw "analyze" + IconRotate "none" + PortRotate "default" + IconUnits "autoscale" + } + MaskParameterDefaults { + Evaluate "on" + Tunable "on" + NeverSave "off" + Internal "off" + ReadOnly "off" + Enabled "on" + Visible "on" + ToolTip "on" + } BlockParameterDefaults { Block { BlockType Clock @@ -656,12 +1178,14 @@ Model { Block { BlockType Inport Port "1" + IconDisplay "Port number" OutputFunctionCall off OutMin "[]" OutMax "[]" OutDataTypeStr "Inherit: auto" LockScale off BusOutputAsStruct off + Unit "inherit" PortDimensions "-1" VarSizeSig "Inherit" SampleTime "-1" @@ -682,26 +1206,33 @@ Model { Block { BlockType Outport Port "1" + IconDisplay "Port number" OutMin "[]" OutMax "[]" OutDataTypeStr "Inherit: auto" LockScale off BusOutputAsStruct off + Unit "inherit" PortDimensions "-1" VarSizeSig "Inherit" SampleTime "-1" SignalType "auto" SamplingMode "auto" + EnsureOutportIsVirtual off SourceOfInitialOutputValue "Dialog" OutputWhenDisabled "held" InitialOutput "[]" + MustResolveToSignalObject off + OutputWhenUnConnected off + OutputWhenUnconnectedValue "0" + VectorParamsAs1DForOutWhenUnconnected on } Block { BlockType S-Function FunctionName "system" SFunctionModules "''" PortCounts "[]" - SFunctionDeploymentMode off + MultiThreadCoSim "auto" } Block { BlockType SignalSpecification @@ -710,6 +1241,7 @@ Model { OutDataTypeStr "Inherit: auto" LockScale off BusOutputAsStruct off + Unit "inherit" Dimensions "-1" VarSizeSig "Inherit" SampleTime "-1" @@ -722,39 +1254,62 @@ Model { Permissions "ReadWrite" PermitHierarchicalResolution "All" TreatAsAtomicUnit off - CheckFcnCallInpInsideContextMsg off + MinAlgLoopOccurrences off + ScheduleAs "Sample time" SystemSampleTime "-1" + RTWSystemCode "Auto" RTWFcnNameOpts "Auto" RTWFileNameOpts "Auto" + FunctionInterfaceSpec "void_void" + FunctionWithSeparateData off + MatchGraphicalInterface off RTWMemSecFuncInitTerm "Inherit from model" RTWMemSecFuncExecute "Inherit from model" RTWMemSecDataConstants "Inherit from model" RTWMemSecDataInternal "Inherit from model" RTWMemSecDataParameters "Inherit from model" SimViewingDevice off + ActiveForDiff off DataTypeOverride "UseLocalSettings" DataTypeOverrideAppliesTo "AllNumericTypes" MinMaxOverflowLogging "UseLocalSettings" + Opaque off + MaskHideContents off SFBlockType "NONE" Variant off - GeneratePreprocessorConditionals off + VariantControlMode "expression" + VariantActivationTime "update diagram" + AllowZeroVariantControls off + PropagateVariantConditions off + TreatAsGroupedWhenPropagatingVariantConditions on + ContentPreviewEnabled off + IsWebBlock off + IsInjectorSS off + Latency "0" + AutoFrameSizeCalculation off + IsWebBlockPanel off } Block { BlockType ToWorkspace VariableName "simulink_output" MaxDataPoints "1000" Decimation "1" - SampleTime "0" SaveFormat "Array" + Save2DSignal "3-D array (concatenate along third dimension)" FixptAsFi off NumInputs "1" + SampleTime "0" } } System { Name "OpenLoop" - Location [2, 93, 1900, 1047] + Location [0, 23, 1920, 1200] + SystemRect [0.000000, 0.000000, 0.000000, 0.000000] Open on - ModelBrowserVisibility off + PortBlocksUseCompactNotation off + SetExecutionDomain off + ExecutionDomainType "Deduce" + ModelBrowserVisibility on ModelBrowserWidth 200 ScreenColor "white" PaperOrientation "landscape" @@ -764,42 +1319,213 @@ Model { TiledPaperMargins [0.500000, 0.500000, 0.500000, 0.500000] TiledPageScale 1 ShowPageBoundaries off - ZoomFactor "243" + ZoomFactor "200" ReportName "simulink-default.rpt" - SIDHighWatermark "34" + SIDHighWatermark "69" + SimulinkSubDomain "Simulink" + Block { + BlockType SubSystem + Name "AirFoil Controller" + SID "59" + Ports [0, 1] + Position [30, 324, 130, 366] + ZOrder 2 + RequestExecContextInheritance off + System { + Name "AirFoil Controller" + Location [0, 23, 1920, 1200] + SystemRect [0.000000, 0.000000, 0.000000, 0.000000] + Open off + PortBlocksUseCompactNotation off + SetExecutionDomain off + ExecutionDomainType "Deduce" + ModelBrowserVisibility on + ModelBrowserWidth 200 + ScreenColor "white" + PaperOrientation "landscape" + PaperPositionMode "auto" + PaperType "usletter" + PaperUnits "inches" + TiledPaperMargins [0.500000, 0.500000, 0.500000, 0.500000] + TiledPageScale 1 + ShowPageBoundaries off + ZoomFactor "100" + SimulinkSubDomain "Simulink" + Block { + BlockType Constant + Name "Airfoil command" + SID "60" + Position [55, 35, 85, 65] + ZOrder -1 + Value "zeros(1,3)'" + } + Block { + BlockType Outport + Name "Out1" + SID "61" + Position [140, 43, 170, 57] + ZOrder -2 + } + Line { + ZOrder 1 + SrcBlock "Airfoil command" + SrcPort 1 + DstBlock "Out1" + DstPort 1 + } + } + } + Block { + BlockType SubSystem + Name "Cable deltaL controller" + SID "64" + Ports [0, 1] + Position [30, 384, 130, 426] + ZOrder 3 + RequestExecContextInheritance off + System { + Name "Cable deltaL controller" + Location [0, 23, 1920, 1200] + SystemRect [0.000000, 0.000000, 0.000000, 0.000000] + Open off + PortBlocksUseCompactNotation off + SetExecutionDomain off + ExecutionDomainType "Deduce" + ModelBrowserVisibility on + ModelBrowserWidth 200 + ScreenColor "white" + PaperOrientation "landscape" + PaperPositionMode "auto" + PaperType "usletter" + PaperUnits "inches" + TiledPaperMargins [0.500000, 0.500000, 0.500000, 0.500000] + TiledPageScale 1 + ShowPageBoundaries off + ZoomFactor "100" + SimulinkSubDomain "Simulink" + Block { + BlockType Constant + Name "Cable deltaL command" + SID "65" + Position [55, 35, 85, 65] + ZOrder -1 + Value "zeros(1,20)'" + } + Block { + BlockType Outport + Name "Out1" + SID "66" + Position [140, 43, 170, 57] + ZOrder -2 + } + Line { + ZOrder 1 + SrcBlock "Cable deltaL command" + SrcPort 1 + DstBlock "Out1" + DstPort 1 + } + } + } + Block { + BlockType SubSystem + Name "Cable deltaLdot controller" + SID "67" + Ports [0, 1] + Position [30, 444, 130, 486] + ZOrder 4 + RequestExecContextInheritance off + System { + Name "Cable deltaLdot controller" + Location [0, 23, 1920, 1200] + SystemRect [0.000000, 0.000000, 0.000000, 0.000000] + Open off + PortBlocksUseCompactNotation off + SetExecutionDomain off + ExecutionDomainType "Deduce" + ModelBrowserVisibility on + ModelBrowserWidth 200 + ScreenColor "white" + PaperOrientation "landscape" + PaperPositionMode "auto" + PaperType "usletter" + PaperUnits "inches" + TiledPaperMargins [0.500000, 0.500000, 0.500000, 0.500000] + TiledPageScale 1 + ShowPageBoundaries off + ZoomFactor "100" + SimulinkSubDomain "Simulink" + Block { + BlockType Constant + Name "Cable deltaLdot command" + SID "68" + Position [55, 35, 85, 65] + ZOrder -1 + Value "zeros(1,20)'" + } + Block { + BlockType Outport + Name "Out1" + SID "69" + Position [140, 43, 170, 57] + ZOrder -2 + } + Line { + ZOrder 1 + SrcBlock "Cable deltaLdot command" + SrcPort 1 + DstBlock "Out1" + DstPort 1 + } + } + } Block { BlockType Clock Name "Clock" SID "1" Position [30, 25, 50, 45] + ZOrder -1 } Block { BlockType SubSystem Name "FAST Nonlinear Wind Turbine" SID "2" - Ports [4, 1] - Position [200, 73, 420, 317] + Ports [7, 1] + Position [205, 73, 420, 497] + ZOrder -2 BackgroundColor "darkGreen" - MinAlgLoopOccurrences off - PropExecContextOutsideSubsystem off - RTWSystemCode "Auto" - FunctionWithSeparateData off - Opaque off RequestExecContextInheritance off - MaskHideContents off - MaskType "FAST Nonlinear Wind Turbine" - MaskDescription "This block contains the FAST S-Function." - MaskInitialization "clear FAST_SFunc\n" - MaskIconFrame on - MaskIconOpaque on - MaskIconRotate "none" - MaskPortRotate "default" - MaskIconUnits "autoscale" + Object { + $PropName "MaskObject" + $ObjectID 30 + $ClassName "Simulink.Mask" + Type "FAST Nonlinear Wind Turbine" + Description "This block contains the FAST S-Function." + Initialization "clear FAST_SFunc\n" + Object { + $PropName "DialogControls" + $ObjectID 31 + $ClassName "Simulink.dialog.Group" + Prompt "%" + Object { + $PropName "DialogControls" + $ObjectID 32 + $ClassName "Simulink.dialog.Text" + Prompt "%" + Name "DescTextVar" + } + Name "DescGroupVar" + } + } System { Name "FAST Nonlinear Wind Turbine" - Location [2, 93, 1900, 1047] + Location [0, 23, 1920, 1200] + SystemRect [0.000000, 0.000000, 0.000000, 0.000000] Open off - ModelBrowserVisibility off + PortBlocksUseCompactNotation off + SetExecutionDomain off + ExecutionDomainType "Deduce" + ModelBrowserVisibility on ModelBrowserWidth 200 ScreenColor "white" PaperOrientation "landscape" @@ -810,44 +1536,71 @@ Model { TiledPageScale 1 ShowPageBoundaries off ZoomFactor "243" + SimulinkSubDomain "Simulink" Block { BlockType Inport Name "Gen. Torque (Nm) and Power (W)" SID "3" Position [80, 43, 110, 57] - IconDisplay "Port number" + ZOrder -1 } Block { BlockType Inport Name "Yaw Position (rad) and Rate (rad/s)" SID "4" Position [80, 98, 110, 112] + ZOrder -2 Port "2" - IconDisplay "Port number" } Block { BlockType Inport Name "Blade Pitch Angles (rad)" SID "5" Position [80, 153, 110, 167] + ZOrder -3 Port "3" - IconDisplay "Port number" } Block { BlockType Inport Name "High-Speed Shaft Braking Fraction (-)" SID "31" Position [80, 208, 110, 222] + ZOrder -4 Port "4" - IconDisplay "Port number" + } + Block { + BlockType Inport + Name "AirFoil command (-)" + SID "44" + Position [80, 263, 110, 277] + ZOrder 4 + Port "5" + } + Block { + BlockType Inport + Name "Cable deltaL command (m)" + SID "62" + Position [80, 318, 110, 332] + ZOrder 5 + Port "6" + } + Block { + BlockType Inport + Name "Cable deltaLdot command (m/s)" + SID "63" + Position [80, 373, 110, 387] + ZOrder 6 + Port "7" } Block { BlockType Mux Name "Mux1" SID "9" - Ports [4, 1] - Position [335, 21, 340, 244] + Ports [7, 1] + Position [335, 23, 340, 407] + ZOrder -5 ShowName off + Inputs "7" DisplayOption "bar" } Block { @@ -856,16 +1609,20 @@ Model { SID "10" Ports [1, 1] Position [380, 96, 450, 174] + ZOrder -6 BackgroundColor "magenta" FunctionName "FAST_SFunc" Parameters "FAST_InputFileName, TMax, 0" + SFunctionDeploymentMode off EnableBusSupport off + SFcnIsStateOwnerBlock off } Block { BlockType SignalSpecification Name "Signal Specification1" SID "11" Position [200, 40, 300, 60] + ZOrder -7 OutDataTypeStr "double" Dimensions "2" SignalType "real" @@ -875,6 +1632,7 @@ Model { Name "Signal Specification2" SID "12" Position [200, 93, 300, 117] + ZOrder -8 OutDataTypeStr "double" Dimensions "2" SignalType "real" @@ -884,57 +1642,87 @@ Model { Name "OutData" SID "13" Position [500, 127, 530, 143] + ZOrder -9 BackgroundColor "yellow" - IconDisplay "Port number" } Line { + ZOrder 1 SrcBlock "Gen. Torque (Nm) and Power (W)" SrcPort 1 DstBlock "Signal Specification1" DstPort 1 } Line { + ZOrder 2 SrcBlock "S-Function" SrcPort 1 DstBlock "OutData" DstPort 1 } Line { + ZOrder 3 SrcBlock "Mux1" SrcPort 1 + Points [10, 0; 0, -80] DstBlock "S-Function" DstPort 1 } Line { + ZOrder 4 SrcBlock "Blade Pitch Angles (rad)" SrcPort 1 DstBlock "Mux1" DstPort 3 } Line { + ZOrder 5 SrcBlock "Yaw Position (rad) and Rate (rad/s)" SrcPort 1 DstBlock "Signal Specification2" DstPort 1 } Line { + ZOrder 6 SrcBlock "Signal Specification1" SrcPort 1 DstBlock "Mux1" DstPort 1 } Line { + ZOrder 7 SrcBlock "Signal Specification2" SrcPort 1 DstBlock "Mux1" DstPort 2 } Line { + ZOrder 8 SrcBlock "High-Speed Shaft Braking Fraction (-)" SrcPort 1 DstBlock "Mux1" DstPort 4 } + Line { + ZOrder 11 + SrcBlock "AirFoil command (-)" + SrcPort 1 + DstBlock "Mux1" + DstPort 5 + } + Line { + ZOrder 12 + SrcBlock "Cable deltaL command (m)" + SrcPort 1 + DstBlock "Mux1" + DstPort 6 + } + Line { + ZOrder 13 + SrcBlock "Cable deltaLdot command (m/s)" + SrcPort 1 + DstBlock "Mux1" + DstPort 7 + } } } Block { @@ -943,18 +1731,17 @@ Model { SID "32" Ports [0, 1] Position [30, 264, 130, 306] - MinAlgLoopOccurrences off - PropExecContextOutsideSubsystem off - RTWSystemCode "Auto" - FunctionWithSeparateData off - Opaque off + ZOrder -3 RequestExecContextInheritance off - MaskHideContents off System { Name "High-Speed Shaft Brake" - Location [433, 403, 916, 674] + Location [0, 23, 1920, 1200] + SystemRect [0.000000, 0.000000, 0.000000, 0.000000] Open off - ModelBrowserVisibility off + PortBlocksUseCompactNotation off + SetExecutionDomain off + ExecutionDomainType "Deduce" + ModelBrowserVisibility on ModelBrowserWidth 200 ScreenColor "white" PaperOrientation "landscape" @@ -965,11 +1752,13 @@ Model { TiledPageScale 1 ShowPageBoundaries off ZoomFactor "100" + SimulinkSubDomain "Simulink" Block { BlockType Constant Name "High-Speed Shaft Braking Fraction" SID "33" Position [55, 35, 85, 65] + ZOrder -1 Value "0" } Block { @@ -977,9 +1766,10 @@ Model { Name "Out1" SID "34" Position [140, 43, 170, 57] - IconDisplay "Port number" + ZOrder -2 } Line { + ZOrder 1 SrcBlock "High-Speed Shaft Braking Fraction" SrcPort 1 DstBlock "Out1" @@ -993,18 +1783,17 @@ Model { SID "16" Ports [0, 1] Position [30, 204, 130, 246] - MinAlgLoopOccurrences off - PropExecContextOutsideSubsystem off - RTWSystemCode "Auto" - FunctionWithSeparateData off - Opaque off + ZOrder -4 RequestExecContextInheritance off - MaskHideContents off System { Name "Pitch Controller" - Location [433, 403, 916, 538] + Location [0, 23, 1920, 1200] + SystemRect [0.000000, 0.000000, 0.000000, 0.000000] Open off - ModelBrowserVisibility off + PortBlocksUseCompactNotation off + SetExecutionDomain off + ExecutionDomainType "Deduce" + ModelBrowserVisibility on ModelBrowserWidth 200 ScreenColor "white" PaperOrientation "landscape" @@ -1015,11 +1804,13 @@ Model { TiledPageScale 1 ShowPageBoundaries off ZoomFactor "100" + SimulinkSubDomain "Simulink" Block { BlockType Constant Name "Blade Pitch Angles" SID "17" Position [55, 35, 85, 65] + ZOrder -1 Value "zeros(1,3)'" } Block { @@ -1027,9 +1818,10 @@ Model { Name "Out1" SID "18" Position [140, 43, 170, 57] - IconDisplay "Port number" + ZOrder -2 } Line { + ZOrder 1 SrcBlock "Blade Pitch Angles" SrcPort 1 DstBlock "Out1" @@ -1043,6 +1835,7 @@ Model { SID "19" Ports [1] Position [70, 20, 130, 50] + ZOrder -5 VariableName "Time" MaxDataPoints "inf" SampleTime "-1" @@ -1053,18 +1846,17 @@ Model { SID "20" Ports [0, 1] Position [30, 84, 130, 126] - MinAlgLoopOccurrences off - PropExecContextOutsideSubsystem off - RTWSystemCode "Auto" - FunctionWithSeparateData off - Opaque off + ZOrder -6 RequestExecContextInheritance off - MaskHideContents off System { Name "Torque Controller" - Location [433, 403, 919, 560] + Location [0, 23, 1920, 1200] + SystemRect [0.000000, 0.000000, 0.000000, 0.000000] Open off - ModelBrowserVisibility off + PortBlocksUseCompactNotation off + SetExecutionDomain off + ExecutionDomainType "Deduce" + ModelBrowserVisibility on ModelBrowserWidth 200 ScreenColor "white" PaperOrientation "landscape" @@ -1075,11 +1867,13 @@ Model { TiledPageScale 1 ShowPageBoundaries off ZoomFactor "100" + SimulinkSubDomain "Simulink" Block { BlockType Constant Name "Electrical Power" SID "21" Position [55, 85, 85, 115] + ZOrder -1 Value "1000" } Block { @@ -1087,6 +1881,7 @@ Model { Name "Generator Torque" SID "22" Position [55, 30, 85, 60] + ZOrder -2 Value "1000" } Block { @@ -1095,6 +1890,7 @@ Model { SID "23" Ports [2, 1] Position [200, 51, 205, 89] + ZOrder -3 ShowName off Inputs "2" DisplayOption "bar" @@ -1104,15 +1900,17 @@ Model { Name "Out1" SID "24" Position [255, 63, 285, 77] - IconDisplay "Port number" + ZOrder -4 } Line { + ZOrder 1 SrcBlock "Mux" SrcPort 1 DstBlock "Out1" DstPort 1 } Line { + ZOrder 2 SrcBlock "Generator Torque" SrcPort 1 Points [45, 0; 0, 15] @@ -1120,6 +1918,7 @@ Model { DstPort 1 } Line { + ZOrder 3 SrcBlock "Electrical Power" SrcPort 1 Points [45, 0; 0, -20] @@ -1134,18 +1933,17 @@ Model { SID "25" Ports [0, 1] Position [30, 144, 130, 186] - MinAlgLoopOccurrences off - PropExecContextOutsideSubsystem off - RTWSystemCode "Auto" - FunctionWithSeparateData off - Opaque off + ZOrder -7 RequestExecContextInheritance off - MaskHideContents off System { Name "Yaw Controller" - Location [433, 403, 907, 565] + Location [0, 23, 1920, 1200] + SystemRect [0.000000, 0.000000, 0.000000, 0.000000] Open off - ModelBrowserVisibility off + PortBlocksUseCompactNotation off + SetExecutionDomain off + ExecutionDomainType "Deduce" + ModelBrowserVisibility on ModelBrowserWidth 200 ScreenColor "white" PaperOrientation "landscape" @@ -1156,12 +1954,14 @@ Model { TiledPageScale 1 ShowPageBoundaries off ZoomFactor "100" + SimulinkSubDomain "Simulink" Block { BlockType Mux Name "Mux" SID "26" Ports [2, 1] Position [190, 56, 195, 94] + ZOrder -1 ShowName off Inputs "2" DisplayOption "bar" @@ -1171,6 +1971,7 @@ Model { Name "Yaw Position" SID "27" Position [45, 30, 75, 60] + ZOrder -2 Value "0" } Block { @@ -1178,6 +1979,7 @@ Model { Name "Yaw rate" SID "28" Position [45, 90, 75, 120] + ZOrder -3 Value "0" } Block { @@ -1185,15 +1987,17 @@ Model { Name "Out1" SID "29" Position [245, 68, 275, 82] - IconDisplay "Port number" + ZOrder -4 } Line { + ZOrder 1 SrcBlock "Mux" SrcPort 1 DstBlock "Out1" DstPort 1 } Line { + ZOrder 2 SrcBlock "Yaw Position" SrcPort 1 Points [45, 0; 0, 20] @@ -1201,6 +2005,7 @@ Model { DstPort 1 } Line { + ZOrder 3 SrcBlock "Yaw rate" SrcPort 1 Points [45, 0; 0, -20] @@ -1214,7 +2019,8 @@ Model { Name "qdotdot_out" SID "30" Ports [1] - Position [485, 183, 555, 207] + Position [485, 213, 555, 237] + ZOrder -8 BackgroundColor "yellow" ShowName off VariableName "OutData" @@ -1222,40 +2028,68 @@ Model { SampleTime "-1" } Line { + ZOrder 1 SrcBlock "Clock" SrcPort 1 DstBlock "To Workspace" DstPort 1 } Line { + ZOrder 2 SrcBlock "FAST Nonlinear Wind Turbine" SrcPort 1 + Points [28, 0; 0, -60] DstBlock "qdotdot_out" DstPort 1 } Line { + ZOrder 3 SrcBlock "Torque Controller" SrcPort 1 DstBlock "FAST Nonlinear Wind Turbine" DstPort 1 } Line { + ZOrder 4 SrcBlock "Yaw Controller" SrcPort 1 DstBlock "FAST Nonlinear Wind Turbine" DstPort 2 } Line { + ZOrder 5 SrcBlock "Pitch Controller" SrcPort 1 DstBlock "FAST Nonlinear Wind Turbine" DstPort 3 } Line { + ZOrder 6 SrcBlock "High-Speed Shaft Brake" SrcPort 1 DstBlock "FAST Nonlinear Wind Turbine" DstPort 4 } + Line { + ZOrder 7 + SrcBlock "AirFoil Controller" + SrcPort 1 + DstBlock "FAST Nonlinear Wind Turbine" + DstPort 5 + } + Line { + ZOrder 8 + SrcBlock "Cable deltaL controller" + SrcPort 1 + DstBlock "FAST Nonlinear Wind Turbine" + DstPort 6 + } + Line { + ZOrder 9 + SrcBlock "Cable deltaLdot controller" + SrcPort 1 + DstBlock "FAST Nonlinear Wind Turbine" + DstPort 7 + } } } diff --git a/glue-codes/simulink/examples/Test01_SIG.mdl b/glue-codes/simulink/examples/Test01_SIG.mdl index c1bb4ac284..4747c02197 100644 --- a/glue-codes/simulink/examples/Test01_SIG.mdl +++ b/glue-codes/simulink/examples/Test01_SIG.mdl @@ -1,17 +1,36 @@ Model { Name "Test01_SIG" - Version 7.9 - MdlSubVersion 0 + Version 10.2 + SavedCharacterEncoding "UTF-8" + ModelUUID "b371e35e-f40b-4371-9a1f-d80b7f89554f" GraphicalInterface { NumRootInports 0 NumRootOutports 0 ParameterArgumentNames "" - ComputedModelVersion "1.81" + ComputedModelVersion "18.1" NumModelReferences 0 NumTestPointedSignals 0 + NumProvidedFunctions 0 + NumRequiredFunctions 0 + NumResetEvents 0 + HasInitializeEvent 0 + HasTerminateEvent 0 + PreCompExecutionDomainType "Unset" + IsExportFunctionModel 0 + IsArchitectureModel 0 + IsAUTOSARArchitectureModel 0 + NumParameterArguments 0 + NumExternalFileReferences 0 + OrderedModelArguments 1 } - SavedCharacterEncoding "windows-1252" - SaveDefaultBlockParams on + LogicAnalyzerPlugin "on" + SLCCPlugin "on" + DiagnosticSuppressor "on" + AnimationPlugin "on" + slcheck_filter_plugin "on" + WebScopes_FoundationPlugin "on" + NotesPlugin "on" + EnableAccessToBaseWorkspace on ScopeRefreshTime 0.035000 OverrideScopeRefreshTime on DisableAllScopes off @@ -21,22 +40,245 @@ Model { MinMaxOverflowArchiveMode "Overwrite" FPTRunName "Run 1" MaxMDLFileLineLength 120 + LastSavedArchitecture "maci64" + Object { + $PropName "BdWindowsInfo" + $ObjectID 1 + $ClassName "Simulink.BDWindowsInfo" + Array { + Type "Simulink.WindowInfo" + Dimension 2 + Object { + $ObjectID 2 + IsActive [0] + Location [79.0, 88.0, 899.0, 590.0] + Object { + $PropName "ModelBrowserInfo" + $ObjectID 3 + $ClassName "Simulink.ModelBrowserInfo" + Visible [0] + DockPosition "Left" + Width [50] + Height [50] + Filter [9] + Minimized "Unset" + } + Object { + $PropName "ExplorerBarInfo" + $ObjectID 4 + $ClassName "Simulink.ExplorerBarInfo" + Visible [1] + } + Object { + $PropName "EditorsInfo" + $ObjectID 5 + $ClassName "Simulink.EditorInfo" + IsActive [1] + IsTabbed [1] + ViewObjType "SimulinkSubsys" + LoadSaveID "20" + Extents [861.0, 361.0] + ZoomFactor [1.0] + Offset [-20.234375, 11.375] + SceneRectInView [-20.234375, 11.375, 861.0, 361.0] + } + Array { + Type "Simulink.DockComponentInfo" + Dimension 2 + Object { + $ObjectID 6 + Type "GLUE2:PropertyInspector" + ID "Property Inspector" + Visible [0] + CreateCallback "" + UserData "" + Floating [0] + DockPosition "Right" + Width [640] + Height [480] + Minimized "Unset" + } + Object { + $ObjectID 7 + Type "Simulink:Editor:ReferencedFiles" + ID "Referenced Files" + Visible [0] + CreateCallback "" + UserData "{\"filterShowRefModels\":\"true\",\"filterShowRefSubs\":\"true\",\"filterShowOnlyDirtyFiles\":\"false\"}\n" + Floating [0] + DockPosition "Left" + Width [640] + Height [480] + Minimized "Unset" + } + PropName "DockComponentsInfo" + } + WindowState "AAAA/wAAAAD9AAAAAgAAAAAAAAC9AAAB+PwCAAAABPsAAAAWAEQAbwBjAGsAVwBpAGQAZwBlAHQAMwEAAAAxAAAB+AAAAAAAAAAA+wA" + "AABYARABvAGMAawBXAGkAZABnAGUAdAA0AAAAAAD/////AAAAAAAAAAD7AAAAUgBHAEwAVQBFADIAIAB0AHIAZQBlACAAYwBvAG0AcABvAG4AZQBuAHQA" + "LwBHAEwAVQBFADIAIAB0AHIAZQBlACAAYwBvAG0AcABvAG4AZQBuAHQAAAAAAP////8AAABrAP////sAAABgAFMAaQBtAHUAbABpAG4AawA6AEUAZABpA" + "HQAbwByADoAUgBlAGYAZQByAGUAbgBjAGUAZABGAGkAbABlAHMALwBSAGUAZgBlAHIAZQBuAGMAZQBkACAARgBpAGwAZQBzAAAAAAD/////AAAAjwD///" + "8AAAABAAAAAAAAAAD8AgAAAAH7AAAAVABHAEwAVQBFADIAOgBQAHIAbwBwAGUAcgB0AHkASQBuAHMAcABlAGMAdABvAHIALwBQAHIAbwBwAGUAcgB0AHk" + "AIABJAG4AcwBwAGUAYwB0AG8AcgAAAAAA/////wAAAawA////AAADgwAAAaYAAAABAAAAAgAAAAEAAAAC/AAAAAA=" + Array { + Type "Cell" + Dimension 0 + PropName "PersistedApps" + } + WindowUuid "63834ef1-ca0c-4004-a4af-a47eb8b2d18a" + } + Object { + $ObjectID 8 + IsActive [1] + Location [0.0, 23.0, 1920.0, 1177.0] + Object { + $PropName "ModelBrowserInfo" + $ObjectID 9 + $ClassName "Simulink.ModelBrowserInfo" + Visible [0] + DockPosition "Left" + Width [50] + Height [50] + Filter [9] + Minimized "Unset" + } + Object { + $PropName "ExplorerBarInfo" + $ObjectID 10 + $ClassName "Simulink.ExplorerBarInfo" + Visible [1] + } + Array { + Type "Simulink.EditorInfo" + Dimension 5 + Object { + $ObjectID 11 + IsActive [1] + IsTabbed [1] + ViewObjType "SimulinkTopLevel" + LoadSaveID "0" + Extents [1882.0, 948.0] + ZoomFactor [1.25] + Offset [-319.50705128205141, -124.89743589743591] + SceneRectInView [-319.50705128205141, -124.89743589743591, 1505.6, 758.4] + } + Object { + $ObjectID 12 + IsActive [0] + IsTabbed [0] + ViewObjType "SimulinkSubsys" + LoadSaveID "69" + Extents [1882.0, 948.0] + ZoomFactor [1.0] + Offset [-842.30078125, -417.0] + SceneRectInView [-842.30078125, -417.0, 1882.0, 948.0] + } + Object { + $ObjectID 13 + IsActive [0] + IsTabbed [0] + ViewObjType "SimulinkSubsys" + LoadSaveID "77" + Extents [1882.0, 948.0] + ZoomFactor [1.0] + Offset [-847.06640625, -417.0] + SceneRectInView [-847.06640625, -417.0, 1882.0, 948.0] + } + Object { + $ObjectID 14 + IsActive [0] + IsTabbed [0] + ViewObjType "SimulinkSubsys" + LoadSaveID "74" + Extents [1882.0, 948.0] + ZoomFactor [1.0] + Offset [-839.390625, -417.0] + SceneRectInView [-839.390625, -417.0, 1882.0, 948.0] + } + Object { + $ObjectID 15 + IsActive [0] + IsTabbed [0] + ViewObjType "SimulinkSubsys" + LoadSaveID "2" + Extents [1882.0, 948.0] + ZoomFactor [1.56] + Offset [-328.14653445512818, -128.84615384615381] + SceneRectInView [-328.14653445512818, -128.84615384615381, 1206.4102564102564, 607.69230769230762] + } + PropName "EditorsInfo" + } + Array { + Type "Simulink.DockComponentInfo" + Dimension 2 + Object { + $ObjectID 16 + Type "GLUE2:PropertyInspector" + ID "Property Inspector" + Visible [0] + CreateCallback "" + UserData "" + Floating [0] + DockPosition "Right" + Width [640] + Height [480] + Minimized "Unset" + } + Object { + $ObjectID 17 + Type "Simulink:Editor:ReferencedFiles" + ID "Referenced Files" + Visible [0] + CreateCallback "" + UserData "{\"filterShowRefModels\":\"true\",\"filterShowRefSubs\":\"true\",\"filterShowOnlyDirtyFiles\":\"false\"}\n" + Floating [0] + DockPosition "Left" + Width [640] + Height [480] + Minimized "Unset" + } + PropName "DockComponentsInfo" + } + WindowState "AAAA/wAAAAD9AAAAAgAAAAAAAAC9AAAB+PwCAAAABPsAAAAWAEQAbwBjAGsAVwBpAGQAZwBlAHQAMwEAAAAxAAAB+AAAAAAAAAAA+wA" + "AABYARABvAGMAawBXAGkAZABnAGUAdAA0AAAAAAD/////AAAAAAAAAAD7AAAAUgBHAEwAVQBFADIAIAB0AHIAZQBlACAAYwBvAG0AcABvAG4AZQBuAHQA" + "LwBHAEwAVQBFADIAIAB0AHIAZQBlACAAYwBvAG0AcABvAG4AZQBuAHQAAAAAAP////8AAABrAP////sAAABgAFMAaQBtAHUAbABpAG4AawA6AEUAZABpA" + "HQAbwByADoAUgBlAGYAZQByAGUAbgBjAGUAZABGAGkAbABlAHMALwBSAGUAZgBlAHIAZQBuAGMAZQBkACAARgBpAGwAZQBzAAAAAAD/////AAAAjwD///" + "8AAAABAAAAAAAAAAD8AgAAAAH7AAAAVABHAEwAVQBFADIAOgBQAHIAbwBwAGUAcgB0AHkASQBuAHMAcABlAGMAdABvAHIALwBQAHIAbwBwAGUAcgB0AHk" + "AIABJAG4AcwBwAGUAYwB0AG8AcgAAAAAA/////wAAAawA////AAAHgAAAA/EAAAABAAAAAgAAAAEAAAAC/AAAAAA=" + Array { + Type "Cell" + Dimension 0 + PropName "PersistedApps" + } + WindowUuid "bab16431-ffee-491d-ba15-9a53a2f6dc95" + } + PropName "WindowsInfo" + } + BDUuid "5114d2ad-db39-4fba-bc57-fd8f10fa3622" + } + HideAutomaticNames on + SequenceViewerTimePrecision 3 + SequenceViewerHistory 1000 Created "Mon Feb 09 16:59:21 2004" Creator "bjonkman" UpdateHistory "UpdateHistoryNever" ModifiedByFormat "%" - LastModifiedBy "bjonkman" + LastModifiedBy "aplatt" ModifiedDateFormat "%" - LastModifiedDate "Thu Feb 26 12:32:59 2015" - RTWModifiedTimeStamp 346854631 - ModelVersionFormat "1.%" - ConfigurationManager "None" + LastModifiedDate "Tue Mar 02 18:07:58 2021" + RTWModifiedTimeStamp 536609274 + ModelVersionFormat "%" SampleTimeColors off SampleTimeAnnotations off LibraryLinkDisplay "none" WideLines off ShowLineDimensions off ShowPortDataTypes off + ShowAllPropagatedSignalLabels off + PortDataTypeDisplayFormat "AliasTypeOnly" + ShowEditTimeErrors on + ShowEditTimeWarnings on + ShowEditTimeAdvisorChecks off + ShowPortUnits off ShowDesignRanges off ShowLoopsOnError on IgnoreBidirectionalLines off @@ -44,17 +286,34 @@ Model { ShowTestPointIcons on ShowSignalResolutionIcons on ShowViewerIcons on - SortedOrder off - ExecutionContextIcon off + VariantCondition off ShowLinearizationAnnotations on + ShowVisualizeInsertedRTB on + ShowMarkup on BlockNameDataTip off BlockParametersDataTip off BlockDescriptionStringDataTip off + BlockVariantConditionDataTip off ToolBar on StatusBar on BrowserShowLibraryLinks off + FunctionConnectors off BrowserLookUnderMasks off + MultiThreadCoSim "on" SimulationMode "normal" + SILPILModeSetting "automated" + SILPILSystemUnderTest "topmodel" + SILPILSimulationModeTopModel "normal" + SILPILSimulationModeModelRef "normal" + SimTabSimulationMode "normal" + CodeVerificationMode "software-in-the-loop (sil)" + PauseTimes "5" + NumberOfSteps 1 + SnapshotBufferSize 10 + SnapshotInterval 10 + NumberOfLastSnapshots 0 + EnablePacing off + PacingRate 1 LinearizationMsg "none" Profile off ParamWorkspaceSource "MATLABWorkspace" @@ -62,26 +321,31 @@ Model { AccelTemplateMakefile "accel_default_tmf" AccelMakeCommand "make_rtw" TryForcingSFcnDF off - RecordCoverage off - CovPath "/" - CovSaveName "covdata" - CovMetricSettings "dw" - CovNameIncrementing off - CovHtmlReporting on - CovForceBlockReductionOff on - covSaveCumulativeToWorkspaceVar on - CovSaveSingleToWorkspaceVar on - CovCumulativeVarName "covCumulativeData" - CovCumulativeReport off - CovReportOnPause on - CovModelRefEnable "Off" - CovExternalEMLEnable off + Object { + $PropName "DataLoggingOverride" + $ObjectID 18 + $ClassName "Simulink.SimulationData.ModelLoggingInfo" + model_ "Test01_SIG" + Array { + Type "Cell" + Dimension 1 + Cell "Test01_SIG" + PropName "logAsSpecifiedByModels_" + } + Array { + Type "Cell" + Dimension 1 + Cell "" + PropName "logAsSpecifiedByModelsSSIDs_" + } + } ExtModeBatchMode off ExtModeEnableFloating on ExtModeTrigType "manual" ExtModeTrigMode "normal" ExtModeTrigPort "1" ExtModeTrigElement "any" + ExtModeTrigSignalOutputPortIndex 0 ExtModeTrigDuration 1000 ExtModeTrigDurationFloating "auto" ExtModeTrigHoldOff 0 @@ -97,27 +361,33 @@ Model { ExtModeSkipDownloadWhenConnect off ExtModeLogAll on ExtModeAutoUpdateStatusClock on - BufferReuse on + VariantFading on ShowModelReferenceBlockVersion off ShowModelReferenceBlockIO off + OrderedModelArguments on Array { Type "Handle" Dimension 1 Simulink.ConfigSet { - $ObjectID 1 - Version "1.12.0" + $ObjectID 19 + Version "20.1.0" + DisabledProps [] + Description "" Array { Type "Handle" - Dimension 8 + Dimension 9 Simulink.SolverCC { - $ObjectID 2 - Version "1.12.0" + $ObjectID 20 + Version "20.1.0" + DisabledProps [] + Description "" + Components [] StartTime "0.0" StopTime "TMax" AbsTol "auto" + AutoScaleAbsTol on FixedStep "DT" InitialStep "auto" - MaxNumMinSteps "-1" MaxOrder 5 ZcThreshold "auto" ConsecutiveZCsStepRelTol "10*128*eps" @@ -128,25 +398,32 @@ Model { MinStep "auto" MaxConsecutiveMinStep "1" RelTol "1e-3" - SolverMode "Auto" - EnableConcurrentExecution off + EnableMultiTasking on ConcurrentTasks off - Solver "ode4" SolverName "ode4" SolverJacobianMethodControl "auto" ShapePreserveControl "DisableAll" ZeroCrossControl "UseLocalSettings" ZeroCrossAlgorithm "Nonadaptive" AlgebraicLoopSolver "TrustRegion" + SolverInfoToggleStatus off + IsAutoAppliedInSIP off SolverResetMethod "Fast" PositivePriorityOrder off AutoInsertRateTranBlk off SampleTimeConstraint "Unconstrained" InsertRTBMode "Whenever possible" + SampleTimeProperty [] + DecoupledContinuousIntegration off + MinimalZcImpactIntegration off + ODENIntegrationMethod "ode3" } Simulink.DataIOCC { - $ObjectID 3 - Version "1.12.0" + $ObjectID 21 + Version "20.1.0" + DisabledProps [] + Description "" + Components [] Decimation "1" ExternalInput "[t, u]" FinalStateName "xFinal" @@ -156,7 +433,7 @@ Model { LoadExternalInput off LoadInitialState off SaveFinalState off - SaveCompleteFinalSimState off + SaveOperatingPoint off SaveFormat "Array" SignalLoggingSaveFormat "ModelDataLogs" SaveOutput off @@ -164,6 +441,9 @@ Model { SignalLogging on DSMLogging on InspectSignalLogs off + VisualizeSimOutput on + StreamToWorkspace off + StreamVariableName "streamout" SaveTime off ReturnWorkspaceOutputs off StateSaveName "xout" @@ -175,57 +455,101 @@ Model { OutputTimes "[]" ReturnWorkspaceOutputsName "out" Refine "1" + LoggingToFile off + DatasetSignalFormat "timeseries" + LoggingFileName "out.mat" + LoggingIntervals "[-inf, inf]" } Simulink.OptimizationCC { - $ObjectID 4 - Version "1.12.0" + $ObjectID 22 + Version "20.1.0" + Array { + Type "Cell" + Dimension 9 + Cell "BooleansAsBitfields" + Cell "PassReuseOutputArgsAs" + Cell "PassReuseOutputArgsThreshold" + Cell "ZeroExternalMemoryAtStartup" + Cell "ZeroInternalMemoryAtStartup" + Cell "OptimizeModelRefInitCode" + Cell "NoFixptDivByZeroProtection" + Cell "UseSpecifiedMinMax" + Cell "EfficientTunableParamExpr" + PropName "DisabledProps" + } + Description "" + Components [] BlockReduction on BooleanDataType on ConditionallyExecuteInputs on - InlineParams off - UseIntDivNetSlope off + DefaultParameterBehavior "Tunable" + UseDivisionForNetSlopeComputation "off" + GainParamInheritBuiltInType off UseFloatMulNetSlope off + DefaultUnderspecifiedDataType "double" UseSpecifiedMinMax off InlineInvariantSignals off OptimizeBlockIOStorage on BufferReuse on EnhancedBackFolding off + CachingGlobalReferences off + GlobalBufferReuse on StrengthReduction off + AdvancedOptControl "" ExpressionFolding on BooleansAsBitfields off BitfieldContainerType "uint_T" + BitwiseOrLogicalOp "Same as modeled" EnableMemcpy on MemcpyThreshold 64 PassReuseOutputArgsAs "Structure reference" + PassReuseOutputArgsThreshold 12 ExpressionDepthLimit 2147483647 - FoldNonRolledExpr on LocalBlockOutputs on RollThreshold 5 - SystemCodeInlineAuto off StateBitsets off DataBitsets off - UseTempVars off + ActiveStateOutputEnumStorageType "Native Integer" ZeroExternalMemoryAtStartup on ZeroInternalMemoryAtStartup on InitFltsAndDblsToZero off NoFixptDivByZeroProtection off EfficientFloat2IntCast off EfficientMapNaN2IntZero on - OptimizeModelRefInitCode off LifeSpan "inf" MaxStackSize "Inherit from target" BufferReusableBoundary on - SimCompilerOptimization "Off" + SimCompilerOptimization "off" AccelVerboseBuild off - ParallelExecutionInRapidAccelerator on + OptimizeBlockOrder "off" + OptimizeDataStoreBuffers on + BusAssignmentInplaceUpdate on + DifferentSizesBufferReuse off + UseRowMajorAlgorithm off + OptimizationLevel "level2" + OptimizationPriority "Balanced" + OptimizationCustomize on + LabelGuidedReuse off + MultiThreadedLoops off + DenormalBehavior "GradualUnderflow" + EfficientTunableParamExpr off } Simulink.DebuggingCC { - $ObjectID 5 - Version "1.12.0" + $ObjectID 23 + Version "20.1.0" + Array { + Type "Cell" + Dimension 1 + Cell "UseOnlyExistingSharedCode" + PropName "DisabledProps" + } + Description "" + Components [] RTPrefix "error" ConsistencyChecking "none" ArrayBoundsChecking "none" SignalInfNanChecking "none" + StringTruncationChecking "error" SignalRangeChecking "none" ReadBeforeWriteMsg "UseLocalSettings" WriteAfterWriteMsg "UseLocalSettings" @@ -248,12 +572,12 @@ Model { IgnoredZcDiagnostic "warning" SolverPrmCheckMsg "none" InheritedTsInSrcMsg "warning" - DiscreteInheritContinuousMsg "warning" MultiTaskDSMMsg "warning" MultiTaskCondExecSysMsg "none" MultiTaskRateTransMsg "error" SingleTaskRateTransMsg "none" TasksWithSamePriorityMsg "warning" + ExportedTasksRateTransMsg "none" SigSpecEnsureSampleTimeMsg "warning" CheckMatrixSingularityMsg "none" IntegerOverflowMsg "warning" @@ -269,236 +593,465 @@ Model { UnderSpecifiedDataTypeMsg "none" UnnecessaryDatatypeConvMsg "none" VectorMatrixConversionMsg "none" - InvalidFcnCallConnMsg "error" - FcnCallInpInsideContextMsg "Use local settings" + FcnCallInpInsideContextMsg "warning" SignalLabelMismatchMsg "none" UnconnectedInputMsg "warning" UnconnectedOutputMsg "warning" UnconnectedLineMsg "warning" + UseOnlyExistingSharedCode "error" SFcnCompatibilityMsg "none" - FrameProcessingCompatibilityMsg "warning" + FrameProcessingCompatibilityMsg "error" UniqueDataStoreMsg "none" BusObjectLabelMismatch "warning" RootOutportRequireBusObject "warning" AssertControl "UseLocalSettings" - EnableOverflowDetection off + AllowSymbolicDim on + RowMajorDimensionSupport off ModelReferenceIOMsg "none" ModelReferenceMultiInstanceNormalModeStructChecksumCheck "error" ModelReferenceVersionMismatchMessage "none" ModelReferenceIOMismatchMessage "none" - ModelReferenceCSMismatchMessage "none" UnknownTsInhSupMsg "warning" ModelReferenceDataLoggingMessage "warning" + ModelReferenceNoExplicitFinalValueMsg "none" ModelReferenceSymbolNameMessage "warning" ModelReferenceExtraNoncontSigs "error" StateNameClashWarn "warning" - SimStateInterfaceChecksumMismatchMsg "warning" - SimStateOlderReleaseMsg "error" + OperatingPointInterfaceChecksumMismatchMsg "warning" + NonCurrentReleaseOperatingPointMsg "error" + ChecksumConsistencyForSSReuse "none" + PregeneratedLibrarySubsystemCodeDiagnostic "warning" + MatchCodeGenerationContextForUpdateDiagram "none" InitInArrayFormatMsg "warning" - StrictBusMsg "None" + StrictBusMsg "ErrorLevel1" BusNameAdapt "WarnAndRepair" NonBusSignalsTreatedAsBus "none" - LoggingUnavailableSignals "error" + SymbolicDimMinMaxWarning "warning" + LossOfSymbolicDimsSimulationWarning "warning" + LossOfSymbolicDimsCodeGenerationWarning "error" + SymbolicDimsDataTypeCodeGenerationDiagnostic "error" BlockIODiagnostic "none" SFUnusedDataAndEventsDiag "warning" SFUnexpectedBacktrackingDiag "warning" SFInvalidInputDataAccessInChartInitDiag "warning" SFNoUnconditionalDefaultTransitionDiag "warning" SFTransitionOutsideNaturalParentDiag "warning" - SFUnconditionalTransitionShadowingDiag "warning" + SFUnreachableExecutionPathDiag "warning" + SFUndirectedBroadcastEventsDiag "warning" + SFTransitionActionBeforeConditionDiag "warning" + SFOutputUsedAsStateInMooreChartDiag "error" + SFTemporalDelaySmallerThanSampleTimeDiag "warning" + SFSelfTransitionDiag "warning" + SFExecutionAtInitializationDiag "none" + SFMachineParentedDataDiag "warning" + IntegerSaturationMsg "warning" + AllowedUnitSystems "all" + UnitsInconsistencyMsg "warning" + AllowAutomaticUnitConversions on + RCSCRenamedMsg "warning" + RCSCObservableMsg "warning" + ForceCombineOutputUpdateInSim off + UnitDatabase "" + UnderSpecifiedDimensionMsg "none" + DebugExecutionForFMUViaOutOfProcess off + ArithmeticOperatorsInVariantConditions "warning" + VariantConditionMismatch "none" } Simulink.HardwareCC { - $ObjectID 6 - Version "1.12.0" + $ObjectID 24 + Version "20.1.0" + DisabledProps [] + Description "" + Components [] ProdBitPerChar 8 ProdBitPerShort 16 ProdBitPerInt 32 ProdBitPerLong 32 + ProdBitPerLongLong 64 ProdBitPerFloat 32 ProdBitPerDouble 64 ProdBitPerPointer 32 + ProdBitPerSizeT 32 + ProdBitPerPtrDiffT 32 ProdLargestAtomicInteger "Char" ProdLargestAtomicFloat "None" ProdIntDivRoundTo "Undefined" ProdEndianess "Unspecified" ProdWordSize 32 ProdShiftRightIntArith on + ProdLongLongMode off ProdHWDeviceType "32-bit Generic" TargetBitPerChar 8 TargetBitPerShort 16 TargetBitPerInt 32 TargetBitPerLong 32 + TargetBitPerLongLong 64 TargetBitPerFloat 32 TargetBitPerDouble 64 TargetBitPerPointer 32 + TargetBitPerSizeT 32 + TargetBitPerPtrDiffT 32 TargetLargestAtomicInteger "Char" TargetLargestAtomicFloat "None" TargetShiftRightIntArith on + TargetLongLongMode off TargetIntDivRoundTo "Undefined" TargetEndianess "Unspecified" TargetWordSize 32 - TargetTypeEmulationWarnSuppressLevel 0 TargetPreprocMaxBitsSint 32 TargetPreprocMaxBitsUint 32 TargetHWDeviceType "Specified" TargetUnknown on ProdEqTarget on + UseEmbeddedCoderFeatures on + UseSimulinkCoderFeatures on + HardwareBoardFeatureSet "EmbeddedCoderHSP" } Simulink.ModelReferenceCC { - $ObjectID 7 - Version "1.12.0" + $ObjectID 25 + Version "20.1.0" + DisabledProps [] + Description "" + Components [] UpdateModelReferenceTargets "IfOutOfDateOrStructuralChange" + EnableRefExpFcnMdlSchedulingChecks on CheckModelReferenceTargetMessage "error" EnableParallelModelReferenceBuilds off ParallelModelReferenceErrorOnInvalidPool on ParallelModelReferenceMATLABWorkerInit "None" ModelReferenceNumInstancesAllowed "Multi" PropagateVarSize "Infer from blocks in model" + ModelDependencies "" ModelReferencePassRootInputsByReference on ModelReferenceMinAlgLoopOccurrences off PropagateSignalLabelsOutOfModel off SupportModelReferenceSimTargetCustomCode off } Simulink.SFSimCC { - $ObjectID 8 - Version "1.12.0" - SFSimEnableDebug on - SFSimOverflowDetection on + $ObjectID 26 + Version "20.1.0" + DisabledProps [] + Description "" + Components [] + SimCustomSourceCode "" + SimCustomHeaderCode "" + SimCustomInitializer "" + SimCustomTerminator "" + SimReservedNameArray [] + SimUserSources "" + SimUserIncludeDirs "" + SimUserLibraries "" + SimUserDefines "" + SimCustomCompilerFlags "" + SimCustomLinkerFlags "" SFSimEcho on - SimBlas on SimCtrlC on - SimExtrinsic on SimIntegrity on SimUseLocalCustomCode off SimParseCustomCode on - SimBuildMode "sf_incremental_build" + SimAnalyzeCustomCode off + SimGenImportedTypeDefs off + ModelFunctionsGlobalVisibility "on" + CompileTimeRecursionLimit 50 + EnableRuntimeRecursion on + MATLABDynamicMemAlloc on + MATLABDynamicMemAllocThreshold 65536 + CustomCodeFunctionArrayLayout [] + DefaultCustomCodeFunctionArrayLayout "NotSpecified" + CustomCodeUndefinedFunction "UseInterfaceOnly" + CustomCodeGlobalsAsFunctionIO off + SimTargetLang "C" + GPUAcceleration off + SimGPUMallocThreshold 200 + SimGPUStackLimitPerThread 1024 + SimGPUErrorChecks off + SimGPUCustomComputeCapability "" + SimGPUCompilerFlags "" + SimDLTargetLibrary "mkl-dnn" + SimDLAutoTuning on } Simulink.RTWCC { $BackupClass "Simulink.RTWCC" - $ObjectID 9 - Version "1.12.0" + $ObjectID 27 + Version "20.1.0" + Array { + Type "Cell" + Dimension 16 + Cell "IncludeHyperlinkInReport" + Cell "GenerateTraceInfo" + Cell "GenerateTraceReport" + Cell "GenerateTraceReportSl" + Cell "GenerateTraceReportSf" + Cell "GenerateTraceReportEml" + Cell "PortableWordSizes" + Cell "GenerateWebview" + Cell "GenerateCodeMetricsReport" + Cell "GenerateCodeReplacementReport" + Cell "GenerateMissedCodeReplacementReport" + Cell "GenerateErtSFunction" + Cell "CreateSILPILBlock" + Cell "CodeExecutionProfiling" + Cell "CodeProfilingSaveOptions" + Cell "CodeProfilingInstrumentation" + PropName "DisabledProps" + } + Description "" SystemTargetFile "grt.tlc" + HardwareBoard "None" + ShowCustomHardwareApp off + ShowEmbeddedHardwareApp off + TLCOptions "" GenCodeOnly off MakeCommand "make_rtw" GenerateMakefile on + PackageGeneratedCodeAndArtifacts off + PackageName "" TemplateMakefile "grt_default_tmf" + PostCodeGenCommand "" GenerateReport off - SaveLog off RTWVerbose on RetainRTWFile off + RTWBuildHooks [] ProfileTLC off TLCDebug off TLCCoverage off TLCAssert off - ProcessScriptMode "Default" - ConfigurationMode "Optimized" - ConfigAtBuild off RTWUseLocalCustomCode off RTWUseSimCustomCode off + CustomSourceCode "" + CustomHeaderCode "" + CustomInclude "" + CustomSource "" + CustomLibrary "" + CustomDefine "" + CustomBLASCallback "" + CustomLAPACKCallback "" + CustomFFTCallback "" + CustomInitializer "" + CustomTerminator "" + Toolchain "Automatically locate an installed toolchain" + BuildConfiguration "Faster Builds" + CustomToolchainOptions [] IncludeHyperlinkInReport off LaunchReport off + PortableWordSizes off + CreateSILPILBlock "None" + CodeExecutionProfiling off + CodeExecutionProfileVariable "executionProfile" + CodeProfilingSaveOptions "SummaryOnly" + CodeProfilingInstrumentation "off" + SILDebugging off TargetLang "C" + GenerateGPUCode "None" IncludeBusHierarchyInRTWFileBlockHierarchyMap off - IncludeERTFirstTime on GenerateTraceInfo off GenerateTraceReport off GenerateTraceReportSl off GenerateTraceReportSf off GenerateTraceReportEml off - GenerateCodeInfo off GenerateWebview off GenerateCodeMetricsReport off GenerateCodeReplacementReport off - RTWCompilerOptimization "Off" + GenerateMissedCodeReplacementReport off + RTWCompilerOptimization "off" + ObjectivePriorities [] + RTWCustomCompilerOptimizations "" CheckMdlBeforeBuild "Off" - CustomRebuildMode "OnUpdate" + SharedConstantsCachingThreshold 1024 + GPUKernelNamePrefix "" + GPUDeviceID -1 + GPUMallocMode "discrete" + GPUMallocThreshold 200 + GPUStackLimitPerThread 1024 + GPUcuBLAS on + GPUcuSOLVER on + GPUcuFFT on + GPUErrorChecks off + GPUComputeCapability "3.5" + GPUCustomComputeCapability "" + GPUCompilerFlags "" + DLTargetLibrary "none" + DLAutoTuning on + DLArmComputeVersion "19.05" + DLArmComputeArch "unspecified" Array { Type "Handle" Dimension 2 Simulink.CodeAppCC { - $ObjectID 10 - Version "1.12.0" + $ObjectID 28 + Version "20.1.0" + Array { + Type "Cell" + Dimension 28 + Cell "IgnoreCustomStorageClasses" + Cell "IgnoreTestpoints" + Cell "BlockCommentType" + Cell "InsertBlockDesc" + Cell "InsertPolySpaceComments" + Cell "SFDataObjDesc" + Cell "MATLABFcnDesc" + Cell "SimulinkDataObjDesc" + Cell "DefineNamingRule" + Cell "SignalNamingRule" + Cell "ParamNamingRule" + Cell "InternalIdentifier" + Cell "InlinedPrmAccess" + Cell "CustomSymbolStr" + Cell "CustomSymbolStrGlobalVar" + Cell "CustomSymbolStrType" + Cell "CustomSymbolStrField" + Cell "CustomSymbolStrFcn" + Cell "CustomSymbolStrModelFcn" + Cell "CustomSymbolStrFcnArg" + Cell "CustomSymbolStrBlkIO" + Cell "CustomSymbolStrTmpVar" + Cell "CustomSymbolStrMacro" + Cell "CustomSymbolStrUtil" + Cell "CustomSymbolStrEmxType" + Cell "CustomSymbolStrEmxFcn" + Cell "CustomUserTokenString" + Cell "ReqsInCode" + PropName "DisabledProps" + } + Description "" + Components [] + Comment "" ForceParamTrailComments off GenerateComments on + CommentStyle "Auto" IgnoreCustomStorageClasses on IgnoreTestpoints off - IncHierarchyInIds off MaxIdLength 31 PreserveName off PreserveNameWithParent off ShowEliminatedStatement off - IncAutoGenComments off + OperatorAnnotations off SimulinkDataObjDesc off SFDataObjDesc off MATLABFcnDesc off - IncDataTypeInIds off MangleLength 1 + SharedChecksumLength 8 CustomSymbolStrGlobalVar "$R$N$M" - CustomSymbolStrType "$N$R$M" + CustomSymbolStrType "$N$R$M_T" CustomSymbolStrField "$N$M" CustomSymbolStrFcn "$R$N$M$F" + CustomSymbolStrModelFcn "$R$N" CustomSymbolStrFcnArg "rt$I$N$M" CustomSymbolStrBlkIO "rtb_$N$M" CustomSymbolStrTmpVar "$N$M" CustomSymbolStrMacro "$R$N$M" + CustomSymbolStrUtil "$N$C" + CustomSymbolStrEmxType "emxArray_$M$N" + CustomSymbolStrEmxFcn "emx$M$N" + CustomUserTokenString "" + CustomCommentsFcn "" DefineNamingRule "None" + DefineNamingFcn "" ParamNamingRule "None" + ParamNamingFcn "" SignalNamingRule "None" + SignalNamingFcn "" InsertBlockDesc off InsertPolySpaceComments off SimulinkBlockComments on + BlockCommentType "BlockPathComment" + StateflowObjectComments on MATLABSourceComments off EnableCustomComments off + InternalIdentifierFile "" + InternalIdentifier "Shortened" InlinedPrmAccess "Literals" ReqsInCode off UseSimReservedNames off + ReservedNameArray [] + EnumMemberNameClash "error" } Simulink.GRTTargetCC { $BackupClass "Simulink.TargetCC" - $ObjectID 11 - Version "1.12.0" + $ObjectID 29 + Version "20.1.0" + Array { + Type "Cell" + Dimension 16 + Cell "GenerateAllocFcn" + Cell "IncludeMdlTerminateFcn" + Cell "PreserveStateflowLocalDataDimensions" + Cell "SuppressErrorStatus" + Cell "ERTCustomFileBanners" + Cell "GenerateSampleERTMain" + Cell "ExistingSharedCode" + Cell "GenerateTestInterfaces" + Cell "ModelStepFunctionPrototypeControlCompliant" + Cell "PurelyIntegerCode" + Cell "SupportComplex" + Cell "SupportAbsoluteTime" + Cell "SupportContinuousTime" + Cell "SupportNonInlinedSFcns" + Cell "RemoveDisableFunc" + Cell "RemoveResetFunc" + PropName "DisabledProps" + } + Description "" + Components [] TargetFcnLib "ansi_tfl_table_tmw.mat" TargetLibSuffix "" TargetPreCompLibLocation "" - CodeReplacementLibrary "ANSI_C" + GenFloatMathFcnCalls "NOT IN USE" + TargetLangStandard "C89/C90 (ANSI)" + CodeReplacementLibrary "None" UtilityFuncGeneration "Auto" - ERTMultiwordTypeDef "System defined" - CodeExecutionProfiling off - ERTMultiwordLength 256 + MultiwordTypeDef "System defined" MultiwordLength 2048 + DynamicStringBufferSize 256 GenerateFullHeader on + InferredTypesCompatibility off + ExistingSharedCode "" GenerateSampleERTMain off GenerateTestInterfaces off - IsPILTarget off ModelReferenceCompliant off ParMdlRefBuildCompliant off CompOptLevelCompliant off ConcurrentExecutionCompliant off IncludeMdlTerminateFcn on - GeneratePreprocessorConditionals "Disable all" CombineOutputUpdateFcns off CombineSignalStateStructs off + GroupInternalDataByFunction off SuppressErrorStatus off - ERTFirstTimeCompliant off IncludeFileDelimiter "Auto" ERTCustomFileBanners off SupportAbsoluteTime on LogVarNameModifier "rt_" MatFileLogging off - MultiInstanceERTCode off + CodeInterfacePackaging "Nonreusable function" + PurelyIntegerCode off SupportNonFinite on SupportComplex on - PurelyIntegerCode off SupportContinuousTime on SupportNonInlinedSFcns on + RemoveDisableFunc off + RemoveResetFunc off SupportVariableSizeSignals off - EnableShiftOperators on ParenthesesLevel "Nominal" - PortableWordSizes off + CastingMode "Nominal" + MATLABClassNameForMDSCustomization "Simulink.SoftwareTarget.GRTCustomization" ModelStepFunctionPrototypeControlCompliant off - CPPClassGenCompliant off + CPPClassGenCompliant on AutosarCompliant off + MDXCompliant off GRTInterface on + GenerateAllocFcn off + UseToolchainInfoCompliant on + GenerateSharedConstants on + CoderGroups [] + AccessMethods [] + LookupTableObjectStructAxisOrder "1,2,3,4,..." + LUTObjectStructOrderExplicitValues "Size,Breakpoints,Table" + LUTObjectStructOrderEvenSpacing "Size,Breakpoints,Table" + ArrayLayout "Column-major" + UnsupportedSFcnMsg "error" + ERTHeaderFileRootName "$R$E" + ERTSourceFileRootName "$R$E" + ERTDataFileRootName "$R_data" UseMalloc off ExtMode off ExtModeStaticAlloc off @@ -506,39 +1059,91 @@ Model { ExtModeStaticAllocSize 1000000 ExtModeTransport 0 ExtModeMexFile "ext_comm" + ExtModeMexArgs "" ExtModeIntrfLevel "Level1" RTWCAPISignals off RTWCAPIParams off RTWCAPIStates off RTWCAPIRootIO off GenerateASAP2 off + MultiInstanceErrorCode "Error" } PropName "Components" } } + SlCovCC.ConfigComp { + $ObjectID 30 + Version "20.1.0" + DisabledProps [] + Description "Simulink Coverage Configuration Component" + Components [] + Name "Simulink Coverage" + CovEnable off + CovScope "EntireSystem" + CovIncludeTopModel on + RecordCoverage off + CovPath "/" + CovSaveName "covdata" + CovCompData "" + CovMetricSettings "dw" + CovFilter "" + CovHTMLOptions "" + CovNameIncrementing off + CovForceBlockReductionOff on + CovEnableCumulative on + CovSaveCumulativeToWorkspaceVar on + CovSaveSingleToWorkspaceVar on + CovCumulativeVarName "covCumulativeData" + CovCumulativeReport off + CovSaveOutputData on + CovOutputDir "slcov_output/$ModelName$" + CovDataFileName "$ModelName$_cvdata" + CovReportOnPause on + CovModelRefEnable "off" + CovModelRefExcluded "" + CovExternalEMLEnable off + CovSFcnEnable on + CovBoundaryAbsTol 1e-05 + CovBoundaryRelTol 0.01 + CovUseTimeInterval off + CovStartTime 0 + CovStopTime 0 + CovMcdcMode "Masking" + } PropName "Components" } Name "Configuration" CurrentDlgPage "Solver" - ConfigPrmDlgPosition [ 520, 285, 1400, 915 ] + ConfigPrmDlgPosition [ 520, 285, 1400, 915 ] + ExtraOptions "" } PropName "ConfigurationSets" } Simulink.ConfigSet { $PropName "ActiveConfigurationSet" - $ObjectID 1 + $ObjectID 19 + } + Object { + $PropName "DataTransfer" + $ObjectID 31 + $ClassName "Simulink.GlobalDataTransfer" + DefaultTransitionBetweenSyncTasks "Ensure deterministic transfer (maximum delay)" + DefaultTransitionBetweenAsyncTasks "Ensure data integrity only" + DefaultTransitionBetweenContTasks "Ensure deterministic transfer (minimum delay)" + DefaultExtrapolationMethodBetweenContTasks "None" } ExplicitPartitioning off BlockDefaults { ForegroundColor "black" BackgroundColor "white" DropShadow off - NamePlacement "normal" + NameLocation "bottom" FontName "Helvetica" FontSize 10 FontWeight "normal" FontAngle "normal" ShowName on + HideAutomaticName on BlockRotation 0 BlockMirror off } @@ -552,7 +1157,12 @@ Model { FontSize 10 FontWeight "normal" FontAngle "normal" + MarkupType "model" UseDisplayTextAsClickCallback off + AnnotationType "note_annotation" + FixedHeight off + FixedWidth off + Interpreter "off" } LineDefaults { FontName "Helvetica" @@ -560,6 +1170,25 @@ Model { FontWeight "normal" FontAngle "normal" } + MaskDefaults { + SelfModifiable "off" + IconFrame "on" + IconOpaque "opaque" + RunInitForIconRedraw "analyze" + IconRotate "none" + PortRotate "default" + IconUnits "autoscale" + } + MaskParameterDefaults { + Evaluate "on" + Tunable "on" + NeverSave "off" + Internal "off" + ReadOnly "off" + Enabled "on" + Visible "on" + ToolTip "on" + } BlockParameterDefaults { Block { BlockType Clock @@ -581,7 +1210,6 @@ Model { } Block { BlockType DotProduct - SampleTime "-1" InputSameDT on OutMin "[]" OutMax "[]" @@ -589,6 +1217,7 @@ Model { LockScale off RndMeth "Floor" SaturateOnIntegerOverflow off + SampleTime "-1" } Block { BlockType Fcn @@ -601,24 +1230,26 @@ Model { Multiplication "Element-wise(K.*u)" ParamMin "[]" ParamMax "[]" - ParamDataTypeStr "Inherit: Same as input" + ParamDataTypeStr "Inherit: Inherit via internal rule" OutMin "[]" OutMax "[]" - OutDataTypeStr "Inherit: Same as input" + OutDataTypeStr "Inherit: Inherit via internal rule" LockScale off RndMeth "Floor" - SaturateOnIntegerOverflow on + SaturateOnIntegerOverflow off SampleTime "-1" } Block { BlockType Inport Port "1" + IconDisplay "Port number" OutputFunctionCall off OutMin "[]" OutMax "[]" OutDataTypeStr "Inherit: auto" LockScale off BusOutputAsStruct off + Unit "inherit" PortDimensions "-1" VarSizeSig "Inherit" SampleTime "-1" @@ -639,32 +1270,37 @@ Model { Block { BlockType Outport Port "1" + IconDisplay "Port number" OutMin "[]" OutMax "[]" OutDataTypeStr "Inherit: auto" LockScale off BusOutputAsStruct off + Unit "inherit" PortDimensions "-1" VarSizeSig "Inherit" SampleTime "-1" SignalType "auto" SamplingMode "auto" + EnsureOutportIsVirtual off SourceOfInitialOutputValue "Dialog" OutputWhenDisabled "held" InitialOutput "[]" + MustResolveToSignalObject off + OutputWhenUnConnected off + OutputWhenUnconnectedValue "0" + VectorParamsAs1DForOutWhenUnconnected on } Block { BlockType S-Function FunctionName "system" SFunctionModules "''" PortCounts "[]" - SFunctionDeploymentMode off + MultiThreadCoSim "auto" } Block { BlockType Saturate - UpperLimitSource "Dialog" UpperLimit "0.5" - LowerLimitSource "Dialog" LowerLimit "-0.5" LinearizeAsGain on ZeroCross on @@ -682,6 +1318,7 @@ Model { OutDataTypeStr "Inherit: auto" LockScale off BusOutputAsStruct off + Unit "inherit" Dimensions "-1" VarSizeSig "Inherit" SampleTime "-1" @@ -694,37 +1331,55 @@ Model { Permissions "ReadWrite" PermitHierarchicalResolution "All" TreatAsAtomicUnit off - CheckFcnCallInpInsideContextMsg off + MinAlgLoopOccurrences off + ScheduleAs "Sample time" SystemSampleTime "-1" + RTWSystemCode "Auto" RTWFcnNameOpts "Auto" RTWFileNameOpts "Auto" + FunctionInterfaceSpec "void_void" + FunctionWithSeparateData off + MatchGraphicalInterface off RTWMemSecFuncInitTerm "Inherit from model" RTWMemSecFuncExecute "Inherit from model" RTWMemSecDataConstants "Inherit from model" RTWMemSecDataInternal "Inherit from model" RTWMemSecDataParameters "Inherit from model" SimViewingDevice off + ActiveForDiff off DataTypeOverride "UseLocalSettings" DataTypeOverrideAppliesTo "AllNumericTypes" MinMaxOverflowLogging "UseLocalSettings" + Opaque off + MaskHideContents off SFBlockType "NONE" Variant off - GeneratePreprocessorConditionals off + VariantControlMode "expression" + VariantActivationTime "update diagram" + AllowZeroVariantControls off + PropagateVariantConditions off + TreatAsGroupedWhenPropagatingVariantConditions on + ContentPreviewEnabled off + IsWebBlock off + IsInjectorSS off + Latency "0" + AutoFrameSizeCalculation off + IsWebBlockPanel off } Block { BlockType Sum - IconShape "rectangular" + IconShape "round" Inputs "++" CollapseMode "All dimensions" CollapseDim "1" - InputSameDT on + InputSameDT off AccumDataTypeStr "Inherit: Inherit via internal rule" OutMin "[]" OutMax "[]" - OutDataTypeStr "Inherit: Same as first input" + OutDataTypeStr "Inherit: Inherit via internal rule" LockScale off RndMeth "Floor" - SaturateOnIntegerOverflow on + SaturateOnIntegerOverflow off SampleTime "-1" } Block { @@ -747,16 +1402,21 @@ Model { VariableName "simulink_output" MaxDataPoints "1000" Decimation "1" - SampleTime "0" SaveFormat "Array" + Save2DSignal "3-D array (concatenate along third dimension)" FixptAsFi off NumInputs "1" + SampleTime "0" } } System { Name "Test01_SIG" - Location [2, 93, 1900, 1047] + Location [0, 23, 1920, 1200] + SystemRect [0.000000, 0.000000, 0.000000, 0.000000] Open on + PortBlocksUseCompactNotation off + SetExecutionDomain off + ExecutionDomainType "Deduce" ModelBrowserVisibility off ModelBrowserWidth 200 ScreenColor "white" @@ -767,41 +1427,198 @@ Model { TiledPaperMargins [0.500000, 0.500000, 0.500000, 0.500000] TiledPageScale 1 ShowPageBoundaries off - ZoomFactor "156" + ZoomFactor "125" ReportName "simulink-default.rpt" - SIDHighWatermark "57" + SIDHighWatermark "79" + SimulinkSubDomain "Simulink" + Block { + BlockType SubSystem + Name "Airfoil Controller" + SID "69" + Ports [0, 1] + Position [295, 324, 395, 366] + ZOrder 3 + RequestExecContextInheritance off + System { + Name "Airfoil Controller" + Location [0, 23, 1920, 1200] + SystemRect [0.000000, 0.000000, 0.000000, 0.000000] + Open off + PortBlocksUseCompactNotation off + SetExecutionDomain off + ExecutionDomainType "Deduce" + ModelBrowserVisibility off + ModelBrowserWidth 200 + ScreenColor "white" + PaperOrientation "landscape" + PaperPositionMode "auto" + PaperType "usletter" + PaperUnits "inches" + TiledPaperMargins [0.500000, 0.500000, 0.500000, 0.500000] + TiledPageScale 1 + ShowPageBoundaries off + ZoomFactor "100" + SimulinkSubDomain "Simulink" + Block { + BlockType Constant + Name "Airfoil command" + SID "70" + Position [55, 35, 85, 65] + ZOrder -1 + Value "zeros(1,3)'" + } + Block { + BlockType Outport + Name "Out1" + SID "71" + Position [140, 43, 170, 57] + ZOrder -2 + } + Line { + ZOrder 1 + SrcBlock "Airfoil command" + SrcPort 1 + DstBlock "Out1" + DstPort 1 + } + } + } + Block { + BlockType SubSystem + Name "Cable deltaL Controller" + SID "74" + Ports [0, 1] + Position [295, 384, 395, 426] + ZOrder 4 + RequestExecContextInheritance off + System { + Name "Cable deltaL Controller" + Location [0, 23, 1920, 1200] + SystemRect [0.000000, 0.000000, 0.000000, 0.000000] + Open off + PortBlocksUseCompactNotation off + SetExecutionDomain off + ExecutionDomainType "Deduce" + ModelBrowserVisibility off + ModelBrowserWidth 200 + ScreenColor "white" + PaperOrientation "landscape" + PaperPositionMode "auto" + PaperType "usletter" + PaperUnits "inches" + TiledPaperMargins [0.500000, 0.500000, 0.500000, 0.500000] + TiledPageScale 1 + ShowPageBoundaries off + ZoomFactor "100" + SimulinkSubDomain "Simulink" + Block { + BlockType Constant + Name "Cable deltaL command" + SID "75" + Position [55, 35, 85, 65] + ZOrder -1 + Value "zeros(1,20)'" + } + Block { + BlockType Outport + Name "Out1" + SID "76" + Position [140, 43, 170, 57] + ZOrder -2 + } + Line { + ZOrder 1 + SrcBlock "Cable deltaL command" + SrcPort 1 + DstBlock "Out1" + DstPort 1 + } + } + } + Block { + BlockType SubSystem + Name "Cable deltaLdot Controller" + SID "77" + Ports [0, 1] + Position [295, 444, 395, 486] + ZOrder 5 + RequestExecContextInheritance off + System { + Name "Cable deltaLdot Controller" + Location [0, 23, 1920, 1200] + SystemRect [0.000000, 0.000000, 0.000000, 0.000000] + Open off + PortBlocksUseCompactNotation off + SetExecutionDomain off + ExecutionDomainType "Deduce" + ModelBrowserVisibility off + ModelBrowserWidth 200 + ScreenColor "white" + PaperOrientation "landscape" + PaperPositionMode "auto" + PaperType "usletter" + PaperUnits "inches" + TiledPaperMargins [0.500000, 0.500000, 0.500000, 0.500000] + TiledPageScale 1 + ShowPageBoundaries off + ZoomFactor "100" + SimulinkSubDomain "Simulink" + Block { + BlockType Constant + Name "Cable deltaLdot command" + SID "78" + Position [55, 35, 85, 65] + ZOrder -1 + Value "zeros(1,20)'" + } + Block { + BlockType Outport + Name "Out1" + SID "79" + Position [140, 43, 170, 57] + ZOrder -2 + } + Line { + ZOrder 1 + SrcBlock "Cable deltaLdot command" + SrcPort 1 + DstBlock "Out1" + DstPort 1 + } + } + } Block { BlockType Clock Name "Clock" SID "1" Position [50, 20, 70, 40] + ZOrder -1 } Block { BlockType SubSystem Name "FAST Nonlinear Wind Turbine" SID "2" - Ports [4, 1] - Position [460, 77, 680, 313] + Ports [7, 1] + Position [460, 77, 685, 493] + ZOrder -2 BackgroundColor "darkGreen" - MinAlgLoopOccurrences off - PropExecContextOutsideSubsystem off - RTWSystemCode "Auto" - FunctionWithSeparateData off - Opaque off RequestExecContextInheritance off - MaskHideContents off - MaskType "FAST Nonlinear Wind Turbine" - MaskDescription "This block contains the FAST S-Function." - MaskInitialization "clear FAST_SFunc\n" - MaskIconFrame on - MaskIconOpaque on - MaskIconRotate "none" - MaskPortRotate "default" - MaskIconUnits "autoscale" + Object { + $PropName "MaskObject" + $ObjectID 32 + $ClassName "Simulink.Mask" + Type "FAST Nonlinear Wind Turbine" + Description "This block contains the FAST S-Function." + Initialization "clear FAST_SFunc\n" + } System { Name "FAST Nonlinear Wind Turbine" - Location [2, 93, 1900, 1047] + Location [0, 23, 1920, 1200] + SystemRect [0.000000, 0.000000, 0.000000, 0.000000] Open off + PortBlocksUseCompactNotation off + SetExecutionDomain off + ExecutionDomainType "Deduce" ModelBrowserVisibility off ModelBrowserWidth 200 ScreenColor "white" @@ -813,44 +1630,71 @@ Model { TiledPageScale 1 ShowPageBoundaries off ZoomFactor "156" + SimulinkSubDomain "Simulink" Block { BlockType Inport Name "Gen. Torque (Nm) and Power (W)" SID "3" Position [80, 48, 110, 62] - IconDisplay "Port number" + ZOrder -1 } Block { BlockType Inport Name "Yaw Position (rad) and Rate (rad/s)" SID "4" Position [80, 108, 110, 122] + ZOrder -2 Port "2" - IconDisplay "Port number" } Block { BlockType Inport Name "Blade Pitch Angles (rad)" SID "5" Position [80, 168, 110, 182] + ZOrder -3 Port "3" - IconDisplay "Port number" } Block { BlockType Inport Name "High-Speed Shaft Braking Fraction (-)" SID "54" Position [80, 228, 110, 242] + ZOrder -4 Port "4" - IconDisplay "Port number" + } + Block { + BlockType Inport + Name "Airfoil Command (-)" + SID "58" + Position [80, 288, 110, 302] + ZOrder 1 + Port "5" + } + Block { + BlockType Inport + Name "Cable deltaL command (m)" + SID "72" + Position [80, 348, 110, 362] + ZOrder 2 + Port "6" + } + Block { + BlockType Inport + Name "Cable deltaLdot command (m/s)" + SID "73" + Position [80, 408, 110, 422] + ZOrder 3 + Port "7" } Block { BlockType Mux Name "Mux1" SID "9" - Ports [4, 1] - Position [340, 20, 345, 270] + Ports [7, 1] + Position [340, 20, 345, 450] + ZOrder -5 ShowName off + Inputs "7" DisplayOption "bar" } Block { @@ -858,17 +1702,21 @@ Model { Name "S-Function" SID "10" Ports [1, 1] - Position [390, 106, 460, 184] + Position [390, 136, 460, 214] + ZOrder -6 BackgroundColor "magenta" FunctionName "FAST_SFunc" Parameters "FAST_InputFileName, TMax, 0" + SFunctionDeploymentMode off EnableBusSupport off + SFcnIsStateOwnerBlock off } Block { BlockType SignalSpecification Name "Signal Specification1" SID "11" Position [200, 45, 300, 65] + ZOrder -7 OutDataTypeStr "double" Dimensions "2" SignalType "real" @@ -878,6 +1726,7 @@ Model { Name "Signal Specification2" SID "12" Position [200, 103, 300, 127] + ZOrder -8 OutDataTypeStr "double" Dimensions "2" SignalType "real" @@ -886,67 +1735,99 @@ Model { BlockType Outport Name "OutData" SID "13" - Position [500, 137, 530, 153] + Position [505, 167, 535, 183] + ZOrder -9 BackgroundColor "yellow" - IconDisplay "Port number" } Line { + ZOrder 1 SrcBlock "Gen. Torque (Nm) and Power (W)" SrcPort 1 DstBlock "Signal Specification1" DstPort 1 } Line { + ZOrder 2 SrcBlock "S-Function" SrcPort 1 DstBlock "OutData" DstPort 1 } Line { + ZOrder 3 SrcBlock "Mux1" SrcPort 1 + Points [18, 0; 0, -60] DstBlock "S-Function" DstPort 1 } Line { + ZOrder 4 SrcBlock "Blade Pitch Angles (rad)" SrcPort 1 DstBlock "Mux1" DstPort 3 } Line { + ZOrder 5 SrcBlock "Yaw Position (rad) and Rate (rad/s)" SrcPort 1 DstBlock "Signal Specification2" DstPort 1 } Line { + ZOrder 6 SrcBlock "Signal Specification1" SrcPort 1 DstBlock "Mux1" DstPort 1 } Line { + ZOrder 7 SrcBlock "Signal Specification2" SrcPort 1 DstBlock "Mux1" DstPort 2 } Line { + ZOrder 8 SrcBlock "High-Speed Shaft Braking Fraction (-)" SrcPort 1 + Points [210, 0] DstBlock "Mux1" DstPort 4 } + Line { + ZOrder 9 + SrcBlock "Airfoil Command (-)" + SrcPort 1 + DstBlock "Mux1" + DstPort 5 + } + Line { + ZOrder 10 + SrcBlock "Cable deltaL command (m)" + SrcPort 1 + DstBlock "Mux1" + DstPort 6 + } + Line { + ZOrder 11 + SrcBlock "Cable deltaLdot command (m/s)" + SrcPort 1 + DstBlock "Mux1" + DstPort 7 + } } } Block { BlockType Fcn Name "Fcn" SID "16" - Position [405, 340, 465, 370] + Position [405, 535, 465, 565] + ZOrder -3 BlockMirror on - NamePlacement "alternate" + NameLocation "top" Expr "u(strmatch('LSSGagVxa',OutList))" } Block { @@ -955,17 +1836,16 @@ Model { SID "55" Ports [0, 1] Position [295, 264, 395, 306] - MinAlgLoopOccurrences off - PropExecContextOutsideSubsystem off - RTWSystemCode "Auto" - FunctionWithSeparateData off - Opaque off + ZOrder -4 RequestExecContextInheritance off - MaskHideContents off System { Name "High-Speed Shaft Brake" - Location [433, 403, 916, 674] + Location [395, 283, 918, 732] + SystemRect [0.000000, 0.000000, 0.000000, 0.000000] Open off + PortBlocksUseCompactNotation off + SetExecutionDomain off + ExecutionDomainType "Deduce" ModelBrowserVisibility off ModelBrowserWidth 200 ScreenColor "white" @@ -977,11 +1857,13 @@ Model { TiledPageScale 1 ShowPageBoundaries off ZoomFactor "100" + SimulinkSubDomain "Simulink" Block { BlockType Constant Name "High-Speed Shaft Braking Fraction" SID "56" Position [55, 35, 85, 65] + ZOrder -1 Value "0" } Block { @@ -989,9 +1871,10 @@ Model { Name "Out1" SID "57" Position [140, 43, 170, 57] - IconDisplay "Port number" + ZOrder -2 } Line { + ZOrder 1 SrcBlock "High-Speed Shaft Braking Fraction" SrcPort 1 DstBlock "Out1" @@ -1005,17 +1888,16 @@ Model { SID "17" Ports [0, 1] Position [295, 204, 395, 246] - MinAlgLoopOccurrences off - PropExecContextOutsideSubsystem off - RTWSystemCode "Auto" - FunctionWithSeparateData off - Opaque off + ZOrder -5 RequestExecContextInheritance off - MaskHideContents off System { Name "Pitch Controller" - Location [433, 403, 916, 538] + Location [395, 283, 918, 596] + SystemRect [0.000000, 0.000000, 0.000000, 0.000000] Open off + PortBlocksUseCompactNotation off + SetExecutionDomain off + ExecutionDomainType "Deduce" ModelBrowserVisibility off ModelBrowserWidth 200 ScreenColor "white" @@ -1027,11 +1909,13 @@ Model { TiledPageScale 1 ShowPageBoundaries off ZoomFactor "100" + SimulinkSubDomain "Simulink" Block { BlockType Constant Name "Blade Pitch Angles" SID "18" Position [55, 35, 85, 65] + ZOrder -1 Value "zeros(1,3)'" } Block { @@ -1039,9 +1923,10 @@ Model { Name "Out1" SID "19" Position [140, 43, 170, 57] - IconDisplay "Port number" + ZOrder -2 } Line { + ZOrder 1 SrcBlock "Blade Pitch Angles" SrcPort 1 DstBlock "Out1" @@ -1055,17 +1940,16 @@ Model { SID "20" Ports [1, 1] Position [80, 79, 290, 131] - MinAlgLoopOccurrences off - PropExecContextOutsideSubsystem off - RTWSystemCode "Auto" - FunctionWithSeparateData off - Opaque off + ZOrder -6 RequestExecContextInheritance off - MaskHideContents off System { Name "Simple Induction Generator" - Location [117, 208, 976, 620] + Location [79, 88, 978, 678] + SystemRect [0.000000, 0.000000, 0.000000, 0.000000] Open on + PortBlocksUseCompactNotation off + SetExecutionDomain off + ExecutionDomainType "Deduce" ModelBrowserVisibility off ModelBrowserWidth 200 ScreenColor "white" @@ -1077,31 +1961,38 @@ Model { TiledPageScale 1 ShowPageBoundaries off ZoomFactor "100" + SimulinkSubDomain "Simulink" Block { BlockType Inport Name "Gen speed\nwrt LSS (RPM)" SID "21" Position [30, 78, 60, 92] - NamePlacement "alternate" - IconDisplay "Port number" + ZOrder -1 + NameLocation "top" } Block { BlockType Gain Name "100/GenEff1" SID "22" Position [520, 215, 550, 245] + ZOrder -2 BlockRotation 270 BlockMirror on + NameLocation "right" Gain "100/GenEff" + ParamDataTypeStr "Inherit: Same as input" + OutDataTypeStr "Inherit: Same as input" + SaturateOnIntegerOverflow on } Block { BlockType DotProduct Name "Dot Product" SID "23" Position [516, 140, 549, 175] + ZOrder -3 BlockRotation 270 BlockMirror on - NamePlacement "alternate" + NameLocation "left" ShowName off OutDataTypeStr "Inherit: Inherit via internal rule" } @@ -1110,9 +2001,10 @@ Model { Name "Dot Product1" SID "24" Position [452, 140, 483, 175] + ZOrder -4 BlockRotation 270 BlockMirror on - NamePlacement "alternate" + NameLocation "left" ShowName off OutDataTypeStr "Inherit: Inherit via internal rule" } @@ -1121,18 +2013,26 @@ Model { Name "GBRatio" SID "25" Position [145, 70, 175, 100] - NamePlacement "alternate" + ZOrder -5 + NameLocation "top" Gain "GBRatio" + ParamDataTypeStr "Inherit: Same as input" + OutDataTypeStr "Inherit: Same as input" + SaturateOnIntegerOverflow on } Block { BlockType Gain Name "GenEff/100" SID "26" Position [455, 215, 485, 245] + ZOrder -6 BlockRotation 270 BlockMirror on - NamePlacement "alternate" + NameLocation "left" Gain "GenEff/100" + ParamDataTypeStr "Inherit: Same as input" + OutDataTypeStr "Inherit: Same as input" + SaturateOnIntegerOverflow on } Block { BlockType Mux @@ -1140,6 +2040,7 @@ Model { SID "27" Ports [2, 1] Position [715, 76, 720, 114] + ZOrder -7 ShowName off Inputs "2" DisplayOption "bar" @@ -1149,30 +2050,39 @@ Model { Name "RPM to rad/s" SID "28" Position [95, 70, 125, 100] + ZOrder -8 Gain "pi/30" + ParamDataTypeStr "Inherit: Same as input" + OutDataTypeStr "Inherit: Same as input" + SaturateOnIntegerOverflow on } Block { BlockType Gain Name "SIG_Slop" SID "29" Position [320, 70, 350, 100] + ZOrder -9 Gain "SIG_Slop" + ParamDataTypeStr "Inherit: Same as input" + OutDataTypeStr "Inherit: Same as input" + SaturateOnIntegerOverflow on } Block { BlockType Constant Name "SIG_SySp" SID "30" Position [210, 135, 240, 165] + ZOrder -10 BlockRotation 270 + NameLocation "right" Value "SIG_SySp" } Block { BlockType Saturate Name "Saturation" SID "31" - Ports [1, 1] Position [400, 70, 430, 100] - InputPortMap "u0" + ZOrder -11 UpperLimit "SIG_POTq" LowerLimit "-(SIG_POTq)" } @@ -1182,20 +2092,20 @@ Model { SID "32" Ports [2, 1] Position [215, 75, 235, 95] + ZOrder -12 ShowName off - IconShape "round" Inputs "|+-" - InputSameDT off - OutDataTypeStr "Inherit: Inherit via internal rule" + SaturateOnIntegerOverflow on } Block { BlockType Switch Name "Switch" SID "33" Position [480, 305, 510, 335] + ZOrder -13 BlockRotation 270 BlockMirror on - NamePlacement "alternate" + NameLocation "left" Criteria "u2 > Threshold" InputSameDT off } @@ -1204,54 +2114,64 @@ Model { Name "GenTrq, ElecPwr" SID "34" Position [755, 88, 785, 102] - IconDisplay "Port number" + ZOrder -14 } Line { + ZOrder 1 SrcBlock "SIG_SySp" SrcPort 1 DstBlock "Sum" DstPort 2 } Line { + ZOrder 2 SrcBlock "GBRatio" SrcPort 1 - Points [0, 0; 10, 0] + Points [10, 0] Branch { + ZOrder 3 DstBlock "Sum" DstPort 1 } Branch { + ZOrder 4 Points [0, -55; 270, 0] Branch { + ZOrder 5 Points [65, 0] DstBlock "Dot Product" DstPort 1 } Branch { + ZOrder 6 DstBlock "Dot Product1" DstPort 1 } } } Line { + ZOrder 7 SrcBlock "Sum" SrcPort 1 DstBlock "SIG_Slop" DstPort 1 } Line { + ZOrder 8 SrcBlock "SIG_Slop" SrcPort 1 DstBlock "Saturation" DstPort 1 } Line { + ZOrder 9 SrcBlock "Dot Product" SrcPort 1 DstBlock "100/GenEff1" DstPort 1 } Line { + ZOrder 10 SrcBlock "100/GenEff1" SrcPort 1 Points [0, 20; -30, 0] @@ -1259,6 +2179,7 @@ Model { DstPort 3 } Line { + ZOrder 11 SrcBlock "GenEff/100" SrcPort 1 Points [0, 20; 15, 0] @@ -1266,51 +2187,62 @@ Model { DstPort 1 } Line { + ZOrder 12 SrcBlock "Dot Product1" SrcPort 1 DstBlock "GenEff/100" DstPort 1 } Line { + ZOrder 13 SrcBlock "Saturation" SrcPort 1 - Points [0, 0; 40, 0] + Points [40, 0] Branch { + ZOrder 14 DstBlock "Dot Product1" DstPort 2 } Branch { + ZOrder 15 Points [20, 0] Branch { + ZOrder 16 Points [45, 0] Branch { + ZOrder 17 DstBlock "Dot Product" DstPort 2 } Branch { + ZOrder 18 DstBlock "Mux" DstPort 1 } } Branch { + ZOrder 19 DstBlock "Switch" DstPort 2 } } } Line { + ZOrder 20 SrcBlock "Mux" SrcPort 1 DstBlock "GenTrq, ElecPwr" DstPort 1 } Line { + ZOrder 21 SrcBlock "RPM to rad/s" SrcPort 1 DstBlock "GBRatio" DstPort 1 } Line { + ZOrder 22 SrcBlock "Switch" SrcPort 1 Points [0, 15; 150, 0; 0, -250] @@ -1318,6 +2250,7 @@ Model { DstPort 2 } Line { + ZOrder 23 SrcBlock "Gen speed\nwrt LSS (RPM)" SrcPort 1 DstBlock "RPM to rad/s" @@ -1326,12 +2259,16 @@ Model { Annotation { SID "35" Name "HSS_Spd" - Position [186, 102] + Position [164, 96, 209, 108] + InternalMargins [0, 0, 0, 0] + ZOrder -1 } Annotation { SID "36" Name "Slip" - Position [272, 101] + Position [263, 95, 281, 107] + InternalMargins [0, 0, 0, 0] + ZOrder -2 } } } @@ -1341,6 +2278,7 @@ Model { SID "37" Ports [1] Position [90, 15, 150, 45] + ZOrder -7 VariableName "Time" MaxDataPoints "inf" SampleTime "-1" @@ -1351,17 +2289,16 @@ Model { SID "38" Ports [0, 1] Position [295, 144, 395, 186] - MinAlgLoopOccurrences off - PropExecContextOutsideSubsystem off - RTWSystemCode "Auto" - FunctionWithSeparateData off - Opaque off + ZOrder -8 RequestExecContextInheritance off - MaskHideContents off System { Name "Yaw Controller" - Location [433, 403, 907, 565] + Location [395, 283, 909, 623] + SystemRect [0.000000, 0.000000, 0.000000, 0.000000] Open off + PortBlocksUseCompactNotation off + SetExecutionDomain off + ExecutionDomainType "Deduce" ModelBrowserVisibility off ModelBrowserWidth 200 ScreenColor "white" @@ -1373,12 +2310,14 @@ Model { TiledPageScale 1 ShowPageBoundaries off ZoomFactor "100" + SimulinkSubDomain "Simulink" Block { BlockType Mux Name "Mux" SID "39" Ports [2, 1] Position [190, 56, 195, 94] + ZOrder -1 ShowName off Inputs "2" DisplayOption "bar" @@ -1388,6 +2327,7 @@ Model { Name "Yaw Position" SID "40" Position [45, 30, 75, 60] + ZOrder -2 Value "0" } Block { @@ -1395,6 +2335,7 @@ Model { Name "Yaw rate" SID "41" Position [45, 90, 75, 120] + ZOrder -3 Value "0" } Block { @@ -1402,15 +2343,17 @@ Model { Name "Out1" SID "42" Position [245, 68, 275, 82] - IconDisplay "Port number" + ZOrder -4 } Line { + ZOrder 1 SrcBlock "Mux" SrcPort 1 DstBlock "Out1" DstPort 1 } Line { + ZOrder 2 SrcBlock "Yaw Position" SrcPort 1 Points [45, 0; 0, 20] @@ -1418,6 +2361,7 @@ Model { DstPort 1 } Line { + ZOrder 3 SrcBlock "Yaw rate" SrcPort 1 Points [45, 0; 0, -20] @@ -1431,7 +2375,8 @@ Model { Name "qdotdot_out" SID "43" Ports [1] - Position [750, 183, 820, 207] + Position [745, 213, 815, 237] + ZOrder -9 BackgroundColor "yellow" ShowName off VariableName "OutData" @@ -1439,60 +2384,93 @@ Model { SampleTime "-1" } Line { + ZOrder 1 SrcBlock "Clock" SrcPort 1 DstBlock "To Workspace" DstPort 1 } Line { + ZOrder 2 SrcBlock "FAST Nonlinear Wind Turbine" SrcPort 1 - Points [30, 0] + Points [25, 0] Branch { + ZOrder 18 + Points [0, -60] DstBlock "qdotdot_out" DstPort 1 } Branch { - Points [0, 160] + ZOrder 4 + Points [0, 265] DstBlock "Fcn" DstPort 1 } } Line { + ZOrder 5 SrcBlock "Simple Induction Generator" SrcPort 1 DstBlock "FAST Nonlinear Wind Turbine" DstPort 1 } Line { + ZOrder 6 SrcBlock "Yaw Controller" SrcPort 1 DstBlock "FAST Nonlinear Wind Turbine" DstPort 2 } Line { + ZOrder 7 SrcBlock "Pitch Controller" SrcPort 1 DstBlock "FAST Nonlinear Wind Turbine" DstPort 3 } Line { + ZOrder 8 SrcBlock "Fcn" SrcPort 1 - Points [-360, 0; 0, -250] + Points [-360, 0; 0, -445] DstBlock "Simple Induction Generator" DstPort 1 } Line { + ZOrder 9 SrcBlock "High-Speed Shaft Brake" SrcPort 1 DstBlock "FAST Nonlinear Wind Turbine" DstPort 4 } + Line { + ZOrder 12 + SrcBlock "Airfoil Controller" + SrcPort 1 + DstBlock "FAST Nonlinear Wind Turbine" + DstPort 5 + } + Line { + ZOrder 19 + SrcBlock "Cable deltaL Controller" + SrcPort 1 + DstBlock "FAST Nonlinear Wind Turbine" + DstPort 6 + } + Line { + ZOrder 20 + SrcBlock "Cable deltaLdot Controller" + SrcPort 1 + DstBlock "FAST Nonlinear Wind Turbine" + DstPort 7 + } Annotation { SID "44" Name "Select LSS speed at entrance to gearbox (rpm)" - Position [451, 383] + Position [330, 575, 540, 587] + InternalMargins [0, 0, 0, 0] + ZOrder -1 } } } diff --git a/glue-codes/simulink/src/create_FAST_SFunc.m b/glue-codes/simulink/src/create_FAST_SFunc.m index 1892c1846b..548f235291 100644 --- a/glue-codes/simulink/src/create_FAST_SFunc.m +++ b/glue-codes/simulink/src/create_FAST_SFunc.m @@ -39,13 +39,16 @@ else %% defaults for cmake builds: - if ( ispc ) % Windows PC + if ( ismac ) % Apple MacOS + installDir = '../../../install'; + outDir = fullfile(installDir, 'lib'); + elseif ( ispc ) % Windows PC installDir = '../../../install'; outDir = fullfile(installDir, 'lib'); % If there are shared libraries does it work for outDir to be the local directory? else - installDir = '/usr/local'; - outDir = '.'; + installDir = '../../../install'; + outDir = fullfile(installDir, 'lib'); end libDir = fullfile(installDir, 'lib'); diff --git a/modules/elastodyn/src/ElastoDyn.f90 b/modules/elastodyn/src/ElastoDyn.f90 index e680d11c0c..753ae6ca21 100644 --- a/modules/elastodyn/src/ElastoDyn.f90 +++ b/modules/elastodyn/src/ElastoDyn.f90 @@ -250,9 +250,11 @@ SUBROUTINE ED_Init( InitInp, u, p, x, xd, z, OtherState, y, m, Interval, InitOut InitOut%PlatformPos(2) = InitOut%PlatformPos(2) - TransMat(3,2)*p%PtfmRefzt InitOut%PlatformPos(3) = InitOut%PlatformPos(3) - TransMat(3,3)*p%PtfmRefzt + p%PtfmRefzt - InitOut%HubHt = p%HubHt - InitOut%TwrBasePos = y%TowerLn2Mesh%Position(:,p%TwrNodes + 2) - InitOut%TwrBaseOrient = y%TowerLn2Mesh%Orientation(:,:,p%TwrNodes + 2) + InitOut%HubHt = p%HubHt + InitOut%TwrBaseRefPos = y%TowerLn2Mesh%Position(:,p%TwrNodes + 2) + InitOut%TwrBaseTransDisp = y%TowerLn2Mesh%TranslationDisp(:,p%TwrNodes + 2) + InitOut%TwrBaseRefOrient = y%TowerLn2Mesh%RefOrientation(:,:,p%TwrNodes + 2) + InitOut%TwrBaseOrient = y%TowerLn2Mesh%Orientation(:,:,p%TwrNodes + 2) InitOut%HubRad = p%HubRad InitOut%RotSpeed = p%RotSpeed InitOut%isFixed_GenDOF = .not. InputFileData%GenDOF diff --git a/modules/elastodyn/src/ElastoDyn_Registry.txt b/modules/elastodyn/src/ElastoDyn_Registry.txt index 69076faeca..f747ea5cc2 100644 --- a/modules/elastodyn/src/ElastoDyn_Registry.txt +++ b/modules/elastodyn/src/ElastoDyn_Registry.txt @@ -38,7 +38,9 @@ typedef ^ InitOutputType ReKi HubHt - - - "Height of the hub" meters typedef ^ InitOutputType ReKi BldRNodes {:} - - "Radius to analysis nodes relative to hub ( 0 < RNodes(:) < BldFlexL )" typedef ^ InitOutputType ReKi TwrHNodes {:} - - "Location of variable-spaced tower nodes (relative to the tower rigid base height" typedef ^ InitOutputType ReKi PlatformPos {6} - - "Initial platform position (6 DOFs)" -typedef ^ InitOutputType ReKi TwrBasePos {3} - - "initial position of the tower base (for SrvD)" m +typedef ^ InitOutputType ReKi TwrBaseRefPos {3} - - "initial position of the tower base (for SrvD)" m +typedef ^ InitOutputType R8Ki TwrBaseTransDisp {3} - - "initial displacement of the tower base (for SrvD)" m +typedef ^ InitOutputType R8Ki TwrBaseRefOrient {3}{3} - - "reference orientation of the tower base (for SrvD)" typedef ^ InitOutputType R8Ki TwrBaseOrient {3}{3} - - "initial orientation of the tower base (for SrvD)" typedef ^ InitOutputType ReKi HubRad - - - "Preconed hub radius (distance from the rotor apex to the blade root)" m typedef ^ InitOutputType ReKi RotSpeed - - - "Initial or fixed rotor speed" rad/s diff --git a/modules/elastodyn/src/ElastoDyn_Types.f90 b/modules/elastodyn/src/ElastoDyn_Types.f90 index 7909c4793e..6fd3d21ea6 100644 --- a/modules/elastodyn/src/ElastoDyn_Types.f90 +++ b/modules/elastodyn/src/ElastoDyn_Types.f90 @@ -58,7 +58,9 @@ MODULE ElastoDyn_Types REAL(ReKi) , DIMENSION(:), ALLOCATABLE :: BldRNodes !< Radius to analysis nodes relative to hub ( 0 < RNodes(:) < BldFlexL ) [-] REAL(ReKi) , DIMENSION(:), ALLOCATABLE :: TwrHNodes !< Location of variable-spaced tower nodes (relative to the tower rigid base height [-] REAL(ReKi) , DIMENSION(1:6) :: PlatformPos !< Initial platform position (6 DOFs) [-] - REAL(ReKi) , DIMENSION(1:3) :: TwrBasePos !< initial position of the tower base (for SrvD) [m] + REAL(ReKi) , DIMENSION(1:3) :: TwrBaseRefPos !< initial position of the tower base (for SrvD) [m] + REAL(R8Ki) , DIMENSION(1:3) :: TwrBaseTransDisp !< initial displacement of the tower base (for SrvD) [m] + REAL(R8Ki) , DIMENSION(1:3,1:3) :: TwrBaseRefOrient !< reference orientation of the tower base (for SrvD) [-] REAL(R8Ki) , DIMENSION(1:3,1:3) :: TwrBaseOrient !< initial orientation of the tower base (for SrvD) [-] REAL(ReKi) :: HubRad !< Preconed hub radius (distance from the rotor apex to the blade root) [m] REAL(ReKi) :: RotSpeed !< Initial or fixed rotor speed [rad/s] @@ -1136,7 +1138,9 @@ SUBROUTINE ED_CopyInitOutput( SrcInitOutputData, DstInitOutputData, CtrlCode, Er DstInitOutputData%TwrHNodes = SrcInitOutputData%TwrHNodes ENDIF DstInitOutputData%PlatformPos = SrcInitOutputData%PlatformPos - DstInitOutputData%TwrBasePos = SrcInitOutputData%TwrBasePos + DstInitOutputData%TwrBaseRefPos = SrcInitOutputData%TwrBaseRefPos + DstInitOutputData%TwrBaseTransDisp = SrcInitOutputData%TwrBaseTransDisp + DstInitOutputData%TwrBaseRefOrient = SrcInitOutputData%TwrBaseRefOrient DstInitOutputData%TwrBaseOrient = SrcInitOutputData%TwrBaseOrient DstInitOutputData%HubRad = SrcInitOutputData%HubRad DstInitOutputData%RotSpeed = SrcInitOutputData%RotSpeed @@ -1374,7 +1378,9 @@ SUBROUTINE ED_PackInitOutput( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMs Re_BufSz = Re_BufSz + SIZE(InData%TwrHNodes) ! TwrHNodes END IF Re_BufSz = Re_BufSz + SIZE(InData%PlatformPos) ! PlatformPos - Re_BufSz = Re_BufSz + SIZE(InData%TwrBasePos) ! TwrBasePos + Re_BufSz = Re_BufSz + SIZE(InData%TwrBaseRefPos) ! TwrBaseRefPos + Db_BufSz = Db_BufSz + SIZE(InData%TwrBaseTransDisp) ! TwrBaseTransDisp + Db_BufSz = Db_BufSz + SIZE(InData%TwrBaseRefOrient) ! TwrBaseRefOrient Db_BufSz = Db_BufSz + SIZE(InData%TwrBaseOrient) ! TwrBaseOrient Re_BufSz = Re_BufSz + 1 ! HubRad Re_BufSz = Re_BufSz + 1 ! RotSpeed @@ -1567,10 +1573,20 @@ SUBROUTINE ED_PackInitOutput( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMs ReKiBuf(Re_Xferred) = InData%PlatformPos(i1) Re_Xferred = Re_Xferred + 1 END DO - DO i1 = LBOUND(InData%TwrBasePos,1), UBOUND(InData%TwrBasePos,1) - ReKiBuf(Re_Xferred) = InData%TwrBasePos(i1) + DO i1 = LBOUND(InData%TwrBaseRefPos,1), UBOUND(InData%TwrBaseRefPos,1) + ReKiBuf(Re_Xferred) = InData%TwrBaseRefPos(i1) Re_Xferred = Re_Xferred + 1 END DO + DO i1 = LBOUND(InData%TwrBaseTransDisp,1), UBOUND(InData%TwrBaseTransDisp,1) + DbKiBuf(Db_Xferred) = InData%TwrBaseTransDisp(i1) + Db_Xferred = Db_Xferred + 1 + END DO + DO i2 = LBOUND(InData%TwrBaseRefOrient,2), UBOUND(InData%TwrBaseRefOrient,2) + DO i1 = LBOUND(InData%TwrBaseRefOrient,1), UBOUND(InData%TwrBaseRefOrient,1) + DbKiBuf(Db_Xferred) = InData%TwrBaseRefOrient(i1,i2) + Db_Xferred = Db_Xferred + 1 + END DO + END DO DO i2 = LBOUND(InData%TwrBaseOrient,2), UBOUND(InData%TwrBaseOrient,2) DO i1 = LBOUND(InData%TwrBaseOrient,1), UBOUND(InData%TwrBaseOrient,1) DbKiBuf(Db_Xferred) = InData%TwrBaseOrient(i1,i2) @@ -1889,12 +1905,28 @@ SUBROUTINE ED_UnPackInitOutput( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, Er OutData%PlatformPos(i1) = ReKiBuf(Re_Xferred) Re_Xferred = Re_Xferred + 1 END DO - i1_l = LBOUND(OutData%TwrBasePos,1) - i1_u = UBOUND(OutData%TwrBasePos,1) - DO i1 = LBOUND(OutData%TwrBasePos,1), UBOUND(OutData%TwrBasePos,1) - OutData%TwrBasePos(i1) = ReKiBuf(Re_Xferred) + i1_l = LBOUND(OutData%TwrBaseRefPos,1) + i1_u = UBOUND(OutData%TwrBaseRefPos,1) + DO i1 = LBOUND(OutData%TwrBaseRefPos,1), UBOUND(OutData%TwrBaseRefPos,1) + OutData%TwrBaseRefPos(i1) = ReKiBuf(Re_Xferred) Re_Xferred = Re_Xferred + 1 END DO + i1_l = LBOUND(OutData%TwrBaseTransDisp,1) + i1_u = UBOUND(OutData%TwrBaseTransDisp,1) + DO i1 = LBOUND(OutData%TwrBaseTransDisp,1), UBOUND(OutData%TwrBaseTransDisp,1) + OutData%TwrBaseTransDisp(i1) = REAL(DbKiBuf(Db_Xferred), R8Ki) + Db_Xferred = Db_Xferred + 1 + END DO + i1_l = LBOUND(OutData%TwrBaseRefOrient,1) + i1_u = UBOUND(OutData%TwrBaseRefOrient,1) + i2_l = LBOUND(OutData%TwrBaseRefOrient,2) + i2_u = UBOUND(OutData%TwrBaseRefOrient,2) + DO i2 = LBOUND(OutData%TwrBaseRefOrient,2), UBOUND(OutData%TwrBaseRefOrient,2) + DO i1 = LBOUND(OutData%TwrBaseRefOrient,1), UBOUND(OutData%TwrBaseRefOrient,1) + OutData%TwrBaseRefOrient(i1,i2) = REAL(DbKiBuf(Db_Xferred), R8Ki) + Db_Xferred = Db_Xferred + 1 + END DO + END DO i1_l = LBOUND(OutData%TwrBaseOrient,1) i1_u = UBOUND(OutData%TwrBaseOrient,1) i2_l = LBOUND(OutData%TwrBaseOrient,2) diff --git a/modules/moordyn/src/MoorDyn.f90 b/modules/moordyn/src/MoorDyn.f90 index be03841bb1..23d8854ef0 100644 --- a/modules/moordyn/src/MoorDyn.f90 +++ b/modules/moordyn/src/MoorDyn.f90 @@ -340,9 +340,25 @@ SUBROUTINE MD_Init(InitInp, u, p, x, xd, z, other, y, m, DTcoupling, InitOut, Er END IF END DO - ! allocate the input arrays - ALLOCATE ( u%DeltaL(N), u%DeltaLdot(N), STAT = ErrStat2 ) - + ! allocate the input arrays (if any requested) + if (N > 0) then + call AllocAry( u%DeltaL, N, 'u%DeltaL', ErrStat2, ErrMsg2 ) + call CheckError( ErrStat2, ErrMsg2 ) + if (ErrStat >= AbortErrLev) return + u%DeltaL = 0.0_ReKi + call AllocAry( u%DeltaLdot, N, 'u%DeltaLdot', ErrStat2, ErrMsg2 ) + call CheckError( ErrStat2, ErrMsg2 ) + if (ErrStat >= AbortErrLev) return + u%DeltaLdot = 0.0_ReKi + call AllocAry( InitOut%CableCChanRqst, N, 'CableCChanRqst', ErrStat2, ErrMsg2 ) + call CheckError( ErrStat2, ErrMsg2 ) + if (ErrStat >= AbortErrLev) return + InitOut%CableCChanRqst = .FALSE. ! Initialize to false + do J=1,p%NLines + if (m%LineList(J)%CtrlChan > 0) InitOut%CableCChanRqst(m%LineList(J)%CtrlChan) = .TRUE. + enddo + endif + ! -------------------------------------------------------------------- ! go through lines and initialize internal node positions using Catenary() diff --git a/modules/moordyn/src/MoorDyn_IO.f90 b/modules/moordyn/src/MoorDyn_IO.f90 index f4dfba6420..2eb3c9a67b 100644 --- a/modules/moordyn/src/MoorDyn_IO.f90 +++ b/modules/moordyn/src/MoorDyn_IO.f90 @@ -1094,18 +1094,25 @@ SUBROUTINE MDIO_CloseOutput ( p, m, ErrStat, ErrMsg ) ! close main MoorDyn output file - CLOSE( p%MDUnOut, IOSTAT = ErrStat ) - IF ( ErrStat /= 0 ) THEN - ErrMsg = 'Error closing output file' - END IF - - ! close individual line output files - DO I=1,p%NLines - CLOSE( m%LineList(I)%LineUnOut, IOSTAT = ErrStat ) + if (p%MDUnOut > 0) then + CLOSE( p%MDUnOut, IOSTAT = ErrStat ) IF ( ErrStat /= 0 ) THEN - ErrMsg = 'Error closing line output file' + ErrMsg = 'Error closing output file' END IF - END DO + endif + + ! close individual line output files + if (allocated(m%LineList)) then + DO I=1,p%NLines + if (m%LineList(I)%LineUnOut > 0) then + CLOSE( m%LineList(I)%LineUnOut, IOSTAT = ErrStat ) + IF ( ErrStat /= 0 ) THEN + ErrMsg = 'Error closing line output file' + exit ! exit this loop + END IF + endif + END DO + endif ! deallocate output arrays IF (ALLOCATED(m%MDWrOutput)) THEN diff --git a/modules/moordyn/src/MoorDyn_Registry.txt b/modules/moordyn/src/MoorDyn_Registry.txt index 6fb1e729db..636bfc9dbf 100644 --- a/modules/moordyn/src/MoorDyn_Registry.txt +++ b/modules/moordyn/src/MoorDyn_Registry.txt @@ -112,6 +112,7 @@ typedef ^ ^ IntKi ObjID - typedef ^ InitOutputType CHARACTER(ChanLen) writeOutputHdr {:} "" - "first line output file contents: output variable names" typedef ^ ^ CHARACTER(ChanLen) writeOutputUnt {:} "" - "second line of output file contents: units" typedef ^ ^ ProgDesc Ver - "" - "this module's name, version, and date" +typedef ^ ^ LOGICAL CableCChanRqst {:} .FALSE. - "flag indicating control channel for drive line active tensioning is requested" - ## ============================== Define Continuous states here: ===================================================================================================================================== diff --git a/modules/moordyn/src/MoorDyn_Types.f90 b/modules/moordyn/src/MoorDyn_Types.f90 index dc9c2bff15..242c7fee18 100644 --- a/modules/moordyn/src/MoorDyn_Types.f90 +++ b/modules/moordyn/src/MoorDyn_Types.f90 @@ -137,6 +137,7 @@ MODULE MoorDyn_Types CHARACTER(ChanLen) , DIMENSION(:), ALLOCATABLE :: writeOutputHdr !< first line output file contents: output variable names [-] CHARACTER(ChanLen) , DIMENSION(:), ALLOCATABLE :: writeOutputUnt !< second line of output file contents: units [-] TYPE(ProgDesc) :: Ver !< this module's name, version, and date [-] + LOGICAL , DIMENSION(:), ALLOCATABLE :: CableCChanRqst !< flag indicating control channel for drive line active tensioning is requested [-] END TYPE MD_InitOutputType ! ======================= ! ========= MD_ContinuousStateType ======= @@ -2692,6 +2693,18 @@ SUBROUTINE MD_CopyInitOutput( SrcInitOutputData, DstInitOutputData, CtrlCode, Er CALL NWTC_Library_Copyprogdesc( SrcInitOutputData%Ver, DstInitOutputData%Ver, CtrlCode, ErrStat2, ErrMsg2 ) CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) IF (ErrStat>=AbortErrLev) RETURN +IF (ALLOCATED(SrcInitOutputData%CableCChanRqst)) THEN + i1_l = LBOUND(SrcInitOutputData%CableCChanRqst,1) + i1_u = UBOUND(SrcInitOutputData%CableCChanRqst,1) + IF (.NOT. ALLOCATED(DstInitOutputData%CableCChanRqst)) THEN + ALLOCATE(DstInitOutputData%CableCChanRqst(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstInitOutputData%CableCChanRqst.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DstInitOutputData%CableCChanRqst = SrcInitOutputData%CableCChanRqst +ENDIF END SUBROUTINE MD_CopyInitOutput SUBROUTINE MD_DestroyInitOutput( InitOutputData, ErrStat, ErrMsg ) @@ -2710,6 +2723,9 @@ SUBROUTINE MD_DestroyInitOutput( InitOutputData, ErrStat, ErrMsg ) DEALLOCATE(InitOutputData%writeOutputUnt) ENDIF CALL NWTC_Library_Destroyprogdesc( InitOutputData%Ver, ErrStat, ErrMsg ) +IF (ALLOCATED(InitOutputData%CableCChanRqst)) THEN + DEALLOCATE(InitOutputData%CableCChanRqst) +ENDIF END SUBROUTINE MD_DestroyInitOutput SUBROUTINE MD_PackInitOutput( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg, SizeOnly ) @@ -2775,6 +2791,11 @@ SUBROUTINE MD_PackInitOutput( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMs Int_BufSz = Int_BufSz + SIZE( Int_Buf ) DEALLOCATE(Int_Buf) END IF + Int_BufSz = Int_BufSz + 1 ! CableCChanRqst allocated yes/no + IF ( ALLOCATED(InData%CableCChanRqst) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! CableCChanRqst upper/lower bounds for each dimension + Int_BufSz = Int_BufSz + SIZE(InData%CableCChanRqst) ! CableCChanRqst + END IF IF ( Re_BufSz .GT. 0 ) THEN ALLOCATE( ReKiBuf( Re_BufSz ), STAT=ErrStat2 ) IF (ErrStat2 /= 0) THEN @@ -2864,6 +2885,21 @@ SUBROUTINE MD_PackInitOutput( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMs ELSE IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 ENDIF + IF ( .NOT. ALLOCATED(InData%CableCChanRqst) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%CableCChanRqst,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%CableCChanRqst,1) + Int_Xferred = Int_Xferred + 2 + + DO i1 = LBOUND(InData%CableCChanRqst,1), UBOUND(InData%CableCChanRqst,1) + IntKiBuf(Int_Xferred) = TRANSFER(InData%CableCChanRqst(i1), IntKiBuf(1)) + Int_Xferred = Int_Xferred + 1 + END DO + END IF END SUBROUTINE MD_PackInitOutput SUBROUTINE MD_UnPackInitOutput( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrMsg ) @@ -2973,6 +3009,24 @@ SUBROUTINE MD_UnPackInitOutput( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, Er IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! CableCChanRqst not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%CableCChanRqst)) DEALLOCATE(OutData%CableCChanRqst) + ALLOCATE(OutData%CableCChanRqst(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%CableCChanRqst.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i1 = LBOUND(OutData%CableCChanRqst,1), UBOUND(OutData%CableCChanRqst,1) + OutData%CableCChanRqst(i1) = TRANSFER(IntKiBuf(Int_Xferred), OutData%CableCChanRqst(i1)) + Int_Xferred = Int_Xferred + 1 + END DO + END IF END SUBROUTINE MD_UnPackInitOutput SUBROUTINE MD_CopyContState( SrcContStateData, DstContStateData, CtrlCode, ErrStat, ErrMsg ) diff --git a/modules/openfast-library/CMakeLists.txt b/modules/openfast-library/CMakeLists.txt index d27f0f2d8b..1a54ec8ab4 100644 --- a/modules/openfast-library/CMakeLists.txt +++ b/modules/openfast-library/CMakeLists.txt @@ -69,6 +69,10 @@ if (${_compiler_id} STREQUAL "GNU" AND ${_build_type} STREQUAL "RELEASE") COMPILE_FLAGS "-fno-var-tracking -fno-var-tracking-assignments" ) endif() +if (${_compiler_id} MATCHES "^INTEL" AND ${_build_type} STREQUAL "RELEASE" AND NOT WIN32) + # Compilation hangs on FAST_Farm_Types.f90 with -O3 on linux (on some hardware) + set_source_files_properties(src/FAST_Types.f90 PROPERTIES COMPILE_FLAGS "-O2") +endif() install(TARGETS openfastlib openfast_prelib openfast_postlib EXPORT ${CMAKE_PROJECT_NAME}Libraries diff --git a/modules/openfast-library/src/FAST_Library.f90 b/modules/openfast-library/src/FAST_Library.f90 index aae84a95f1..a70bfe7fe5 100644 --- a/modules/openfast-library/src/FAST_Library.f90 +++ b/modules/openfast-library/src/FAST_Library.f90 @@ -22,8 +22,8 @@ MODULE FAST_Data INTEGER(IntKi) :: NumTurbines INTEGER, PARAMETER :: IntfStrLen = 1025 ! length of strings through the C interface INTEGER(IntKi), PARAMETER :: MAXOUTPUTS = 4000 ! Maximum number of outputs - INTEGER(IntKi), PARAMETER :: MAXInitINPUTS = 10 ! Maximum number of initialization values from Simulink - INTEGER(IntKi), PARAMETER :: NumFixedInputs = 8 + INTEGER(IntKi), PARAMETER :: MAXInitINPUTS = 53 ! Maximum number of initialization values from Simulink + INTEGER(IntKi), PARAMETER :: NumFixedInputs = 51 ! Global (static) data: @@ -187,17 +187,7 @@ subroutine FAST_Start(iTurb, NumInputs_c, NumOutputs_c, InputAry, OutputAry, Err ! initialize variables: n_t_global = 0 -#ifdef SIMULINK_DirectFeedThrough - IF( NumInputs_c /= NumFixedInputs .AND. NumInputs_c /= NumFixedInputs+3 ) THEN - ErrStat_c = ErrID_Fatal - ErrMsg = "FAST_Start:size of InputAry is invalid."//C_NULL_CHAR - ErrMsg_c = TRANSFER( ErrMsg//C_NULL_CHAR, ErrMsg_c ) - RETURN - END IF - CALL FAST_SetExternalInputs(iTurb, NumInputs_c, InputAry, Turbine(iTurb)%m_FAST) - -#endif !............................................................................................................................... ! Initialization of solver: (calculate outputs based on states at t=t_initial as well as guesses of inputs and constraint states) !............................................................................................................................... @@ -318,6 +308,9 @@ subroutine FAST_Update(iTurb, NumInputs_c, NumOutputs_c, InputAry, OutputAry, Er end subroutine FAST_Update !================================================================================================================================== +!> NOTE: If this interface is changed, update the table in the ServoDyn_IO.f90::WrSumInfo4Simulink routine +!! Ideally we would write this summary info from here, but that isn't currently done. So as a workaround so the user has some +!! vague idea what went wrong with their simulation, we have ServoDyn include the arrangement set here in the SrvD.sum file. subroutine FAST_SetExternalInputs(iTurb, NumInputs_c, InputAry, m_FAST) USE, INTRINSIC :: ISO_C_Binding @@ -334,17 +327,21 @@ subroutine FAST_SetExternalInputs(iTurb, NumInputs_c, InputAry, m_FAST) ! set the inputs from external code here... ! transfer inputs from Simulink to FAST IF ( NumInputs_c < NumFixedInputs ) RETURN ! This is an error - - m_FAST%ExternInput%GenTrq = InputAry(1) - m_FAST%ExternInput%ElecPwr = InputAry(2) - m_FAST%ExternInput%YawPosCom = InputAry(3) - m_FAST%ExternInput%YawRateCom = InputAry(4) - m_FAST%ExternInput%BlPitchCom = InputAry(5:7) - m_FAST%ExternInput%HSSBrFrac = InputAry(8) + + !NOTE: if anything here changes, update ServoDyn_IO.f90::WrSumInfo4Simulink + m_FAST%ExternInput%GenTrq = InputAry(1) + m_FAST%ExternInput%ElecPwr = InputAry(2) + m_FAST%ExternInput%YawPosCom = InputAry(3) + m_FAST%ExternInput%YawRateCom = InputAry(4) + m_FAST%ExternInput%BlPitchCom = InputAry(5:7) + m_FAST%ExternInput%HSSBrFrac = InputAry(8) + m_FAST%ExternInput%BlAirfoilCom = InputAry(9:11) + m_FAST%ExternInput%CableDeltaL = InputAry(12:31) + m_FAST%ExternInput%CableDeltaLdot = InputAry(32:51) IF ( NumInputs_c > NumFixedInputs ) THEN ! NumFixedInputs is the fixed number of inputs IF ( NumInputs_c == NumFixedInputs + 3 ) & - m_FAST%ExternInput%LidarFocus = InputAry(9:11) + m_FAST%ExternInput%LidarFocus = InputAry(52:54) END IF end subroutine FAST_SetExternalInputs diff --git a/modules/openfast-library/src/FAST_Library.h b/modules/openfast-library/src/FAST_Library.h index fd4e9399f1..69fbec8b83 100644 --- a/modules/openfast-library/src/FAST_Library.h +++ b/modules/openfast-library/src/FAST_Library.h @@ -43,11 +43,14 @@ EXTERNAL_ROUTINE void FAST_CreateCheckpoint(int * iTurb, const char *CheckpointR // make sure these parameters match with FAST_Library.f90 and NWTC_Base.f90 #define MAXIMUM_BLADES 3 +#define MAXIMUM_AFCTRL 3 +#define MAXIMUM_CABLE_DELTAL 20 +#define MAXIMUM_CABLE_DELTALDOT 20 #define MAXIMUM_OUTPUTS 4000 #define CHANNEL_LENGTH 20 -#define MAXInitINPUTS 10 +#define MAXInitINPUTS 53 -#define NumFixedInputs 2 + 2 + MAXIMUM_BLADES + 1 +#define NumFixedInputs 2 + 2 + MAXIMUM_BLADES + 1 + MAXIMUM_AFCTRL + MAXIMUM_CABLE_DELTAL + MAXIMUM_CABLE_DELTALDOT #endif diff --git a/modules/openfast-library/src/FAST_Lin.f90 b/modules/openfast-library/src/FAST_Lin.f90 index 3b603da049..b26bacf7fa 100644 --- a/modules/openfast-library/src/FAST_Lin.f90 +++ b/modules/openfast-library/src/FAST_Lin.f90 @@ -2529,14 +2529,14 @@ SUBROUTINE Linear_SrvD_InputSolve_dy( p_FAST, y_FAST, dUdy ) !IF (u_SrvD%NStC%Mesh%Committed) THEN ! - ! CALL Linearize_Point_to_Point( y_ED%NacelleMotion, u_SrvD%NStC%Mesh, MeshMapData%ED_P_2_SrvD_P_N, ErrStat2, ErrMsg2 ) + ! CALL Linearize_Point_to_Point( y_ED%NacelleMotion, u_SrvD%NStC%Mesh, MeshMapData%ED_P_2_NStC_P_N, ErrStat2, ErrMsg2 ) ! call SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) ! !END IF ! !IF (u_SrvD%TSC%Mesh%Committed) THEN ! - ! CALL Linearize_Line2_to_Point( y_ED%TowerLn2Mesh, u_SrvD%TStC%Mesh, MeshMapData%ED_L_2_SrvD_P_T, ErrStat2, ErrMsg2 ) + ! CALL Linearize_Line2_to_Point( y_ED%TowerLn2Mesh, u_SrvD%TStC%Mesh, MeshMapData%ED_L_2_TStC_P_T, ErrStat2, ErrMsg2 ) ! call SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) ! !END IF @@ -2591,12 +2591,12 @@ SUBROUTINE Linear_ED_InputSolve_dy( p_FAST, y_FAST, u_ED, y_ED, y_AD, u_AD, BD, end do !IF (y_SrvD%NStC%Mesh%Committed) THEN - ! CALL Linearize_Point_to_Point( y_SrvD%NStC%Mesh, u_ED%NacelleLoads, MeshMapData%SrvD_P_2_ED_P_N, ErrStat2, ErrMsg2, u_SrvD%NStC%Mesh, y_ED%NacelleMotion ) + ! CALL Linearize_Point_to_Point( y_SrvD%NStC%Mesh, u_ED%NacelleLoads, MeshMapData%NStC_P_2_ED_P_N, ErrStat2, ErrMsg2, u_SrvD%NStC%Mesh, y_ED%NacelleMotion ) ! CALL SetErrStat(ErrStat2,ErrMsg2,ErrStat, ErrMsg,RoutineName//':u_ED%NacelleLoads' ) !END IF ! !IF (y_SrvD%TStC%Mesh%Committed) THEN - ! CALL Linearize_Point_to_Point( y_SrvD%TStC%Mesh, u_ED%TowerPtLoads, MeshMapData%SrvD_P_2_ED_P_T, ErrStat2, ErrMsg2, u_SrvD%TStC%Mesh, y_ED%TowerLn2Mesh ) + ! CALL Linearize_Point_to_Point( y_SrvD%TStC%Mesh, u_ED%TowerPtLoads, MeshMapData%TStC_P_2_ED_P_T, ErrStat2, ErrMsg2, u_SrvD%TStC%Mesh, y_ED%TowerLn2Mesh ) ! CALL SetErrStat(ErrStat2,ErrMsg2,ErrStat, ErrMsg,RoutineName//':u_ED%TowerPtLoads' ) !END IF diff --git a/modules/openfast-library/src/FAST_Registry.txt b/modules/openfast-library/src/FAST_Registry.txt index f6f9fadf4d..c806cef96f 100644 --- a/modules/openfast-library/src/FAST_Registry.txt +++ b/modules/openfast-library/src/FAST_Registry.txt @@ -600,19 +600,21 @@ typedef ^ FAST_ModuleMapType MeshMapType HD_M_P_2_SD_P - - - "Map HydroDyn Moris typedef ^ FAST_ModuleMapType MeshMapType SD_P_2_HD_W_P - - - "Map SubDyn y2Mesh Point to HydroDyn WAMIT Point" typedef ^ FAST_ModuleMapType MeshMapType HD_W_P_2_SD_P - - - "Map HydroDyn WAMIT Point to SubDyn y2Mesh Point" # ED/BD <-> SrvD/StC -typedef ^ FAST_ModuleMapType MeshMapType ED_P_2_SrvD_P_N {:} - - "Map ElastoDyn Nacelle point mesh to ServoDyn/NStC point mesh" -typedef ^ FAST_ModuleMapType MeshMapType SrvD_P_2_ED_P_N {:} - - "Map ServoDyn nacelle point mesh to ElastoDyn point mesh on the nacelle" -typedef ^ FAST_ModuleMapType MeshMapType ED_L_2_SrvD_P_T {:} - - "Map ElastoDyn tower line2 mesh to ServoDyn/TStC point mesh" -typedef ^ FAST_ModuleMapType MeshMapType SrvD_P_2_ED_P_T {:} - - "Map ServoDyn tower point mesh to ElastoDyn point load mesh on the tower" -typedef ^ FAST_ModuleMapType MeshMapType ED_L_2_SrvD_P_B {:}{:} - - "Map ElastoDyn blade line2 mesh to ServoDyn/BStC point mesh" -typedef ^ FAST_ModuleMapType MeshMapType SrvD_P_2_ED_P_B {:}{:} - - "Map ServoDyn/BStC point mesh to ElastoDyn point load mesh on the blade" -typedef ^ FAST_ModuleMapType MeshMapType BD_L_2_SrvD_P_B {:}{:} - - "Map BeamDyn blade line2 mesh to ServoDyn/BStC point mesh" -typedef ^ FAST_ModuleMapType MeshMapType SrvD_P_2_BD_P_B {:}{:} - - "Map ServoDyn/BStC point mesh to BeamDyn point load mesh on the blade" +typedef ^ FAST_ModuleMapType MeshMapType ED_P_2_NStC_P_N {:} - - "Map ElastoDyn nacelle point mesh to ServoDyn/NStC point mesh" +typedef ^ FAST_ModuleMapType MeshMapType NStC_P_2_ED_P_N {:} - - "Map ServoDyn/NStC nacelle point mesh to ElastoDyn point mesh on the nacelle" +typedef ^ FAST_ModuleMapType MeshMapType ED_L_2_TStC_P_T {:} - - "Map ElastoDyn tower line2 mesh to ServoDyn/TStC point mesh" +typedef ^ FAST_ModuleMapType MeshMapType TStC_P_2_ED_P_T {:} - - "Map ServoDyn/TStC tower point mesh to ElastoDyn point load mesh on the tower" +typedef ^ FAST_ModuleMapType MeshMapType ED_L_2_BStC_P_B {:}{:} - - "Map ElastoDyn blade line2 mesh to ServoDyn/BStC point mesh" +typedef ^ FAST_ModuleMapType MeshMapType BStC_P_2_ED_P_B {:}{:} - - "Map ServoDyn/BStC point mesh to ElastoDyn point load mesh on the blade" +typedef ^ FAST_ModuleMapType MeshMapType BD_L_2_BStC_P_B {:}{:} - - "Map BeamDyn blade line2 mesh to ServoDyn/BStC point mesh" +typedef ^ FAST_ModuleMapType MeshMapType BStC_P_2_BD_P_B {:}{:} - - "Map ServoDyn/BStC point mesh to BeamDyn point load mesh on the blade" # ED/SD <-> SrvD/StC -- Platform TMD -typedef ^ FAST_ModuleMapType MeshMapType SrvD_P_P_2_ED_P {:} - - "Map ServoDyn platform point mesh load to ElastoDyn point load mesh" -typedef ^ FAST_ModuleMapType MeshMapType ED_P_2_SrvD_P_P {:} - - "Map ElastoDyn platform point mesh motion to ServoDyn/SStC point mesh" -typedef ^ FAST_ModuleMapType MeshMapType SrvD_P_P_2_SD_P {:} - - "Map ServoDyn platform point mesh load to SubDyn point load Lmesh" -typedef ^ FAST_ModuleMapType MeshMapType SDy3_P_2_SrvD_P_P {:} - - "Map SubDyn platform y3mesh motion to ServoDyn/SStC point mesh" +typedef ^ FAST_ModuleMapType MeshMapType SStC_P_P_2_ED_P {:} - - "Map ServoDyn/SStC platform point mesh load to ElastoDyn point load mesh" +typedef ^ FAST_ModuleMapType MeshMapType ED_P_2_SStC_P_P {:} - - "Map ElastoDyn platform point mesh motion to ServoDyn/SStC point mesh" +typedef ^ FAST_ModuleMapType MeshMapType SStC_P_P_2_SD_P {:} - - "Map ServoDyn/SStC platform point mesh load to SubDyn point load mesh" +typedef ^ FAST_ModuleMapType MeshMapType SDy3_P_2_SStC_P_P {:} - - "Map SubDyn y3mesh point mesh motion to ServoDyn/SStC point mesh" +# ED --> SrvD -- PlatformPtMesh motion to SrvD%PtfmMotionMesh for passing to DLL +typedef ^ FAST_ModuleMapType MeshMapType ED_P_2_SrvD_P_P - - - "Map ElastoDyn platform point mesh motion to ServoDyn point mesh -- for passing to controller" # ED/BD <-> AD (blades) typedef ^ FAST_ModuleMapType MeshMapType BDED_L_2_AD_L_B {:} - - "Map ElastoDyn BladeLn2Mesh point meshes OR BeamDyn BldMotion line2 meshes to AeroDyn14 InputMarkers OR AeroDyn BladeMotion line2 meshes" typedef ^ FAST_ModuleMapType MeshMapType AD_L_2_BDED_B {:} - - "Map AeroDyn14 InputMarkers or AeroDyn BladeLoad line2 meshes to ElastoDyn BladePtLoad point meshes or BeamDyn BldMotion line2 meshes" @@ -638,7 +640,6 @@ typedef ^ FAST_ModuleMapType Integer Jac_u_indx {:}{:} - - "matrix to help fill/ typedef ^ FAST_ModuleMapType MeshType u_ED_NacelleLoads - - - "copy of ED input mesh" typedef ^ FAST_ModuleMapType MeshType u_ED_PlatformPtMesh - - - "copy of ED input mesh" typedef ^ FAST_ModuleMapType MeshType u_ED_PlatformPtMesh_2 - - - "copy of ED input mesh (used only for temporary storage)" -typedef ^ FAST_ModuleMapType MeshType u_ED_PlatformPtMesh_3 - - - "copy of ED input mesh (used only for temporary storage)" typedef ^ FAST_ModuleMapType MeshType u_ED_TowerPtloads - - - "copy of ED input mesh" typedef ^ FAST_ModuleMapType MeshType u_ED_BladePtLoads {:} - - "copy of ED input mesh" typedef ^ FAST_ModuleMapType MeshType u_SD_TPMesh - - - "copy of SD input mesh" @@ -661,8 +662,11 @@ typedef ^ FAST_ExternInputType ReKi ElecPwr - - - "electric power input from Sim typedef ^ FAST_ExternInputType ReKi YawPosCom - - 2pi "yaw position command from Simulink/Labview" typedef ^ FAST_ExternInputType ReKi YawRateCom - - - "yaw rate command from Simulink/Labview" typedef ^ FAST_ExternInputType ReKi BlPitchCom 3 - 2pi "blade pitch commands from Simulink/Labview" "rad" +typedef ^ FAST_ExternInputType ReKi BlAirfoilCom 3 - - "blade airfoil commands from Simulink/Labview" "-" typedef ^ FAST_ExternInputType ReKi HSSBrFrac - - - "Fraction of full braking torque: 0 (off) <= HSSBrFrac <= 1 (full) from Simulink or LabVIEW" typedef ^ FAST_ExternInputType ReKi LidarFocus 3 - - "lidar focus (relative to lidar location)" m +typedef ^ FAST_ExternInputType ReKi CableDeltaL {20} - - "Cable control DeltaL" m +typedef ^ FAST_ExternInputType ReKi CableDeltaLdot {20} - - "Cable control DeltaLdot" m/s # ..... FAST_MiscVarType data ....................................................................................................... typedef FAST FAST_MiscVarType DbKi TiLstPrn - - - "The simulation time of the last print (to file)" (s) diff --git a/modules/openfast-library/src/FAST_Solver.f90 b/modules/openfast-library/src/FAST_Solver.f90 index dcbefe71a2..b562512a58 100644 --- a/modules/openfast-library/src/FAST_Solver.f90 +++ b/modules/openfast-library/src/FAST_Solver.f90 @@ -122,22 +122,20 @@ SUBROUTINE BD_InputSolve( p_FAST, BD, y_AD, u_AD, y_ED, y_SrvD, u_SrvD, MeshMapD END IF ! Add blade loads from StrucCtrl in SrvD to BD loads - IF ( p_FAST%CompServo == Module_SrvD .and. allocated(y_SrvD%BStC)) THEN - do j=1,size(y_SrvD%BStC) - if (allocated(y_SrvD%BStC(j)%Mesh)) then - DO K = 1,p_FAST%nBeams ! Loop through all blades - IF (y_SrvD%BStC(j)%Mesh(K)%Committed) THEN - MeshMapData%u_BD_DistrLoad(k)%Force = 0.0_ReKi - MeshMapData%u_BD_DistrLoad(k)%Moment = 0.0_ReKi - CALL Transfer_Point_to_Line2( y_SrvD%BStC(j)%Mesh(k), MeshMapData%u_BD_DistrLoad(k), MeshMapData%SrvD_P_2_BD_P_B(j,k), ErrStat2, ErrMsg2, u_SrvD%BStC(j)%Mesh(k), BD%y(k)%BldMotion ) - CALL SetErrStat(ErrStat2,ErrMsg2,ErrStat, ErrMsg,RoutineName//':u_BD_DistrLoad' ) - do I = 1,BD%Input(1,k)%DistrLoad%Nnodes ! Loop through the tower nodes / elements - BD%Input(1,k)%DistrLoad%Force(:,I) = BD%Input(1,k)%DistrLoad%Force(:,I) + MeshMapData%u_BD_DistrLoad(k)%Force(:,I) - BD%Input(1,k)%DistrLoad%Moment(:,I) = BD%Input(1,k)%DistrLoad%Moment(:,I) + MeshMapData%u_BD_DistrLoad(k)%Moment(:,I) - enddo - ENDIF - ENDDO - endif + IF ( p_FAST%CompServo == Module_SrvD .and. allocated(y_SrvD%BStCLoadMesh)) THEN + do j=1,size(y_SrvD%BStCLoadMesh,2) + DO K = 1,p_FAST%nBeams ! Loop through all blades + IF (y_SrvD%BStCLoadMesh(K,J)%Committed) THEN + MeshMapData%u_BD_DistrLoad(k)%Force = 0.0_ReKi + MeshMapData%u_BD_DistrLoad(k)%Moment = 0.0_ReKi + CALL Transfer_Point_to_Line2( y_SrvD%BStCLoadMesh(k,J), MeshMapData%u_BD_DistrLoad(k), MeshMapData%BStC_P_2_BD_P_B(k,j), ErrStat2, ErrMsg2, u_SrvD%BStCMotionMesh(k,J), BD%y(k)%BldMotion ) + CALL SetErrStat(ErrStat2,ErrMsg2,ErrStat, ErrMsg,RoutineName//':u_BD_DistrLoad' ) + do I = 1,BD%Input(1,k)%DistrLoad%Nnodes ! Loop through the tower nodes / elements + BD%Input(1,k)%DistrLoad%Force(:,I) = BD%Input(1,k)%DistrLoad%Force(:,I) + MeshMapData%u_BD_DistrLoad(k)%Force(:,I) + BD%Input(1,k)%DistrLoad%Moment(:,I) = BD%Input(1,k)%DistrLoad%Moment(:,I) + MeshMapData%u_BD_DistrLoad(k)%Moment(:,I) + enddo + ENDIF + ENDDO enddo ENDIF @@ -295,66 +293,60 @@ SUBROUTINE ED_InputSolve( p_FAST, u_ED, y_ED, p_AD14, y_AD14, y_AD, y_SrvD, u_AD u_ED%YawMom = y_SrvD%YawMom ! u_ED%TBDrCon = y_SrvD%TBDrCon !array - ! StrucCtrl loads - IF ( ALLOCATED(y_SrvD%NStC) ) THEN ! Nacelle - do j=1,size(y_SrvD%NStC) - IF ( ALLOCATED(y_SrvD%NStC(j)%Mesh) ) THEN - IF (y_SrvD%NStC(j)%Mesh(1)%Committed) THEN ! size 1 only for NStC - CALL Transfer_Point_to_Point( y_SrvD%NStC(j)%Mesh(1), u_ED%NacelleLoads, MeshMapData%SrvD_P_2_ED_P_N(j), ErrStat2, ErrMsg2, u_SrvD%NStC(j)%Mesh(1), y_ED%NacelleMotion ) - CALL SetErrStat(ErrStat2,ErrMsg2,ErrStat, ErrMsg,RoutineName//':u_ED%NacelleLoads' ) - ENDIF - END IF + ! StrucCtrl loads + IF ( ALLOCATED(y_SrvD%NStCLoadMesh) ) THEN ! Nacelle + do j=1,size(y_SrvD%NStCLoadMesh) + IF (y_SrvD%NStCLoadMesh(j)%Committed) THEN + CALL Transfer_Point_to_Point( y_SrvD%NStCLoadMesh(j), MeshMapData%u_ED_NacelleLoads, MeshMapData%NStC_P_2_ED_P_N(j), ErrStat2, ErrMsg2, u_SrvD%NStCMotionMesh(j), y_ED%NacelleMotion ) + CALL SetErrStat(ErrStat2,ErrMsg2,ErrStat, ErrMsg,RoutineName//':u_ED%NacelleLoads' ) + u_ED%NacelleLoads%Force = u_ED%NacelleLoads%Force + MeshMapData%u_ED_NacelleLoads%Force + u_ED%NacelleLoads%Moment = u_ED%NacelleLoads%Moment + MeshMapData%u_ED_NacelleLoads%Moment + ENDIF enddo END IF - IF ( ALLOCATED(y_SrvD%TStC) ) THEN ! Tower - do j=1,size(y_SrvD%TStC) - IF ( ALLOCATED(y_SrvD%TStC(j)%Mesh) ) THEN - IF (y_SrvD%TStC(j)%Mesh(1)%Committed) THEN ! size 1 only for TStC - MeshMapData%u_ED_TowerPtLoads%Force = 0.0_ReKi - MeshMapData%u_ED_TowerPtLoads%Moment = 0.0_ReKi - CALL Transfer_Point_to_Point( y_SrvD%TStC(j)%Mesh(1), MeshMapData%u_ED_TowerPtLoads, MeshMapData%SrvD_P_2_ED_P_T(j), ErrStat2, ErrMsg2, u_SrvD%TStC(j)%Mesh(1), y_ED%TowerLn2Mesh ) - CALL SetErrStat(ErrStat2,ErrMsg2,ErrStat, ErrMsg,RoutineName//':u_ED%TowerPtLoads' ) - do K = 1,u_ED%TowerPtLoads%Nnodes ! Loop through the tower nodes / elements - u_ED%TowerPtLoads%Force(:,K) = u_ED%TowerPtLoads%Force(:,K) + MeshMapData%u_ED_TowerPtLoads%Force(:,K) - u_ED%TowerPtLoads%Moment(:,K) = u_ED%TowerPtLoads%Moment(:,K) + MeshMapData%u_ED_TowerPtLoads%Moment(:,K) - enddo - ENDIF - END IF + IF ( ALLOCATED(y_SrvD%TStCLoadMesh) ) THEN ! Tower + do j=1,size(y_SrvD%TStCLoadMesh) + IF (y_SrvD%TStCLoadMesh(j)%Committed) THEN ! size 1 only for TStC + MeshMapData%u_ED_TowerPtLoads%Force = 0.0_ReKi + MeshMapData%u_ED_TowerPtLoads%Moment = 0.0_ReKi + CALL Transfer_Point_to_Point( y_SrvD%TStCLoadMesh(j), MeshMapData%u_ED_TowerPtLoads, MeshMapData%TStC_P_2_ED_P_T(j), ErrStat2, ErrMsg2, u_SrvD%TStCMotionMesh(j), y_ED%TowerLn2Mesh ) + CALL SetErrStat(ErrStat2,ErrMsg2,ErrStat, ErrMsg,RoutineName//':u_ED%TowerPtLoads' ) + do K = 1,u_ED%TowerPtLoads%Nnodes ! Loop through the tower nodes / elements + u_ED%TowerPtLoads%Force(:,K) = u_ED%TowerPtLoads%Force(:,K) + MeshMapData%u_ED_TowerPtLoads%Force(:,K) + u_ED%TowerPtLoads%Moment(:,K) = u_ED%TowerPtLoads%Moment(:,K) + MeshMapData%u_ED_TowerPtLoads%Moment(:,K) + enddo + ENDIF enddo ENDIF IF (p_FAST%CompElast == Module_ED) THEN - IF ( ALLOCATED(y_SrvD%BStC) ) THEN ! Blades - do j=1,size(y_SrvD%BStC) - IF ( ALLOCATED(y_SrvD%BStC(j)%Mesh) ) THEN - DO K = 1,SIZE(u_ED%BladePtLoads,1) ! Loop through all blades (p_ED%NumBl) - IF (y_SrvD%BStC(j)%Mesh(k)%Committed) THEN - MeshMapData%u_ED_BladePtLoads(k)%Force = 0.0_ReKi - MeshMapData%u_ED_BladePtLoads(k)%Moment = 0.0_ReKi - CALL Transfer_Point_to_Point( y_SrvD%BStC(j)%Mesh(k), MeshMapData%u_ED_BladePtLoads(k), MeshMapData%SrvD_P_2_ED_P_B(j,k), ErrStat2, ErrMsg2, u_SrvD%BStC(j)%Mesh(k), y_ED%BladeLn2Mesh(k) ) - CALL SetErrStat(ErrStat2,ErrMsg2,ErrStat, ErrMsg,RoutineName//':u_ED%BladePtLoads' ) - do I = 1,u_ED%BladePtLoads(k)%Nnodes ! Loop through the tower nodes / elements - u_ED%BladePtLoads(k)%Force(:,I) = u_ED%BladePtLoads(k)%Force(:,I) + MeshMapData%u_ED_BladePtLoads(k)%Force(:,I) - u_ED%BladePtLoads(k)%Moment(:,I) = u_ED%BladePtLoads(k)%Moment(:,I) + MeshMapData%u_ED_BladePtLoads(k)%Moment(:,I) - enddo - END IF - ENDDO - ENDIF + IF ( ALLOCATED(y_SrvD%BStCLoadMesh) ) THEN ! Blades + do j=1,size(y_SrvD%BStCLoadMesh,2) + DO K = 1,SIZE(u_ED%BladePtLoads,1) ! Loop through all blades (p_ED%NumBl) + IF (y_SrvD%BStCLoadMesh(k,j)%Committed) THEN + MeshMapData%u_ED_BladePtLoads(k)%Force = 0.0_ReKi + MeshMapData%u_ED_BladePtLoads(k)%Moment = 0.0_ReKi + CALL Transfer_Point_to_Point( y_SrvD%BStCLoadMesh(k,j), MeshMapData%u_ED_BladePtLoads(k), MeshMapData%BStC_P_2_ED_P_B(k,j), ErrStat2, ErrMsg2, u_SrvD%BStCMotionMesh(k,j), y_ED%BladeLn2Mesh(k) ) + CALL SetErrStat(ErrStat2,ErrMsg2,ErrStat, ErrMsg,RoutineName//':u_ED%BladePtLoads' ) + do I = 1,u_ED%BladePtLoads(k)%Nnodes ! Loop through the tower nodes / elements + u_ED%BladePtLoads(k)%Force(:,I) = u_ED%BladePtLoads(k)%Force(:,I) + MeshMapData%u_ED_BladePtLoads(k)%Force(:,I) + u_ED%BladePtLoads(k)%Moment(:,I) = u_ED%BladePtLoads(k)%Moment(:,I) + MeshMapData%u_ED_BladePtLoads(k)%Moment(:,I) + enddo + END IF + ENDDO enddo ENDIF ENDIF IF ( p_FAST%CompSub /= Module_SD ) THEN ! Platform loads if not SD - IF ( ALLOCATED(y_SrvD%SStC) ) THEN ! Platform - do j=1,size(y_SrvD%SStC) - IF ( ALLOCATED(y_SrvD%SStC(j)%Mesh) ) THEN - IF (y_SrvD%SStC(j)%Mesh(1)%Committed) THEN ! size 1 only for SStC - CALL Transfer_Point_to_Point( y_SrvD%SStC(j)%Mesh(1), MeshMapData%u_ED_PlatformPtMesh, MeshMapData%SrvD_P_P_2_ED_P(j), ErrStat2, ErrMsg2, u_SrvD%SStC(j)%Mesh(1), y_ED%PlatformPtMesh ) - CALL SetErrStat(ErrStat2,ErrMsg2,ErrStat, ErrMsg,RoutineName//':u_ED%PlatformPtMesh' ) - u_ED%PlatformPtMesh%Force = u_ED%PlatformPtMesh%Force + MeshMapData%u_ED_PlatformPtMesh%Force - u_ED%PlatformPtMesh%Moment = u_ED%PlatformPtMesh%Moment + MeshMapData%u_ED_PlatformPtMesh%Moment - ENDIF + IF ( ALLOCATED(y_SrvD%SStCLoadMesh) ) THEN ! Platform + do j=1,size(y_SrvD%SStCLoadMesh) + IF (y_SrvD%SStCLoadMesh(j)%Committed) THEN + CALL Transfer_Point_to_Point( y_SrvD%SStCLoadMesh(j), MeshMapData%u_ED_PlatformPtMesh, MeshMapData%SStC_P_P_2_ED_P(j), ErrStat2, ErrMsg2, u_SrvD%SStCMotionMesh(j), y_ED%PlatformPtMesh ) + CALL SetErrStat(ErrStat2,ErrMsg2,ErrStat, ErrMsg,RoutineName//':u_ED%PlatformPtMesh' ) + u_ED%PlatformPtMesh%Force = u_ED%PlatformPtMesh%Force + MeshMapData%u_ED_PlatformPtMesh%Force + u_ED%PlatformPtMesh%Moment = u_ED%PlatformPtMesh%Moment + MeshMapData%u_ED_PlatformPtMesh%Moment ENDIF enddo ENDIF @@ -1032,55 +1024,54 @@ SUBROUTINE SrvD_InputSolve( p_FAST, m_FAST, u_SrvD, y_ED, y_IfW, y_OpFM, y_BD, y !ELSE !END IF ! + + ! Platform motion mesh to pass to DLL -- NOTE: this is only the transition piece motion, and only passed when DLL is used + IF (y_ED%PlatformPtMesh%Committed .and. u_SrvD%PtfmMotionMesh%Committed ) THEN + CALL Transfer_Point_to_Point( y_ED%PlatformPtMesh, u_SrvD%PtfmMotionMesh, MeshMapData%ED_P_2_SrvD_P_P, ErrStat2, ErrMsg2 ) + call SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) + ENDIF + ! StrucCtrl input motion meshes - IF ( ALLOCATED(u_SrvD%NStC) ) THEN - do j = 1,size(u_SrvD%NStC) - IF ( ALLOCATED(u_SrvD%NStC(j)%Mesh) ) THEN - IF (u_SrvD%NStC(j)%Mesh(1)%Committed) THEN - CALL Transfer_Point_to_Point( y_ED%NacelleMotion, u_SrvD%NStC(j)%Mesh(1), MeshMapData%ED_P_2_SrvD_P_N(j), ErrStat2, ErrMsg2 ) - call SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) - ENDIF - END IF + IF ( ALLOCATED(u_SrvD%NStCMotionMesh) ) THEN + do j = 1,size(u_SrvD%NStCMotionMesh) + IF (u_SrvD%NStCMotionMesh(j)%Committed) THEN + CALL Transfer_Point_to_Point( y_ED%NacelleMotion, u_SrvD%NStCMotionMesh(j), MeshMapData%ED_P_2_NStC_P_N(j), ErrStat2, ErrMsg2 ) + call SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) + ENDIF enddo ENDIF - IF ( ALLOCATED(u_SrvD%TStC) ) THEN - do j=1,size(u_SrvD%TStC) - IF ( ALLOCATED(u_SrvD%TStC(j)%Mesh) ) THEN - IF (u_SrvD%TStC(j)%Mesh(1)%Committed) THEN - CALL Transfer_Line2_to_Point( y_ED%TowerLn2Mesh, u_SrvD%TStC(j)%Mesh(1), MeshMapData%ED_L_2_SrvD_P_T(j), ErrStat2, ErrMsg2 ) - call SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) - ENDIF - END IF + IF ( ALLOCATED(u_SrvD%TStCMotionMesh) ) THEN + do j=1,size(u_SrvD%TStCMotionMesh) + IF (u_SrvD%TStCMotionMesh(j)%Committed) THEN + CALL Transfer_Line2_to_Point( y_ED%TowerLn2Mesh, u_SrvD%TStCMotionMesh(j), MeshMapData%ED_L_2_TStC_P_T(j), ErrStat2, ErrMsg2 ) + call SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) + ENDIF enddo ENDIF ! Blade StrucCtrl IF ( p_FAST%CompElast == Module_ED ) then - IF ( ALLOCATED(u_SrvD%BStC) ) THEN - do j=1,size(u_SrvD%BStC) - IF ( ALLOCATED(u_SrvD%BStC(j)%Mesh) ) THEN - DO K = 1,SIZE(y_ED%BladeLn2Mesh,1) - IF (u_SrvD%BStC(j)%Mesh(K)%Committed) THEN - CALL Transfer_Line2_to_Point( y_ED%BladeLn2Mesh(K), u_SrvD%BStC(j)%Mesh(K), MeshMapData%ED_L_2_SrvD_P_B(j,K), ErrStat2, ErrMsg2 ) - call SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) - ENDIF - ENDDO - ENDIF + IF ( ALLOCATED(u_SrvD%BStCMotionMesh) ) THEN + do j=1,size(u_SrvD%BStCMotionMesh,2) + DO K = 1,SIZE(y_ED%BladeLn2Mesh,1) + IF (u_SrvD%BStCMotionMesh(K,j)%Committed) THEN + CALL Transfer_Line2_to_Point( y_ED%BladeLn2Mesh(K), u_SrvD%BStCMotionMesh(K,j), MeshMapData%ED_L_2_BStC_P_B(K,j), ErrStat2, ErrMsg2 ) + call SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) + ENDIF + ENDDO enddo ENDIF ELSEIF ( p_FAST%CompElast == Module_BD ) THEN - IF ( ALLOCATED(u_SrvD%BStC) ) THEN - do j=1,size(u_SrvD%BStC) - IF ( ALLOCATED(u_SrvD%BStC(j)%Mesh) ) THEN - DO K = 1,SIZE(y_BD,1) - IF (u_SrvD%BStC(j)%Mesh(K)%Committed) THEN - CALL Transfer_Line2_to_Point( y_BD(k)%BldMotion, u_SrvD%BStC(j)%Mesh(K), MeshMapData%BD_L_2_SrvD_P_B(j,K), ErrStat2, ErrMsg2 ) - call SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) - ENDIF - ENDDO - ENDIF + IF ( ALLOCATED(u_SrvD%BStCMotionMesh) ) THEN + do j=1,size(u_SrvD%BStCMotionMesh,2) + DO K = 1,SIZE(y_BD,1) + IF (u_SrvD%BStCMotionMesh(K,j)%Committed) THEN + CALL Transfer_Line2_to_Point( y_BD(k)%BldMotion, u_SrvD%BStCMotionMesh(K,j), MeshMapData%BD_L_2_BStC_P_B(K,j), ErrStat2, ErrMsg2 ) + call SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) + ENDIF + ENDDO enddo ENDIF ENDIF @@ -1094,6 +1085,9 @@ SUBROUTINE SrvD_InputSolve( p_FAST, m_FAST, u_SrvD, y_ED, y_IfW, y_OpFM, y_BD, y call SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) ENDIF + ! Transfer any cable length info from SD or MD + ! --> SrvD, SD, and MD are not setup for this yet. Add here if feedback is ever required + #ifdef SIMULINK_TIMESHIFT ! we're going to use the extrapolated values instead of the old values (Simulink inputs are from t, not t+dt) CALL SrvD_SetExternalInputs( p_FAST, m_FAST, u_SrvD ) @@ -1120,14 +1114,12 @@ SUBROUTINE Transfer_ED_to_SStC( u_SrvD, y_ED, MeshMapData, ErrStat, ErrMsg ) ! Map ElastoDyn platform point mesh motion to ServoDyn/SStC point mesh -- motions !---------------------------------------------------------------------------------------------------- ! motions: - IF ( ALLOCATED(u_SrvD%SStC) ) THEN - do j=1,size(u_SrvD%SStC) - IF ( ALLOCATED(u_SrvD%SStC(j)%Mesh) ) THEN - IF (u_SrvD%SStC(j)%Mesh(1)%Committed) THEN - CALL Transfer_Point_to_Point( y_ED%PlatformPtMesh, u_SrvD%SStC(j)%Mesh(1), MeshMapData%ED_P_2_SrvD_P_P(j), ErrStat2, ErrMsg2 ) - call SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,'Transfer_ED_to_SStC') - ENDIF - END IF + IF ( ALLOCATED(u_SrvD%SStCMotionMesh) ) THEN + do j=1,size(u_SrvD%SStCMotionMesh) + IF (u_SrvD%SStCMotionMesh(j)%Committed) THEN + CALL Transfer_Point_to_Point( y_ED%PlatformPtMesh, u_SrvD%SStCMotionMesh(j), MeshMapData%ED_P_2_SStC_P_P(j), ErrStat2, ErrMsg2 ) + call SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,'Transfer_ED_to_SStC') + ENDIF enddo ENDIF END SUBROUTINE Transfer_ED_to_SStC @@ -1150,14 +1142,12 @@ SUBROUTINE Transfer_SD_to_SStC( u_SrvD, y_SD, MeshMapData, ErrStat, ErrMsg ) ! Map SubDyn platform point mesh motion to ServoDyn/SStC point mesh -- motions !---------------------------------------------------------------------------------------------------- ! motions: - IF ( ALLOCATED(u_SrvD%SStC) ) THEN - do j=1,size(u_SrvD%SStC) - IF ( ALLOCATED(u_SrvD%SStC(j)%Mesh) ) THEN - IF (u_SrvD%SStC(j)%Mesh(1)%Committed) THEN - CALL Transfer_Point_to_Point( y_SD%y3Mesh, u_SrvD%SStC(j)%Mesh(1), MeshMapData%SDy3_P_2_SrvD_P_P(j), ErrStat2, ErrMsg2 ) - call SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,'Transfer_SD_to_SStC') - ENDIF - END IF + IF ( ALLOCATED(u_SrvD%SStCMotionMesh) ) THEN + do j=1,size(u_SrvD%SStCMotionMesh) + IF (u_SrvD%SStCMotionMesh(j)%Committed) THEN + CALL Transfer_Point_to_Point( y_SD%y3Mesh, u_SrvD%SStCMotionMesh(j), MeshMapData%SDy3_P_2_SStC_P_P(j), ErrStat2, ErrMsg2 ) + call SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,'Transfer_SD_to_SStC') + ENDIF enddo ENDIF END SUBROUTINE Transfer_SD_to_SStC @@ -1186,6 +1176,27 @@ SUBROUTINE SrvD_SetExternalInputs( p_FAST, m_FAST, u_SrvD ) end do end if + if (ALLOCATED(u_SrvD%ExternalBlAirfoilCom)) then ! Added Blade Flap use with Simulink + do i=1,SIZE(u_SrvD%ExternalBlAirfoilCom) + u_SrvD%ExternalBlAirfoilCom(i) = m_FAST%ExternInput%BlAirfoilCom(i) + end do + end if + + ! Cable controls + if (ALLOCATED(u_SrvD%ExternalCableDeltaL)) then ! This is only allocated if cable control signals are requested + do i=1,min(SIZE(u_SrvD%ExternalCableDeltaL),SIZE(m_FAST%ExternInput%CableDeltaL)) + u_SrvD%ExternalCableDeltaL(i) = m_FAST%ExternInput%CableDeltaL(i) + end do + end if + if (ALLOCATED(u_SrvD%ExternalCableDeltaLdot)) then ! This is only allocated if cable control signals are requested + do i=1,min(SIZE(u_SrvD%ExternalCableDeltaLdot),SIZE(m_FAST%ExternInput%CableDeltaLdot)) + u_SrvD%ExternalCableDeltaLdot(i) = m_FAST%ExternInput%CableDeltaLdot(i) + end do + end if + + ! StC controls + ! This is a placeholder for where StC controls would be passed if they are enabled from Simulink + END SUBROUTINE SrvD_SetExternalInputs !---------------------------------------------------------------------------------------------------------------------------------- !> This routine transfers the SD outputs into inputs required for HD @@ -1273,6 +1284,33 @@ SUBROUTINE Transfer_PlatformMotion_to_HD( PlatformMotion, u_HD, MeshMapData, Err END SUBROUTINE Transfer_PlatformMotion_to_HD !---------------------------------------------------------------------------------------------------------------------------------- +!> This routine transfers the SrvD outputs into inputs required for SD MDM +SUBROUTINE Transfer_SrvD_to_SD_MD( p_FAST, y_SrvD, u_SD, u_MD ) +!.................................................................................................................................. + TYPE(FAST_ParameterType), INTENT(IN) :: p_FAST !< Glue-code simulation parameters + TYPE(SrvD_OutputType), INTENT(IN ) :: y_SrvD !< SrvD input + TYPE(SD_InputType), INTENT(INOUT) :: u_SD !< SubDyn input + TYPE(MD_InputType), INTENT(INOUT) :: u_MD !< MoorDyn input + + if (p_FAST%CompServo /= Module_SrvD) return + + ! transfer SrvD outputs to other modules used in option 1: + IF ( p_FAST%CompSub == Module_SD ) THEN + if (allocated(u_SD%CableDeltaL) .and. allocated(y_SrvD%CableDeltaL)) then + u_SD%CableDeltaL = y_SrvD%CableDeltaL ! these should be sized identically during init + endif + ENDIF + + IF ( p_FAST%CompMooring == Module_MD ) THEN + if (allocated(u_MD%DeltaL) .and. allocated(y_SrvD%CableDeltaL)) then + u_MD%DeltaL = y_SrvD%CableDeltaL ! these should be sized identically during init + endif + if (allocated(u_MD%DeltaLdot) .and. allocated(y_SrvD%CableDeltaLdot)) then + u_MD%DeltaLdot = y_SrvD%CableDeltaLdot ! these should be sized identically during init + endif + ENDIF +END SUBROUTINE Transfer_SrvD_to_SD_MD +!---------------------------------------------------------------------------------------------------------------------------------- !> This routine transfers the ED outputs into inputs required for HD, SD, ExtPtfm, BD, MAP, and/or FEAM SUBROUTINE Transfer_ED_to_HD_SD_BD_Mooring( p_FAST, y_ED, u_HD, u_SD, u_ExtPtfm, u_MAP, u_FEAM, u_MD, u_Orca, u_BD, u_SrvD, MeshMapData, ErrStat, ErrMsg ) !.................................................................................................................................. @@ -1370,7 +1408,7 @@ SUBROUTINE Transfer_ED_to_HD_SD_BD_Mooring( p_FAST, y_ED, u_HD, u_SD, u_ExtPtfm, ! Map motions for ServodDyn Structural control (TMD) if used. IF ( p_FAST%CompServo == Module_SrvD .and. p_FAST%CompSub /= Module_SD ) THEN call Transfer_ED_to_SStC( u_SrvD, y_ED, MeshMapData, ErrStat2, ErrMsg2 ) - call SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName//'u_SrvD%SStC%Mesh') + call SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName//'u_SrvD%SStCMotionMesh') ENDIF contains @@ -1443,7 +1481,7 @@ SUBROUTINE IceD_InputSolve( u_IceD, y_SD, MeshMapData, legNum, ErrStat, ErrMsg ) END SUBROUTINE IceD_InputSolve !---------------------------------------------------------------------------------------------------------------------------------- -!> This routine sets the inputs required for IceFloe. +!> This routine sets the inputs required for BeamDyn. SUBROUTINE Transfer_ED_to_BD( y_ED, u_BD, MeshMapData, ErrStat, ErrMsg ) !.................................................................................................................................. @@ -2029,15 +2067,13 @@ SUBROUTINE U_ED_HD_Residual( y_ED2, y_HD2, u_IN, U_Resid) call Transfer_ED_to_SStC( u_SrvD, y_ED, MeshMapData, ErrStat2, ErrMsg2 ) call SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName//'u_SrvD%SStC%Mesh') ! we're mapping loads, so we also need the sibling meshes' displacements: - IF ( ALLOCATED(y_SrvD%SStC) ) THEN ! Platform - do j=1,size(y_SrvD%SStC) - IF ( ALLOCATED(y_SrvD%SStC(j)%Mesh) ) THEN - IF (y_SrvD%SStC(j)%Mesh(1)%Committed) THEN ! size 1 only for SStC - CALL Transfer_Point_to_Point( y_SrvD%SStC(j)%Mesh(1), MeshMapData%u_ED_PlatformPtMesh_3, MeshMapData%SrvD_P_P_2_ED_P(j), ErrStat2, ErrMsg2, u_SrvD%SStC(j)%Mesh(1), PlatformMotions ) - CALL SetErrStat(ErrStat2,ErrMsg2,ErrStat, ErrMsg,RoutineName//':u_ED%PlatformPtMesh' ) - MeshMapData%u_ED_PlatformPtMesh_2%Force = MeshMapData%u_ED_PlatformPtMesh_2%Force + MeshMapData%u_ED_PlatformPtMesh_3%Force - MeshMapData%u_ED_PlatformPtMesh_2%Moment = MeshMapData%u_ED_PlatformPtMesh_2%Moment + MeshMapData%u_ED_PlatformPtMesh_3%Moment - ENDIF + IF ( ALLOCATED(y_SrvD%SStCLoadMesh) ) THEN ! Platform + do j=1,size(y_SrvD%SStCLoadMesh) + IF (y_SrvD%SStCLoadMesh(j)%Committed) THEN + CALL Transfer_Point_to_Point( y_SrvD%SStCLoadMesh(j), MeshMapData%u_ED_PlatformPtMesh_2, MeshMapData%SStC_P_P_2_ED_P(j), ErrStat2, ErrMsg2, u_SrvD%SStCMotionMesh(j), PlatformMotions ) + CALL SetErrStat(ErrStat2,ErrMsg2,ErrStat, ErrMsg,RoutineName//':u_ED%PlatformPtMesh' ) + MeshMapData%u_ED_PlatformPtMesh%Force = MeshMapData%u_ED_PlatformPtMesh%Force + MeshMapData%u_ED_PlatformPtMesh_2%Force + MeshMapData%u_ED_PlatformPtMesh%Moment = MeshMapData%u_ED_PlatformPtMesh%Moment + MeshMapData%u_ED_PlatformPtMesh_2%Moment ENDIF enddo ENDIF @@ -2345,7 +2381,7 @@ SUBROUTINE FullOpt1_InputOutputSolve( this_time, p_FAST, calcJacobian & CALL Create_FullOpt1_UVector(u, u_ED%PlatformPtMesh, u_SD%TPMesh, u_SD%LMesh, & u_HD%Morison%Mesh, u_HD%WAMITMesh, u_ED%HubPtLoad, MeshMapData%u_BD_RootMotion, u_Orca%PtfmMesh, & - u_ExtPtfm%PtfmMesh, u_SrvD%SStC, p_FAST ) + u_ExtPtfm%PtfmMesh, p_FAST ) K = 0 @@ -3012,13 +3048,12 @@ SUBROUTINE U_FullOpt1_Residual( y_ED2, y_SD2, y_HD2, y_BD2, y_Orca2, y_ExtPtfm2, IF ( p_FAST%CompSub == Module_SD ) THEN - IF ( p_FAST%CompHydro == Module_HD .or. (p_FAST%CompServo == Module_SrvD .and. allocated(y_SrvD%SStC)) ) THEN + IF ( p_FAST%CompHydro == Module_HD ) THEN + ! initialize these SD loads inputs here in case HD is used (note from initialiazation that these meshes don't exist if HD isn't used) MeshMapData%u_SD_LMesh%Force = 0.0_ReKi MeshMapData%u_SD_LMesh%Moment = 0.0_ReKi - ENDIF - IF ( p_FAST%CompHydro == Module_HD ) THEN !.................. ! Get HD inputs on Morison%Mesh and WAMITMesh @@ -3091,16 +3126,14 @@ SUBROUTINE U_FullOpt1_Residual( y_ED2, y_SD2, y_HD2, y_BD2, y_Orca2, y_ExtPtfm2, ! Get SD loads inputs from ServoDyn Structural control !.................. - IF ( p_FAST%CompServo == Module_SrvD .and. allocated(y_SrvD%SStC) ) THEN - do k=1,size(y_SrvD%SStC) - IF ( ALLOCATED(y_SrvD%SStC(k)%Mesh) ) THEN - IF (y_SrvD%SStC(k)%Mesh(1)%Committed) THEN ! size 1 only for SStC - CALL Transfer_Point_to_Point( y_SrvD%SStC(k)%Mesh(1), MeshMapData%u_SD_LMesh_2, MeshMapData%SrvD_P_P_2_SD_P(k), ErrStat2, ErrMsg2, u_SrvD%SStC(k)%Mesh(1), y_SD2%Y3Mesh ) - CALL SetErrStat(ErrStat2,ErrMsg2,ErrStat, ErrMsg,RoutineName ) - MeshMapData%u_SD_LMesh%Force = MeshMapData%u_SD_LMesh%Force + MeshMapData%u_SD_LMesh_2%Force - MeshMapData%u_SD_LMesh%Moment = MeshMapData%u_SD_LMesh%Moment + MeshMapData%u_SD_LMesh_2%Moment - ENDIF - END IF + IF ( p_FAST%CompServo == Module_SrvD .and. allocated(y_SrvD%SStCLoadMesh) ) THEN + do k=1,size(y_SrvD%SStCLoadMesh) + IF (y_SrvD%SStCLoadMesh(k)%Committed) THEN ! size 1 only for SStC + CALL Transfer_Point_to_Point( y_SrvD%SStCLoadMesh(k), MeshMapData%u_SD_LMesh_2, MeshMapData%SStC_P_P_2_SD_P(k), ErrStat2, ErrMsg2, u_SrvD%SStCMotionMesh(k), y_SD2%Y3Mesh ) + CALL SetErrStat(ErrStat2,ErrMsg2,ErrStat, ErrMsg,RoutineName ) + MeshMapData%u_SD_LMesh%Force = MeshMapData%u_SD_LMesh%Force + MeshMapData%u_SD_LMesh_2%Force + MeshMapData%u_SD_LMesh%Moment = MeshMapData%u_SD_LMesh%Moment + MeshMapData%u_SD_LMesh_2%Moment + ENDIF enddo ENDIF @@ -3262,15 +3295,13 @@ SUBROUTINE U_FullOpt1_Residual( y_ED2, y_SD2, y_HD2, y_BD2, y_Orca2, y_ExtPtfm2, ! Map the forces from the platform mounted TMD (from ServoDyn) to the platform reference point - IF ( p_FAST%CompServo == Module_SrvD .and. p_FAST%CompSub /= Module_SD .and. allocated(y_SrvD%SStC)) THEN - do k=1,size(y_SrvD%SStC) - IF ( ALLOCATED(y_SrvD%SStC(k)%Mesh) ) THEN - IF (y_SrvD%SStC(k)%Mesh(1)%Committed) THEN ! size 1 only for SStC - CALL Transfer_Point_to_Point( y_SrvD%SStC(k)%Mesh(1), MeshMapData%u_ED_PlatformPtMesh_2, MeshMapData%SrvD_P_P_2_ED_P(k), ErrStat2, ErrMsg2, u_SrvD%SStC(k)%Mesh(1), PlatformMotions ) - CALL SetErrStat(ErrStat2,ErrMsg2,ErrStat, ErrMsg,RoutineName//':u_ED%PlatformPtMesh' ) - MeshMapData%u_ED_PlatformPtMesh%Force = MeshMapData%u_ED_PlatformPtMesh%Force + MeshMapData%u_ED_PlatformPtMesh_2%Force - MeshMapData%u_ED_PlatformPtMesh%Moment = MeshMapData%u_ED_PlatformPtMesh%Moment + MeshMapData%u_ED_PlatformPtMesh_2%Moment - ENDIF + IF ( p_FAST%CompServo == Module_SrvD .and. p_FAST%CompSub /= Module_SD .and. allocated(y_SrvD%SStCLoadMesh)) THEN + do k=1,size(y_SrvD%SStCLoadMesh) + IF (y_SrvD%SStCLoadMesh(k)%Committed) THEN ! size 1 only for SStC + CALL Transfer_Point_to_Point( y_SrvD%SStCLoadMesh(k), MeshMapData%u_ED_PlatformPtMesh_2, MeshMapData%SStC_P_P_2_ED_P(k), ErrStat2, ErrMsg2, u_SrvD%SStCMotionMesh(k), PlatformMotions ) + CALL SetErrStat(ErrStat2,ErrMsg2,ErrStat, ErrMsg,RoutineName//':u_ED%PlatformPtMesh' ) + MeshMapData%u_ED_PlatformPtMesh%Force = MeshMapData%u_ED_PlatformPtMesh%Force + MeshMapData%u_ED_PlatformPtMesh_2%Force + MeshMapData%u_ED_PlatformPtMesh%Moment = MeshMapData%u_ED_PlatformPtMesh%Moment + MeshMapData%u_ED_PlatformPtMesh_2%Moment ENDIF enddo ENDIF @@ -3282,7 +3313,7 @@ SUBROUTINE U_FullOpt1_Residual( y_ED2, y_SD2, y_HD2, y_BD2, y_Orca2, y_ExtPtfm2, CALL Create_FullOpt1_UVector(U_Resid, MeshMapData%u_ED_PlatformPtMesh, MeshMapData%u_SD_TPMesh, MeshMapData%u_SD_LMesh, & MeshMapData%u_HD_M_Mesh, MeshMapData%u_HD_W_Mesh, & MeshMapData%u_ED_HubPtLoad, MeshMapData%u_BD_RootMotion, MeshMapData%u_Orca_PtfmMesh, & - MeshMapData%u_ExtPtfm_PtfmMesh, u_SrvD%SStC, p_FAST ) + MeshMapData%u_ExtPtfm_PtfmMesh, p_FAST ) U_Resid = u_in - U_Resid @@ -3341,7 +3372,7 @@ END SUBROUTINE FullOpt1_InputOutputSolve !> This routine initializes the array that maps rows/columns of the Jacobian to specific mesh fields. !! Do not change the order of this packing without changing subroutine Create_FullOpt1_UVector()! SUBROUTINE Init_FullOpt1_Jacobian( p_FAST, MeshMapData, ED_PlatformPtMesh, SD_TPMesh, SD_LMesh, HD_M_Mesh, & - HD_WAMIT_Mesh, ED_HubPtLoad, u_BD, Orca_PtfmMesh, ExtPtfm_PtfmMesh, SrvD_u_SStC, ErrStat, ErrMsg) + HD_WAMIT_Mesh, ED_HubPtLoad, u_BD, Orca_PtfmMesh, ExtPtfm_PtfmMesh, ErrStat, ErrMsg) TYPE(FAST_ParameterType) , INTENT(INOUT) :: p_FAST !< FAST parameters TYPE(FAST_ModuleMapType) , INTENT(INOUT) :: MeshMapData !< data that maps meshes together @@ -3356,7 +3387,6 @@ SUBROUTINE Init_FullOpt1_Jacobian( p_FAST, MeshMapData, ED_PlatformPtMesh, SD_TP TYPE(BD_InputType) , INTENT(IN ) :: u_BD(:) !< inputs for each instance of the BeamDyn module (for the RootMotion meshes) TYPE(MeshType) , INTENT(IN ) :: Orca_PtfmMesh !< OrcaFlex interface PtfmMesh TYPE(MeshType) , INTENT(IN ) :: ExtPtfm_PtfmMesh !< ExtPtfm_MCKF interface PtfmMesh - TYPE(StC_InputType), ALLOCATABLE , INTENT(IN ) :: SrvD_u_SStC(:) !< ServoDyn SStC inputs (this will be changed later to mesh) INTEGER(IntKi) , INTENT( OUT) :: ErrStat !< Error status of the operation CHARACTER(*) , INTENT( OUT) :: ErrMsg !< Error message if ErrStat /= ErrID_None @@ -3380,7 +3410,7 @@ SUBROUTINE Init_FullOpt1_Jacobian( p_FAST, MeshMapData, ED_PlatformPtMesh, SD_TP p_FAST%SizeJac_Opt1(3) = SD_TPMesh%NNodes*6 ! SD inputs: 6 accelerations per node (size of SD input from ED) - IF ( p_FAST%CompHydro == Module_HD .or. (p_FAST%CompServo == Module_SrvD .and. ALLOCATED(SrvD_u_SStC)) ) THEN + IF ( p_FAST%CompHydro == Module_HD ) THEN p_FAST%SizeJac_Opt1(3) = p_FAST%SizeJac_Opt1(3) & + SD_LMesh%NNodes *6 ! SD inputs: 6 loads per node (size of SD input from HD) END IF @@ -3509,7 +3539,7 @@ SUBROUTINE Init_FullOpt1_Jacobian( p_FAST, MeshMapData, ED_PlatformPtMesh, SD_TP end do !j end do !i - if ( p_FAST%CompHydro == Module_HD .or. (p_FAST%CompServo == Module_SrvD .and. ALLOCATED(SrvD_u_SStC)) ) then ! this SD mesh linked only when HD is enabled, or SrvD SStC enabled + IF ( p_FAST%CompHydro == Module_HD ) THEN ! this SD mesh linked only when HD is enabled ! SD_LMesh do i=1,SD_LMesh%NNodes @@ -3657,7 +3687,7 @@ END SUBROUTINE Init_FullOpt1_Jacobian !> This routine basically packs the relevant parts of the modules' input meshes for use in this InputOutput solve. !! Do not change the order of this packing without changing subroutine Init_FullOpt1_Jacobian()! SUBROUTINE Create_FullOpt1_UVector(u, ED_PlatformPtMesh, SD_TPMesh, SD_LMesh, HD_M_Mesh, HD_WAMIT_Mesh, & - ED_HubPtLoad, BD_RootMotion, Orca_PtfmMesh, ExtPtfm_PtfmMesh, SrvD_u_SStC, p_FAST ) + ED_HubPtLoad, BD_RootMotion, Orca_PtfmMesh, ExtPtfm_PtfmMesh, p_FAST ) !.................................................................................................................................. REAL(ReKi) , INTENT(INOUT) :: u(:) !< output u vector @@ -3672,7 +3702,6 @@ SUBROUTINE Create_FullOpt1_UVector(u, ED_PlatformPtMesh, SD_TPMesh, SD_LMesh, HD TYPE(MeshType), ALLOCATABLE , INTENT(IN ) :: BD_RootMotion(:) !< BeamDyn RootMotion meshes TYPE(MeshType) , INTENT(IN ) :: Orca_PtfmMesh !< OrcaFlex interface PtfmMesh TYPE(MeshType) , INTENT(IN ) :: ExtPtfm_PtfmMesh !< ExtPtfm interface PtfmMesh - TYPE(StC_InputType), ALLOCATABLE , INTENT(IN ) :: SrvD_u_SStC(:) !< ServoDyn SStC inputs (this will be changed later to mesh) TYPE(FAST_ParameterType) , INTENT(IN ) :: p_FAST !< FAST parameters @@ -3724,7 +3753,7 @@ SUBROUTINE Create_FullOpt1_UVector(u, ED_PlatformPtMesh, SD_TPMesh, SD_LMesh, HD indx_first = indx_last + 1 end do - if ( p_FAST%CompHydro == Module_HD .or. (p_FAST%CompServo == Module_SrvD .and. ALLOCATED(SrvD_u_SStC)) ) then ! this SD mesh linked only when HD is enabled, or SrvD SStC enabled + if ( p_FAST%CompHydro == Module_HD ) then ! this SD mesh linked only when HD is enabled ! SD inputs (SD_LMesh): do i=1,SD_LMesh%NNodes indx_last = indx_first + 2 @@ -4118,54 +4147,40 @@ SUBROUTINE ResetRemapFlags(p_FAST, ED, BD, AD14, AD, HD, SD, ExtPtfm, SrvD, MAPp ! ServoDyn -- StrucCtrl meshes IF ( p_FAST%CompServo == Module_SrvD ) THEN - IF ( ALLOCATED(SrvD%y%NStC) ) THEN - do j=1,size(SrvD%y%NStC) - IF ( ALLOCATED(SrvD%y%NStC(j)%Mesh) ) THEN - DO K = 1,SIZE(SrvD%y%NStC(j)%Mesh) - IF (SrvD%y%NStC(j)%Mesh(K)%Committed) THEN - SrvD%y%NStC(j)%Mesh(K)%RemapFlag = .FALSE. - SrvD%Input(1)%NStC(j)%Mesh(K)%RemapFlag = .FALSE. - END IF - ENDDO + IF ( ALLOCATED(SrvD%y%NStCLoadMesh) ) THEN + do j=1,size(SrvD%y%NStCLoadMesh) + IF (SrvD%y%NStCLoadMesh(j)%Committed) THEN + SrvD%y%NStCLoadMesh(j)%RemapFlag = .FALSE. + SrvD%Input(1)%NStCMotionMesh(j)%RemapFlag = .FALSE. END IF enddo END IF - IF ( ALLOCATED(SrvD%y%TStC) ) THEN - do j=1,size(SrvD%y%TStC) - IF ( ALLOCATED(SrvD%y%TStC(j)%Mesh) ) THEN - DO K = 1,SIZE(SrvD%y%TStC(j)%Mesh) - IF (SrvD%y%TStC(j)%Mesh(K)%Committed) THEN - SrvD%y%TStC(j)%Mesh(K)%RemapFlag = .FALSE. - SrvD%Input(1)%TStC(j)%Mesh(K)%RemapFlag = .FALSE. - END IF - ENDDO + IF ( ALLOCATED(SrvD%y%TStCLoadMesh) ) THEN + do j=1,size(SrvD%y%TStCLoadMesh) + IF (SrvD%y%TStCLoadMesh(j)%Committed) THEN + SrvD%y%TStCLoadMesh(j)%RemapFlag = .FALSE. + SrvD%Input(1)%TStCMotionMesh(j)%RemapFlag = .FALSE. END IF enddo ENDIF - IF ( ALLOCATED(SrvD%y%BStC) ) THEN - do j=1,size(SrvD%y%BStC) - IF ( ALLOCATED(SrvD%y%BStC(j)%Mesh) ) THEN - DO K = 1,SIZE(SrvD%y%BStC(j)%Mesh) - IF (SrvD%y%BStC(j)%Mesh(K)%Committed) THEN - SrvD%y%BStC(j)%Mesh(K)%RemapFlag = .FALSE. - SrvD%Input(1)%BStC(j)%Mesh(K)%RemapFlag = .FALSE. - END IF - END DO - END IF + IF ( ALLOCATED(SrvD%y%BStCLoadMesh) ) THEN + do j=1,size(SrvD%y%BStCLoadMesh,2) + DO K = 1,SIZE(SrvD%y%BStCLoadMesh,1) + IF (SrvD%y%BStCLoadMesh(K,j)%Committed) THEN + SrvD%y%BStCLoadMesh(K,j)%RemapFlag = .FALSE. + SrvD%Input(1)%BStCMotionMesh(K,j)%RemapFlag = .FALSE. + END IF + END DO enddo ENDIF - IF ( ALLOCATED(SrvD%y%SStC) ) THEN - do j=1,size(SrvD%y%SStC) - IF ( ALLOCATED(SrvD%y%SStC(j)%Mesh) ) THEN - DO K = 1,SIZE(SrvD%y%SStC(j)%Mesh) - IF (SrvD%y%SStC(j)%Mesh(K)%Committed) THEN - SrvD%y%SStC(j)%Mesh(K)%RemapFlag = .FALSE. - SrvD%Input(1)%SStC(j)%Mesh(K)%RemapFlag = .FALSE. - END IF - END DO + IF ( ALLOCATED(SrvD%y%SStCLoadMesh) ) THEN + do j=1,size(SrvD%y%SStCLoadMesh) + IF (SrvD%y%SStCLoadMesh(j)%Committed) THEN + SrvD%y%SStCLoadMesh(j)%RemapFlag = .FALSE. + SrvD%Input(1)%SStCMotionMesh(j)%RemapFlag = .FALSE. END IF enddo ENDIF @@ -4327,136 +4342,141 @@ SUBROUTINE InitModuleMappings(p_FAST, ED, BD, AD14, AD, HD, SD, ExtPtfm, SrvD, M ! ServoDyn <-> ElastoDyn !------------------------- ! Nacelle TMD - IF ( ALLOCATED(SrvD%Input(1)%NStC) ) THEN - j=size(SrvD%Input(1)%NStC) - ALLOCATE( MeshMapData%ED_P_2_SrvD_P_N(j), MeshMapData%SrvD_P_2_ED_P_N(j), STAT=ErrStat2 ) + IF ( ALLOCATED(SrvD%Input(1)%NStCMotionMesh) ) THEN + j=size(SrvD%Input(1)%NStCMotionMesh) + ALLOCATE( MeshMapData%ED_P_2_NStC_P_N(j), MeshMapData%NStC_P_2_ED_P_N(j), STAT=ErrStat2 ) IF ( ErrStat2 /= 0 ) THEN - CALL SetErrStat( ErrID_Fatal, 'Error allocating MeshMapData%ED_P_2_SrvD_P_N and MeshMapData%SrvD_P_2_ED_P_N.', & + CALL SetErrStat( ErrID_Fatal, 'Error allocating MeshMapData%ED_P_2_NStC_P_N and MeshMapData%NStC_P_2_ED_P_N.', & ErrStat, ErrMsg, RoutineName ) RETURN END IF - do j=1,size(SrvD%Input(1)%NStC) - IF ( ALLOCATED(SrvD%Input(1)%NStC(j)%Mesh) ) THEN - IF ( SrvD%Input(1)%NStC(j)%Mesh(1)%Committed ) THEN - CALL MeshMapCreate( ED%y%NacelleMotion, SrvD%Input(1)%NStC(j)%Mesh(1), MeshMapData%ED_P_2_SrvD_P_N(j), ErrStat2, ErrMsg2 ) - CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName//':ED_2_SrvD_NacelleMotion' ) - CALL MeshMapCreate( SrvD%y%NStC(j)%Mesh(1), ED%Input(1)%NacelleLoads, MeshMapData%SrvD_P_2_ED_P_N(j), ErrStat2, ErrMsg2 ) - CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName//':SrvD_2_ED_NacelleLoads' ) - ENDIF - END IF + do j=1,size(SrvD%Input(1)%NStCMotionMesh) + IF ( SrvD%Input(1)%NStCMotionMesh(j)%Committed ) THEN + CALL MeshMapCreate( ED%y%NacelleMotion, SrvD%Input(1)%NStCMotionMesh(j), MeshMapData%ED_P_2_NStC_P_N(j), ErrStat2, ErrMsg2 ) + CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName//':ED_2_SrvD_NacelleMotion' ) + CALL MeshMapCreate( SrvD%y%NStCLoadMesh(j), ED%Input(1)%NacelleLoads, MeshMapData%NStC_P_2_ED_P_N(j), ErrStat2, ErrMsg2 ) + CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName//':SrvD_2_ED_NacelleLoads' ) + ENDIF enddo + CALL MeshCopy( ED%Input(1)%NacelleLoads, MeshMapData%u_ED_NacelleLoads, MESH_NEWCOPY, ErrStat2, ErrMsg2 ) + CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName//':u_ED_NacelleLoads' ) END IF ! Tower TMD - IF ( ALLOCATED(SrvD%Input(1)%TStC) ) THEN - j=size(SrvD%Input(1)%TStC) - ALLOCATE( MeshMapData%ED_L_2_SrvD_P_T(j), MeshMapData%SrvD_P_2_ED_P_T(j), STAT=ErrStat2 ) + IF ( ALLOCATED(SrvD%Input(1)%TStCMotionMesh) ) THEN + j=size(SrvD%Input(1)%TStCMotionMesh) + ALLOCATE( MeshMapData%ED_L_2_TStC_P_T(j), MeshMapData%TStC_P_2_ED_P_T(j), STAT=ErrStat2 ) IF ( ErrStat2 /= 0 ) THEN - CALL SetErrStat( ErrID_Fatal, 'Error allocating MeshMapData%ED_L_2_SrvD_P_T and MeshMapData%SrvD_P_2_ED_P_T.', & + CALL SetErrStat( ErrID_Fatal, 'Error allocating MeshMapData%ED_L_2_TStC_P_T and MeshMapData%TStC_P_2_ED_P_T.', & ErrStat, ErrMsg, RoutineName ) RETURN END IF - do j=1,size(SrvD%Input(1)%TStC) - IF ( ALLOCATED(SrvD%Input(1)%TStC(j)%Mesh) ) THEN - IF ( SrvD%Input(1)%TStC(j)%Mesh(1)%Committed ) THEN - CALL MeshMapCreate( ED%y%TowerLn2Mesh, SrvD%Input(1)%TStC(j)%Mesh(1), MeshMapData%ED_L_2_SrvD_P_T(j), ErrStat2, ErrMsg2 ) - CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName//':ED_2_SrvD_TowerMotion' ) - CALL MeshMapCreate( SrvD%y%TStC(j)%Mesh(1), ED%Input(1)%TowerPtLoads, MeshMapData%SrvD_P_2_ED_P_T(j), ErrStat2, ErrMsg2 ) - CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName//':SrvD_2_ED_TowerLoad' ) - CALL MeshCopy ( ED%Input(1)%TowerPtLoads, MeshMapData%u_ED_TowerPtLoads, MESH_NEWCOPY, ErrStat2, ErrMsg2 ) - CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName//':u_ED_TowerPtLoads' ) - ENDIF - END IF + do j=1,size(SrvD%Input(1)%TStCMotionMesh) + IF ( SrvD%Input(1)%TStCMotionMesh(j)%Committed ) THEN + CALL MeshMapCreate( ED%y%TowerLn2Mesh, SrvD%Input(1)%TStCMotionMesh(j), MeshMapData%ED_L_2_TStC_P_T(j), ErrStat2, ErrMsg2 ) + CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName//':ED_2_SrvD_TowerMotion' ) + CALL MeshMapCreate( SrvD%y%TStCLoadMesh(j), ED%Input(1)%TowerPtLoads, MeshMapData%TStC_P_2_ED_P_T(j), ErrStat2, ErrMsg2 ) + CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName//':SrvD_2_ED_TowerLoad' ) + CALL MeshCopy ( ED%Input(1)%TowerPtLoads, MeshMapData%u_ED_TowerPtLoads, MESH_NEWCOPY, ErrStat2, ErrMsg2 ) + CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName//':u_ED_TowerPtLoads' ) + ENDIF enddo ENDIF !------------------------- ! ServoDyn <-> Blades !------------------------- - IF ( ALLOCATED(SrvD%Input(1)%BStC) ) THEN + IF ( ALLOCATED(SrvD%Input(1)%BStCMotionMesh) ) THEN IF ( p_FAST%CompElast == Module_ED ) then ! ElastoDyn Blades - j=size(SrvD%Input(1)%BStC) - ALLOCATE( MeshMapData%ED_L_2_SrvD_P_B(j,NumBl), MeshMapData%SrvD_P_2_ED_P_B(j,NumBl), MeshMapData%u_ED_BladePtLoads(NumBl), STAT=ErrStat2 ) + j=size(SrvD%Input(1)%BStCMotionMesh,2) + ALLOCATE( MeshMapData%ED_L_2_BStC_P_B(NumBl,j), MeshMapData%BStC_P_2_ED_P_B(NumBl,j), MeshMapData%u_ED_BladePtLoads(NumBl), STAT=ErrStat2 ) IF ( ErrStat2 /= 0 ) THEN - CALL SetErrStat( ErrID_Fatal, 'Error allocating MeshMapData%ED_L_2_SrvD_P_B and MeshMapData%SrvD_P_2_ED_P_B and MeshMapData%u_ED_BladePtLoads.', & + CALL SetErrStat( ErrID_Fatal, 'Error allocating MeshMapData%ED_L_2_BStC_P_B and MeshMapData%BStC_P_2_ED_P_B and MeshMapData%u_ED_BladePtLoads.', & ErrStat, ErrMsg, RoutineName ) RETURN END IF - do j=1,size(SrvD%Input(1)%BStC) + do j=1,size(SrvD%Input(1)%BStCMotionMesh,2) DO K = 1,NumBl - IF ( SrvD%Input(1)%BStC(j)%Mesh(K)%Committed ) THEN - CALL MeshMapCreate( ED%y%BladeLn2Mesh(K), SrvD%Input(1)%BStC(j)%Mesh(K), MeshMapData%ED_L_2_SrvD_P_B(j,K), ErrStat2, ErrMsg2 ) - CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName//':ED_L_2_SrvD_P_B' ) - CALL MeshMapCreate( SrvD%y%BStC(j)%Mesh(K), ED%Input(1)%BladePtLoads(K), MeshMapData%SrvD_P_2_ED_P_B(j,K), ErrStat2, ErrMsg2 ) - CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName//':SrvD_P_2_ED_P_B' ) - CALL MeshCopy ( ED%Input(1)%BladePtLoads(K), MeshMapData%u_ED_BladePtLoads(K), MESH_NEWCOPY, ErrStat2, ErrMsg2 ) - CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName//':u_ED_BladePtLoads('//trim(num2lstr(j))//','//trim(num2lstr(k))//')' ) + IF ( SrvD%Input(1)%BStCMotionMesh(K,j)%Committed ) THEN + CALL MeshMapCreate( ED%y%BladeLn2Mesh(K), SrvD%Input(1)%BStCMotionMesh(K,j), MeshMapData%ED_L_2_BStC_P_B(K,j), ErrStat2, ErrMsg2 ) + CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName//':ED_L_2_BStC_P_B' ) + CALL MeshMapCreate( SrvD%y%BStCLoadMesh(K,j), ED%Input(1)%BladePtLoads(K), MeshMapData%BStC_P_2_ED_P_B(K,j), ErrStat2, ErrMsg2 ) + CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName//':BStC_P_2_ED_P_B' ) END IF ENDDO enddo + do K = 1,NumBl + CALL MeshCopy ( ED%Input(1)%BladePtLoads(K), MeshMapData%u_ED_BladePtLoads(K), MESH_NEWCOPY, ErrStat2, ErrMsg2 ) + CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName//':u_ED_BladePtLoads('//trim(num2lstr(j))//','//trim(num2lstr(k))//')' ) + enddo ELSEIF ( p_FAST%CompElast == Module_BD ) THEN ! BeamDyn Blades - j=size(SrvD%Input(1)%BStC) - ALLOCATE( MeshMapData%BD_L_2_SrvD_P_B(j,NumBl), MeshMapData%SrvD_P_2_BD_P_B(j,NumBl), MeshMapData%u_BD_DistrLoad(NumBl), STAT=ErrStat2 ) + j=size(SrvD%Input(1)%BStCMotionMesh,2) + ALLOCATE( MeshMapData%BD_L_2_BStC_P_B(NumBl,j), MeshMapData%BStC_P_2_BD_P_B(NumBl,j), MeshMapData%u_BD_DistrLoad(NumBl), STAT=ErrStat2 ) IF ( ErrStat2 /= 0 ) THEN - CALL SetErrStat( ErrID_Fatal, 'Error allocating MeshMapData%BD_L_2_SrvD_P_B and MeshMapData%SrvD_P_2_BD_P_B and MeshMapData%u_BD_DistrLoad.', & + CALL SetErrStat( ErrID_Fatal, 'Error allocating MeshMapData%BD_L_2_BStC_P_B and MeshMapData%BStC_P_2_BD_P_B and MeshMapData%u_BD_DistrLoad.', & ErrStat, ErrMsg, RoutineName ) RETURN END IF - do j=1,size(SrvD%Input(1)%BStC) + do j=1,size(SrvD%Input(1)%BStCMotionMesh,2) DO K = 1,NumBl - IF ( SrvD%Input(1)%BStC(j)%Mesh(K)%Committed ) THEN - CALL MeshMapCreate( BD%y(k)%BldMotion, SrvD%Input(1)%BStC(j)%Mesh(K), MeshMapData%BD_L_2_SrvD_P_B(j,K), ErrStat2, ErrMsg2 ) - CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName//':BD_L_2_SrvD_P_B' ) - CALL MeshMapCreate( SrvD%y%BStC(j)%Mesh(K), BD%Input(1,k)%DistrLoad, MeshMapData%SrvD_P_2_BD_P_B(j,K), ErrStat2, ErrMsg2 ) - CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName//':SrvD_P_2_BD_P_B' ) - CALL MeshCopy ( BD%Input(1,k)%DistrLoad, MeshMapData%u_BD_DistrLoad(k), MESH_NEWCOPY, ErrStat2, ErrMsg2 ) - CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName//':u_BD_DistrLoad('//trim(num2lstr(k))//')' ) + IF ( SrvD%Input(1)%BStCMotionMesh(K,j)%Committed ) THEN + CALL MeshMapCreate( BD%y(k)%BldMotion, SrvD%Input(1)%BStCMotionMesh(K,j), MeshMapData%BD_L_2_BStC_P_B(K,j), ErrStat2, ErrMsg2 ) + CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName//':BD_L_2_BStC_P_B' ) + CALL MeshMapCreate( SrvD%y%BStCLoadMesh(K,j), BD%Input(1,k)%DistrLoad, MeshMapData%BStC_P_2_BD_P_B(K,j), ErrStat2, ErrMsg2 ) + CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName//':BStC_P_2_BD_P_B' ) END IF ENDDO enddo + do K = 1,NumBl + CALL MeshCopy ( BD%Input(1,k)%DistrLoad, MeshMapData%u_BD_DistrLoad(k), MESH_NEWCOPY, ErrStat2, ErrMsg2 ) + CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName//':u_BD_DistrLoad('//trim(num2lstr(k))//')' ) + enddo ENDIF ENDIF !------------------------- ! ServoDyn <-> Platform !------------------------- - IF ( ALLOCATED(SrvD%Input(1)%SStC) ) THEN + ! ServoDyn platform point mesh from ElastoDyn platform point mesh -- Motions passed to DLL + IF ( SrvD%Input(1)%PtfmMotionMesh%Committed ) THEN + CALL MeshMapCreate( PlatformMotion, SrvD%Input(1)%PtfmMotionMesh, MeshMapData%ED_P_2_SrvD_P_P, ErrStat2, ErrMsg2 ) + CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName//':ED_P_2_SrvD_P_P' ) + ENDIF + + + IF ( ALLOCATED(SrvD%Input(1)%SStCMotionMesh) ) THEN IF ( p_FAST%CompSub /= Module_SD ) THEN ! all of these get mapped to ElastoDyn ! (offshore floating with rigid substructure) - j=size(SrvD%Input(1)%SStC) - ALLOCATE( MeshMapData%SrvD_P_P_2_ED_P(j), MeshMapData%ED_P_2_SrvD_P_P(j), STAT=ErrStat2 ) + j=size(SrvD%Input(1)%SStCMotionMesh) + ALLOCATE( MeshMapData%SStC_P_P_2_ED_P(j), MeshMapData%ED_P_2_SStC_P_P(j), STAT=ErrStat2 ) IF ( ErrStat2 /= 0 ) THEN - CALL SetErrStat( ErrID_Fatal, 'Error allocating MeshMapData%SrvD_P_P_2_ED_P and MeshMapData%ED_P_2_SrvD_P_P.', & + CALL SetErrStat( ErrID_Fatal, 'Error allocating MeshMapData%SStC_P_P_2_ED_P and MeshMapData%ED_P_2_SStC_P_P.', & ErrStat, ErrMsg, RoutineName ) RETURN END IF - do j=1,size(SrvD%Input(1)%SStC) - IF ( ALLOCATED(SrvD%Input(1)%SStC(j)%Mesh) ) THEN - IF ( SrvD%Input(1)%SStC(j)%Mesh(1)%Committed ) THEN ! Single point per SStC instance - ! ServoDyn SStC point mesh to/from ElastoDyn point mesh - CALL MeshMapCreate( PlatformMotion, SrvD%Input(1)%SStC(j)%Mesh(1), MeshMapData%ED_P_2_SrvD_P_P(j), ErrStat2, ErrMsg2 ) - CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName//':ED_P_2_SrvD_P_P' ) - CALL MeshMapCreate( SrvD%y%SStC(j)%Mesh(1), PlatformLoads, MeshMapData%SrvD_P_P_2_ED_P(j), ErrStat2, ErrMsg2 ) - CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName//':SrvD_P_P_2_ED_P' ) - ENDIF + do j=1,size(SrvD%Input(1)%SStCMotionMesh) + IF ( SrvD%Input(1)%SStCMotionMesh(j)%Committed ) THEN ! Single point per SStC instance + ! ServoDyn SStC point mesh to/from ElastoDyn point mesh + CALL MeshMapCreate( PlatformMotion, SrvD%Input(1)%SStCMotionMesh(j), MeshMapData%ED_P_2_SStC_P_P(j), ErrStat2, ErrMsg2 ) + CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName//':ED_P_2_SStC_P_P' ) + CALL MeshMapCreate( SrvD%y%SStCLoadMesh(j), PlatformLoads, MeshMapData%SStC_P_P_2_ED_P(j), ErrStat2, ErrMsg2 ) + CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName//':SStC_P_P_2_ED_P' ) ENDIF enddo ELSE ! SubDyn is used - j=size(SrvD%Input(1)%SStC) - ALLOCATE( MeshMapData%SrvD_P_P_2_SD_P(j), MeshMapData%SDy3_P_2_SrvD_P_P(j), STAT=ErrStat2 ) + j=size(SrvD%Input(1)%SStCMotionMesh) + ALLOCATE( MeshMapData%SStC_P_P_2_SD_P(j), MeshMapData%SDy3_P_2_SStC_P_P(j), STAT=ErrStat2 ) IF ( ErrStat2 /= 0 ) THEN - CALL SetErrStat( ErrID_Fatal, 'Error allocating MeshMapData%SrvD_P_P_2_SD_P and MeshMapData%SDy3_P_2_SrvD_P_P.', & + CALL SetErrStat( ErrID_Fatal, 'Error allocating MeshMapData%SStC_P_P_2_SD_P and MeshMapData%SDy3_P_2_SStC_P_P.', & ErrStat, ErrMsg, RoutineName ) RETURN END IF - do j=1,size(SrvD%Input(1)%SStC) - IF ( ALLOCATED(SrvD%Input(1)%SStC(j)%Mesh) ) THEN - IF ( SrvD%Input(1)%SStC(j)%Mesh(1)%Committed ) THEN ! Single point per SStC instance - ! ServoDyn SStC point mesh to/from SubDyn point mesh - CALL MeshMapCreate( SrvD%y%SStC(j)%Mesh(1), SD%Input(1)%LMesh, MeshMapData%SrvD_P_P_2_SD_P(j), ErrStat2, ErrMsg2 ) - CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName//':SrvD_P_P_2_SD_P' ) - CALL MeshMapCreate( SD%y%y3Mesh, SrvD%Input(1)%SStC(j)%Mesh(1), MeshMapData%SDy3_P_2_SrvD_P_P(j), ErrStat2, ErrMsg2 ) - CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName//':SDy3_P_2_SrvD_P_P' ) - ENDIF + do j=1,size(SrvD%Input(1)%SStCMotionMesh) + IF ( SrvD%Input(1)%SStCMotionMesh(j)%Committed ) THEN ! Single point per SStC instance + ! ServoDyn SStC point mesh to/from SubDyn point mesh + CALL MeshMapCreate( SrvD%y%SStCLoadMesh(j), SD%Input(1)%LMesh, MeshMapData%SStC_P_P_2_SD_P(j), ErrStat2, ErrMsg2 ) + CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName//':SStC_P_P_2_SD_P' ) + CALL MeshMapCreate( SD%y%y3Mesh, SrvD%Input(1)%SStCMotionMesh(j), MeshMapData%SDy3_P_2_SStC_P_P(j), ErrStat2, ErrMsg2 ) + CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName//':SDy3_P_2_SStC_P_P' ) ENDIF enddo ENDIF @@ -4543,16 +4563,17 @@ SUBROUTINE InitModuleMappings(p_FAST, ED, BD, AD14, AD, HD, SD, ExtPtfm, SrvD, M END IF END IF - ! Nacelle mesh: - IF ( AD%Input(1)%rotors(1)%NacelleMotion%Committed ) THEN - CALL MeshMapCreate( ED%y%NacelleMotion, AD%Input(1)%rotors(1)%NacelleMotion, MeshMapData%ED_P_2_AD_P_N, ErrStat2, ErrMsg2 ) - CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName//':ED_2_AD_NacelleMotion' ) - CALL MeshMapCreate( AD%y%rotors(1)%NacelleLoad, ED%Input(1)%NacelleLoads, MeshMapData%AD_P_2_ED_P_N, ErrStat2, ErrMsg2 ) - CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName//':AD_2_ED_NacelleLoads' ) - + ! Nacelle mesh: + IF ( AD%Input(1)%rotors(1)%NacelleMotion%Committed ) THEN + CALL MeshMapCreate( ED%y%NacelleMotion, AD%Input(1)%rotors(1)%NacelleMotion, MeshMapData%ED_P_2_AD_P_N, ErrStat2, ErrMsg2 ) + CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName//':ED_2_AD_NacelleMotion' ) + CALL MeshMapCreate( AD%y%rotors(1)%NacelleLoad, ED%Input(1)%NacelleLoads, MeshMapData%AD_P_2_ED_P_N, ErrStat2, ErrMsg2 ) + CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName//':AD_2_ED_NacelleLoads' ) + if (.not. MeshMapData%u_ED_NacelleLoads%Committed ) then ! May have been set for NStC intance CALL MeshCopy( ED%Input(1)%NacelleLoads, MeshMapData%u_ED_NacelleLoads, MESH_NEWCOPY, ErrStat2, ErrMsg2 ) CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName//':u_ED_NacelleLoads' ) - END IF + endif + endif IF ( p_FAST%CompElast == Module_ED ) then @@ -4839,7 +4860,7 @@ SUBROUTINE InitModuleMappings(p_FAST, ED, BD, AD14, AD, HD, SD, ExtPtfm, SrvD, M IF ( p_FAST%CompSub /= Module_None .OR. (p_FAST%CompElast == Module_BD .and. BD_Solve_Option1) .or. p_FAST%CompMooring == Module_Orca) THEN !.OR. p_FAST%CompHydro == Module_HD ) THEN CALL Init_FullOpt1_Jacobian( p_FAST, MeshMapData, ED%Input(1)%PlatformPtMesh, SD%Input(1)%TPMesh, SD%Input(1)%LMesh, & HD%Input(1)%Morison%Mesh, HD%Input(1)%WAMITMesh, & - ED%Input(1)%HubPtLoad, BD%Input(1,:), Orca%Input(1)%PtfmMesh, ExtPtfm%Input(1)%PtfmMesh, SrvD%Input(1)%SStC, ErrStat2, ErrMsg2) + ED%Input(1)%HubPtLoad, BD%Input(1,:), Orca%Input(1)%PtfmMesh, ExtPtfm%Input(1)%PtfmMesh, ErrStat2, ErrMsg2) CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) ELSEIF ( p_FAST%CompHydro == Module_HD ) THEN CALL AllocAry( MeshMapData%Jacobian_Opt1, SizeJac_ED_HD, SizeJac_ED_HD, 'Jacobian for Ptfm-HD coupling', ErrStat2, ErrMsg2 ) @@ -4875,9 +4896,6 @@ SUBROUTINE InitModuleMappings(p_FAST, ED, BD, AD14, AD, HD, SD, ExtPtfm, SrvD, M CALL MeshCopy ( ED%Input(1)%PlatformPtMesh, MeshMapData%u_ED_PlatformPtMesh_2, MESH_NEWCOPY, ErrStat2, ErrMsg2 ) CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName//':u_ED_PlatformPtMesh_2' ) - CALL MeshCopy ( ED%Input(1)%PlatformPtMesh, MeshMapData%u_ED_PlatformPtMesh_3, MESH_NEWCOPY, ErrStat2, ErrMsg2 ) - CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName//':u_ED_PlatformPtMesh_3' ) - IF ( p_FAST%CompElast == Module_BD ) THEN @@ -4904,15 +4922,15 @@ SUBROUTINE InitModuleMappings(p_FAST, ED, BD, AD14, AD, HD, SD, ExtPtfm, SrvD, M CALL MeshCopy ( SD%Input(1)%TPMesh, MeshMapData%u_SD_TPMesh, MESH_NEWCOPY, ErrStat2, ErrMsg2 ) CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName//':u_SD_TPMesh' ) - IF ( p_FAST%CompHydro == Module_HD .or. ( p_FAST%CompServo == Module_SrvD .and. ALLOCATED(SrvD%Input(1)%SStC) )) THEN + IF ( p_FAST%CompHydro == Module_HD ) THEN + CALL MeshCopy ( SD%Input(1)%LMesh, MeshMapData%u_SD_LMesh, MESH_NEWCOPY, ErrStat2, ErrMsg2 ) CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName//':u_SD_LMesh' ) - END IF - IF ( p_FAST%CompHydro == Module_HD .or. ( p_FAST%CompServo == Module_SrvD .and. ALLOCATED(SrvD%Input(1)%SStC) )) THEN CALL MeshCopy ( SD%Input(1)%LMesh, MeshMapData%u_SD_LMesh_2, MESH_NEWCOPY, ErrStat2, ErrMsg2 ) CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName//':u_SD_LMesh_2' ) - ENDIF + + END IF ELSE IF ( p_FAST%CompSub == Module_ExtPtfm ) THEN @@ -4944,7 +4962,7 @@ SUBROUTINE InitModuleMappings(p_FAST, ED, BD, AD14, AD, HD, SD, ExtPtfm, SrvD, M ELSEIF ( p_FAST%CompSub /= Module_SD ) THEN ! Platform loads from SrvD Structural control (TMDs) if not SD - IF ( ALLOCATED(SrvD%Input(1)%SStC) ) THEN ! Platform TMD loads + IF ( ALLOCATED(SrvD%Input(1)%SStCMotionMesh) ) THEN ! Platform TMD loads CALL MeshCopy ( ED%Input(1)%PlatformPtMesh, MeshMapData%u_ED_PlatformPtMesh, MESH_NEWCOPY, ErrStat2, ErrMsg2 ) CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName//':u_ED_PlatformPtMesh' ) ENDIF @@ -5055,6 +5073,10 @@ SUBROUTINE CalcOutputs_And_SolveForInputs( n_t_global, this_time, this_state, ca end if #endif + + !> transfer SrvD outputs to other modules used in option 1: + call Transfer_SrvD_to_SD_MD( p_FAST, SrvD%y, SD%Input(1), MD%Input(1) ) + !> transfer ED outputs to other modules used in option 1: CALL Transfer_ED_to_HD_SD_BD_Mooring( p_FAST, ED%y, HD%Input(1), SD%Input(1), ExtPtfm%Input(1), & MAPp%Input(1), FEAM%Input(1), MD%Input(1), & @@ -5227,7 +5249,7 @@ SUBROUTINE SolveOption1(this_time, this_state, calcJacobian, p_FAST, ED, BD, HD, ! the Structural control (TMD) from ServoDyn requires recalculating SrvD if we are using it. While it uses accelerations, ! the masses involved are small enough compared to the platform that we don't need to account for them in the jacobian - IF ( p_FAST%CompServo == Module_SrvD .and. allocated(SrvD%Input(1)%SStC) ) THEN + IF ( p_FAST%CompServo == Module_SrvD .and. allocated(SrvD%Input(1)%SStCMotionMesh) ) THEN ! need loads from SrvD%y%SStC%Mesh CALL SrvD_CalcOutput( this_time, SrvD%Input(1), SrvD%p, SrvD%x(this_state), SrvD%xd(this_state), SrvD%z(this_state), & SrvD%OtherSt(this_state), SrvD%y, SrvD%m, ErrStat2, ErrMsg2 ) diff --git a/modules/openfast-library/src/FAST_Subs.f90 b/modules/openfast-library/src/FAST_Subs.f90 index 214caa073d..3690d9ff08 100644 --- a/modules/openfast-library/src/FAST_Subs.f90 +++ b/modules/openfast-library/src/FAST_Subs.f90 @@ -702,147 +702,6 @@ SUBROUTINE FAST_InitializeAll( t_initial, p_FAST, y_FAST, m_FAST, ED, BD, SrvD, END IF - ! ........................ - ! initialize ServoDyn - ! ........................ - ALLOCATE( SrvD%Input( p_FAST%InterpOrder+1 ), SrvD%InputTimes( p_FAST%InterpOrder+1 ), STAT = ErrStat2 ) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal,"Error allocating SrvD%Input and SrvD%InputTimes.",ErrStat,ErrMsg,RoutineName) - CALL Cleanup() - RETURN - END IF - - IF ( p_FAST%CompServo == Module_SrvD ) THEN - Init%InData_SrvD%InputFile = p_FAST%ServoFile - Init%InData_SrvD%RootName = TRIM(p_FAST%OutFileRoot)//'.'//TRIM(y_FAST%Module_Abrev(Module_SrvD)) - Init%InData_SrvD%NumBl = NumBl - Init%InData_SrvD%Gravity = (/ 0.0_ReKi, 0.0_ReKi, -p_FAST%Gravity /) ! "Gravitational acceleration vector" m/s^2 - Init%InData_SrvD%NacPosition(1:3) = ED%Input(1)%NacelleLoads%Position(1:3,1) - Init%InData_SrvD%NacOrientation(1:3,1:3) = ED%Input(1)%NacelleLoads%RefOrientation(1:3,1:3,1) ! R8Ki - Init%InData_SrvD%TwrBasePos = Init%OutData_ED%TwrBasePos - Init%InData_SrvD%TwrBaseOrient = Init%OutData_ED%TwrBaseOrient ! R8Ki - Init%InData_SrvD%PlatformPos(1:3) = ED%y%PlatformPtMesh%Position(1:3,1) - Init%InData_SrvD%PlatformOrient(1:3,1:3) = ED%y%PlatformPtMesh%Orientation(1:3,1:3,1) ! R8Ki - Init%InData_SrvD%TMax = p_FAST%TMax - Init%InData_SrvD%AirDens = AirDens - Init%InData_SrvD%AvgWindSpeed = Init%OutData_IfW%WindFileInfo%MWS - Init%InData_SrvD%Linearize = p_FAST%Linearize - Init%InData_SrvD%TrimCase = p_FAST%TrimCase - Init%InData_SrvD%TrimGain = p_FAST%TrimGain - Init%InData_SrvD%RotSpeedRef = Init%OutData_ED%RotSpeed - - CALL AllocAry( Init%InData_SrvD%BladeRootPosition, 3, Init%OutData_ED%NumBl, 'Init%InData_SrvD%BladeRootPosition', errStat2, ErrMsg2) - CALL SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) - CALL AllocAry( Init%InData_SrvD%BladeRootOrientation,3, 3, Init%OutData_ED%NumBl, 'Init%InData_SrvD%BladeRootOrientation', errStat2, ErrMsg2) - CALL SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) - IF (ErrStat >= AbortErrLev) THEN - CALL Cleanup() - RETURN - END IF - do k=1,Init%OutData_ED%NumBl - Init%InData_SrvD%BladeRootPosition(:,k) = ED%y%BladeRootMotion(k)%Position(:,1) - Init%InData_SrvD%BladeRootOrientation(:,:,k) = ED%y%BladeRootMotion(k)%RefOrientation(:,:,1) - enddo - - - IF ( PRESENT(ExternInitData) ) THEN - Init%InData_SrvD%NumSC2CtrlGlob = ExternInitData%NumSC2CtrlGlob - IF ( (Init%InData_SrvD%NumSC2CtrlGlob > 0) ) THEN - CALL AllocAry( Init%InData_SrvD%fromSCGlob, Init%InData_SrvD%NumSC2CtrlGlob, 'Init%InData_SrvD%fromSCGlob', ErrStat2, ErrMsg2) - CALL SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) - IF (ErrStat >= AbortErrLev) THEN - CALL Cleanup() - RETURN - END IF - - do i=1,Init%InData_SrvD%NumSC2CtrlGlob - Init%InData_SrvD%fromSCGlob(i) = ExternInitData%fromSCGlob(i) - end do - END IF - - Init%InData_SrvD%NumSC2Ctrl = ExternInitData%NumSC2Ctrl - IF ( (Init%InData_SrvD%NumSC2Ctrl > 0) ) THEN - CALL AllocAry( Init%InData_SrvD%fromSC, Init%InData_SrvD%NumSC2Ctrl, 'Init%InData_SrvD%fromSC', ErrStat2, ErrMsg2) - CALL SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) - IF (ErrStat >= AbortErrLev) THEN - CALL Cleanup() - RETURN - END IF - - do i=1,Init%InData_SrvD%NumSC2Ctrl - Init%InData_SrvD%fromSC(i) = ExternInitData%fromSC(i) - end do - END IF - - Init%InData_SrvD%NumCtrl2SC = ExternInitData%NumCtrl2SC - - ELSE - Init%InData_SrvD%NumSC2CtrlGlob = 0 - Init%InData_SrvD%NumSC2Ctrl = 0 - Init%InData_SrvD%NumCtrl2SC = 0 - END IF - - CALL AllocAry(Init%InData_SrvD%BlPitchInit, Init%OutData_ED%NumBl, 'BlPitchInit', ErrStat2, ErrMsg2) - CALL SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) - - if (ErrStat >= abortErrLev) then ! make sure allocatable arrays are valid before setting them - CALL Cleanup() - RETURN - end if - - Init%InData_SrvD%BlPitchInit = Init%OutData_ED%BlPitch - CALL SrvD_Init( Init%InData_SrvD, SrvD%Input(1), SrvD%p, SrvD%x(STATE_CURR), SrvD%xd(STATE_CURR), SrvD%z(STATE_CURR), & - SrvD%OtherSt(STATE_CURR), SrvD%y, SrvD%m, p_FAST%dt_module( MODULE_SrvD ), Init%OutData_SrvD, ErrStat2, ErrMsg2 ) - CALL SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) - p_FAST%ModuleInitialized(Module_SrvD) = .TRUE. - - !IF ( Init%OutData_SrvD%CouplingScheme == ExplicitLoose ) THEN ... bjj: abort if we're doing anything else! - - CALL SetModuleSubstepTime(Module_SrvD, p_FAST, y_FAST, ErrStat2, ErrMsg2) - CALL SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) - - !! initialize SrvD%y%ElecPwr and SrvD%y%GenTq because they are one timestep different (used as input for the next step)? - - allocate( y_FAST%Lin%Modules(MODULE_SrvD)%Instance(1), stat=ErrStat2) - if (ErrStat2 /= 0 ) then - call SetErrStat(ErrID_Fatal, "Error allocating Lin%Modules(SrvD).", ErrStat, ErrMsg, RoutineName ) - else - if (allocated(Init%OutData_SrvD%LinNames_y)) call move_alloc(Init%OutData_SrvD%LinNames_y,y_FAST%Lin%Modules(MODULE_SrvD)%Instance(1)%Names_y ) - if (allocated(Init%OutData_SrvD%LinNames_u)) call move_alloc(Init%OutData_SrvD%LinNames_u,y_FAST%Lin%Modules(MODULE_SrvD)%Instance(1)%Names_u ) - if (allocated(Init%OutData_SrvD%RotFrame_y)) call move_alloc(Init%OutData_SrvD%RotFrame_y,y_FAST%Lin%Modules(MODULE_SrvD)%Instance(1)%RotFrame_y ) - if (allocated(Init%OutData_SrvD%RotFrame_u)) call move_alloc(Init%OutData_SrvD%RotFrame_u,y_FAST%Lin%Modules(MODULE_SrvD)%Instance(1)%RotFrame_u ) - if (allocated(Init%OutData_SrvD%IsLoad_u )) call move_alloc(Init%OutData_SrvD%IsLoad_u ,y_FAST%Lin%Modules(MODULE_SrvD)%Instance(1)%IsLoad_u ) - - if (allocated(Init%OutData_SrvD%WriteOutputHdr)) y_FAST%Lin%Modules(MODULE_SrvD)%Instance(1)%NumOutputs = size(Init%OutData_SrvD%WriteOutputHdr) - end if - - IF (ErrStat >= AbortErrLev) THEN - CALL Cleanup() - RETURN - END IF - - ! ........................ - ! some checks for AeroDyn and ElastoDyn inputs with the high-speed shaft brake hack in ElastoDyn: - ! (DO NOT COPY THIS CODE!) - ! ........................ - ! bjj: this is a hack to get high-speed shaft braking in FAST v8 - - IF ( Init%OutData_SrvD%UseHSSBrake ) THEN - IF ( p_FAST%CompAero == Module_AD14 ) THEN - IF ( AD14%p%DYNINFL ) THEN - CALL SetErrStat(ErrID_Fatal,'AeroDyn v14 "DYNINFL" InfModel is invalid for models with high-speed shaft braking.',ErrStat,ErrMsg,RoutineName) - END IF - END IF - - - IF ( ED%p%method == Method_RK4 ) THEN ! bjj: should be using ElastoDyn's Method_ABM4 Method_AB4 parameters - CALL SetErrStat(ErrID_Fatal,'ElastoDyn must use the AB4 or ABM4 integration method to implement high-speed shaft braking.',ErrStat,ErrMsg,RoutineName) - ENDIF - END IF ! Init%OutData_SrvD%UseHSSBrake - - - END IF - ! ........................ ! set some VTK parameters required before HydroDyn init (so we can get wave elevations for visualization) ! ........................ @@ -1275,6 +1134,165 @@ SUBROUTINE FAST_InitializeAll( t_initial, p_FAST, y_FAST, m_FAST, ED, BD, SrvD, END IF + ! ........................ + ! initialize ServoDyn + ! ........................ + ALLOCATE( SrvD%Input( p_FAST%InterpOrder+1 ), SrvD%InputTimes( p_FAST%InterpOrder+1 ), STAT = ErrStat2 ) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal,"Error allocating SrvD%Input and SrvD%InputTimes.",ErrStat,ErrMsg,RoutineName) + CALL Cleanup() + RETURN + END IF + + IF ( p_FAST%CompServo == Module_SrvD ) THEN + Init%InData_SrvD%InputFile = p_FAST%ServoFile + Init%InData_SrvD%RootName = TRIM(p_FAST%OutFileRoot)//'.'//TRIM(y_FAST%Module_Abrev(Module_SrvD)) + Init%InData_SrvD%NumBl = Init%OutData_ED%NumBl + Init%InData_SrvD%Gravity = (/ 0.0_ReKi, 0.0_ReKi, -p_FAST%Gravity /) ! "Gravitational acceleration vector" m/s^2 + Init%InData_SrvD%NacRefPos(1:3) = ED%y%NacelleMotion%Position(1:3,1) + Init%InData_SrvD%NacTransDisp(1:3) = ED%y%NacelleMotion%TranslationDisp(1:3,1) ! R8Ki + Init%InData_SrvD%NacRefOrient(1:3,1:3) = ED%y%NacelleMotion%RefOrientation(1:3,1:3,1) ! R8Ki + Init%InData_SrvD%NacOrient(1:3,1:3) = ED%y%NacelleMotion%Orientation(1:3,1:3,1) ! R8Ki + Init%InData_SrvD%TwrBaseRefPos = Init%OutData_ED%TwrBaseRefPos + Init%InData_SrvD%TwrBaseTransDisp = Init%OutData_ED%TwrBaseTransDisp + Init%InData_SrvD%TwrBaseRefOrient = Init%OutData_ED%TwrBaseRefOrient ! R8Ki + Init%InData_SrvD%TwrBaseOrient = Init%OutData_ED%TwrBaseOrient ! R8Ki + Init%InData_SrvD%PtfmRefPos(1:3) = ED%y%PlatformPtMesh%Position(1:3,1) + Init%InData_SrvD%PtfmTransDisp(1:3) = ED%y%PlatformPtMesh%TranslationDisp(1:3,1) + Init%InData_SrvD%PtfmRefOrient(1:3,1:3)= ED%y%PlatformPtMesh%RefOrientation(1:3,1:3,1) ! R8Ki + Init%InData_SrvD%PtfmOrient(1:3,1:3) = ED%y%PlatformPtMesh%Orientation(1:3,1:3,1) ! R8Ki + Init%InData_SrvD%TMax = p_FAST%TMax + Init%InData_SrvD%AirDens = AirDens + Init%InData_SrvD%AvgWindSpeed = Init%OutData_IfW%WindFileInfo%MWS + Init%InData_SrvD%Linearize = p_FAST%Linearize + Init%InData_SrvD%TrimCase = p_FAST%TrimCase + Init%InData_SrvD%TrimGain = p_FAST%TrimGain + Init%InData_SrvD%RotSpeedRef = Init%OutData_ED%RotSpeed + Init%InData_SrvD%InterpOrder = p_FAST%InterpOrder + + CALL AllocAry( Init%InData_SrvD%BladeRootRefPos, 3, Init%OutData_ED%NumBl, 'Init%InData_SrvD%BladeRootRefPos', errStat2, ErrMsg2) + CALL SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) + CALL AllocAry( Init%InData_SrvD%BladeRootTransDisp, 3, Init%OutData_ED%NumBl, 'Init%InData_SrvD%BladeRootTransDisp', errStat2, ErrMsg2) + CALL SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) + CALL AllocAry( Init%InData_SrvD%BladeRootRefOrient, 3, 3, Init%OutData_ED%NumBl, 'Init%InData_SrvD%BladeRootRefOrient', errStat2, ErrMsg2) + CALL SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) + CALL AllocAry( Init%InData_SrvD%BladeRootOrient, 3, 3, Init%OutData_ED%NumBl, 'Init%InData_SrvD%BladeRootOrient', errStat2, ErrMsg2) + CALL SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) + IF (ErrStat >= AbortErrLev) THEN + CALL Cleanup() + RETURN + END IF + do k=1,Init%OutData_ED%NumBl + Init%InData_SrvD%BladeRootRefPos(:,k) = ED%y%BladeRootMotion(k)%Position(:,1) + Init%InData_SrvD%BladeRootTransDisp(:,k) = ED%y%BladeRootMotion(k)%TranslationDisp(:,1) + Init%InData_SrvD%BladeRootRefOrient(:,:,k)= ED%y%BladeRootMotion(k)%RefOrientation(:,:,1) + Init%InData_SrvD%BladeRootOrient(:,:,k) = ED%y%BladeRootMotion(k)%Orientation(:,:,1) + enddo + + + IF ( PRESENT(ExternInitData) ) THEN + Init%InData_SrvD%NumSC2CtrlGlob = ExternInitData%NumSC2CtrlGlob + IF ( (Init%InData_SrvD%NumSC2CtrlGlob > 0) ) THEN + CALL AllocAry( Init%InData_SrvD%fromSCGlob, Init%InData_SrvD%NumSC2CtrlGlob, 'Init%InData_SrvD%fromSCGlob', ErrStat2, ErrMsg2) + CALL SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) + IF (ErrStat >= AbortErrLev) THEN + CALL Cleanup() + RETURN + END IF + + do i=1,Init%InData_SrvD%NumSC2CtrlGlob + Init%InData_SrvD%fromSCGlob(i) = ExternInitData%fromSCGlob(i) + end do + END IF + + Init%InData_SrvD%NumSC2Ctrl = ExternInitData%NumSC2Ctrl + IF ( (Init%InData_SrvD%NumSC2Ctrl > 0) ) THEN + CALL AllocAry( Init%InData_SrvD%fromSC, Init%InData_SrvD%NumSC2Ctrl, 'Init%InData_SrvD%fromSC', ErrStat2, ErrMsg2) + CALL SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) + IF (ErrStat >= AbortErrLev) THEN + CALL Cleanup() + RETURN + END IF + + do i=1,Init%InData_SrvD%NumSC2Ctrl + Init%InData_SrvD%fromSC(i) = ExternInitData%fromSC(i) + end do + END IF + + Init%InData_SrvD%NumCtrl2SC = ExternInitData%NumCtrl2SC + + ELSE + Init%InData_SrvD%NumSC2CtrlGlob = 0 + Init%InData_SrvD%NumSC2Ctrl = 0 + Init%InData_SrvD%NumCtrl2SC = 0 + END IF + + ! Set cable controls inputs (if requested by other modules) -- There is probably a nicer way to do this, but this will work for now. + call SetSrvDCableControls() + + + CALL AllocAry(Init%InData_SrvD%BlPitchInit, Init%OutData_ED%NumBl, 'BlPitchInit', ErrStat2, ErrMsg2) + CALL SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) + + if (ErrStat >= abortErrLev) then ! make sure allocatable arrays are valid before setting them + CALL Cleanup() + RETURN + end if + + Init%InData_SrvD%BlPitchInit = Init%OutData_ED%BlPitch + CALL SrvD_Init( Init%InData_SrvD, SrvD%Input(1), SrvD%p, SrvD%x(STATE_CURR), SrvD%xd(STATE_CURR), SrvD%z(STATE_CURR), & + SrvD%OtherSt(STATE_CURR), SrvD%y, SrvD%m, p_FAST%dt_module( MODULE_SrvD ), Init%OutData_SrvD, ErrStat2, ErrMsg2 ) + CALL SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) + p_FAST%ModuleInitialized(Module_SrvD) = .TRUE. + + !IF ( Init%OutData_SrvD%CouplingScheme == ExplicitLoose ) THEN ... bjj: abort if we're doing anything else! + + CALL SetModuleSubstepTime(Module_SrvD, p_FAST, y_FAST, ErrStat2, ErrMsg2) + CALL SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) + + !! initialize SrvD%y%ElecPwr and SrvD%y%GenTq because they are one timestep different (used as input for the next step)? + + allocate( y_FAST%Lin%Modules(MODULE_SrvD)%Instance(1), stat=ErrStat2) + if (ErrStat2 /= 0 ) then + call SetErrStat(ErrID_Fatal, "Error allocating Lin%Modules(SrvD).", ErrStat, ErrMsg, RoutineName ) + else + if (allocated(Init%OutData_SrvD%LinNames_y)) call move_alloc(Init%OutData_SrvD%LinNames_y,y_FAST%Lin%Modules(MODULE_SrvD)%Instance(1)%Names_y ) + if (allocated(Init%OutData_SrvD%LinNames_u)) call move_alloc(Init%OutData_SrvD%LinNames_u,y_FAST%Lin%Modules(MODULE_SrvD)%Instance(1)%Names_u ) + if (allocated(Init%OutData_SrvD%RotFrame_y)) call move_alloc(Init%OutData_SrvD%RotFrame_y,y_FAST%Lin%Modules(MODULE_SrvD)%Instance(1)%RotFrame_y ) + if (allocated(Init%OutData_SrvD%RotFrame_u)) call move_alloc(Init%OutData_SrvD%RotFrame_u,y_FAST%Lin%Modules(MODULE_SrvD)%Instance(1)%RotFrame_u ) + if (allocated(Init%OutData_SrvD%IsLoad_u )) call move_alloc(Init%OutData_SrvD%IsLoad_u ,y_FAST%Lin%Modules(MODULE_SrvD)%Instance(1)%IsLoad_u ) + + if (allocated(Init%OutData_SrvD%WriteOutputHdr)) y_FAST%Lin%Modules(MODULE_SrvD)%Instance(1)%NumOutputs = size(Init%OutData_SrvD%WriteOutputHdr) + end if + + IF (ErrStat >= AbortErrLev) THEN + CALL Cleanup() + RETURN + END IF + + ! ........................ + ! some checks for AeroDyn and ElastoDyn inputs with the high-speed shaft brake hack in ElastoDyn: + ! (DO NOT COPY THIS CODE!) + ! ........................ + ! bjj: this is a hack to get high-speed shaft braking in FAST v8 + + IF ( Init%OutData_SrvD%UseHSSBrake ) THEN + IF ( p_FAST%CompAero == Module_AD14 ) THEN + IF ( AD14%p%DYNINFL ) THEN + CALL SetErrStat(ErrID_Fatal,'AeroDyn v14 "DYNINFL" InfModel is invalid for models with high-speed shaft braking.',ErrStat,ErrMsg,RoutineName) + END IF + END IF + + + IF ( ED%p%method == Method_RK4 ) THEN ! bjj: should be using ElastoDyn's Method_ABM4 Method_AB4 parameters + CALL SetErrStat(ErrID_Fatal,'ElastoDyn must use the AB4 or ABM4 integration method to implement high-speed shaft braking.',ErrStat,ErrMsg,RoutineName) + ENDIF + END IF ! Init%OutData_SrvD%UseHSSBrake + + + END IF + + ! ........................ ! Set up output for glue code (must be done after all modules are initialized so we have their WriteOutput information) ! ........................ @@ -1354,6 +1372,26 @@ SUBROUTINE FAST_InitializeAll( t_initial, p_FAST, y_FAST, m_FAST, ED, BD, SrvD, do i=1,SIZE(SrvD%Input(1)%ExternalBlPitchCom) m_FAST%ExternInput%BlPitchCom(i) = SrvD%Input(1)%ExternalBlPitchCom(i) end do + + do i=1,SIZE(SrvD%Input(1)%ExternalBlAirfoilCom) + m_FAST%ExternInput%BlAirfoilCom(i) = SrvD%Input(1)%ExternalBlAirfoilCom(i) + end do + + ! Cable Controls (only 20 channels are passed to simulink, but may be less or more in SrvD) + if (allocated(SrvD%Input(1)%ExternalCableDeltaL)) then + do i=1,min(SIZE(m_FAST%ExternInput%CableDeltaL),SIZE(SrvD%Input(1)%ExternalCableDeltaL)) + m_FAST%ExternInput%CableDeltaL(i) = SrvD%Input(1)%ExternalCableDeltaL(i) + end do + else ! Initialize to zero for consistency + m_FAST%ExternInput%CableDeltaL = 0.0_Reki + endif + if (allocated(SrvD%Input(1)%ExternalCableDeltaLdot)) then + do i=1,min(SIZE(m_FAST%ExternInput%CableDeltaLdot),SIZE(SrvD%Input(1)%ExternalCableDeltaLdot)) + m_FAST%ExternInput%CableDeltaLdot(i) = SrvD%Input(1)%ExternalCableDeltaLdot(i) + end do + else ! Initialize to zero for consistency + m_FAST%ExternInput%CableDeltaLdot = 0.0_Reki + endif end if m_FAST%ExternInput%LidarFocus = 1.0_ReKi ! make this non-zero (until we add the initial position in the InflowWind input file) @@ -1374,6 +1412,101 @@ SUBROUTINE Cleanup() END SUBROUTINE Cleanup + SUBROUTINE SetSrvDCableControls() + ! There is probably a better method for doint this, but this will work for now. Kind of an ugly bit of hacking. + Init%InData_SrvD%NumCableControl = 0 + if (allocated(Init%OutData_SD%CableCChanRqst)) then + Init%InData_SrvD%NumCableControl = max(Init%InData_SrvD%NumCableControl, size(Init%OutData_SD%CableCChanRqst)) + endif + if (allocated(Init%OutData_MD%CableCChanRqst)) then + Init%InData_SrvD%NumCableControl = max(Init%InData_SrvD%NumCableControl, size(Init%OutData_MD%CableCChanRqst)) + endif + ! Set an array listing which modules requested which channels. + ! They may not all be requested, so check the arrays returned from them during initialization. + if (Init%InData_SrvD%NumCableControl > 0) then + call AllocAry(Init%InData_SrvD%CableControlRequestor, Init%InData_SrvD%NumCableControl, 'CableControlRequestor', ErrStat2, ErrMsg2) + call SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) + if (ErrStat >= abortErrLev) then ! make sure allocatable arrays are valid before setting them + call Cleanup() + return + endif + ! Fill a string array that we pass to SrvD containing info about which module is using which of the + ! requested channels. This is not strictly necessary, but will greatly simplify troubleshooting erros + ! with the setup later. + Init%InData_SrvD%CableControlRequestor = '' + do I=1,Init%InData_SrvD%NumCableControl + ! SD -- lots of logic here since we don't know if SD did the requesting of the channels + if (allocated(Init%OutData_SD%CableCChanRqst)) then + if (I <= size(Init%OutData_SD%CableCChanRqst)) then + if (Init%OutData_SD%CableCChanRqst(I)) then + if (len_trim(Init%InData_SrvD%CableControlRequestor(I))>0) Init%InData_SrvD%CableControlRequestor(I) = trim(Init%InData_SrvD%CableControlRequestor(I))//', ' + Init%InData_SrvD%CableControlRequestor(I) = trim(Init%InData_SrvD%CableControlRequestor(I))//trim(y_FAST%Module_Ver( Module_SD )%Name) + endif + endif + endif + ! MD -- lots of logic here since we don't know if MD did the requesting of the channels + if (allocated(Init%OutData_MD%CableCChanRqst)) then + if (I <= size(Init%OutData_MD%CableCChanRqst)) then + if (Init%OutData_MD%CableCChanRqst(I)) then + if (len_trim(Init%InData_SrvD%CableControlRequestor(I))>0) Init%InData_SrvD%CableControlRequestor(I) = trim(Init%InData_SrvD%CableControlRequestor(I))//', ' + Init%InData_SrvD%CableControlRequestor(I) = trim(Init%InData_SrvD%CableControlRequestor(I))//trim(y_FAST%Module_Ver( Module_MD )%Name) + endif + endif + endif + enddo + endif + + ! Now that we actually know which channels are requested, resize the arrays sent into SD and MD. They can both handle + ! larger and sparse arrays. They will simply ignore the channels they aren't looking for., + if (Init%InData_SrvD%NumCableControl > 0) then + ! SD has one array (CableDeltaL) + if (allocated(SD%Input)) then + if (allocated(SD%Input(1)%CableDeltaL)) then + if (size(SD%Input(1)%CableDeltaL)= abortErrLev) then ! make sure allocatable arrays are valid before setting them + call Cleanup() + return + endif + SD%Input(1)%CableDeltaL = 0.0_ReKi + endif + endif + endif + ! Resize the MD arrays as needed -- They may have requested different inputs, but we are passing larger arrays if necessary. + ! MD has two arrays (DeltaL, DeltaLdot) + if (allocated(MD%Input)) then + if (allocated(MD%Input(1)%DeltaL)) then + if (size(MD%Input(1)%DeltaL)= abortErrLev) then ! make sure allocatable arrays are valid before setting them + call Cleanup() + return + endif + MD%Input(1)%DeltaL = 0.0_ReKi + endif + endif + endif + if (allocated(MD%Input)) then + if (allocated(MD%Input(1)%DeltaLdot)) then + if (size(MD%Input(1)%DeltaLdot)= abortErrLev) then ! make sure allocatable arrays are valid before setting them + call Cleanup() + return + endif + MD%Input(1)%DeltaLdot = 0.0_ReKi + endif + endif + endif + endif + END SUBROUTINE SetSrvDCableControls + END SUBROUTINE FAST_InitializeAll !---------------------------------------------------------------------------------------------------------------------------------- @@ -5360,43 +5493,31 @@ SUBROUTINE WrVTK_AllMeshes(p_FAST, y_FAST, MeshMapData, ED, BD, AD, IfW, OpFM, H ! ServoDyn if (allocated(SrvD%Input)) then - IF ( ALLOCATED(SrvD%Input(1)%NStC) ) THEN - do j=1,size(SrvD%Input(1)%NStC) - IF ( ALLOCATED(SrvD%Input(1)%NStC(j)%Mesh) ) THEN - IF ( SrvD%Input(1)%NStC(j)%Mesh(1)%Committed ) THEN - !call MeshWrVTK(p_FAST%TurbinePos, SrvD%Input(1)%NStC(j)%Mesh(1), trim(p_FAST%VTK_OutFileRoot)//'.SrvD_NStC_Motion'//trim(num2lstr(j)), y_FAST%VTK_count, p_FAST%VTK_fields, ErrStat2, ErrMsg2, p_FAST%VTK_tWidth ) - call MeshWrVTK(p_FAST%TurbinePos, SrvD%y%NStC(j)%Mesh(1), trim(p_FAST%VTK_OutFileRoot)//'.SrvD_NStC'//trim(num2lstr(j)), y_FAST%VTK_count, p_FAST%VTK_fields, ErrStat2, ErrMsg2, p_FAST%VTK_tWidth, SrvD%Input(1)%NStC(j)%Mesh(1) ) - END IF + IF ( ALLOCATED(SrvD%Input(1)%NStCMotionMesh) ) THEN + do j=1,size(SrvD%Input(1)%NStCMotionMesh) + IF ( SrvD%Input(1)%NStCMotionMesh(j)%Committed ) THEN + call MeshWrVTK(p_FAST%TurbinePos, SrvD%y%NStCLoadMesh(j), trim(p_FAST%VTK_OutFileRoot)//'.SrvD_NStC'//trim(num2lstr(j)), y_FAST%VTK_count, p_FAST%VTK_fields, ErrStat2, ErrMsg2, p_FAST%VTK_tWidth, SrvD%Input(1)%NStCMotionMesh(j) ) ENDIF enddo ENDIF - IF ( ALLOCATED(SrvD%Input(1)%TStC) ) THEN - do j=1,size(SrvD%Input(1)%TStC) - IF ( ALLOCATED(SrvD%Input(1)%TStC(j)%Mesh) ) THEN - IF ( SrvD%Input(1)%TStC(j)%Mesh(1)%Committed ) THEN - !call MeshWrVTK(p_FAST%TurbinePos, SrvD%Input(1)%TStC(j)%Mesh(1), trim(p_FAST%VTK_OutFileRoot)//'.SrvD_TStC_Motion', y_FAST%VTK_count, p_FAST%VTK_fields, ErrStat2, ErrMsg2, p_FAST%VTK_tWidth ) - call MeshWrVTK(p_FAST%TurbinePos, SrvD%y%TStC(j)%Mesh(1), trim(p_FAST%VTK_OutFileRoot)//'.SrvD_TStC'//trim(num2lstr(j)), y_FAST%VTK_count, p_FAST%VTK_fields, ErrStat2, ErrMsg2, p_FAST%VTK_tWidth, SrvD%Input(1)%TStC(j)%Mesh(1) ) - ENDIF + IF ( ALLOCATED(SrvD%Input(1)%TStCMotionMesh) ) THEN + do j=1,size(SrvD%Input(1)%TStCMotionMesh) + IF ( SrvD%Input(1)%TStCMotionMesh(j)%Committed ) THEN + call MeshWrVTK(p_FAST%TurbinePos, SrvD%y%TStCLoadMesh(j), trim(p_FAST%VTK_OutFileRoot)//'.SrvD_TStC'//trim(num2lstr(j)), y_FAST%VTK_count, p_FAST%VTK_fields, ErrStat2, ErrMsg2, p_FAST%VTK_tWidth, SrvD%Input(1)%TStCMotionMesh(j) ) ENDIF enddo ENDIF - IF ( ALLOCATED(SrvD%Input(1)%BStC) ) THEN - do j=1,size(SrvD%Input(1)%BStC) - IF ( ALLOCATED(SrvD%Input(1)%BStC(j)%Mesh) ) THEN - DO K=1,size(SrvD%Input(1)%BStC(j)%Mesh) - !call MeshWrVTK(p_FAST%TurbinePos, SrvD%Input(1)%BStC(j)%Mesh(k), trim(p_FAST%VTK_OutFileRoot)//'.SrvD_BStC_Motion', y_FAST%VTK_count, p_FAST%VTK_fields, ErrStat2, ErrMsg2, p_FAST%VTK_tWidth ) - call MeshWrVTK(p_FAST%TurbinePos, SrvD%y%BStC(j)%Mesh(k), trim(p_FAST%VTK_OutFileRoot)//'.SrvD_BStC'//trim(num2lstr(j))//'B'//trim(num2lstr(k)), y_FAST%VTK_count, p_FAST%VTK_fields, ErrStat2, ErrMsg2, p_FAST%VTK_tWidth, SrvD%Input(1)%BStC(j)%Mesh(k) ) - ENDDO - END IF + IF ( ALLOCATED(SrvD%Input(1)%BStCMotionMesh) ) THEN + do j=1,size(SrvD%Input(1)%BStCMotionMesh,2) + DO K=1,size(SrvD%Input(1)%BStCMotionMesh,1) + call MeshWrVTK(p_FAST%TurbinePos, SrvD%y%BStCLoadMesh(k,j), trim(p_FAST%VTK_OutFileRoot)//'.SrvD_BStC'//trim(num2lstr(j))//'B'//trim(num2lstr(k)), y_FAST%VTK_count, p_FAST%VTK_fields, ErrStat2, ErrMsg2, p_FAST%VTK_tWidth, SrvD%Input(1)%BStCMotionMesh(k,j) ) + ENDDO enddo ENDIF - IF ( ALLOCATED(SrvD%Input(1)%SStC) ) THEN - do j=1,size(SrvD%Input(1)%SStC) - IF ( ALLOCATED(SrvD%Input(1)%SStC(j)%Mesh) ) THEN - IF ( SrvD%Input(1)%SStC(j)%Mesh(1)%Committed ) THEN - !call MeshWrVTK(p_FAST%TurbinePos, SrvD%Input(1)%SStC(j)%Mesh(1), trim(p_FAST%VTK_OutFileRoot)//'.SrvD_SStC_Motion', y_FAST%VTK_count, p_FAST%VTK_fields, ErrStat2, ErrMsg2, p_FAST%VTK_tWidth ) - call MeshWrVTK(p_FAST%TurbinePos, SrvD%y%SStC(j)%Mesh(1), trim(p_FAST%VTK_OutFileRoot)//'.SrvD_SStC'//trim(num2lstr(j)), y_FAST%VTK_count, p_FAST%VTK_fields, ErrStat2, ErrMsg2, p_FAST%VTK_tWidth, SrvD%Input(1)%SStC(j)%Mesh(1) ) - ENDIF + IF ( ALLOCATED(SrvD%Input(1)%SStCMotionMesh) ) THEN + do j=1,size(SrvD%Input(1)%SStCMotionMesh) + IF ( SrvD%Input(1)%SStCMotionMesh(j)%Committed ) THEN + call MeshWrVTK(p_FAST%TurbinePos, SrvD%y%SStCLoadMesh(j), trim(p_FAST%VTK_OutFileRoot)//'.SrvD_SStC'//trim(num2lstr(j)), y_FAST%VTK_count, p_FAST%VTK_fields, ErrStat2, ErrMsg2, p_FAST%VTK_tWidth, SrvD%Input(1)%SStCMotionMesh(j) ) ENDIF enddo ENDIF diff --git a/modules/openfast-library/src/FAST_Types.f90 b/modules/openfast-library/src/FAST_Types.f90 index c7f0c39fa5..d16e227aa9 100644 --- a/modules/openfast-library/src/FAST_Types.f90 +++ b/modules/openfast-library/src/FAST_Types.f90 @@ -621,18 +621,19 @@ MODULE FAST_Types TYPE(MeshMapType) :: HD_M_P_2_SD_P !< Map HydroDyn Morison Point to SubDyn y2Mesh Point [-] TYPE(MeshMapType) :: SD_P_2_HD_W_P !< Map SubDyn y2Mesh Point to HydroDyn WAMIT Point [-] TYPE(MeshMapType) :: HD_W_P_2_SD_P !< Map HydroDyn WAMIT Point to SubDyn y2Mesh Point [-] - TYPE(MeshMapType) , DIMENSION(:), ALLOCATABLE :: ED_P_2_SrvD_P_N !< Map ElastoDyn Nacelle point mesh to ServoDyn/NStC point mesh [-] - TYPE(MeshMapType) , DIMENSION(:), ALLOCATABLE :: SrvD_P_2_ED_P_N !< Map ServoDyn nacelle point mesh to ElastoDyn point mesh on the nacelle [-] - TYPE(MeshMapType) , DIMENSION(:), ALLOCATABLE :: ED_L_2_SrvD_P_T !< Map ElastoDyn tower line2 mesh to ServoDyn/TStC point mesh [-] - TYPE(MeshMapType) , DIMENSION(:), ALLOCATABLE :: SrvD_P_2_ED_P_T !< Map ServoDyn tower point mesh to ElastoDyn point load mesh on the tower [-] - TYPE(MeshMapType) , DIMENSION(:,:), ALLOCATABLE :: ED_L_2_SrvD_P_B !< Map ElastoDyn blade line2 mesh to ServoDyn/BStC point mesh [-] - TYPE(MeshMapType) , DIMENSION(:,:), ALLOCATABLE :: SrvD_P_2_ED_P_B !< Map ServoDyn/BStC point mesh to ElastoDyn point load mesh on the blade [-] - TYPE(MeshMapType) , DIMENSION(:,:), ALLOCATABLE :: BD_L_2_SrvD_P_B !< Map BeamDyn blade line2 mesh to ServoDyn/BStC point mesh [-] - TYPE(MeshMapType) , DIMENSION(:,:), ALLOCATABLE :: SrvD_P_2_BD_P_B !< Map ServoDyn/BStC point mesh to BeamDyn point load mesh on the blade [-] - TYPE(MeshMapType) , DIMENSION(:), ALLOCATABLE :: SrvD_P_P_2_ED_P !< Map ServoDyn platform point mesh load to ElastoDyn point load mesh [-] - TYPE(MeshMapType) , DIMENSION(:), ALLOCATABLE :: ED_P_2_SrvD_P_P !< Map ElastoDyn platform point mesh motion to ServoDyn/SStC point mesh [-] - TYPE(MeshMapType) , DIMENSION(:), ALLOCATABLE :: SrvD_P_P_2_SD_P !< Map ServoDyn platform point mesh load to SubDyn point load Lmesh [-] - TYPE(MeshMapType) , DIMENSION(:), ALLOCATABLE :: SDy3_P_2_SrvD_P_P !< Map SubDyn platform y3mesh motion to ServoDyn/SStC point mesh [-] + TYPE(MeshMapType) , DIMENSION(:), ALLOCATABLE :: ED_P_2_NStC_P_N !< Map ElastoDyn nacelle point mesh to ServoDyn/NStC point mesh [-] + TYPE(MeshMapType) , DIMENSION(:), ALLOCATABLE :: NStC_P_2_ED_P_N !< Map ServoDyn/NStC nacelle point mesh to ElastoDyn point mesh on the nacelle [-] + TYPE(MeshMapType) , DIMENSION(:), ALLOCATABLE :: ED_L_2_TStC_P_T !< Map ElastoDyn tower line2 mesh to ServoDyn/TStC point mesh [-] + TYPE(MeshMapType) , DIMENSION(:), ALLOCATABLE :: TStC_P_2_ED_P_T !< Map ServoDyn/TStC tower point mesh to ElastoDyn point load mesh on the tower [-] + TYPE(MeshMapType) , DIMENSION(:,:), ALLOCATABLE :: ED_L_2_BStC_P_B !< Map ElastoDyn blade line2 mesh to ServoDyn/BStC point mesh [-] + TYPE(MeshMapType) , DIMENSION(:,:), ALLOCATABLE :: BStC_P_2_ED_P_B !< Map ServoDyn/BStC point mesh to ElastoDyn point load mesh on the blade [-] + TYPE(MeshMapType) , DIMENSION(:,:), ALLOCATABLE :: BD_L_2_BStC_P_B !< Map BeamDyn blade line2 mesh to ServoDyn/BStC point mesh [-] + TYPE(MeshMapType) , DIMENSION(:,:), ALLOCATABLE :: BStC_P_2_BD_P_B !< Map ServoDyn/BStC point mesh to BeamDyn point load mesh on the blade [-] + TYPE(MeshMapType) , DIMENSION(:), ALLOCATABLE :: SStC_P_P_2_ED_P !< Map ServoDyn/SStC platform point mesh load to ElastoDyn point load mesh [-] + TYPE(MeshMapType) , DIMENSION(:), ALLOCATABLE :: ED_P_2_SStC_P_P !< Map ElastoDyn platform point mesh motion to ServoDyn/SStC point mesh [-] + TYPE(MeshMapType) , DIMENSION(:), ALLOCATABLE :: SStC_P_P_2_SD_P !< Map ServoDyn/SStC platform point mesh load to SubDyn point load mesh [-] + TYPE(MeshMapType) , DIMENSION(:), ALLOCATABLE :: SDy3_P_2_SStC_P_P !< Map SubDyn y3mesh point mesh motion to ServoDyn/SStC point mesh [-] + TYPE(MeshMapType) :: ED_P_2_SrvD_P_P !< Map ElastoDyn platform point mesh motion to ServoDyn point mesh -- for passing to controller [-] TYPE(MeshMapType) , DIMENSION(:), ALLOCATABLE :: BDED_L_2_AD_L_B !< Map ElastoDyn BladeLn2Mesh point meshes OR BeamDyn BldMotion line2 meshes to AeroDyn14 InputMarkers OR AeroDyn BladeMotion line2 meshes [-] TYPE(MeshMapType) , DIMENSION(:), ALLOCATABLE :: AD_L_2_BDED_B !< Map AeroDyn14 InputMarkers or AeroDyn BladeLoad line2 meshes to ElastoDyn BladePtLoad point meshes or BeamDyn BldMotion line2 meshes [-] TYPE(MeshMapType) , DIMENSION(:), ALLOCATABLE :: BD_L_2_BD_L !< Map BeamDyn BldMotion output meshes to locations on the BD input DistrLoad mesh stored in MeshMapType%y_BD_BldMotion_4Loads (BD input and output meshes are not siblings and in fact have nodes at different locations [-] @@ -652,7 +653,6 @@ MODULE FAST_Types TYPE(MeshType) :: u_ED_NacelleLoads !< copy of ED input mesh [-] TYPE(MeshType) :: u_ED_PlatformPtMesh !< copy of ED input mesh [-] TYPE(MeshType) :: u_ED_PlatformPtMesh_2 !< copy of ED input mesh (used only for temporary storage) [-] - TYPE(MeshType) :: u_ED_PlatformPtMesh_3 !< copy of ED input mesh (used only for temporary storage) [-] TYPE(MeshType) :: u_ED_TowerPtloads !< copy of ED input mesh [-] TYPE(MeshType) , DIMENSION(:), ALLOCATABLE :: u_ED_BladePtLoads !< copy of ED input mesh [-] TYPE(MeshType) :: u_SD_TPMesh !< copy of SD input mesh [-] @@ -676,8 +676,11 @@ MODULE FAST_Types REAL(ReKi) :: YawPosCom !< yaw position command from Simulink/Labview [-] REAL(ReKi) :: YawRateCom !< yaw rate command from Simulink/Labview [-] REAL(ReKi) , DIMENSION(1:3) :: BlPitchCom !< blade pitch commands from Simulink/Labview [rad] + REAL(ReKi) , DIMENSION(1:3) :: BlAirfoilCom !< blade airfoil commands from Simulink/Labview [-] REAL(ReKi) :: HSSBrFrac !< Fraction of full braking torque: 0 (off) <= HSSBrFrac <= 1 (full) from Simulink or LabVIEW [-] REAL(ReKi) , DIMENSION(1:3) :: LidarFocus !< lidar focus (relative to lidar location) [m] + REAL(ReKi) , DIMENSION(1:20) :: CableDeltaL !< Cable control DeltaL [m] + REAL(ReKi) , DIMENSION(1:20) :: CableDeltaLdot !< Cable control DeltaLdot [m/s] END TYPE FAST_ExternInputType ! ======================= ! ========= FAST_MiscVarType ======= @@ -35971,214 +35974,217 @@ SUBROUTINE FAST_CopyModuleMapType( SrcModuleMapTypeData, DstModuleMapTypeData, C CALL NWTC_Library_Copymeshmaptype( SrcModuleMapTypeData%HD_W_P_2_SD_P, DstModuleMapTypeData%HD_W_P_2_SD_P, CtrlCode, ErrStat2, ErrMsg2 ) CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) IF (ErrStat>=AbortErrLev) RETURN -IF (ALLOCATED(SrcModuleMapTypeData%ED_P_2_SrvD_P_N)) THEN - i1_l = LBOUND(SrcModuleMapTypeData%ED_P_2_SrvD_P_N,1) - i1_u = UBOUND(SrcModuleMapTypeData%ED_P_2_SrvD_P_N,1) - IF (.NOT. ALLOCATED(DstModuleMapTypeData%ED_P_2_SrvD_P_N)) THEN - ALLOCATE(DstModuleMapTypeData%ED_P_2_SrvD_P_N(i1_l:i1_u),STAT=ErrStat2) +IF (ALLOCATED(SrcModuleMapTypeData%ED_P_2_NStC_P_N)) THEN + i1_l = LBOUND(SrcModuleMapTypeData%ED_P_2_NStC_P_N,1) + i1_u = UBOUND(SrcModuleMapTypeData%ED_P_2_NStC_P_N,1) + IF (.NOT. ALLOCATED(DstModuleMapTypeData%ED_P_2_NStC_P_N)) THEN + ALLOCATE(DstModuleMapTypeData%ED_P_2_NStC_P_N(i1_l:i1_u),STAT=ErrStat2) IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating DstModuleMapTypeData%ED_P_2_SrvD_P_N.', ErrStat, ErrMsg,RoutineName) + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstModuleMapTypeData%ED_P_2_NStC_P_N.', ErrStat, ErrMsg,RoutineName) RETURN END IF END IF - DO i1 = LBOUND(SrcModuleMapTypeData%ED_P_2_SrvD_P_N,1), UBOUND(SrcModuleMapTypeData%ED_P_2_SrvD_P_N,1) - CALL NWTC_Library_Copymeshmaptype( SrcModuleMapTypeData%ED_P_2_SrvD_P_N(i1), DstModuleMapTypeData%ED_P_2_SrvD_P_N(i1), CtrlCode, ErrStat2, ErrMsg2 ) + DO i1 = LBOUND(SrcModuleMapTypeData%ED_P_2_NStC_P_N,1), UBOUND(SrcModuleMapTypeData%ED_P_2_NStC_P_N,1) + CALL NWTC_Library_Copymeshmaptype( SrcModuleMapTypeData%ED_P_2_NStC_P_N(i1), DstModuleMapTypeData%ED_P_2_NStC_P_N(i1), CtrlCode, ErrStat2, ErrMsg2 ) CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) IF (ErrStat>=AbortErrLev) RETURN ENDDO ENDIF -IF (ALLOCATED(SrcModuleMapTypeData%SrvD_P_2_ED_P_N)) THEN - i1_l = LBOUND(SrcModuleMapTypeData%SrvD_P_2_ED_P_N,1) - i1_u = UBOUND(SrcModuleMapTypeData%SrvD_P_2_ED_P_N,1) - IF (.NOT. ALLOCATED(DstModuleMapTypeData%SrvD_P_2_ED_P_N)) THEN - ALLOCATE(DstModuleMapTypeData%SrvD_P_2_ED_P_N(i1_l:i1_u),STAT=ErrStat2) +IF (ALLOCATED(SrcModuleMapTypeData%NStC_P_2_ED_P_N)) THEN + i1_l = LBOUND(SrcModuleMapTypeData%NStC_P_2_ED_P_N,1) + i1_u = UBOUND(SrcModuleMapTypeData%NStC_P_2_ED_P_N,1) + IF (.NOT. ALLOCATED(DstModuleMapTypeData%NStC_P_2_ED_P_N)) THEN + ALLOCATE(DstModuleMapTypeData%NStC_P_2_ED_P_N(i1_l:i1_u),STAT=ErrStat2) IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating DstModuleMapTypeData%SrvD_P_2_ED_P_N.', ErrStat, ErrMsg,RoutineName) + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstModuleMapTypeData%NStC_P_2_ED_P_N.', ErrStat, ErrMsg,RoutineName) RETURN END IF END IF - DO i1 = LBOUND(SrcModuleMapTypeData%SrvD_P_2_ED_P_N,1), UBOUND(SrcModuleMapTypeData%SrvD_P_2_ED_P_N,1) - CALL NWTC_Library_Copymeshmaptype( SrcModuleMapTypeData%SrvD_P_2_ED_P_N(i1), DstModuleMapTypeData%SrvD_P_2_ED_P_N(i1), CtrlCode, ErrStat2, ErrMsg2 ) + DO i1 = LBOUND(SrcModuleMapTypeData%NStC_P_2_ED_P_N,1), UBOUND(SrcModuleMapTypeData%NStC_P_2_ED_P_N,1) + CALL NWTC_Library_Copymeshmaptype( SrcModuleMapTypeData%NStC_P_2_ED_P_N(i1), DstModuleMapTypeData%NStC_P_2_ED_P_N(i1), CtrlCode, ErrStat2, ErrMsg2 ) CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) IF (ErrStat>=AbortErrLev) RETURN ENDDO ENDIF -IF (ALLOCATED(SrcModuleMapTypeData%ED_L_2_SrvD_P_T)) THEN - i1_l = LBOUND(SrcModuleMapTypeData%ED_L_2_SrvD_P_T,1) - i1_u = UBOUND(SrcModuleMapTypeData%ED_L_2_SrvD_P_T,1) - IF (.NOT. ALLOCATED(DstModuleMapTypeData%ED_L_2_SrvD_P_T)) THEN - ALLOCATE(DstModuleMapTypeData%ED_L_2_SrvD_P_T(i1_l:i1_u),STAT=ErrStat2) +IF (ALLOCATED(SrcModuleMapTypeData%ED_L_2_TStC_P_T)) THEN + i1_l = LBOUND(SrcModuleMapTypeData%ED_L_2_TStC_P_T,1) + i1_u = UBOUND(SrcModuleMapTypeData%ED_L_2_TStC_P_T,1) + IF (.NOT. ALLOCATED(DstModuleMapTypeData%ED_L_2_TStC_P_T)) THEN + ALLOCATE(DstModuleMapTypeData%ED_L_2_TStC_P_T(i1_l:i1_u),STAT=ErrStat2) IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating DstModuleMapTypeData%ED_L_2_SrvD_P_T.', ErrStat, ErrMsg,RoutineName) + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstModuleMapTypeData%ED_L_2_TStC_P_T.', ErrStat, ErrMsg,RoutineName) RETURN END IF END IF - DO i1 = LBOUND(SrcModuleMapTypeData%ED_L_2_SrvD_P_T,1), UBOUND(SrcModuleMapTypeData%ED_L_2_SrvD_P_T,1) - CALL NWTC_Library_Copymeshmaptype( SrcModuleMapTypeData%ED_L_2_SrvD_P_T(i1), DstModuleMapTypeData%ED_L_2_SrvD_P_T(i1), CtrlCode, ErrStat2, ErrMsg2 ) + DO i1 = LBOUND(SrcModuleMapTypeData%ED_L_2_TStC_P_T,1), UBOUND(SrcModuleMapTypeData%ED_L_2_TStC_P_T,1) + CALL NWTC_Library_Copymeshmaptype( SrcModuleMapTypeData%ED_L_2_TStC_P_T(i1), DstModuleMapTypeData%ED_L_2_TStC_P_T(i1), CtrlCode, ErrStat2, ErrMsg2 ) CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) IF (ErrStat>=AbortErrLev) RETURN ENDDO ENDIF -IF (ALLOCATED(SrcModuleMapTypeData%SrvD_P_2_ED_P_T)) THEN - i1_l = LBOUND(SrcModuleMapTypeData%SrvD_P_2_ED_P_T,1) - i1_u = UBOUND(SrcModuleMapTypeData%SrvD_P_2_ED_P_T,1) - IF (.NOT. ALLOCATED(DstModuleMapTypeData%SrvD_P_2_ED_P_T)) THEN - ALLOCATE(DstModuleMapTypeData%SrvD_P_2_ED_P_T(i1_l:i1_u),STAT=ErrStat2) +IF (ALLOCATED(SrcModuleMapTypeData%TStC_P_2_ED_P_T)) THEN + i1_l = LBOUND(SrcModuleMapTypeData%TStC_P_2_ED_P_T,1) + i1_u = UBOUND(SrcModuleMapTypeData%TStC_P_2_ED_P_T,1) + IF (.NOT. ALLOCATED(DstModuleMapTypeData%TStC_P_2_ED_P_T)) THEN + ALLOCATE(DstModuleMapTypeData%TStC_P_2_ED_P_T(i1_l:i1_u),STAT=ErrStat2) IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating DstModuleMapTypeData%SrvD_P_2_ED_P_T.', ErrStat, ErrMsg,RoutineName) + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstModuleMapTypeData%TStC_P_2_ED_P_T.', ErrStat, ErrMsg,RoutineName) RETURN END IF END IF - DO i1 = LBOUND(SrcModuleMapTypeData%SrvD_P_2_ED_P_T,1), UBOUND(SrcModuleMapTypeData%SrvD_P_2_ED_P_T,1) - CALL NWTC_Library_Copymeshmaptype( SrcModuleMapTypeData%SrvD_P_2_ED_P_T(i1), DstModuleMapTypeData%SrvD_P_2_ED_P_T(i1), CtrlCode, ErrStat2, ErrMsg2 ) + DO i1 = LBOUND(SrcModuleMapTypeData%TStC_P_2_ED_P_T,1), UBOUND(SrcModuleMapTypeData%TStC_P_2_ED_P_T,1) + CALL NWTC_Library_Copymeshmaptype( SrcModuleMapTypeData%TStC_P_2_ED_P_T(i1), DstModuleMapTypeData%TStC_P_2_ED_P_T(i1), CtrlCode, ErrStat2, ErrMsg2 ) CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) IF (ErrStat>=AbortErrLev) RETURN ENDDO ENDIF -IF (ALLOCATED(SrcModuleMapTypeData%ED_L_2_SrvD_P_B)) THEN - i1_l = LBOUND(SrcModuleMapTypeData%ED_L_2_SrvD_P_B,1) - i1_u = UBOUND(SrcModuleMapTypeData%ED_L_2_SrvD_P_B,1) - i2_l = LBOUND(SrcModuleMapTypeData%ED_L_2_SrvD_P_B,2) - i2_u = UBOUND(SrcModuleMapTypeData%ED_L_2_SrvD_P_B,2) - IF (.NOT. ALLOCATED(DstModuleMapTypeData%ED_L_2_SrvD_P_B)) THEN - ALLOCATE(DstModuleMapTypeData%ED_L_2_SrvD_P_B(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) +IF (ALLOCATED(SrcModuleMapTypeData%ED_L_2_BStC_P_B)) THEN + i1_l = LBOUND(SrcModuleMapTypeData%ED_L_2_BStC_P_B,1) + i1_u = UBOUND(SrcModuleMapTypeData%ED_L_2_BStC_P_B,1) + i2_l = LBOUND(SrcModuleMapTypeData%ED_L_2_BStC_P_B,2) + i2_u = UBOUND(SrcModuleMapTypeData%ED_L_2_BStC_P_B,2) + IF (.NOT. ALLOCATED(DstModuleMapTypeData%ED_L_2_BStC_P_B)) THEN + ALLOCATE(DstModuleMapTypeData%ED_L_2_BStC_P_B(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating DstModuleMapTypeData%ED_L_2_SrvD_P_B.', ErrStat, ErrMsg,RoutineName) + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstModuleMapTypeData%ED_L_2_BStC_P_B.', ErrStat, ErrMsg,RoutineName) RETURN END IF END IF - DO i2 = LBOUND(SrcModuleMapTypeData%ED_L_2_SrvD_P_B,2), UBOUND(SrcModuleMapTypeData%ED_L_2_SrvD_P_B,2) - DO i1 = LBOUND(SrcModuleMapTypeData%ED_L_2_SrvD_P_B,1), UBOUND(SrcModuleMapTypeData%ED_L_2_SrvD_P_B,1) - CALL NWTC_Library_Copymeshmaptype( SrcModuleMapTypeData%ED_L_2_SrvD_P_B(i1,i2), DstModuleMapTypeData%ED_L_2_SrvD_P_B(i1,i2), CtrlCode, ErrStat2, ErrMsg2 ) + DO i2 = LBOUND(SrcModuleMapTypeData%ED_L_2_BStC_P_B,2), UBOUND(SrcModuleMapTypeData%ED_L_2_BStC_P_B,2) + DO i1 = LBOUND(SrcModuleMapTypeData%ED_L_2_BStC_P_B,1), UBOUND(SrcModuleMapTypeData%ED_L_2_BStC_P_B,1) + CALL NWTC_Library_Copymeshmaptype( SrcModuleMapTypeData%ED_L_2_BStC_P_B(i1,i2), DstModuleMapTypeData%ED_L_2_BStC_P_B(i1,i2), CtrlCode, ErrStat2, ErrMsg2 ) CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) IF (ErrStat>=AbortErrLev) RETURN ENDDO ENDDO ENDIF -IF (ALLOCATED(SrcModuleMapTypeData%SrvD_P_2_ED_P_B)) THEN - i1_l = LBOUND(SrcModuleMapTypeData%SrvD_P_2_ED_P_B,1) - i1_u = UBOUND(SrcModuleMapTypeData%SrvD_P_2_ED_P_B,1) - i2_l = LBOUND(SrcModuleMapTypeData%SrvD_P_2_ED_P_B,2) - i2_u = UBOUND(SrcModuleMapTypeData%SrvD_P_2_ED_P_B,2) - IF (.NOT. ALLOCATED(DstModuleMapTypeData%SrvD_P_2_ED_P_B)) THEN - ALLOCATE(DstModuleMapTypeData%SrvD_P_2_ED_P_B(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) +IF (ALLOCATED(SrcModuleMapTypeData%BStC_P_2_ED_P_B)) THEN + i1_l = LBOUND(SrcModuleMapTypeData%BStC_P_2_ED_P_B,1) + i1_u = UBOUND(SrcModuleMapTypeData%BStC_P_2_ED_P_B,1) + i2_l = LBOUND(SrcModuleMapTypeData%BStC_P_2_ED_P_B,2) + i2_u = UBOUND(SrcModuleMapTypeData%BStC_P_2_ED_P_B,2) + IF (.NOT. ALLOCATED(DstModuleMapTypeData%BStC_P_2_ED_P_B)) THEN + ALLOCATE(DstModuleMapTypeData%BStC_P_2_ED_P_B(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating DstModuleMapTypeData%SrvD_P_2_ED_P_B.', ErrStat, ErrMsg,RoutineName) + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstModuleMapTypeData%BStC_P_2_ED_P_B.', ErrStat, ErrMsg,RoutineName) RETURN END IF END IF - DO i2 = LBOUND(SrcModuleMapTypeData%SrvD_P_2_ED_P_B,2), UBOUND(SrcModuleMapTypeData%SrvD_P_2_ED_P_B,2) - DO i1 = LBOUND(SrcModuleMapTypeData%SrvD_P_2_ED_P_B,1), UBOUND(SrcModuleMapTypeData%SrvD_P_2_ED_P_B,1) - CALL NWTC_Library_Copymeshmaptype( SrcModuleMapTypeData%SrvD_P_2_ED_P_B(i1,i2), DstModuleMapTypeData%SrvD_P_2_ED_P_B(i1,i2), CtrlCode, ErrStat2, ErrMsg2 ) + DO i2 = LBOUND(SrcModuleMapTypeData%BStC_P_2_ED_P_B,2), UBOUND(SrcModuleMapTypeData%BStC_P_2_ED_P_B,2) + DO i1 = LBOUND(SrcModuleMapTypeData%BStC_P_2_ED_P_B,1), UBOUND(SrcModuleMapTypeData%BStC_P_2_ED_P_B,1) + CALL NWTC_Library_Copymeshmaptype( SrcModuleMapTypeData%BStC_P_2_ED_P_B(i1,i2), DstModuleMapTypeData%BStC_P_2_ED_P_B(i1,i2), CtrlCode, ErrStat2, ErrMsg2 ) CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) IF (ErrStat>=AbortErrLev) RETURN ENDDO ENDDO ENDIF -IF (ALLOCATED(SrcModuleMapTypeData%BD_L_2_SrvD_P_B)) THEN - i1_l = LBOUND(SrcModuleMapTypeData%BD_L_2_SrvD_P_B,1) - i1_u = UBOUND(SrcModuleMapTypeData%BD_L_2_SrvD_P_B,1) - i2_l = LBOUND(SrcModuleMapTypeData%BD_L_2_SrvD_P_B,2) - i2_u = UBOUND(SrcModuleMapTypeData%BD_L_2_SrvD_P_B,2) - IF (.NOT. ALLOCATED(DstModuleMapTypeData%BD_L_2_SrvD_P_B)) THEN - ALLOCATE(DstModuleMapTypeData%BD_L_2_SrvD_P_B(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) +IF (ALLOCATED(SrcModuleMapTypeData%BD_L_2_BStC_P_B)) THEN + i1_l = LBOUND(SrcModuleMapTypeData%BD_L_2_BStC_P_B,1) + i1_u = UBOUND(SrcModuleMapTypeData%BD_L_2_BStC_P_B,1) + i2_l = LBOUND(SrcModuleMapTypeData%BD_L_2_BStC_P_B,2) + i2_u = UBOUND(SrcModuleMapTypeData%BD_L_2_BStC_P_B,2) + IF (.NOT. ALLOCATED(DstModuleMapTypeData%BD_L_2_BStC_P_B)) THEN + ALLOCATE(DstModuleMapTypeData%BD_L_2_BStC_P_B(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating DstModuleMapTypeData%BD_L_2_SrvD_P_B.', ErrStat, ErrMsg,RoutineName) + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstModuleMapTypeData%BD_L_2_BStC_P_B.', ErrStat, ErrMsg,RoutineName) RETURN END IF END IF - DO i2 = LBOUND(SrcModuleMapTypeData%BD_L_2_SrvD_P_B,2), UBOUND(SrcModuleMapTypeData%BD_L_2_SrvD_P_B,2) - DO i1 = LBOUND(SrcModuleMapTypeData%BD_L_2_SrvD_P_B,1), UBOUND(SrcModuleMapTypeData%BD_L_2_SrvD_P_B,1) - CALL NWTC_Library_Copymeshmaptype( SrcModuleMapTypeData%BD_L_2_SrvD_P_B(i1,i2), DstModuleMapTypeData%BD_L_2_SrvD_P_B(i1,i2), CtrlCode, ErrStat2, ErrMsg2 ) + DO i2 = LBOUND(SrcModuleMapTypeData%BD_L_2_BStC_P_B,2), UBOUND(SrcModuleMapTypeData%BD_L_2_BStC_P_B,2) + DO i1 = LBOUND(SrcModuleMapTypeData%BD_L_2_BStC_P_B,1), UBOUND(SrcModuleMapTypeData%BD_L_2_BStC_P_B,1) + CALL NWTC_Library_Copymeshmaptype( SrcModuleMapTypeData%BD_L_2_BStC_P_B(i1,i2), DstModuleMapTypeData%BD_L_2_BStC_P_B(i1,i2), CtrlCode, ErrStat2, ErrMsg2 ) CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) IF (ErrStat>=AbortErrLev) RETURN ENDDO ENDDO ENDIF -IF (ALLOCATED(SrcModuleMapTypeData%SrvD_P_2_BD_P_B)) THEN - i1_l = LBOUND(SrcModuleMapTypeData%SrvD_P_2_BD_P_B,1) - i1_u = UBOUND(SrcModuleMapTypeData%SrvD_P_2_BD_P_B,1) - i2_l = LBOUND(SrcModuleMapTypeData%SrvD_P_2_BD_P_B,2) - i2_u = UBOUND(SrcModuleMapTypeData%SrvD_P_2_BD_P_B,2) - IF (.NOT. ALLOCATED(DstModuleMapTypeData%SrvD_P_2_BD_P_B)) THEN - ALLOCATE(DstModuleMapTypeData%SrvD_P_2_BD_P_B(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) +IF (ALLOCATED(SrcModuleMapTypeData%BStC_P_2_BD_P_B)) THEN + i1_l = LBOUND(SrcModuleMapTypeData%BStC_P_2_BD_P_B,1) + i1_u = UBOUND(SrcModuleMapTypeData%BStC_P_2_BD_P_B,1) + i2_l = LBOUND(SrcModuleMapTypeData%BStC_P_2_BD_P_B,2) + i2_u = UBOUND(SrcModuleMapTypeData%BStC_P_2_BD_P_B,2) + IF (.NOT. ALLOCATED(DstModuleMapTypeData%BStC_P_2_BD_P_B)) THEN + ALLOCATE(DstModuleMapTypeData%BStC_P_2_BD_P_B(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating DstModuleMapTypeData%SrvD_P_2_BD_P_B.', ErrStat, ErrMsg,RoutineName) + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstModuleMapTypeData%BStC_P_2_BD_P_B.', ErrStat, ErrMsg,RoutineName) RETURN END IF END IF - DO i2 = LBOUND(SrcModuleMapTypeData%SrvD_P_2_BD_P_B,2), UBOUND(SrcModuleMapTypeData%SrvD_P_2_BD_P_B,2) - DO i1 = LBOUND(SrcModuleMapTypeData%SrvD_P_2_BD_P_B,1), UBOUND(SrcModuleMapTypeData%SrvD_P_2_BD_P_B,1) - CALL NWTC_Library_Copymeshmaptype( SrcModuleMapTypeData%SrvD_P_2_BD_P_B(i1,i2), DstModuleMapTypeData%SrvD_P_2_BD_P_B(i1,i2), CtrlCode, ErrStat2, ErrMsg2 ) + DO i2 = LBOUND(SrcModuleMapTypeData%BStC_P_2_BD_P_B,2), UBOUND(SrcModuleMapTypeData%BStC_P_2_BD_P_B,2) + DO i1 = LBOUND(SrcModuleMapTypeData%BStC_P_2_BD_P_B,1), UBOUND(SrcModuleMapTypeData%BStC_P_2_BD_P_B,1) + CALL NWTC_Library_Copymeshmaptype( SrcModuleMapTypeData%BStC_P_2_BD_P_B(i1,i2), DstModuleMapTypeData%BStC_P_2_BD_P_B(i1,i2), CtrlCode, ErrStat2, ErrMsg2 ) CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) IF (ErrStat>=AbortErrLev) RETURN ENDDO ENDDO ENDIF -IF (ALLOCATED(SrcModuleMapTypeData%SrvD_P_P_2_ED_P)) THEN - i1_l = LBOUND(SrcModuleMapTypeData%SrvD_P_P_2_ED_P,1) - i1_u = UBOUND(SrcModuleMapTypeData%SrvD_P_P_2_ED_P,1) - IF (.NOT. ALLOCATED(DstModuleMapTypeData%SrvD_P_P_2_ED_P)) THEN - ALLOCATE(DstModuleMapTypeData%SrvD_P_P_2_ED_P(i1_l:i1_u),STAT=ErrStat2) +IF (ALLOCATED(SrcModuleMapTypeData%SStC_P_P_2_ED_P)) THEN + i1_l = LBOUND(SrcModuleMapTypeData%SStC_P_P_2_ED_P,1) + i1_u = UBOUND(SrcModuleMapTypeData%SStC_P_P_2_ED_P,1) + IF (.NOT. ALLOCATED(DstModuleMapTypeData%SStC_P_P_2_ED_P)) THEN + ALLOCATE(DstModuleMapTypeData%SStC_P_P_2_ED_P(i1_l:i1_u),STAT=ErrStat2) IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating DstModuleMapTypeData%SrvD_P_P_2_ED_P.', ErrStat, ErrMsg,RoutineName) + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstModuleMapTypeData%SStC_P_P_2_ED_P.', ErrStat, ErrMsg,RoutineName) RETURN END IF END IF - DO i1 = LBOUND(SrcModuleMapTypeData%SrvD_P_P_2_ED_P,1), UBOUND(SrcModuleMapTypeData%SrvD_P_P_2_ED_P,1) - CALL NWTC_Library_Copymeshmaptype( SrcModuleMapTypeData%SrvD_P_P_2_ED_P(i1), DstModuleMapTypeData%SrvD_P_P_2_ED_P(i1), CtrlCode, ErrStat2, ErrMsg2 ) + DO i1 = LBOUND(SrcModuleMapTypeData%SStC_P_P_2_ED_P,1), UBOUND(SrcModuleMapTypeData%SStC_P_P_2_ED_P,1) + CALL NWTC_Library_Copymeshmaptype( SrcModuleMapTypeData%SStC_P_P_2_ED_P(i1), DstModuleMapTypeData%SStC_P_P_2_ED_P(i1), CtrlCode, ErrStat2, ErrMsg2 ) CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) IF (ErrStat>=AbortErrLev) RETURN ENDDO ENDIF -IF (ALLOCATED(SrcModuleMapTypeData%ED_P_2_SrvD_P_P)) THEN - i1_l = LBOUND(SrcModuleMapTypeData%ED_P_2_SrvD_P_P,1) - i1_u = UBOUND(SrcModuleMapTypeData%ED_P_2_SrvD_P_P,1) - IF (.NOT. ALLOCATED(DstModuleMapTypeData%ED_P_2_SrvD_P_P)) THEN - ALLOCATE(DstModuleMapTypeData%ED_P_2_SrvD_P_P(i1_l:i1_u),STAT=ErrStat2) +IF (ALLOCATED(SrcModuleMapTypeData%ED_P_2_SStC_P_P)) THEN + i1_l = LBOUND(SrcModuleMapTypeData%ED_P_2_SStC_P_P,1) + i1_u = UBOUND(SrcModuleMapTypeData%ED_P_2_SStC_P_P,1) + IF (.NOT. ALLOCATED(DstModuleMapTypeData%ED_P_2_SStC_P_P)) THEN + ALLOCATE(DstModuleMapTypeData%ED_P_2_SStC_P_P(i1_l:i1_u),STAT=ErrStat2) IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating DstModuleMapTypeData%ED_P_2_SrvD_P_P.', ErrStat, ErrMsg,RoutineName) + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstModuleMapTypeData%ED_P_2_SStC_P_P.', ErrStat, ErrMsg,RoutineName) RETURN END IF END IF - DO i1 = LBOUND(SrcModuleMapTypeData%ED_P_2_SrvD_P_P,1), UBOUND(SrcModuleMapTypeData%ED_P_2_SrvD_P_P,1) - CALL NWTC_Library_Copymeshmaptype( SrcModuleMapTypeData%ED_P_2_SrvD_P_P(i1), DstModuleMapTypeData%ED_P_2_SrvD_P_P(i1), CtrlCode, ErrStat2, ErrMsg2 ) + DO i1 = LBOUND(SrcModuleMapTypeData%ED_P_2_SStC_P_P,1), UBOUND(SrcModuleMapTypeData%ED_P_2_SStC_P_P,1) + CALL NWTC_Library_Copymeshmaptype( SrcModuleMapTypeData%ED_P_2_SStC_P_P(i1), DstModuleMapTypeData%ED_P_2_SStC_P_P(i1), CtrlCode, ErrStat2, ErrMsg2 ) CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) IF (ErrStat>=AbortErrLev) RETURN ENDDO ENDIF -IF (ALLOCATED(SrcModuleMapTypeData%SrvD_P_P_2_SD_P)) THEN - i1_l = LBOUND(SrcModuleMapTypeData%SrvD_P_P_2_SD_P,1) - i1_u = UBOUND(SrcModuleMapTypeData%SrvD_P_P_2_SD_P,1) - IF (.NOT. ALLOCATED(DstModuleMapTypeData%SrvD_P_P_2_SD_P)) THEN - ALLOCATE(DstModuleMapTypeData%SrvD_P_P_2_SD_P(i1_l:i1_u),STAT=ErrStat2) +IF (ALLOCATED(SrcModuleMapTypeData%SStC_P_P_2_SD_P)) THEN + i1_l = LBOUND(SrcModuleMapTypeData%SStC_P_P_2_SD_P,1) + i1_u = UBOUND(SrcModuleMapTypeData%SStC_P_P_2_SD_P,1) + IF (.NOT. ALLOCATED(DstModuleMapTypeData%SStC_P_P_2_SD_P)) THEN + ALLOCATE(DstModuleMapTypeData%SStC_P_P_2_SD_P(i1_l:i1_u),STAT=ErrStat2) IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating DstModuleMapTypeData%SrvD_P_P_2_SD_P.', ErrStat, ErrMsg,RoutineName) + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstModuleMapTypeData%SStC_P_P_2_SD_P.', ErrStat, ErrMsg,RoutineName) RETURN END IF END IF - DO i1 = LBOUND(SrcModuleMapTypeData%SrvD_P_P_2_SD_P,1), UBOUND(SrcModuleMapTypeData%SrvD_P_P_2_SD_P,1) - CALL NWTC_Library_Copymeshmaptype( SrcModuleMapTypeData%SrvD_P_P_2_SD_P(i1), DstModuleMapTypeData%SrvD_P_P_2_SD_P(i1), CtrlCode, ErrStat2, ErrMsg2 ) + DO i1 = LBOUND(SrcModuleMapTypeData%SStC_P_P_2_SD_P,1), UBOUND(SrcModuleMapTypeData%SStC_P_P_2_SD_P,1) + CALL NWTC_Library_Copymeshmaptype( SrcModuleMapTypeData%SStC_P_P_2_SD_P(i1), DstModuleMapTypeData%SStC_P_P_2_SD_P(i1), CtrlCode, ErrStat2, ErrMsg2 ) CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) IF (ErrStat>=AbortErrLev) RETURN ENDDO ENDIF -IF (ALLOCATED(SrcModuleMapTypeData%SDy3_P_2_SrvD_P_P)) THEN - i1_l = LBOUND(SrcModuleMapTypeData%SDy3_P_2_SrvD_P_P,1) - i1_u = UBOUND(SrcModuleMapTypeData%SDy3_P_2_SrvD_P_P,1) - IF (.NOT. ALLOCATED(DstModuleMapTypeData%SDy3_P_2_SrvD_P_P)) THEN - ALLOCATE(DstModuleMapTypeData%SDy3_P_2_SrvD_P_P(i1_l:i1_u),STAT=ErrStat2) +IF (ALLOCATED(SrcModuleMapTypeData%SDy3_P_2_SStC_P_P)) THEN + i1_l = LBOUND(SrcModuleMapTypeData%SDy3_P_2_SStC_P_P,1) + i1_u = UBOUND(SrcModuleMapTypeData%SDy3_P_2_SStC_P_P,1) + IF (.NOT. ALLOCATED(DstModuleMapTypeData%SDy3_P_2_SStC_P_P)) THEN + ALLOCATE(DstModuleMapTypeData%SDy3_P_2_SStC_P_P(i1_l:i1_u),STAT=ErrStat2) IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating DstModuleMapTypeData%SDy3_P_2_SrvD_P_P.', ErrStat, ErrMsg,RoutineName) + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstModuleMapTypeData%SDy3_P_2_SStC_P_P.', ErrStat, ErrMsg,RoutineName) RETURN END IF END IF - DO i1 = LBOUND(SrcModuleMapTypeData%SDy3_P_2_SrvD_P_P,1), UBOUND(SrcModuleMapTypeData%SDy3_P_2_SrvD_P_P,1) - CALL NWTC_Library_Copymeshmaptype( SrcModuleMapTypeData%SDy3_P_2_SrvD_P_P(i1), DstModuleMapTypeData%SDy3_P_2_SrvD_P_P(i1), CtrlCode, ErrStat2, ErrMsg2 ) + DO i1 = LBOUND(SrcModuleMapTypeData%SDy3_P_2_SStC_P_P,1), UBOUND(SrcModuleMapTypeData%SDy3_P_2_SStC_P_P,1) + CALL NWTC_Library_Copymeshmaptype( SrcModuleMapTypeData%SDy3_P_2_SStC_P_P(i1), DstModuleMapTypeData%SDy3_P_2_SStC_P_P(i1), CtrlCode, ErrStat2, ErrMsg2 ) CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) IF (ErrStat>=AbortErrLev) RETURN ENDDO ENDIF + CALL NWTC_Library_Copymeshmaptype( SrcModuleMapTypeData%ED_P_2_SrvD_P_P, DstModuleMapTypeData%ED_P_2_SrvD_P_P, CtrlCode, ErrStat2, ErrMsg2 ) + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) + IF (ErrStat>=AbortErrLev) RETURN IF (ALLOCATED(SrcModuleMapTypeData%BDED_L_2_AD_L_B)) THEN i1_l = LBOUND(SrcModuleMapTypeData%BDED_L_2_AD_L_B,1) i1_u = UBOUND(SrcModuleMapTypeData%BDED_L_2_AD_L_B,1) @@ -36345,9 +36351,6 @@ SUBROUTINE FAST_CopyModuleMapType( SrcModuleMapTypeData, DstModuleMapTypeData, C CALL MeshCopy( SrcModuleMapTypeData%u_ED_PlatformPtMesh_2, DstModuleMapTypeData%u_ED_PlatformPtMesh_2, CtrlCode, ErrStat2, ErrMsg2 ) CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat>=AbortErrLev) RETURN - CALL MeshCopy( SrcModuleMapTypeData%u_ED_PlatformPtMesh_3, DstModuleMapTypeData%u_ED_PlatformPtMesh_3, CtrlCode, ErrStat2, ErrMsg2 ) - CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) - IF (ErrStat>=AbortErrLev) RETURN CALL MeshCopy( SrcModuleMapTypeData%u_ED_TowerPtloads, DstModuleMapTypeData%u_ED_TowerPtloads, CtrlCode, ErrStat2, ErrMsg2 ) CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat>=AbortErrLev) RETURN @@ -36486,86 +36489,87 @@ SUBROUTINE FAST_DestroyModuleMapType( ModuleMapTypeData, ErrStat, ErrMsg ) CALL NWTC_Library_Destroymeshmaptype( ModuleMapTypeData%HD_M_P_2_SD_P, ErrStat, ErrMsg ) CALL NWTC_Library_Destroymeshmaptype( ModuleMapTypeData%SD_P_2_HD_W_P, ErrStat, ErrMsg ) CALL NWTC_Library_Destroymeshmaptype( ModuleMapTypeData%HD_W_P_2_SD_P, ErrStat, ErrMsg ) -IF (ALLOCATED(ModuleMapTypeData%ED_P_2_SrvD_P_N)) THEN -DO i1 = LBOUND(ModuleMapTypeData%ED_P_2_SrvD_P_N,1), UBOUND(ModuleMapTypeData%ED_P_2_SrvD_P_N,1) - CALL NWTC_Library_Destroymeshmaptype( ModuleMapTypeData%ED_P_2_SrvD_P_N(i1), ErrStat, ErrMsg ) +IF (ALLOCATED(ModuleMapTypeData%ED_P_2_NStC_P_N)) THEN +DO i1 = LBOUND(ModuleMapTypeData%ED_P_2_NStC_P_N,1), UBOUND(ModuleMapTypeData%ED_P_2_NStC_P_N,1) + CALL NWTC_Library_Destroymeshmaptype( ModuleMapTypeData%ED_P_2_NStC_P_N(i1), ErrStat, ErrMsg ) ENDDO - DEALLOCATE(ModuleMapTypeData%ED_P_2_SrvD_P_N) + DEALLOCATE(ModuleMapTypeData%ED_P_2_NStC_P_N) ENDIF -IF (ALLOCATED(ModuleMapTypeData%SrvD_P_2_ED_P_N)) THEN -DO i1 = LBOUND(ModuleMapTypeData%SrvD_P_2_ED_P_N,1), UBOUND(ModuleMapTypeData%SrvD_P_2_ED_P_N,1) - CALL NWTC_Library_Destroymeshmaptype( ModuleMapTypeData%SrvD_P_2_ED_P_N(i1), ErrStat, ErrMsg ) +IF (ALLOCATED(ModuleMapTypeData%NStC_P_2_ED_P_N)) THEN +DO i1 = LBOUND(ModuleMapTypeData%NStC_P_2_ED_P_N,1), UBOUND(ModuleMapTypeData%NStC_P_2_ED_P_N,1) + CALL NWTC_Library_Destroymeshmaptype( ModuleMapTypeData%NStC_P_2_ED_P_N(i1), ErrStat, ErrMsg ) ENDDO - DEALLOCATE(ModuleMapTypeData%SrvD_P_2_ED_P_N) + DEALLOCATE(ModuleMapTypeData%NStC_P_2_ED_P_N) ENDIF -IF (ALLOCATED(ModuleMapTypeData%ED_L_2_SrvD_P_T)) THEN -DO i1 = LBOUND(ModuleMapTypeData%ED_L_2_SrvD_P_T,1), UBOUND(ModuleMapTypeData%ED_L_2_SrvD_P_T,1) - CALL NWTC_Library_Destroymeshmaptype( ModuleMapTypeData%ED_L_2_SrvD_P_T(i1), ErrStat, ErrMsg ) +IF (ALLOCATED(ModuleMapTypeData%ED_L_2_TStC_P_T)) THEN +DO i1 = LBOUND(ModuleMapTypeData%ED_L_2_TStC_P_T,1), UBOUND(ModuleMapTypeData%ED_L_2_TStC_P_T,1) + CALL NWTC_Library_Destroymeshmaptype( ModuleMapTypeData%ED_L_2_TStC_P_T(i1), ErrStat, ErrMsg ) ENDDO - DEALLOCATE(ModuleMapTypeData%ED_L_2_SrvD_P_T) + DEALLOCATE(ModuleMapTypeData%ED_L_2_TStC_P_T) ENDIF -IF (ALLOCATED(ModuleMapTypeData%SrvD_P_2_ED_P_T)) THEN -DO i1 = LBOUND(ModuleMapTypeData%SrvD_P_2_ED_P_T,1), UBOUND(ModuleMapTypeData%SrvD_P_2_ED_P_T,1) - CALL NWTC_Library_Destroymeshmaptype( ModuleMapTypeData%SrvD_P_2_ED_P_T(i1), ErrStat, ErrMsg ) +IF (ALLOCATED(ModuleMapTypeData%TStC_P_2_ED_P_T)) THEN +DO i1 = LBOUND(ModuleMapTypeData%TStC_P_2_ED_P_T,1), UBOUND(ModuleMapTypeData%TStC_P_2_ED_P_T,1) + CALL NWTC_Library_Destroymeshmaptype( ModuleMapTypeData%TStC_P_2_ED_P_T(i1), ErrStat, ErrMsg ) ENDDO - DEALLOCATE(ModuleMapTypeData%SrvD_P_2_ED_P_T) + DEALLOCATE(ModuleMapTypeData%TStC_P_2_ED_P_T) ENDIF -IF (ALLOCATED(ModuleMapTypeData%ED_L_2_SrvD_P_B)) THEN -DO i2 = LBOUND(ModuleMapTypeData%ED_L_2_SrvD_P_B,2), UBOUND(ModuleMapTypeData%ED_L_2_SrvD_P_B,2) -DO i1 = LBOUND(ModuleMapTypeData%ED_L_2_SrvD_P_B,1), UBOUND(ModuleMapTypeData%ED_L_2_SrvD_P_B,1) - CALL NWTC_Library_Destroymeshmaptype( ModuleMapTypeData%ED_L_2_SrvD_P_B(i1,i2), ErrStat, ErrMsg ) +IF (ALLOCATED(ModuleMapTypeData%ED_L_2_BStC_P_B)) THEN +DO i2 = LBOUND(ModuleMapTypeData%ED_L_2_BStC_P_B,2), UBOUND(ModuleMapTypeData%ED_L_2_BStC_P_B,2) +DO i1 = LBOUND(ModuleMapTypeData%ED_L_2_BStC_P_B,1), UBOUND(ModuleMapTypeData%ED_L_2_BStC_P_B,1) + CALL NWTC_Library_Destroymeshmaptype( ModuleMapTypeData%ED_L_2_BStC_P_B(i1,i2), ErrStat, ErrMsg ) ENDDO ENDDO - DEALLOCATE(ModuleMapTypeData%ED_L_2_SrvD_P_B) + DEALLOCATE(ModuleMapTypeData%ED_L_2_BStC_P_B) ENDIF -IF (ALLOCATED(ModuleMapTypeData%SrvD_P_2_ED_P_B)) THEN -DO i2 = LBOUND(ModuleMapTypeData%SrvD_P_2_ED_P_B,2), UBOUND(ModuleMapTypeData%SrvD_P_2_ED_P_B,2) -DO i1 = LBOUND(ModuleMapTypeData%SrvD_P_2_ED_P_B,1), UBOUND(ModuleMapTypeData%SrvD_P_2_ED_P_B,1) - CALL NWTC_Library_Destroymeshmaptype( ModuleMapTypeData%SrvD_P_2_ED_P_B(i1,i2), ErrStat, ErrMsg ) +IF (ALLOCATED(ModuleMapTypeData%BStC_P_2_ED_P_B)) THEN +DO i2 = LBOUND(ModuleMapTypeData%BStC_P_2_ED_P_B,2), UBOUND(ModuleMapTypeData%BStC_P_2_ED_P_B,2) +DO i1 = LBOUND(ModuleMapTypeData%BStC_P_2_ED_P_B,1), UBOUND(ModuleMapTypeData%BStC_P_2_ED_P_B,1) + CALL NWTC_Library_Destroymeshmaptype( ModuleMapTypeData%BStC_P_2_ED_P_B(i1,i2), ErrStat, ErrMsg ) ENDDO ENDDO - DEALLOCATE(ModuleMapTypeData%SrvD_P_2_ED_P_B) + DEALLOCATE(ModuleMapTypeData%BStC_P_2_ED_P_B) ENDIF -IF (ALLOCATED(ModuleMapTypeData%BD_L_2_SrvD_P_B)) THEN -DO i2 = LBOUND(ModuleMapTypeData%BD_L_2_SrvD_P_B,2), UBOUND(ModuleMapTypeData%BD_L_2_SrvD_P_B,2) -DO i1 = LBOUND(ModuleMapTypeData%BD_L_2_SrvD_P_B,1), UBOUND(ModuleMapTypeData%BD_L_2_SrvD_P_B,1) - CALL NWTC_Library_Destroymeshmaptype( ModuleMapTypeData%BD_L_2_SrvD_P_B(i1,i2), ErrStat, ErrMsg ) +IF (ALLOCATED(ModuleMapTypeData%BD_L_2_BStC_P_B)) THEN +DO i2 = LBOUND(ModuleMapTypeData%BD_L_2_BStC_P_B,2), UBOUND(ModuleMapTypeData%BD_L_2_BStC_P_B,2) +DO i1 = LBOUND(ModuleMapTypeData%BD_L_2_BStC_P_B,1), UBOUND(ModuleMapTypeData%BD_L_2_BStC_P_B,1) + CALL NWTC_Library_Destroymeshmaptype( ModuleMapTypeData%BD_L_2_BStC_P_B(i1,i2), ErrStat, ErrMsg ) ENDDO ENDDO - DEALLOCATE(ModuleMapTypeData%BD_L_2_SrvD_P_B) + DEALLOCATE(ModuleMapTypeData%BD_L_2_BStC_P_B) ENDIF -IF (ALLOCATED(ModuleMapTypeData%SrvD_P_2_BD_P_B)) THEN -DO i2 = LBOUND(ModuleMapTypeData%SrvD_P_2_BD_P_B,2), UBOUND(ModuleMapTypeData%SrvD_P_2_BD_P_B,2) -DO i1 = LBOUND(ModuleMapTypeData%SrvD_P_2_BD_P_B,1), UBOUND(ModuleMapTypeData%SrvD_P_2_BD_P_B,1) - CALL NWTC_Library_Destroymeshmaptype( ModuleMapTypeData%SrvD_P_2_BD_P_B(i1,i2), ErrStat, ErrMsg ) +IF (ALLOCATED(ModuleMapTypeData%BStC_P_2_BD_P_B)) THEN +DO i2 = LBOUND(ModuleMapTypeData%BStC_P_2_BD_P_B,2), UBOUND(ModuleMapTypeData%BStC_P_2_BD_P_B,2) +DO i1 = LBOUND(ModuleMapTypeData%BStC_P_2_BD_P_B,1), UBOUND(ModuleMapTypeData%BStC_P_2_BD_P_B,1) + CALL NWTC_Library_Destroymeshmaptype( ModuleMapTypeData%BStC_P_2_BD_P_B(i1,i2), ErrStat, ErrMsg ) ENDDO ENDDO - DEALLOCATE(ModuleMapTypeData%SrvD_P_2_BD_P_B) + DEALLOCATE(ModuleMapTypeData%BStC_P_2_BD_P_B) ENDIF -IF (ALLOCATED(ModuleMapTypeData%SrvD_P_P_2_ED_P)) THEN -DO i1 = LBOUND(ModuleMapTypeData%SrvD_P_P_2_ED_P,1), UBOUND(ModuleMapTypeData%SrvD_P_P_2_ED_P,1) - CALL NWTC_Library_Destroymeshmaptype( ModuleMapTypeData%SrvD_P_P_2_ED_P(i1), ErrStat, ErrMsg ) +IF (ALLOCATED(ModuleMapTypeData%SStC_P_P_2_ED_P)) THEN +DO i1 = LBOUND(ModuleMapTypeData%SStC_P_P_2_ED_P,1), UBOUND(ModuleMapTypeData%SStC_P_P_2_ED_P,1) + CALL NWTC_Library_Destroymeshmaptype( ModuleMapTypeData%SStC_P_P_2_ED_P(i1), ErrStat, ErrMsg ) ENDDO - DEALLOCATE(ModuleMapTypeData%SrvD_P_P_2_ED_P) + DEALLOCATE(ModuleMapTypeData%SStC_P_P_2_ED_P) ENDIF -IF (ALLOCATED(ModuleMapTypeData%ED_P_2_SrvD_P_P)) THEN -DO i1 = LBOUND(ModuleMapTypeData%ED_P_2_SrvD_P_P,1), UBOUND(ModuleMapTypeData%ED_P_2_SrvD_P_P,1) - CALL NWTC_Library_Destroymeshmaptype( ModuleMapTypeData%ED_P_2_SrvD_P_P(i1), ErrStat, ErrMsg ) +IF (ALLOCATED(ModuleMapTypeData%ED_P_2_SStC_P_P)) THEN +DO i1 = LBOUND(ModuleMapTypeData%ED_P_2_SStC_P_P,1), UBOUND(ModuleMapTypeData%ED_P_2_SStC_P_P,1) + CALL NWTC_Library_Destroymeshmaptype( ModuleMapTypeData%ED_P_2_SStC_P_P(i1), ErrStat, ErrMsg ) ENDDO - DEALLOCATE(ModuleMapTypeData%ED_P_2_SrvD_P_P) + DEALLOCATE(ModuleMapTypeData%ED_P_2_SStC_P_P) ENDIF -IF (ALLOCATED(ModuleMapTypeData%SrvD_P_P_2_SD_P)) THEN -DO i1 = LBOUND(ModuleMapTypeData%SrvD_P_P_2_SD_P,1), UBOUND(ModuleMapTypeData%SrvD_P_P_2_SD_P,1) - CALL NWTC_Library_Destroymeshmaptype( ModuleMapTypeData%SrvD_P_P_2_SD_P(i1), ErrStat, ErrMsg ) +IF (ALLOCATED(ModuleMapTypeData%SStC_P_P_2_SD_P)) THEN +DO i1 = LBOUND(ModuleMapTypeData%SStC_P_P_2_SD_P,1), UBOUND(ModuleMapTypeData%SStC_P_P_2_SD_P,1) + CALL NWTC_Library_Destroymeshmaptype( ModuleMapTypeData%SStC_P_P_2_SD_P(i1), ErrStat, ErrMsg ) ENDDO - DEALLOCATE(ModuleMapTypeData%SrvD_P_P_2_SD_P) + DEALLOCATE(ModuleMapTypeData%SStC_P_P_2_SD_P) ENDIF -IF (ALLOCATED(ModuleMapTypeData%SDy3_P_2_SrvD_P_P)) THEN -DO i1 = LBOUND(ModuleMapTypeData%SDy3_P_2_SrvD_P_P,1), UBOUND(ModuleMapTypeData%SDy3_P_2_SrvD_P_P,1) - CALL NWTC_Library_Destroymeshmaptype( ModuleMapTypeData%SDy3_P_2_SrvD_P_P(i1), ErrStat, ErrMsg ) +IF (ALLOCATED(ModuleMapTypeData%SDy3_P_2_SStC_P_P)) THEN +DO i1 = LBOUND(ModuleMapTypeData%SDy3_P_2_SStC_P_P,1), UBOUND(ModuleMapTypeData%SDy3_P_2_SStC_P_P,1) + CALL NWTC_Library_Destroymeshmaptype( ModuleMapTypeData%SDy3_P_2_SStC_P_P(i1), ErrStat, ErrMsg ) ENDDO - DEALLOCATE(ModuleMapTypeData%SDy3_P_2_SrvD_P_P) + DEALLOCATE(ModuleMapTypeData%SDy3_P_2_SStC_P_P) ENDIF + CALL NWTC_Library_Destroymeshmaptype( ModuleMapTypeData%ED_P_2_SrvD_P_P, ErrStat, ErrMsg ) IF (ALLOCATED(ModuleMapTypeData%BDED_L_2_AD_L_B)) THEN DO i1 = LBOUND(ModuleMapTypeData%BDED_L_2_AD_L_B,1), UBOUND(ModuleMapTypeData%BDED_L_2_AD_L_B,1) CALL NWTC_Library_Destroymeshmaptype( ModuleMapTypeData%BDED_L_2_AD_L_B(i1), ErrStat, ErrMsg ) @@ -36621,7 +36625,6 @@ SUBROUTINE FAST_DestroyModuleMapType( ModuleMapTypeData, ErrStat, ErrMsg ) CALL MeshDestroy( ModuleMapTypeData%u_ED_NacelleLoads, ErrStat, ErrMsg ) CALL MeshDestroy( ModuleMapTypeData%u_ED_PlatformPtMesh, ErrStat, ErrMsg ) CALL MeshDestroy( ModuleMapTypeData%u_ED_PlatformPtMesh_2, ErrStat, ErrMsg ) - CALL MeshDestroy( ModuleMapTypeData%u_ED_PlatformPtMesh_3, ErrStat, ErrMsg ) CALL MeshDestroy( ModuleMapTypeData%u_ED_TowerPtloads, ErrStat, ErrMsg ) IF (ALLOCATED(ModuleMapTypeData%u_ED_BladePtLoads)) THEN DO i1 = LBOUND(ModuleMapTypeData%u_ED_BladePtLoads,1), UBOUND(ModuleMapTypeData%u_ED_BladePtLoads,1) @@ -37018,290 +37021,307 @@ SUBROUTINE FAST_PackModuleMapType( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, Int_BufSz = Int_BufSz + SIZE( Int_Buf ) DEALLOCATE(Int_Buf) END IF - Int_BufSz = Int_BufSz + 1 ! ED_P_2_SrvD_P_N allocated yes/no - IF ( ALLOCATED(InData%ED_P_2_SrvD_P_N) ) THEN - Int_BufSz = Int_BufSz + 2*1 ! ED_P_2_SrvD_P_N upper/lower bounds for each dimension - DO i1 = LBOUND(InData%ED_P_2_SrvD_P_N,1), UBOUND(InData%ED_P_2_SrvD_P_N,1) - Int_BufSz = Int_BufSz + 3 ! ED_P_2_SrvD_P_N: size of buffers for each call to pack subtype - CALL NWTC_Library_Packmeshmaptype( Re_Buf, Db_Buf, Int_Buf, InData%ED_P_2_SrvD_P_N(i1), ErrStat2, ErrMsg2, .TRUE. ) ! ED_P_2_SrvD_P_N + Int_BufSz = Int_BufSz + 1 ! ED_P_2_NStC_P_N allocated yes/no + IF ( ALLOCATED(InData%ED_P_2_NStC_P_N) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! ED_P_2_NStC_P_N upper/lower bounds for each dimension + DO i1 = LBOUND(InData%ED_P_2_NStC_P_N,1), UBOUND(InData%ED_P_2_NStC_P_N,1) + Int_BufSz = Int_BufSz + 3 ! ED_P_2_NStC_P_N: size of buffers for each call to pack subtype + CALL NWTC_Library_Packmeshmaptype( Re_Buf, Db_Buf, Int_Buf, InData%ED_P_2_NStC_P_N(i1), ErrStat2, ErrMsg2, .TRUE. ) ! ED_P_2_NStC_P_N CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN - IF(ALLOCATED(Re_Buf)) THEN ! ED_P_2_SrvD_P_N + IF(ALLOCATED(Re_Buf)) THEN ! ED_P_2_NStC_P_N Re_BufSz = Re_BufSz + SIZE( Re_Buf ) DEALLOCATE(Re_Buf) END IF - IF(ALLOCATED(Db_Buf)) THEN ! ED_P_2_SrvD_P_N + IF(ALLOCATED(Db_Buf)) THEN ! ED_P_2_NStC_P_N Db_BufSz = Db_BufSz + SIZE( Db_Buf ) DEALLOCATE(Db_Buf) END IF - IF(ALLOCATED(Int_Buf)) THEN ! ED_P_2_SrvD_P_N + IF(ALLOCATED(Int_Buf)) THEN ! ED_P_2_NStC_P_N Int_BufSz = Int_BufSz + SIZE( Int_Buf ) DEALLOCATE(Int_Buf) END IF END DO END IF - Int_BufSz = Int_BufSz + 1 ! SrvD_P_2_ED_P_N allocated yes/no - IF ( ALLOCATED(InData%SrvD_P_2_ED_P_N) ) THEN - Int_BufSz = Int_BufSz + 2*1 ! SrvD_P_2_ED_P_N upper/lower bounds for each dimension - DO i1 = LBOUND(InData%SrvD_P_2_ED_P_N,1), UBOUND(InData%SrvD_P_2_ED_P_N,1) - Int_BufSz = Int_BufSz + 3 ! SrvD_P_2_ED_P_N: size of buffers for each call to pack subtype - CALL NWTC_Library_Packmeshmaptype( Re_Buf, Db_Buf, Int_Buf, InData%SrvD_P_2_ED_P_N(i1), ErrStat2, ErrMsg2, .TRUE. ) ! SrvD_P_2_ED_P_N + Int_BufSz = Int_BufSz + 1 ! NStC_P_2_ED_P_N allocated yes/no + IF ( ALLOCATED(InData%NStC_P_2_ED_P_N) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! NStC_P_2_ED_P_N upper/lower bounds for each dimension + DO i1 = LBOUND(InData%NStC_P_2_ED_P_N,1), UBOUND(InData%NStC_P_2_ED_P_N,1) + Int_BufSz = Int_BufSz + 3 ! NStC_P_2_ED_P_N: size of buffers for each call to pack subtype + CALL NWTC_Library_Packmeshmaptype( Re_Buf, Db_Buf, Int_Buf, InData%NStC_P_2_ED_P_N(i1), ErrStat2, ErrMsg2, .TRUE. ) ! NStC_P_2_ED_P_N CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN - IF(ALLOCATED(Re_Buf)) THEN ! SrvD_P_2_ED_P_N + IF(ALLOCATED(Re_Buf)) THEN ! NStC_P_2_ED_P_N Re_BufSz = Re_BufSz + SIZE( Re_Buf ) DEALLOCATE(Re_Buf) END IF - IF(ALLOCATED(Db_Buf)) THEN ! SrvD_P_2_ED_P_N + IF(ALLOCATED(Db_Buf)) THEN ! NStC_P_2_ED_P_N Db_BufSz = Db_BufSz + SIZE( Db_Buf ) DEALLOCATE(Db_Buf) END IF - IF(ALLOCATED(Int_Buf)) THEN ! SrvD_P_2_ED_P_N + IF(ALLOCATED(Int_Buf)) THEN ! NStC_P_2_ED_P_N Int_BufSz = Int_BufSz + SIZE( Int_Buf ) DEALLOCATE(Int_Buf) END IF END DO END IF - Int_BufSz = Int_BufSz + 1 ! ED_L_2_SrvD_P_T allocated yes/no - IF ( ALLOCATED(InData%ED_L_2_SrvD_P_T) ) THEN - Int_BufSz = Int_BufSz + 2*1 ! ED_L_2_SrvD_P_T upper/lower bounds for each dimension - DO i1 = LBOUND(InData%ED_L_2_SrvD_P_T,1), UBOUND(InData%ED_L_2_SrvD_P_T,1) - Int_BufSz = Int_BufSz + 3 ! ED_L_2_SrvD_P_T: size of buffers for each call to pack subtype - CALL NWTC_Library_Packmeshmaptype( Re_Buf, Db_Buf, Int_Buf, InData%ED_L_2_SrvD_P_T(i1), ErrStat2, ErrMsg2, .TRUE. ) ! ED_L_2_SrvD_P_T + Int_BufSz = Int_BufSz + 1 ! ED_L_2_TStC_P_T allocated yes/no + IF ( ALLOCATED(InData%ED_L_2_TStC_P_T) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! ED_L_2_TStC_P_T upper/lower bounds for each dimension + DO i1 = LBOUND(InData%ED_L_2_TStC_P_T,1), UBOUND(InData%ED_L_2_TStC_P_T,1) + Int_BufSz = Int_BufSz + 3 ! ED_L_2_TStC_P_T: size of buffers for each call to pack subtype + CALL NWTC_Library_Packmeshmaptype( Re_Buf, Db_Buf, Int_Buf, InData%ED_L_2_TStC_P_T(i1), ErrStat2, ErrMsg2, .TRUE. ) ! ED_L_2_TStC_P_T CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN - IF(ALLOCATED(Re_Buf)) THEN ! ED_L_2_SrvD_P_T + IF(ALLOCATED(Re_Buf)) THEN ! ED_L_2_TStC_P_T Re_BufSz = Re_BufSz + SIZE( Re_Buf ) DEALLOCATE(Re_Buf) END IF - IF(ALLOCATED(Db_Buf)) THEN ! ED_L_2_SrvD_P_T + IF(ALLOCATED(Db_Buf)) THEN ! ED_L_2_TStC_P_T Db_BufSz = Db_BufSz + SIZE( Db_Buf ) DEALLOCATE(Db_Buf) END IF - IF(ALLOCATED(Int_Buf)) THEN ! ED_L_2_SrvD_P_T + IF(ALLOCATED(Int_Buf)) THEN ! ED_L_2_TStC_P_T Int_BufSz = Int_BufSz + SIZE( Int_Buf ) DEALLOCATE(Int_Buf) END IF END DO END IF - Int_BufSz = Int_BufSz + 1 ! SrvD_P_2_ED_P_T allocated yes/no - IF ( ALLOCATED(InData%SrvD_P_2_ED_P_T) ) THEN - Int_BufSz = Int_BufSz + 2*1 ! SrvD_P_2_ED_P_T upper/lower bounds for each dimension - DO i1 = LBOUND(InData%SrvD_P_2_ED_P_T,1), UBOUND(InData%SrvD_P_2_ED_P_T,1) - Int_BufSz = Int_BufSz + 3 ! SrvD_P_2_ED_P_T: size of buffers for each call to pack subtype - CALL NWTC_Library_Packmeshmaptype( Re_Buf, Db_Buf, Int_Buf, InData%SrvD_P_2_ED_P_T(i1), ErrStat2, ErrMsg2, .TRUE. ) ! SrvD_P_2_ED_P_T + Int_BufSz = Int_BufSz + 1 ! TStC_P_2_ED_P_T allocated yes/no + IF ( ALLOCATED(InData%TStC_P_2_ED_P_T) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! TStC_P_2_ED_P_T upper/lower bounds for each dimension + DO i1 = LBOUND(InData%TStC_P_2_ED_P_T,1), UBOUND(InData%TStC_P_2_ED_P_T,1) + Int_BufSz = Int_BufSz + 3 ! TStC_P_2_ED_P_T: size of buffers for each call to pack subtype + CALL NWTC_Library_Packmeshmaptype( Re_Buf, Db_Buf, Int_Buf, InData%TStC_P_2_ED_P_T(i1), ErrStat2, ErrMsg2, .TRUE. ) ! TStC_P_2_ED_P_T CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN - IF(ALLOCATED(Re_Buf)) THEN ! SrvD_P_2_ED_P_T + IF(ALLOCATED(Re_Buf)) THEN ! TStC_P_2_ED_P_T Re_BufSz = Re_BufSz + SIZE( Re_Buf ) DEALLOCATE(Re_Buf) END IF - IF(ALLOCATED(Db_Buf)) THEN ! SrvD_P_2_ED_P_T + IF(ALLOCATED(Db_Buf)) THEN ! TStC_P_2_ED_P_T Db_BufSz = Db_BufSz + SIZE( Db_Buf ) DEALLOCATE(Db_Buf) END IF - IF(ALLOCATED(Int_Buf)) THEN ! SrvD_P_2_ED_P_T + IF(ALLOCATED(Int_Buf)) THEN ! TStC_P_2_ED_P_T Int_BufSz = Int_BufSz + SIZE( Int_Buf ) DEALLOCATE(Int_Buf) END IF END DO END IF - Int_BufSz = Int_BufSz + 1 ! ED_L_2_SrvD_P_B allocated yes/no - IF ( ALLOCATED(InData%ED_L_2_SrvD_P_B) ) THEN - Int_BufSz = Int_BufSz + 2*2 ! ED_L_2_SrvD_P_B upper/lower bounds for each dimension - DO i2 = LBOUND(InData%ED_L_2_SrvD_P_B,2), UBOUND(InData%ED_L_2_SrvD_P_B,2) - DO i1 = LBOUND(InData%ED_L_2_SrvD_P_B,1), UBOUND(InData%ED_L_2_SrvD_P_B,1) - Int_BufSz = Int_BufSz + 3 ! ED_L_2_SrvD_P_B: size of buffers for each call to pack subtype - CALL NWTC_Library_Packmeshmaptype( Re_Buf, Db_Buf, Int_Buf, InData%ED_L_2_SrvD_P_B(i1,i2), ErrStat2, ErrMsg2, .TRUE. ) ! ED_L_2_SrvD_P_B + Int_BufSz = Int_BufSz + 1 ! ED_L_2_BStC_P_B allocated yes/no + IF ( ALLOCATED(InData%ED_L_2_BStC_P_B) ) THEN + Int_BufSz = Int_BufSz + 2*2 ! ED_L_2_BStC_P_B upper/lower bounds for each dimension + DO i2 = LBOUND(InData%ED_L_2_BStC_P_B,2), UBOUND(InData%ED_L_2_BStC_P_B,2) + DO i1 = LBOUND(InData%ED_L_2_BStC_P_B,1), UBOUND(InData%ED_L_2_BStC_P_B,1) + Int_BufSz = Int_BufSz + 3 ! ED_L_2_BStC_P_B: size of buffers for each call to pack subtype + CALL NWTC_Library_Packmeshmaptype( Re_Buf, Db_Buf, Int_Buf, InData%ED_L_2_BStC_P_B(i1,i2), ErrStat2, ErrMsg2, .TRUE. ) ! ED_L_2_BStC_P_B CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN - IF(ALLOCATED(Re_Buf)) THEN ! ED_L_2_SrvD_P_B + IF(ALLOCATED(Re_Buf)) THEN ! ED_L_2_BStC_P_B Re_BufSz = Re_BufSz + SIZE( Re_Buf ) DEALLOCATE(Re_Buf) END IF - IF(ALLOCATED(Db_Buf)) THEN ! ED_L_2_SrvD_P_B + IF(ALLOCATED(Db_Buf)) THEN ! ED_L_2_BStC_P_B Db_BufSz = Db_BufSz + SIZE( Db_Buf ) DEALLOCATE(Db_Buf) END IF - IF(ALLOCATED(Int_Buf)) THEN ! ED_L_2_SrvD_P_B + IF(ALLOCATED(Int_Buf)) THEN ! ED_L_2_BStC_P_B Int_BufSz = Int_BufSz + SIZE( Int_Buf ) DEALLOCATE(Int_Buf) END IF END DO END DO END IF - Int_BufSz = Int_BufSz + 1 ! SrvD_P_2_ED_P_B allocated yes/no - IF ( ALLOCATED(InData%SrvD_P_2_ED_P_B) ) THEN - Int_BufSz = Int_BufSz + 2*2 ! SrvD_P_2_ED_P_B upper/lower bounds for each dimension - DO i2 = LBOUND(InData%SrvD_P_2_ED_P_B,2), UBOUND(InData%SrvD_P_2_ED_P_B,2) - DO i1 = LBOUND(InData%SrvD_P_2_ED_P_B,1), UBOUND(InData%SrvD_P_2_ED_P_B,1) - Int_BufSz = Int_BufSz + 3 ! SrvD_P_2_ED_P_B: size of buffers for each call to pack subtype - CALL NWTC_Library_Packmeshmaptype( Re_Buf, Db_Buf, Int_Buf, InData%SrvD_P_2_ED_P_B(i1,i2), ErrStat2, ErrMsg2, .TRUE. ) ! SrvD_P_2_ED_P_B + Int_BufSz = Int_BufSz + 1 ! BStC_P_2_ED_P_B allocated yes/no + IF ( ALLOCATED(InData%BStC_P_2_ED_P_B) ) THEN + Int_BufSz = Int_BufSz + 2*2 ! BStC_P_2_ED_P_B upper/lower bounds for each dimension + DO i2 = LBOUND(InData%BStC_P_2_ED_P_B,2), UBOUND(InData%BStC_P_2_ED_P_B,2) + DO i1 = LBOUND(InData%BStC_P_2_ED_P_B,1), UBOUND(InData%BStC_P_2_ED_P_B,1) + Int_BufSz = Int_BufSz + 3 ! BStC_P_2_ED_P_B: size of buffers for each call to pack subtype + CALL NWTC_Library_Packmeshmaptype( Re_Buf, Db_Buf, Int_Buf, InData%BStC_P_2_ED_P_B(i1,i2), ErrStat2, ErrMsg2, .TRUE. ) ! BStC_P_2_ED_P_B CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN - IF(ALLOCATED(Re_Buf)) THEN ! SrvD_P_2_ED_P_B + IF(ALLOCATED(Re_Buf)) THEN ! BStC_P_2_ED_P_B Re_BufSz = Re_BufSz + SIZE( Re_Buf ) DEALLOCATE(Re_Buf) END IF - IF(ALLOCATED(Db_Buf)) THEN ! SrvD_P_2_ED_P_B + IF(ALLOCATED(Db_Buf)) THEN ! BStC_P_2_ED_P_B Db_BufSz = Db_BufSz + SIZE( Db_Buf ) DEALLOCATE(Db_Buf) END IF - IF(ALLOCATED(Int_Buf)) THEN ! SrvD_P_2_ED_P_B + IF(ALLOCATED(Int_Buf)) THEN ! BStC_P_2_ED_P_B Int_BufSz = Int_BufSz + SIZE( Int_Buf ) DEALLOCATE(Int_Buf) END IF END DO END DO END IF - Int_BufSz = Int_BufSz + 1 ! BD_L_2_SrvD_P_B allocated yes/no - IF ( ALLOCATED(InData%BD_L_2_SrvD_P_B) ) THEN - Int_BufSz = Int_BufSz + 2*2 ! BD_L_2_SrvD_P_B upper/lower bounds for each dimension - DO i2 = LBOUND(InData%BD_L_2_SrvD_P_B,2), UBOUND(InData%BD_L_2_SrvD_P_B,2) - DO i1 = LBOUND(InData%BD_L_2_SrvD_P_B,1), UBOUND(InData%BD_L_2_SrvD_P_B,1) - Int_BufSz = Int_BufSz + 3 ! BD_L_2_SrvD_P_B: size of buffers for each call to pack subtype - CALL NWTC_Library_Packmeshmaptype( Re_Buf, Db_Buf, Int_Buf, InData%BD_L_2_SrvD_P_B(i1,i2), ErrStat2, ErrMsg2, .TRUE. ) ! BD_L_2_SrvD_P_B + Int_BufSz = Int_BufSz + 1 ! BD_L_2_BStC_P_B allocated yes/no + IF ( ALLOCATED(InData%BD_L_2_BStC_P_B) ) THEN + Int_BufSz = Int_BufSz + 2*2 ! BD_L_2_BStC_P_B upper/lower bounds for each dimension + DO i2 = LBOUND(InData%BD_L_2_BStC_P_B,2), UBOUND(InData%BD_L_2_BStC_P_B,2) + DO i1 = LBOUND(InData%BD_L_2_BStC_P_B,1), UBOUND(InData%BD_L_2_BStC_P_B,1) + Int_BufSz = Int_BufSz + 3 ! BD_L_2_BStC_P_B: size of buffers for each call to pack subtype + CALL NWTC_Library_Packmeshmaptype( Re_Buf, Db_Buf, Int_Buf, InData%BD_L_2_BStC_P_B(i1,i2), ErrStat2, ErrMsg2, .TRUE. ) ! BD_L_2_BStC_P_B CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN - IF(ALLOCATED(Re_Buf)) THEN ! BD_L_2_SrvD_P_B + IF(ALLOCATED(Re_Buf)) THEN ! BD_L_2_BStC_P_B Re_BufSz = Re_BufSz + SIZE( Re_Buf ) DEALLOCATE(Re_Buf) END IF - IF(ALLOCATED(Db_Buf)) THEN ! BD_L_2_SrvD_P_B + IF(ALLOCATED(Db_Buf)) THEN ! BD_L_2_BStC_P_B Db_BufSz = Db_BufSz + SIZE( Db_Buf ) DEALLOCATE(Db_Buf) END IF - IF(ALLOCATED(Int_Buf)) THEN ! BD_L_2_SrvD_P_B + IF(ALLOCATED(Int_Buf)) THEN ! BD_L_2_BStC_P_B Int_BufSz = Int_BufSz + SIZE( Int_Buf ) DEALLOCATE(Int_Buf) END IF END DO END DO END IF - Int_BufSz = Int_BufSz + 1 ! SrvD_P_2_BD_P_B allocated yes/no - IF ( ALLOCATED(InData%SrvD_P_2_BD_P_B) ) THEN - Int_BufSz = Int_BufSz + 2*2 ! SrvD_P_2_BD_P_B upper/lower bounds for each dimension - DO i2 = LBOUND(InData%SrvD_P_2_BD_P_B,2), UBOUND(InData%SrvD_P_2_BD_P_B,2) - DO i1 = LBOUND(InData%SrvD_P_2_BD_P_B,1), UBOUND(InData%SrvD_P_2_BD_P_B,1) - Int_BufSz = Int_BufSz + 3 ! SrvD_P_2_BD_P_B: size of buffers for each call to pack subtype - CALL NWTC_Library_Packmeshmaptype( Re_Buf, Db_Buf, Int_Buf, InData%SrvD_P_2_BD_P_B(i1,i2), ErrStat2, ErrMsg2, .TRUE. ) ! SrvD_P_2_BD_P_B + Int_BufSz = Int_BufSz + 1 ! BStC_P_2_BD_P_B allocated yes/no + IF ( ALLOCATED(InData%BStC_P_2_BD_P_B) ) THEN + Int_BufSz = Int_BufSz + 2*2 ! BStC_P_2_BD_P_B upper/lower bounds for each dimension + DO i2 = LBOUND(InData%BStC_P_2_BD_P_B,2), UBOUND(InData%BStC_P_2_BD_P_B,2) + DO i1 = LBOUND(InData%BStC_P_2_BD_P_B,1), UBOUND(InData%BStC_P_2_BD_P_B,1) + Int_BufSz = Int_BufSz + 3 ! BStC_P_2_BD_P_B: size of buffers for each call to pack subtype + CALL NWTC_Library_Packmeshmaptype( Re_Buf, Db_Buf, Int_Buf, InData%BStC_P_2_BD_P_B(i1,i2), ErrStat2, ErrMsg2, .TRUE. ) ! BStC_P_2_BD_P_B CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN - IF(ALLOCATED(Re_Buf)) THEN ! SrvD_P_2_BD_P_B + IF(ALLOCATED(Re_Buf)) THEN ! BStC_P_2_BD_P_B Re_BufSz = Re_BufSz + SIZE( Re_Buf ) DEALLOCATE(Re_Buf) END IF - IF(ALLOCATED(Db_Buf)) THEN ! SrvD_P_2_BD_P_B + IF(ALLOCATED(Db_Buf)) THEN ! BStC_P_2_BD_P_B Db_BufSz = Db_BufSz + SIZE( Db_Buf ) DEALLOCATE(Db_Buf) END IF - IF(ALLOCATED(Int_Buf)) THEN ! SrvD_P_2_BD_P_B + IF(ALLOCATED(Int_Buf)) THEN ! BStC_P_2_BD_P_B Int_BufSz = Int_BufSz + SIZE( Int_Buf ) DEALLOCATE(Int_Buf) END IF END DO END DO END IF - Int_BufSz = Int_BufSz + 1 ! SrvD_P_P_2_ED_P allocated yes/no - IF ( ALLOCATED(InData%SrvD_P_P_2_ED_P) ) THEN - Int_BufSz = Int_BufSz + 2*1 ! SrvD_P_P_2_ED_P upper/lower bounds for each dimension - DO i1 = LBOUND(InData%SrvD_P_P_2_ED_P,1), UBOUND(InData%SrvD_P_P_2_ED_P,1) - Int_BufSz = Int_BufSz + 3 ! SrvD_P_P_2_ED_P: size of buffers for each call to pack subtype - CALL NWTC_Library_Packmeshmaptype( Re_Buf, Db_Buf, Int_Buf, InData%SrvD_P_P_2_ED_P(i1), ErrStat2, ErrMsg2, .TRUE. ) ! SrvD_P_P_2_ED_P + Int_BufSz = Int_BufSz + 1 ! SStC_P_P_2_ED_P allocated yes/no + IF ( ALLOCATED(InData%SStC_P_P_2_ED_P) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! SStC_P_P_2_ED_P upper/lower bounds for each dimension + DO i1 = LBOUND(InData%SStC_P_P_2_ED_P,1), UBOUND(InData%SStC_P_P_2_ED_P,1) + Int_BufSz = Int_BufSz + 3 ! SStC_P_P_2_ED_P: size of buffers for each call to pack subtype + CALL NWTC_Library_Packmeshmaptype( Re_Buf, Db_Buf, Int_Buf, InData%SStC_P_P_2_ED_P(i1), ErrStat2, ErrMsg2, .TRUE. ) ! SStC_P_P_2_ED_P CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN - IF(ALLOCATED(Re_Buf)) THEN ! SrvD_P_P_2_ED_P + IF(ALLOCATED(Re_Buf)) THEN ! SStC_P_P_2_ED_P Re_BufSz = Re_BufSz + SIZE( Re_Buf ) DEALLOCATE(Re_Buf) END IF - IF(ALLOCATED(Db_Buf)) THEN ! SrvD_P_P_2_ED_P + IF(ALLOCATED(Db_Buf)) THEN ! SStC_P_P_2_ED_P Db_BufSz = Db_BufSz + SIZE( Db_Buf ) DEALLOCATE(Db_Buf) END IF - IF(ALLOCATED(Int_Buf)) THEN ! SrvD_P_P_2_ED_P + IF(ALLOCATED(Int_Buf)) THEN ! SStC_P_P_2_ED_P Int_BufSz = Int_BufSz + SIZE( Int_Buf ) DEALLOCATE(Int_Buf) END IF END DO END IF - Int_BufSz = Int_BufSz + 1 ! ED_P_2_SrvD_P_P allocated yes/no - IF ( ALLOCATED(InData%ED_P_2_SrvD_P_P) ) THEN - Int_BufSz = Int_BufSz + 2*1 ! ED_P_2_SrvD_P_P upper/lower bounds for each dimension - DO i1 = LBOUND(InData%ED_P_2_SrvD_P_P,1), UBOUND(InData%ED_P_2_SrvD_P_P,1) - Int_BufSz = Int_BufSz + 3 ! ED_P_2_SrvD_P_P: size of buffers for each call to pack subtype - CALL NWTC_Library_Packmeshmaptype( Re_Buf, Db_Buf, Int_Buf, InData%ED_P_2_SrvD_P_P(i1), ErrStat2, ErrMsg2, .TRUE. ) ! ED_P_2_SrvD_P_P + Int_BufSz = Int_BufSz + 1 ! ED_P_2_SStC_P_P allocated yes/no + IF ( ALLOCATED(InData%ED_P_2_SStC_P_P) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! ED_P_2_SStC_P_P upper/lower bounds for each dimension + DO i1 = LBOUND(InData%ED_P_2_SStC_P_P,1), UBOUND(InData%ED_P_2_SStC_P_P,1) + Int_BufSz = Int_BufSz + 3 ! ED_P_2_SStC_P_P: size of buffers for each call to pack subtype + CALL NWTC_Library_Packmeshmaptype( Re_Buf, Db_Buf, Int_Buf, InData%ED_P_2_SStC_P_P(i1), ErrStat2, ErrMsg2, .TRUE. ) ! ED_P_2_SStC_P_P CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN - IF(ALLOCATED(Re_Buf)) THEN ! ED_P_2_SrvD_P_P + IF(ALLOCATED(Re_Buf)) THEN ! ED_P_2_SStC_P_P Re_BufSz = Re_BufSz + SIZE( Re_Buf ) DEALLOCATE(Re_Buf) END IF - IF(ALLOCATED(Db_Buf)) THEN ! ED_P_2_SrvD_P_P + IF(ALLOCATED(Db_Buf)) THEN ! ED_P_2_SStC_P_P Db_BufSz = Db_BufSz + SIZE( Db_Buf ) DEALLOCATE(Db_Buf) END IF - IF(ALLOCATED(Int_Buf)) THEN ! ED_P_2_SrvD_P_P + IF(ALLOCATED(Int_Buf)) THEN ! ED_P_2_SStC_P_P Int_BufSz = Int_BufSz + SIZE( Int_Buf ) DEALLOCATE(Int_Buf) END IF END DO END IF - Int_BufSz = Int_BufSz + 1 ! SrvD_P_P_2_SD_P allocated yes/no - IF ( ALLOCATED(InData%SrvD_P_P_2_SD_P) ) THEN - Int_BufSz = Int_BufSz + 2*1 ! SrvD_P_P_2_SD_P upper/lower bounds for each dimension - DO i1 = LBOUND(InData%SrvD_P_P_2_SD_P,1), UBOUND(InData%SrvD_P_P_2_SD_P,1) - Int_BufSz = Int_BufSz + 3 ! SrvD_P_P_2_SD_P: size of buffers for each call to pack subtype - CALL NWTC_Library_Packmeshmaptype( Re_Buf, Db_Buf, Int_Buf, InData%SrvD_P_P_2_SD_P(i1), ErrStat2, ErrMsg2, .TRUE. ) ! SrvD_P_P_2_SD_P + Int_BufSz = Int_BufSz + 1 ! SStC_P_P_2_SD_P allocated yes/no + IF ( ALLOCATED(InData%SStC_P_P_2_SD_P) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! SStC_P_P_2_SD_P upper/lower bounds for each dimension + DO i1 = LBOUND(InData%SStC_P_P_2_SD_P,1), UBOUND(InData%SStC_P_P_2_SD_P,1) + Int_BufSz = Int_BufSz + 3 ! SStC_P_P_2_SD_P: size of buffers for each call to pack subtype + CALL NWTC_Library_Packmeshmaptype( Re_Buf, Db_Buf, Int_Buf, InData%SStC_P_P_2_SD_P(i1), ErrStat2, ErrMsg2, .TRUE. ) ! SStC_P_P_2_SD_P CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN - IF(ALLOCATED(Re_Buf)) THEN ! SrvD_P_P_2_SD_P + IF(ALLOCATED(Re_Buf)) THEN ! SStC_P_P_2_SD_P Re_BufSz = Re_BufSz + SIZE( Re_Buf ) DEALLOCATE(Re_Buf) END IF - IF(ALLOCATED(Db_Buf)) THEN ! SrvD_P_P_2_SD_P + IF(ALLOCATED(Db_Buf)) THEN ! SStC_P_P_2_SD_P Db_BufSz = Db_BufSz + SIZE( Db_Buf ) DEALLOCATE(Db_Buf) END IF - IF(ALLOCATED(Int_Buf)) THEN ! SrvD_P_P_2_SD_P + IF(ALLOCATED(Int_Buf)) THEN ! SStC_P_P_2_SD_P Int_BufSz = Int_BufSz + SIZE( Int_Buf ) DEALLOCATE(Int_Buf) END IF END DO END IF - Int_BufSz = Int_BufSz + 1 ! SDy3_P_2_SrvD_P_P allocated yes/no - IF ( ALLOCATED(InData%SDy3_P_2_SrvD_P_P) ) THEN - Int_BufSz = Int_BufSz + 2*1 ! SDy3_P_2_SrvD_P_P upper/lower bounds for each dimension - DO i1 = LBOUND(InData%SDy3_P_2_SrvD_P_P,1), UBOUND(InData%SDy3_P_2_SrvD_P_P,1) - Int_BufSz = Int_BufSz + 3 ! SDy3_P_2_SrvD_P_P: size of buffers for each call to pack subtype - CALL NWTC_Library_Packmeshmaptype( Re_Buf, Db_Buf, Int_Buf, InData%SDy3_P_2_SrvD_P_P(i1), ErrStat2, ErrMsg2, .TRUE. ) ! SDy3_P_2_SrvD_P_P + Int_BufSz = Int_BufSz + 1 ! SDy3_P_2_SStC_P_P allocated yes/no + IF ( ALLOCATED(InData%SDy3_P_2_SStC_P_P) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! SDy3_P_2_SStC_P_P upper/lower bounds for each dimension + DO i1 = LBOUND(InData%SDy3_P_2_SStC_P_P,1), UBOUND(InData%SDy3_P_2_SStC_P_P,1) + Int_BufSz = Int_BufSz + 3 ! SDy3_P_2_SStC_P_P: size of buffers for each call to pack subtype + CALL NWTC_Library_Packmeshmaptype( Re_Buf, Db_Buf, Int_Buf, InData%SDy3_P_2_SStC_P_P(i1), ErrStat2, ErrMsg2, .TRUE. ) ! SDy3_P_2_SStC_P_P CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN - IF(ALLOCATED(Re_Buf)) THEN ! SDy3_P_2_SrvD_P_P + IF(ALLOCATED(Re_Buf)) THEN ! SDy3_P_2_SStC_P_P Re_BufSz = Re_BufSz + SIZE( Re_Buf ) DEALLOCATE(Re_Buf) END IF - IF(ALLOCATED(Db_Buf)) THEN ! SDy3_P_2_SrvD_P_P + IF(ALLOCATED(Db_Buf)) THEN ! SDy3_P_2_SStC_P_P Db_BufSz = Db_BufSz + SIZE( Db_Buf ) DEALLOCATE(Db_Buf) END IF - IF(ALLOCATED(Int_Buf)) THEN ! SDy3_P_2_SrvD_P_P + IF(ALLOCATED(Int_Buf)) THEN ! SDy3_P_2_SStC_P_P Int_BufSz = Int_BufSz + SIZE( Int_Buf ) DEALLOCATE(Int_Buf) END IF END DO END IF + Int_BufSz = Int_BufSz + 3 ! ED_P_2_SrvD_P_P: size of buffers for each call to pack subtype + CALL NWTC_Library_Packmeshmaptype( Re_Buf, Db_Buf, Int_Buf, InData%ED_P_2_SrvD_P_P, ErrStat2, ErrMsg2, .TRUE. ) ! ED_P_2_SrvD_P_P + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN ! ED_P_2_SrvD_P_P + Re_BufSz = Re_BufSz + SIZE( Re_Buf ) + DEALLOCATE(Re_Buf) + END IF + IF(ALLOCATED(Db_Buf)) THEN ! ED_P_2_SrvD_P_P + Db_BufSz = Db_BufSz + SIZE( Db_Buf ) + DEALLOCATE(Db_Buf) + END IF + IF(ALLOCATED(Int_Buf)) THEN ! ED_P_2_SrvD_P_P + Int_BufSz = Int_BufSz + SIZE( Int_Buf ) + DEALLOCATE(Int_Buf) + END IF Int_BufSz = Int_BufSz + 1 ! BDED_L_2_AD_L_B allocated yes/no IF ( ALLOCATED(InData%BDED_L_2_AD_L_B) ) THEN Int_BufSz = Int_BufSz + 2*1 ! BDED_L_2_AD_L_B upper/lower bounds for each dimension @@ -37625,23 +37645,6 @@ SUBROUTINE FAST_PackModuleMapType( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, Int_BufSz = Int_BufSz + SIZE( Int_Buf ) DEALLOCATE(Int_Buf) END IF - Int_BufSz = Int_BufSz + 3 ! u_ED_PlatformPtMesh_3: size of buffers for each call to pack subtype - CALL MeshPack( InData%u_ED_PlatformPtMesh_3, Re_Buf, Db_Buf, Int_Buf, ErrStat2, ErrMsg2, .TRUE. ) ! u_ED_PlatformPtMesh_3 - CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) - IF (ErrStat >= AbortErrLev) RETURN - - IF(ALLOCATED(Re_Buf)) THEN ! u_ED_PlatformPtMesh_3 - Re_BufSz = Re_BufSz + SIZE( Re_Buf ) - DEALLOCATE(Re_Buf) - END IF - IF(ALLOCATED(Db_Buf)) THEN ! u_ED_PlatformPtMesh_3 - Db_BufSz = Db_BufSz + SIZE( Db_Buf ) - DEALLOCATE(Db_Buf) - END IF - IF(ALLOCATED(Int_Buf)) THEN ! u_ED_PlatformPtMesh_3 - Int_BufSz = Int_BufSz + SIZE( Int_Buf ) - DEALLOCATE(Int_Buf) - END IF Int_BufSz = Int_BufSz + 3 ! u_ED_TowerPtloads: size of buffers for each call to pack subtype CALL MeshPack( InData%u_ED_TowerPtloads, Re_Buf, Db_Buf, Int_Buf, ErrStat2, ErrMsg2, .TRUE. ) ! u_ED_TowerPtloads CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) @@ -38474,18 +38477,18 @@ SUBROUTINE FAST_PackModuleMapType( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ELSE IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 ENDIF - IF ( .NOT. ALLOCATED(InData%ED_P_2_SrvD_P_N) ) THEN + IF ( .NOT. ALLOCATED(InData%ED_P_2_NStC_P_N) ) THEN IntKiBuf( Int_Xferred ) = 0 Int_Xferred = Int_Xferred + 1 ELSE IntKiBuf( Int_Xferred ) = 1 Int_Xferred = Int_Xferred + 1 - IntKiBuf( Int_Xferred ) = LBOUND(InData%ED_P_2_SrvD_P_N,1) - IntKiBuf( Int_Xferred + 1) = UBOUND(InData%ED_P_2_SrvD_P_N,1) + IntKiBuf( Int_Xferred ) = LBOUND(InData%ED_P_2_NStC_P_N,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%ED_P_2_NStC_P_N,1) Int_Xferred = Int_Xferred + 2 - DO i1 = LBOUND(InData%ED_P_2_SrvD_P_N,1), UBOUND(InData%ED_P_2_SrvD_P_N,1) - CALL NWTC_Library_Packmeshmaptype( Re_Buf, Db_Buf, Int_Buf, InData%ED_P_2_SrvD_P_N(i1), ErrStat2, ErrMsg2, OnlySize ) ! ED_P_2_SrvD_P_N + DO i1 = LBOUND(InData%ED_P_2_NStC_P_N,1), UBOUND(InData%ED_P_2_NStC_P_N,1) + CALL NWTC_Library_Packmeshmaptype( Re_Buf, Db_Buf, Int_Buf, InData%ED_P_2_NStC_P_N(i1), ErrStat2, ErrMsg2, OnlySize ) ! ED_P_2_NStC_P_N CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN @@ -38515,18 +38518,18 @@ SUBROUTINE FAST_PackModuleMapType( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ENDIF END DO END IF - IF ( .NOT. ALLOCATED(InData%SrvD_P_2_ED_P_N) ) THEN + IF ( .NOT. ALLOCATED(InData%NStC_P_2_ED_P_N) ) THEN IntKiBuf( Int_Xferred ) = 0 Int_Xferred = Int_Xferred + 1 ELSE IntKiBuf( Int_Xferred ) = 1 Int_Xferred = Int_Xferred + 1 - IntKiBuf( Int_Xferred ) = LBOUND(InData%SrvD_P_2_ED_P_N,1) - IntKiBuf( Int_Xferred + 1) = UBOUND(InData%SrvD_P_2_ED_P_N,1) + IntKiBuf( Int_Xferred ) = LBOUND(InData%NStC_P_2_ED_P_N,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%NStC_P_2_ED_P_N,1) Int_Xferred = Int_Xferred + 2 - DO i1 = LBOUND(InData%SrvD_P_2_ED_P_N,1), UBOUND(InData%SrvD_P_2_ED_P_N,1) - CALL NWTC_Library_Packmeshmaptype( Re_Buf, Db_Buf, Int_Buf, InData%SrvD_P_2_ED_P_N(i1), ErrStat2, ErrMsg2, OnlySize ) ! SrvD_P_2_ED_P_N + DO i1 = LBOUND(InData%NStC_P_2_ED_P_N,1), UBOUND(InData%NStC_P_2_ED_P_N,1) + CALL NWTC_Library_Packmeshmaptype( Re_Buf, Db_Buf, Int_Buf, InData%NStC_P_2_ED_P_N(i1), ErrStat2, ErrMsg2, OnlySize ) ! NStC_P_2_ED_P_N CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN @@ -38556,18 +38559,18 @@ SUBROUTINE FAST_PackModuleMapType( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ENDIF END DO END IF - IF ( .NOT. ALLOCATED(InData%ED_L_2_SrvD_P_T) ) THEN + IF ( .NOT. ALLOCATED(InData%ED_L_2_TStC_P_T) ) THEN IntKiBuf( Int_Xferred ) = 0 Int_Xferred = Int_Xferred + 1 ELSE IntKiBuf( Int_Xferred ) = 1 Int_Xferred = Int_Xferred + 1 - IntKiBuf( Int_Xferred ) = LBOUND(InData%ED_L_2_SrvD_P_T,1) - IntKiBuf( Int_Xferred + 1) = UBOUND(InData%ED_L_2_SrvD_P_T,1) + IntKiBuf( Int_Xferred ) = LBOUND(InData%ED_L_2_TStC_P_T,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%ED_L_2_TStC_P_T,1) Int_Xferred = Int_Xferred + 2 - DO i1 = LBOUND(InData%ED_L_2_SrvD_P_T,1), UBOUND(InData%ED_L_2_SrvD_P_T,1) - CALL NWTC_Library_Packmeshmaptype( Re_Buf, Db_Buf, Int_Buf, InData%ED_L_2_SrvD_P_T(i1), ErrStat2, ErrMsg2, OnlySize ) ! ED_L_2_SrvD_P_T + DO i1 = LBOUND(InData%ED_L_2_TStC_P_T,1), UBOUND(InData%ED_L_2_TStC_P_T,1) + CALL NWTC_Library_Packmeshmaptype( Re_Buf, Db_Buf, Int_Buf, InData%ED_L_2_TStC_P_T(i1), ErrStat2, ErrMsg2, OnlySize ) ! ED_L_2_TStC_P_T CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN @@ -38597,18 +38600,18 @@ SUBROUTINE FAST_PackModuleMapType( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ENDIF END DO END IF - IF ( .NOT. ALLOCATED(InData%SrvD_P_2_ED_P_T) ) THEN + IF ( .NOT. ALLOCATED(InData%TStC_P_2_ED_P_T) ) THEN IntKiBuf( Int_Xferred ) = 0 Int_Xferred = Int_Xferred + 1 ELSE IntKiBuf( Int_Xferred ) = 1 Int_Xferred = Int_Xferred + 1 - IntKiBuf( Int_Xferred ) = LBOUND(InData%SrvD_P_2_ED_P_T,1) - IntKiBuf( Int_Xferred + 1) = UBOUND(InData%SrvD_P_2_ED_P_T,1) + IntKiBuf( Int_Xferred ) = LBOUND(InData%TStC_P_2_ED_P_T,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%TStC_P_2_ED_P_T,1) Int_Xferred = Int_Xferred + 2 - DO i1 = LBOUND(InData%SrvD_P_2_ED_P_T,1), UBOUND(InData%SrvD_P_2_ED_P_T,1) - CALL NWTC_Library_Packmeshmaptype( Re_Buf, Db_Buf, Int_Buf, InData%SrvD_P_2_ED_P_T(i1), ErrStat2, ErrMsg2, OnlySize ) ! SrvD_P_2_ED_P_T + DO i1 = LBOUND(InData%TStC_P_2_ED_P_T,1), UBOUND(InData%TStC_P_2_ED_P_T,1) + CALL NWTC_Library_Packmeshmaptype( Re_Buf, Db_Buf, Int_Buf, InData%TStC_P_2_ED_P_T(i1), ErrStat2, ErrMsg2, OnlySize ) ! TStC_P_2_ED_P_T CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN @@ -38638,22 +38641,22 @@ SUBROUTINE FAST_PackModuleMapType( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ENDIF END DO END IF - IF ( .NOT. ALLOCATED(InData%ED_L_2_SrvD_P_B) ) THEN + IF ( .NOT. ALLOCATED(InData%ED_L_2_BStC_P_B) ) THEN IntKiBuf( Int_Xferred ) = 0 Int_Xferred = Int_Xferred + 1 ELSE IntKiBuf( Int_Xferred ) = 1 Int_Xferred = Int_Xferred + 1 - IntKiBuf( Int_Xferred ) = LBOUND(InData%ED_L_2_SrvD_P_B,1) - IntKiBuf( Int_Xferred + 1) = UBOUND(InData%ED_L_2_SrvD_P_B,1) + IntKiBuf( Int_Xferred ) = LBOUND(InData%ED_L_2_BStC_P_B,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%ED_L_2_BStC_P_B,1) Int_Xferred = Int_Xferred + 2 - IntKiBuf( Int_Xferred ) = LBOUND(InData%ED_L_2_SrvD_P_B,2) - IntKiBuf( Int_Xferred + 1) = UBOUND(InData%ED_L_2_SrvD_P_B,2) + IntKiBuf( Int_Xferred ) = LBOUND(InData%ED_L_2_BStC_P_B,2) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%ED_L_2_BStC_P_B,2) Int_Xferred = Int_Xferred + 2 - DO i2 = LBOUND(InData%ED_L_2_SrvD_P_B,2), UBOUND(InData%ED_L_2_SrvD_P_B,2) - DO i1 = LBOUND(InData%ED_L_2_SrvD_P_B,1), UBOUND(InData%ED_L_2_SrvD_P_B,1) - CALL NWTC_Library_Packmeshmaptype( Re_Buf, Db_Buf, Int_Buf, InData%ED_L_2_SrvD_P_B(i1,i2), ErrStat2, ErrMsg2, OnlySize ) ! ED_L_2_SrvD_P_B + DO i2 = LBOUND(InData%ED_L_2_BStC_P_B,2), UBOUND(InData%ED_L_2_BStC_P_B,2) + DO i1 = LBOUND(InData%ED_L_2_BStC_P_B,1), UBOUND(InData%ED_L_2_BStC_P_B,1) + CALL NWTC_Library_Packmeshmaptype( Re_Buf, Db_Buf, Int_Buf, InData%ED_L_2_BStC_P_B(i1,i2), ErrStat2, ErrMsg2, OnlySize ) ! ED_L_2_BStC_P_B CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN @@ -38684,22 +38687,22 @@ SUBROUTINE FAST_PackModuleMapType( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, END DO END DO END IF - IF ( .NOT. ALLOCATED(InData%SrvD_P_2_ED_P_B) ) THEN + IF ( .NOT. ALLOCATED(InData%BStC_P_2_ED_P_B) ) THEN IntKiBuf( Int_Xferred ) = 0 Int_Xferred = Int_Xferred + 1 ELSE IntKiBuf( Int_Xferred ) = 1 Int_Xferred = Int_Xferred + 1 - IntKiBuf( Int_Xferred ) = LBOUND(InData%SrvD_P_2_ED_P_B,1) - IntKiBuf( Int_Xferred + 1) = UBOUND(InData%SrvD_P_2_ED_P_B,1) + IntKiBuf( Int_Xferred ) = LBOUND(InData%BStC_P_2_ED_P_B,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%BStC_P_2_ED_P_B,1) Int_Xferred = Int_Xferred + 2 - IntKiBuf( Int_Xferred ) = LBOUND(InData%SrvD_P_2_ED_P_B,2) - IntKiBuf( Int_Xferred + 1) = UBOUND(InData%SrvD_P_2_ED_P_B,2) + IntKiBuf( Int_Xferred ) = LBOUND(InData%BStC_P_2_ED_P_B,2) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%BStC_P_2_ED_P_B,2) Int_Xferred = Int_Xferred + 2 - DO i2 = LBOUND(InData%SrvD_P_2_ED_P_B,2), UBOUND(InData%SrvD_P_2_ED_P_B,2) - DO i1 = LBOUND(InData%SrvD_P_2_ED_P_B,1), UBOUND(InData%SrvD_P_2_ED_P_B,1) - CALL NWTC_Library_Packmeshmaptype( Re_Buf, Db_Buf, Int_Buf, InData%SrvD_P_2_ED_P_B(i1,i2), ErrStat2, ErrMsg2, OnlySize ) ! SrvD_P_2_ED_P_B + DO i2 = LBOUND(InData%BStC_P_2_ED_P_B,2), UBOUND(InData%BStC_P_2_ED_P_B,2) + DO i1 = LBOUND(InData%BStC_P_2_ED_P_B,1), UBOUND(InData%BStC_P_2_ED_P_B,1) + CALL NWTC_Library_Packmeshmaptype( Re_Buf, Db_Buf, Int_Buf, InData%BStC_P_2_ED_P_B(i1,i2), ErrStat2, ErrMsg2, OnlySize ) ! BStC_P_2_ED_P_B CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN @@ -38730,22 +38733,22 @@ SUBROUTINE FAST_PackModuleMapType( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, END DO END DO END IF - IF ( .NOT. ALLOCATED(InData%BD_L_2_SrvD_P_B) ) THEN + IF ( .NOT. ALLOCATED(InData%BD_L_2_BStC_P_B) ) THEN IntKiBuf( Int_Xferred ) = 0 Int_Xferred = Int_Xferred + 1 ELSE IntKiBuf( Int_Xferred ) = 1 Int_Xferred = Int_Xferred + 1 - IntKiBuf( Int_Xferred ) = LBOUND(InData%BD_L_2_SrvD_P_B,1) - IntKiBuf( Int_Xferred + 1) = UBOUND(InData%BD_L_2_SrvD_P_B,1) + IntKiBuf( Int_Xferred ) = LBOUND(InData%BD_L_2_BStC_P_B,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%BD_L_2_BStC_P_B,1) Int_Xferred = Int_Xferred + 2 - IntKiBuf( Int_Xferred ) = LBOUND(InData%BD_L_2_SrvD_P_B,2) - IntKiBuf( Int_Xferred + 1) = UBOUND(InData%BD_L_2_SrvD_P_B,2) + IntKiBuf( Int_Xferred ) = LBOUND(InData%BD_L_2_BStC_P_B,2) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%BD_L_2_BStC_P_B,2) Int_Xferred = Int_Xferred + 2 - DO i2 = LBOUND(InData%BD_L_2_SrvD_P_B,2), UBOUND(InData%BD_L_2_SrvD_P_B,2) - DO i1 = LBOUND(InData%BD_L_2_SrvD_P_B,1), UBOUND(InData%BD_L_2_SrvD_P_B,1) - CALL NWTC_Library_Packmeshmaptype( Re_Buf, Db_Buf, Int_Buf, InData%BD_L_2_SrvD_P_B(i1,i2), ErrStat2, ErrMsg2, OnlySize ) ! BD_L_2_SrvD_P_B + DO i2 = LBOUND(InData%BD_L_2_BStC_P_B,2), UBOUND(InData%BD_L_2_BStC_P_B,2) + DO i1 = LBOUND(InData%BD_L_2_BStC_P_B,1), UBOUND(InData%BD_L_2_BStC_P_B,1) + CALL NWTC_Library_Packmeshmaptype( Re_Buf, Db_Buf, Int_Buf, InData%BD_L_2_BStC_P_B(i1,i2), ErrStat2, ErrMsg2, OnlySize ) ! BD_L_2_BStC_P_B CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN @@ -38776,22 +38779,22 @@ SUBROUTINE FAST_PackModuleMapType( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, END DO END DO END IF - IF ( .NOT. ALLOCATED(InData%SrvD_P_2_BD_P_B) ) THEN + IF ( .NOT. ALLOCATED(InData%BStC_P_2_BD_P_B) ) THEN IntKiBuf( Int_Xferred ) = 0 Int_Xferred = Int_Xferred + 1 ELSE IntKiBuf( Int_Xferred ) = 1 Int_Xferred = Int_Xferred + 1 - IntKiBuf( Int_Xferred ) = LBOUND(InData%SrvD_P_2_BD_P_B,1) - IntKiBuf( Int_Xferred + 1) = UBOUND(InData%SrvD_P_2_BD_P_B,1) + IntKiBuf( Int_Xferred ) = LBOUND(InData%BStC_P_2_BD_P_B,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%BStC_P_2_BD_P_B,1) Int_Xferred = Int_Xferred + 2 - IntKiBuf( Int_Xferred ) = LBOUND(InData%SrvD_P_2_BD_P_B,2) - IntKiBuf( Int_Xferred + 1) = UBOUND(InData%SrvD_P_2_BD_P_B,2) + IntKiBuf( Int_Xferred ) = LBOUND(InData%BStC_P_2_BD_P_B,2) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%BStC_P_2_BD_P_B,2) Int_Xferred = Int_Xferred + 2 - DO i2 = LBOUND(InData%SrvD_P_2_BD_P_B,2), UBOUND(InData%SrvD_P_2_BD_P_B,2) - DO i1 = LBOUND(InData%SrvD_P_2_BD_P_B,1), UBOUND(InData%SrvD_P_2_BD_P_B,1) - CALL NWTC_Library_Packmeshmaptype( Re_Buf, Db_Buf, Int_Buf, InData%SrvD_P_2_BD_P_B(i1,i2), ErrStat2, ErrMsg2, OnlySize ) ! SrvD_P_2_BD_P_B + DO i2 = LBOUND(InData%BStC_P_2_BD_P_B,2), UBOUND(InData%BStC_P_2_BD_P_B,2) + DO i1 = LBOUND(InData%BStC_P_2_BD_P_B,1), UBOUND(InData%BStC_P_2_BD_P_B,1) + CALL NWTC_Library_Packmeshmaptype( Re_Buf, Db_Buf, Int_Buf, InData%BStC_P_2_BD_P_B(i1,i2), ErrStat2, ErrMsg2, OnlySize ) ! BStC_P_2_BD_P_B CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN @@ -38822,18 +38825,18 @@ SUBROUTINE FAST_PackModuleMapType( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, END DO END DO END IF - IF ( .NOT. ALLOCATED(InData%SrvD_P_P_2_ED_P) ) THEN + IF ( .NOT. ALLOCATED(InData%SStC_P_P_2_ED_P) ) THEN IntKiBuf( Int_Xferred ) = 0 Int_Xferred = Int_Xferred + 1 ELSE IntKiBuf( Int_Xferred ) = 1 Int_Xferred = Int_Xferred + 1 - IntKiBuf( Int_Xferred ) = LBOUND(InData%SrvD_P_P_2_ED_P,1) - IntKiBuf( Int_Xferred + 1) = UBOUND(InData%SrvD_P_P_2_ED_P,1) + IntKiBuf( Int_Xferred ) = LBOUND(InData%SStC_P_P_2_ED_P,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%SStC_P_P_2_ED_P,1) Int_Xferred = Int_Xferred + 2 - DO i1 = LBOUND(InData%SrvD_P_P_2_ED_P,1), UBOUND(InData%SrvD_P_P_2_ED_P,1) - CALL NWTC_Library_Packmeshmaptype( Re_Buf, Db_Buf, Int_Buf, InData%SrvD_P_P_2_ED_P(i1), ErrStat2, ErrMsg2, OnlySize ) ! SrvD_P_P_2_ED_P + DO i1 = LBOUND(InData%SStC_P_P_2_ED_P,1), UBOUND(InData%SStC_P_P_2_ED_P,1) + CALL NWTC_Library_Packmeshmaptype( Re_Buf, Db_Buf, Int_Buf, InData%SStC_P_P_2_ED_P(i1), ErrStat2, ErrMsg2, OnlySize ) ! SStC_P_P_2_ED_P CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN @@ -38863,18 +38866,18 @@ SUBROUTINE FAST_PackModuleMapType( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ENDIF END DO END IF - IF ( .NOT. ALLOCATED(InData%ED_P_2_SrvD_P_P) ) THEN + IF ( .NOT. ALLOCATED(InData%ED_P_2_SStC_P_P) ) THEN IntKiBuf( Int_Xferred ) = 0 Int_Xferred = Int_Xferred + 1 ELSE IntKiBuf( Int_Xferred ) = 1 Int_Xferred = Int_Xferred + 1 - IntKiBuf( Int_Xferred ) = LBOUND(InData%ED_P_2_SrvD_P_P,1) - IntKiBuf( Int_Xferred + 1) = UBOUND(InData%ED_P_2_SrvD_P_P,1) + IntKiBuf( Int_Xferred ) = LBOUND(InData%ED_P_2_SStC_P_P,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%ED_P_2_SStC_P_P,1) Int_Xferred = Int_Xferred + 2 - DO i1 = LBOUND(InData%ED_P_2_SrvD_P_P,1), UBOUND(InData%ED_P_2_SrvD_P_P,1) - CALL NWTC_Library_Packmeshmaptype( Re_Buf, Db_Buf, Int_Buf, InData%ED_P_2_SrvD_P_P(i1), ErrStat2, ErrMsg2, OnlySize ) ! ED_P_2_SrvD_P_P + DO i1 = LBOUND(InData%ED_P_2_SStC_P_P,1), UBOUND(InData%ED_P_2_SStC_P_P,1) + CALL NWTC_Library_Packmeshmaptype( Re_Buf, Db_Buf, Int_Buf, InData%ED_P_2_SStC_P_P(i1), ErrStat2, ErrMsg2, OnlySize ) ! ED_P_2_SStC_P_P CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN @@ -38904,18 +38907,18 @@ SUBROUTINE FAST_PackModuleMapType( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ENDIF END DO END IF - IF ( .NOT. ALLOCATED(InData%SrvD_P_P_2_SD_P) ) THEN + IF ( .NOT. ALLOCATED(InData%SStC_P_P_2_SD_P) ) THEN IntKiBuf( Int_Xferred ) = 0 Int_Xferred = Int_Xferred + 1 ELSE IntKiBuf( Int_Xferred ) = 1 Int_Xferred = Int_Xferred + 1 - IntKiBuf( Int_Xferred ) = LBOUND(InData%SrvD_P_P_2_SD_P,1) - IntKiBuf( Int_Xferred + 1) = UBOUND(InData%SrvD_P_P_2_SD_P,1) + IntKiBuf( Int_Xferred ) = LBOUND(InData%SStC_P_P_2_SD_P,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%SStC_P_P_2_SD_P,1) Int_Xferred = Int_Xferred + 2 - DO i1 = LBOUND(InData%SrvD_P_P_2_SD_P,1), UBOUND(InData%SrvD_P_P_2_SD_P,1) - CALL NWTC_Library_Packmeshmaptype( Re_Buf, Db_Buf, Int_Buf, InData%SrvD_P_P_2_SD_P(i1), ErrStat2, ErrMsg2, OnlySize ) ! SrvD_P_P_2_SD_P + DO i1 = LBOUND(InData%SStC_P_P_2_SD_P,1), UBOUND(InData%SStC_P_P_2_SD_P,1) + CALL NWTC_Library_Packmeshmaptype( Re_Buf, Db_Buf, Int_Buf, InData%SStC_P_P_2_SD_P(i1), ErrStat2, ErrMsg2, OnlySize ) ! SStC_P_P_2_SD_P CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN @@ -38945,18 +38948,18 @@ SUBROUTINE FAST_PackModuleMapType( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ENDIF END DO END IF - IF ( .NOT. ALLOCATED(InData%SDy3_P_2_SrvD_P_P) ) THEN + IF ( .NOT. ALLOCATED(InData%SDy3_P_2_SStC_P_P) ) THEN IntKiBuf( Int_Xferred ) = 0 Int_Xferred = Int_Xferred + 1 ELSE IntKiBuf( Int_Xferred ) = 1 Int_Xferred = Int_Xferred + 1 - IntKiBuf( Int_Xferred ) = LBOUND(InData%SDy3_P_2_SrvD_P_P,1) - IntKiBuf( Int_Xferred + 1) = UBOUND(InData%SDy3_P_2_SrvD_P_P,1) + IntKiBuf( Int_Xferred ) = LBOUND(InData%SDy3_P_2_SStC_P_P,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%SDy3_P_2_SStC_P_P,1) Int_Xferred = Int_Xferred + 2 - DO i1 = LBOUND(InData%SDy3_P_2_SrvD_P_P,1), UBOUND(InData%SDy3_P_2_SrvD_P_P,1) - CALL NWTC_Library_Packmeshmaptype( Re_Buf, Db_Buf, Int_Buf, InData%SDy3_P_2_SrvD_P_P(i1), ErrStat2, ErrMsg2, OnlySize ) ! SDy3_P_2_SrvD_P_P + DO i1 = LBOUND(InData%SDy3_P_2_SStC_P_P,1), UBOUND(InData%SDy3_P_2_SStC_P_P,1) + CALL NWTC_Library_Packmeshmaptype( Re_Buf, Db_Buf, Int_Buf, InData%SDy3_P_2_SStC_P_P(i1), ErrStat2, ErrMsg2, OnlySize ) ! SDy3_P_2_SStC_P_P CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN @@ -38986,6 +38989,34 @@ SUBROUTINE FAST_PackModuleMapType( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ENDIF END DO END IF + CALL NWTC_Library_Packmeshmaptype( Re_Buf, Db_Buf, Int_Buf, InData%ED_P_2_SrvD_P_P, ErrStat2, ErrMsg2, OnlySize ) ! ED_P_2_SrvD_P_P + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Re_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Re_Buf) > 0) ReKiBuf( Re_Xferred:Re_Xferred+SIZE(Re_Buf)-1 ) = Re_Buf + Re_Xferred = Re_Xferred + SIZE(Re_Buf) + DEALLOCATE(Re_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Db_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Db_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Db_Buf) > 0) DbKiBuf( Db_Xferred:Db_Xferred+SIZE(Db_Buf)-1 ) = Db_Buf + Db_Xferred = Db_Xferred + SIZE(Db_Buf) + DEALLOCATE(Db_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Int_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Int_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Int_Buf) > 0) IntKiBuf( Int_Xferred:Int_Xferred+SIZE(Int_Buf)-1 ) = Int_Buf + Int_Xferred = Int_Xferred + SIZE(Int_Buf) + DEALLOCATE(Int_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF IF ( .NOT. ALLOCATED(InData%BDED_L_2_AD_L_B) ) THEN IntKiBuf( Int_Xferred ) = 0 Int_Xferred = Int_Xferred + 1 @@ -39543,34 +39574,6 @@ SUBROUTINE FAST_PackModuleMapType( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN - IF(ALLOCATED(Re_Buf)) THEN - IntKiBuf( Int_Xferred ) = SIZE(Re_Buf); Int_Xferred = Int_Xferred + 1 - IF (SIZE(Re_Buf) > 0) ReKiBuf( Re_Xferred:Re_Xferred+SIZE(Re_Buf)-1 ) = Re_Buf - Re_Xferred = Re_Xferred + SIZE(Re_Buf) - DEALLOCATE(Re_Buf) - ELSE - IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 - ENDIF - IF(ALLOCATED(Db_Buf)) THEN - IntKiBuf( Int_Xferred ) = SIZE(Db_Buf); Int_Xferred = Int_Xferred + 1 - IF (SIZE(Db_Buf) > 0) DbKiBuf( Db_Xferred:Db_Xferred+SIZE(Db_Buf)-1 ) = Db_Buf - Db_Xferred = Db_Xferred + SIZE(Db_Buf) - DEALLOCATE(Db_Buf) - ELSE - IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 - ENDIF - IF(ALLOCATED(Int_Buf)) THEN - IntKiBuf( Int_Xferred ) = SIZE(Int_Buf); Int_Xferred = Int_Xferred + 1 - IF (SIZE(Int_Buf) > 0) IntKiBuf( Int_Xferred:Int_Xferred+SIZE(Int_Buf)-1 ) = Int_Buf - Int_Xferred = Int_Xferred + SIZE(Int_Buf) - DEALLOCATE(Int_Buf) - ELSE - IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 - ENDIF - CALL MeshPack( InData%u_ED_PlatformPtMesh_3, Re_Buf, Db_Buf, Int_Buf, ErrStat2, ErrMsg2, OnlySize ) ! u_ED_PlatformPtMesh_3 - CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) - IF (ErrStat >= AbortErrLev) RETURN - IF(ALLOCATED(Re_Buf)) THEN IntKiBuf( Int_Xferred ) = SIZE(Re_Buf); Int_Xferred = Int_Xferred + 1 IF (SIZE(Re_Buf) > 0) ReKiBuf( Re_Xferred:Re_Xferred+SIZE(Re_Buf)-1 ) = Re_Buf @@ -40837,20 +40840,20 @@ SUBROUTINE FAST_UnPackModuleMapType( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrSta IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) - IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! ED_P_2_SrvD_P_N not allocated + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! ED_P_2_NStC_P_N not allocated Int_Xferred = Int_Xferred + 1 ELSE Int_Xferred = Int_Xferred + 1 i1_l = IntKiBuf( Int_Xferred ) i1_u = IntKiBuf( Int_Xferred + 1) Int_Xferred = Int_Xferred + 2 - IF (ALLOCATED(OutData%ED_P_2_SrvD_P_N)) DEALLOCATE(OutData%ED_P_2_SrvD_P_N) - ALLOCATE(OutData%ED_P_2_SrvD_P_N(i1_l:i1_u),STAT=ErrStat2) + IF (ALLOCATED(OutData%ED_P_2_NStC_P_N)) DEALLOCATE(OutData%ED_P_2_NStC_P_N) + ALLOCATE(OutData%ED_P_2_NStC_P_N(i1_l:i1_u),STAT=ErrStat2) IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%ED_P_2_SrvD_P_N.', ErrStat, ErrMsg,RoutineName) + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%ED_P_2_NStC_P_N.', ErrStat, ErrMsg,RoutineName) RETURN END IF - DO i1 = LBOUND(OutData%ED_P_2_SrvD_P_N,1), UBOUND(OutData%ED_P_2_SrvD_P_N,1) + DO i1 = LBOUND(OutData%ED_P_2_NStC_P_N,1), UBOUND(OutData%ED_P_2_NStC_P_N,1) Buf_size=IntKiBuf( Int_Xferred ) Int_Xferred = Int_Xferred + 1 IF(Buf_size > 0) THEN @@ -40884,7 +40887,7 @@ SUBROUTINE FAST_UnPackModuleMapType( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrSta Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) Int_Xferred = Int_Xferred + Buf_size END IF - CALL NWTC_Library_Unpackmeshmaptype( Re_Buf, Db_Buf, Int_Buf, OutData%ED_P_2_SrvD_P_N(i1), ErrStat2, ErrMsg2 ) ! ED_P_2_SrvD_P_N + CALL NWTC_Library_Unpackmeshmaptype( Re_Buf, Db_Buf, Int_Buf, OutData%ED_P_2_NStC_P_N(i1), ErrStat2, ErrMsg2 ) ! ED_P_2_NStC_P_N CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN @@ -40893,20 +40896,20 @@ SUBROUTINE FAST_UnPackModuleMapType( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrSta IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) END DO END IF - IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! SrvD_P_2_ED_P_N not allocated + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! NStC_P_2_ED_P_N not allocated Int_Xferred = Int_Xferred + 1 ELSE Int_Xferred = Int_Xferred + 1 i1_l = IntKiBuf( Int_Xferred ) i1_u = IntKiBuf( Int_Xferred + 1) Int_Xferred = Int_Xferred + 2 - IF (ALLOCATED(OutData%SrvD_P_2_ED_P_N)) DEALLOCATE(OutData%SrvD_P_2_ED_P_N) - ALLOCATE(OutData%SrvD_P_2_ED_P_N(i1_l:i1_u),STAT=ErrStat2) + IF (ALLOCATED(OutData%NStC_P_2_ED_P_N)) DEALLOCATE(OutData%NStC_P_2_ED_P_N) + ALLOCATE(OutData%NStC_P_2_ED_P_N(i1_l:i1_u),STAT=ErrStat2) IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%SrvD_P_2_ED_P_N.', ErrStat, ErrMsg,RoutineName) + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%NStC_P_2_ED_P_N.', ErrStat, ErrMsg,RoutineName) RETURN END IF - DO i1 = LBOUND(OutData%SrvD_P_2_ED_P_N,1), UBOUND(OutData%SrvD_P_2_ED_P_N,1) + DO i1 = LBOUND(OutData%NStC_P_2_ED_P_N,1), UBOUND(OutData%NStC_P_2_ED_P_N,1) Buf_size=IntKiBuf( Int_Xferred ) Int_Xferred = Int_Xferred + 1 IF(Buf_size > 0) THEN @@ -40940,7 +40943,7 @@ SUBROUTINE FAST_UnPackModuleMapType( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrSta Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) Int_Xferred = Int_Xferred + Buf_size END IF - CALL NWTC_Library_Unpackmeshmaptype( Re_Buf, Db_Buf, Int_Buf, OutData%SrvD_P_2_ED_P_N(i1), ErrStat2, ErrMsg2 ) ! SrvD_P_2_ED_P_N + CALL NWTC_Library_Unpackmeshmaptype( Re_Buf, Db_Buf, Int_Buf, OutData%NStC_P_2_ED_P_N(i1), ErrStat2, ErrMsg2 ) ! NStC_P_2_ED_P_N CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN @@ -40949,20 +40952,20 @@ SUBROUTINE FAST_UnPackModuleMapType( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrSta IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) END DO END IF - IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! ED_L_2_SrvD_P_T not allocated + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! ED_L_2_TStC_P_T not allocated Int_Xferred = Int_Xferred + 1 ELSE Int_Xferred = Int_Xferred + 1 i1_l = IntKiBuf( Int_Xferred ) i1_u = IntKiBuf( Int_Xferred + 1) Int_Xferred = Int_Xferred + 2 - IF (ALLOCATED(OutData%ED_L_2_SrvD_P_T)) DEALLOCATE(OutData%ED_L_2_SrvD_P_T) - ALLOCATE(OutData%ED_L_2_SrvD_P_T(i1_l:i1_u),STAT=ErrStat2) + IF (ALLOCATED(OutData%ED_L_2_TStC_P_T)) DEALLOCATE(OutData%ED_L_2_TStC_P_T) + ALLOCATE(OutData%ED_L_2_TStC_P_T(i1_l:i1_u),STAT=ErrStat2) IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%ED_L_2_SrvD_P_T.', ErrStat, ErrMsg,RoutineName) + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%ED_L_2_TStC_P_T.', ErrStat, ErrMsg,RoutineName) RETURN END IF - DO i1 = LBOUND(OutData%ED_L_2_SrvD_P_T,1), UBOUND(OutData%ED_L_2_SrvD_P_T,1) + DO i1 = LBOUND(OutData%ED_L_2_TStC_P_T,1), UBOUND(OutData%ED_L_2_TStC_P_T,1) Buf_size=IntKiBuf( Int_Xferred ) Int_Xferred = Int_Xferred + 1 IF(Buf_size > 0) THEN @@ -40996,7 +40999,7 @@ SUBROUTINE FAST_UnPackModuleMapType( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrSta Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) Int_Xferred = Int_Xferred + Buf_size END IF - CALL NWTC_Library_Unpackmeshmaptype( Re_Buf, Db_Buf, Int_Buf, OutData%ED_L_2_SrvD_P_T(i1), ErrStat2, ErrMsg2 ) ! ED_L_2_SrvD_P_T + CALL NWTC_Library_Unpackmeshmaptype( Re_Buf, Db_Buf, Int_Buf, OutData%ED_L_2_TStC_P_T(i1), ErrStat2, ErrMsg2 ) ! ED_L_2_TStC_P_T CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN @@ -41005,20 +41008,20 @@ SUBROUTINE FAST_UnPackModuleMapType( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrSta IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) END DO END IF - IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! SrvD_P_2_ED_P_T not allocated + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! TStC_P_2_ED_P_T not allocated Int_Xferred = Int_Xferred + 1 ELSE Int_Xferred = Int_Xferred + 1 i1_l = IntKiBuf( Int_Xferred ) i1_u = IntKiBuf( Int_Xferred + 1) Int_Xferred = Int_Xferred + 2 - IF (ALLOCATED(OutData%SrvD_P_2_ED_P_T)) DEALLOCATE(OutData%SrvD_P_2_ED_P_T) - ALLOCATE(OutData%SrvD_P_2_ED_P_T(i1_l:i1_u),STAT=ErrStat2) + IF (ALLOCATED(OutData%TStC_P_2_ED_P_T)) DEALLOCATE(OutData%TStC_P_2_ED_P_T) + ALLOCATE(OutData%TStC_P_2_ED_P_T(i1_l:i1_u),STAT=ErrStat2) IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%SrvD_P_2_ED_P_T.', ErrStat, ErrMsg,RoutineName) + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%TStC_P_2_ED_P_T.', ErrStat, ErrMsg,RoutineName) RETURN END IF - DO i1 = LBOUND(OutData%SrvD_P_2_ED_P_T,1), UBOUND(OutData%SrvD_P_2_ED_P_T,1) + DO i1 = LBOUND(OutData%TStC_P_2_ED_P_T,1), UBOUND(OutData%TStC_P_2_ED_P_T,1) Buf_size=IntKiBuf( Int_Xferred ) Int_Xferred = Int_Xferred + 1 IF(Buf_size > 0) THEN @@ -41052,7 +41055,7 @@ SUBROUTINE FAST_UnPackModuleMapType( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrSta Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) Int_Xferred = Int_Xferred + Buf_size END IF - CALL NWTC_Library_Unpackmeshmaptype( Re_Buf, Db_Buf, Int_Buf, OutData%SrvD_P_2_ED_P_T(i1), ErrStat2, ErrMsg2 ) ! SrvD_P_2_ED_P_T + CALL NWTC_Library_Unpackmeshmaptype( Re_Buf, Db_Buf, Int_Buf, OutData%TStC_P_2_ED_P_T(i1), ErrStat2, ErrMsg2 ) ! TStC_P_2_ED_P_T CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN @@ -41061,7 +41064,7 @@ SUBROUTINE FAST_UnPackModuleMapType( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrSta IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) END DO END IF - IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! ED_L_2_SrvD_P_B not allocated + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! ED_L_2_BStC_P_B not allocated Int_Xferred = Int_Xferred + 1 ELSE Int_Xferred = Int_Xferred + 1 @@ -41071,14 +41074,14 @@ SUBROUTINE FAST_UnPackModuleMapType( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrSta i2_l = IntKiBuf( Int_Xferred ) i2_u = IntKiBuf( Int_Xferred + 1) Int_Xferred = Int_Xferred + 2 - IF (ALLOCATED(OutData%ED_L_2_SrvD_P_B)) DEALLOCATE(OutData%ED_L_2_SrvD_P_B) - ALLOCATE(OutData%ED_L_2_SrvD_P_B(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) + IF (ALLOCATED(OutData%ED_L_2_BStC_P_B)) DEALLOCATE(OutData%ED_L_2_BStC_P_B) + ALLOCATE(OutData%ED_L_2_BStC_P_B(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%ED_L_2_SrvD_P_B.', ErrStat, ErrMsg,RoutineName) + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%ED_L_2_BStC_P_B.', ErrStat, ErrMsg,RoutineName) RETURN END IF - DO i2 = LBOUND(OutData%ED_L_2_SrvD_P_B,2), UBOUND(OutData%ED_L_2_SrvD_P_B,2) - DO i1 = LBOUND(OutData%ED_L_2_SrvD_P_B,1), UBOUND(OutData%ED_L_2_SrvD_P_B,1) + DO i2 = LBOUND(OutData%ED_L_2_BStC_P_B,2), UBOUND(OutData%ED_L_2_BStC_P_B,2) + DO i1 = LBOUND(OutData%ED_L_2_BStC_P_B,1), UBOUND(OutData%ED_L_2_BStC_P_B,1) Buf_size=IntKiBuf( Int_Xferred ) Int_Xferred = Int_Xferred + 1 IF(Buf_size > 0) THEN @@ -41112,7 +41115,7 @@ SUBROUTINE FAST_UnPackModuleMapType( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrSta Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) Int_Xferred = Int_Xferred + Buf_size END IF - CALL NWTC_Library_Unpackmeshmaptype( Re_Buf, Db_Buf, Int_Buf, OutData%ED_L_2_SrvD_P_B(i1,i2), ErrStat2, ErrMsg2 ) ! ED_L_2_SrvD_P_B + CALL NWTC_Library_Unpackmeshmaptype( Re_Buf, Db_Buf, Int_Buf, OutData%ED_L_2_BStC_P_B(i1,i2), ErrStat2, ErrMsg2 ) ! ED_L_2_BStC_P_B CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN @@ -41122,7 +41125,7 @@ SUBROUTINE FAST_UnPackModuleMapType( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrSta END DO END DO END IF - IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! SrvD_P_2_ED_P_B not allocated + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! BStC_P_2_ED_P_B not allocated Int_Xferred = Int_Xferred + 1 ELSE Int_Xferred = Int_Xferred + 1 @@ -41132,14 +41135,14 @@ SUBROUTINE FAST_UnPackModuleMapType( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrSta i2_l = IntKiBuf( Int_Xferred ) i2_u = IntKiBuf( Int_Xferred + 1) Int_Xferred = Int_Xferred + 2 - IF (ALLOCATED(OutData%SrvD_P_2_ED_P_B)) DEALLOCATE(OutData%SrvD_P_2_ED_P_B) - ALLOCATE(OutData%SrvD_P_2_ED_P_B(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) + IF (ALLOCATED(OutData%BStC_P_2_ED_P_B)) DEALLOCATE(OutData%BStC_P_2_ED_P_B) + ALLOCATE(OutData%BStC_P_2_ED_P_B(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%SrvD_P_2_ED_P_B.', ErrStat, ErrMsg,RoutineName) + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%BStC_P_2_ED_P_B.', ErrStat, ErrMsg,RoutineName) RETURN END IF - DO i2 = LBOUND(OutData%SrvD_P_2_ED_P_B,2), UBOUND(OutData%SrvD_P_2_ED_P_B,2) - DO i1 = LBOUND(OutData%SrvD_P_2_ED_P_B,1), UBOUND(OutData%SrvD_P_2_ED_P_B,1) + DO i2 = LBOUND(OutData%BStC_P_2_ED_P_B,2), UBOUND(OutData%BStC_P_2_ED_P_B,2) + DO i1 = LBOUND(OutData%BStC_P_2_ED_P_B,1), UBOUND(OutData%BStC_P_2_ED_P_B,1) Buf_size=IntKiBuf( Int_Xferred ) Int_Xferred = Int_Xferred + 1 IF(Buf_size > 0) THEN @@ -41173,7 +41176,7 @@ SUBROUTINE FAST_UnPackModuleMapType( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrSta Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) Int_Xferred = Int_Xferred + Buf_size END IF - CALL NWTC_Library_Unpackmeshmaptype( Re_Buf, Db_Buf, Int_Buf, OutData%SrvD_P_2_ED_P_B(i1,i2), ErrStat2, ErrMsg2 ) ! SrvD_P_2_ED_P_B + CALL NWTC_Library_Unpackmeshmaptype( Re_Buf, Db_Buf, Int_Buf, OutData%BStC_P_2_ED_P_B(i1,i2), ErrStat2, ErrMsg2 ) ! BStC_P_2_ED_P_B CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN @@ -41183,7 +41186,7 @@ SUBROUTINE FAST_UnPackModuleMapType( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrSta END DO END DO END IF - IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! BD_L_2_SrvD_P_B not allocated + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! BD_L_2_BStC_P_B not allocated Int_Xferred = Int_Xferred + 1 ELSE Int_Xferred = Int_Xferred + 1 @@ -41193,14 +41196,14 @@ SUBROUTINE FAST_UnPackModuleMapType( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrSta i2_l = IntKiBuf( Int_Xferred ) i2_u = IntKiBuf( Int_Xferred + 1) Int_Xferred = Int_Xferred + 2 - IF (ALLOCATED(OutData%BD_L_2_SrvD_P_B)) DEALLOCATE(OutData%BD_L_2_SrvD_P_B) - ALLOCATE(OutData%BD_L_2_SrvD_P_B(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) + IF (ALLOCATED(OutData%BD_L_2_BStC_P_B)) DEALLOCATE(OutData%BD_L_2_BStC_P_B) + ALLOCATE(OutData%BD_L_2_BStC_P_B(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%BD_L_2_SrvD_P_B.', ErrStat, ErrMsg,RoutineName) + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%BD_L_2_BStC_P_B.', ErrStat, ErrMsg,RoutineName) RETURN END IF - DO i2 = LBOUND(OutData%BD_L_2_SrvD_P_B,2), UBOUND(OutData%BD_L_2_SrvD_P_B,2) - DO i1 = LBOUND(OutData%BD_L_2_SrvD_P_B,1), UBOUND(OutData%BD_L_2_SrvD_P_B,1) + DO i2 = LBOUND(OutData%BD_L_2_BStC_P_B,2), UBOUND(OutData%BD_L_2_BStC_P_B,2) + DO i1 = LBOUND(OutData%BD_L_2_BStC_P_B,1), UBOUND(OutData%BD_L_2_BStC_P_B,1) Buf_size=IntKiBuf( Int_Xferred ) Int_Xferred = Int_Xferred + 1 IF(Buf_size > 0) THEN @@ -41234,7 +41237,7 @@ SUBROUTINE FAST_UnPackModuleMapType( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrSta Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) Int_Xferred = Int_Xferred + Buf_size END IF - CALL NWTC_Library_Unpackmeshmaptype( Re_Buf, Db_Buf, Int_Buf, OutData%BD_L_2_SrvD_P_B(i1,i2), ErrStat2, ErrMsg2 ) ! BD_L_2_SrvD_P_B + CALL NWTC_Library_Unpackmeshmaptype( Re_Buf, Db_Buf, Int_Buf, OutData%BD_L_2_BStC_P_B(i1,i2), ErrStat2, ErrMsg2 ) ! BD_L_2_BStC_P_B CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN @@ -41244,7 +41247,7 @@ SUBROUTINE FAST_UnPackModuleMapType( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrSta END DO END DO END IF - IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! SrvD_P_2_BD_P_B not allocated + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! BStC_P_2_BD_P_B not allocated Int_Xferred = Int_Xferred + 1 ELSE Int_Xferred = Int_Xferred + 1 @@ -41254,14 +41257,14 @@ SUBROUTINE FAST_UnPackModuleMapType( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrSta i2_l = IntKiBuf( Int_Xferred ) i2_u = IntKiBuf( Int_Xferred + 1) Int_Xferred = Int_Xferred + 2 - IF (ALLOCATED(OutData%SrvD_P_2_BD_P_B)) DEALLOCATE(OutData%SrvD_P_2_BD_P_B) - ALLOCATE(OutData%SrvD_P_2_BD_P_B(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) + IF (ALLOCATED(OutData%BStC_P_2_BD_P_B)) DEALLOCATE(OutData%BStC_P_2_BD_P_B) + ALLOCATE(OutData%BStC_P_2_BD_P_B(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%SrvD_P_2_BD_P_B.', ErrStat, ErrMsg,RoutineName) + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%BStC_P_2_BD_P_B.', ErrStat, ErrMsg,RoutineName) RETURN END IF - DO i2 = LBOUND(OutData%SrvD_P_2_BD_P_B,2), UBOUND(OutData%SrvD_P_2_BD_P_B,2) - DO i1 = LBOUND(OutData%SrvD_P_2_BD_P_B,1), UBOUND(OutData%SrvD_P_2_BD_P_B,1) + DO i2 = LBOUND(OutData%BStC_P_2_BD_P_B,2), UBOUND(OutData%BStC_P_2_BD_P_B,2) + DO i1 = LBOUND(OutData%BStC_P_2_BD_P_B,1), UBOUND(OutData%BStC_P_2_BD_P_B,1) Buf_size=IntKiBuf( Int_Xferred ) Int_Xferred = Int_Xferred + 1 IF(Buf_size > 0) THEN @@ -41295,7 +41298,7 @@ SUBROUTINE FAST_UnPackModuleMapType( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrSta Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) Int_Xferred = Int_Xferred + Buf_size END IF - CALL NWTC_Library_Unpackmeshmaptype( Re_Buf, Db_Buf, Int_Buf, OutData%SrvD_P_2_BD_P_B(i1,i2), ErrStat2, ErrMsg2 ) ! SrvD_P_2_BD_P_B + CALL NWTC_Library_Unpackmeshmaptype( Re_Buf, Db_Buf, Int_Buf, OutData%BStC_P_2_BD_P_B(i1,i2), ErrStat2, ErrMsg2 ) ! BStC_P_2_BD_P_B CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN @@ -41305,20 +41308,20 @@ SUBROUTINE FAST_UnPackModuleMapType( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrSta END DO END DO END IF - IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! SrvD_P_P_2_ED_P not allocated + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! SStC_P_P_2_ED_P not allocated Int_Xferred = Int_Xferred + 1 ELSE Int_Xferred = Int_Xferred + 1 i1_l = IntKiBuf( Int_Xferred ) i1_u = IntKiBuf( Int_Xferred + 1) Int_Xferred = Int_Xferred + 2 - IF (ALLOCATED(OutData%SrvD_P_P_2_ED_P)) DEALLOCATE(OutData%SrvD_P_P_2_ED_P) - ALLOCATE(OutData%SrvD_P_P_2_ED_P(i1_l:i1_u),STAT=ErrStat2) + IF (ALLOCATED(OutData%SStC_P_P_2_ED_P)) DEALLOCATE(OutData%SStC_P_P_2_ED_P) + ALLOCATE(OutData%SStC_P_P_2_ED_P(i1_l:i1_u),STAT=ErrStat2) IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%SrvD_P_P_2_ED_P.', ErrStat, ErrMsg,RoutineName) + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%SStC_P_P_2_ED_P.', ErrStat, ErrMsg,RoutineName) RETURN END IF - DO i1 = LBOUND(OutData%SrvD_P_P_2_ED_P,1), UBOUND(OutData%SrvD_P_P_2_ED_P,1) + DO i1 = LBOUND(OutData%SStC_P_P_2_ED_P,1), UBOUND(OutData%SStC_P_P_2_ED_P,1) Buf_size=IntKiBuf( Int_Xferred ) Int_Xferred = Int_Xferred + 1 IF(Buf_size > 0) THEN @@ -41352,7 +41355,7 @@ SUBROUTINE FAST_UnPackModuleMapType( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrSta Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) Int_Xferred = Int_Xferred + Buf_size END IF - CALL NWTC_Library_Unpackmeshmaptype( Re_Buf, Db_Buf, Int_Buf, OutData%SrvD_P_P_2_ED_P(i1), ErrStat2, ErrMsg2 ) ! SrvD_P_P_2_ED_P + CALL NWTC_Library_Unpackmeshmaptype( Re_Buf, Db_Buf, Int_Buf, OutData%SStC_P_P_2_ED_P(i1), ErrStat2, ErrMsg2 ) ! SStC_P_P_2_ED_P CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN @@ -41361,20 +41364,20 @@ SUBROUTINE FAST_UnPackModuleMapType( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrSta IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) END DO END IF - IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! ED_P_2_SrvD_P_P not allocated + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! ED_P_2_SStC_P_P not allocated Int_Xferred = Int_Xferred + 1 ELSE Int_Xferred = Int_Xferred + 1 i1_l = IntKiBuf( Int_Xferred ) i1_u = IntKiBuf( Int_Xferred + 1) Int_Xferred = Int_Xferred + 2 - IF (ALLOCATED(OutData%ED_P_2_SrvD_P_P)) DEALLOCATE(OutData%ED_P_2_SrvD_P_P) - ALLOCATE(OutData%ED_P_2_SrvD_P_P(i1_l:i1_u),STAT=ErrStat2) + IF (ALLOCATED(OutData%ED_P_2_SStC_P_P)) DEALLOCATE(OutData%ED_P_2_SStC_P_P) + ALLOCATE(OutData%ED_P_2_SStC_P_P(i1_l:i1_u),STAT=ErrStat2) IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%ED_P_2_SrvD_P_P.', ErrStat, ErrMsg,RoutineName) + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%ED_P_2_SStC_P_P.', ErrStat, ErrMsg,RoutineName) RETURN END IF - DO i1 = LBOUND(OutData%ED_P_2_SrvD_P_P,1), UBOUND(OutData%ED_P_2_SrvD_P_P,1) + DO i1 = LBOUND(OutData%ED_P_2_SStC_P_P,1), UBOUND(OutData%ED_P_2_SStC_P_P,1) Buf_size=IntKiBuf( Int_Xferred ) Int_Xferred = Int_Xferred + 1 IF(Buf_size > 0) THEN @@ -41408,7 +41411,7 @@ SUBROUTINE FAST_UnPackModuleMapType( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrSta Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) Int_Xferred = Int_Xferred + Buf_size END IF - CALL NWTC_Library_Unpackmeshmaptype( Re_Buf, Db_Buf, Int_Buf, OutData%ED_P_2_SrvD_P_P(i1), ErrStat2, ErrMsg2 ) ! ED_P_2_SrvD_P_P + CALL NWTC_Library_Unpackmeshmaptype( Re_Buf, Db_Buf, Int_Buf, OutData%ED_P_2_SStC_P_P(i1), ErrStat2, ErrMsg2 ) ! ED_P_2_SStC_P_P CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN @@ -41417,20 +41420,20 @@ SUBROUTINE FAST_UnPackModuleMapType( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrSta IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) END DO END IF - IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! SrvD_P_P_2_SD_P not allocated + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! SStC_P_P_2_SD_P not allocated Int_Xferred = Int_Xferred + 1 ELSE Int_Xferred = Int_Xferred + 1 i1_l = IntKiBuf( Int_Xferred ) i1_u = IntKiBuf( Int_Xferred + 1) Int_Xferred = Int_Xferred + 2 - IF (ALLOCATED(OutData%SrvD_P_P_2_SD_P)) DEALLOCATE(OutData%SrvD_P_P_2_SD_P) - ALLOCATE(OutData%SrvD_P_P_2_SD_P(i1_l:i1_u),STAT=ErrStat2) + IF (ALLOCATED(OutData%SStC_P_P_2_SD_P)) DEALLOCATE(OutData%SStC_P_P_2_SD_P) + ALLOCATE(OutData%SStC_P_P_2_SD_P(i1_l:i1_u),STAT=ErrStat2) IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%SrvD_P_P_2_SD_P.', ErrStat, ErrMsg,RoutineName) + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%SStC_P_P_2_SD_P.', ErrStat, ErrMsg,RoutineName) RETURN END IF - DO i1 = LBOUND(OutData%SrvD_P_P_2_SD_P,1), UBOUND(OutData%SrvD_P_P_2_SD_P,1) + DO i1 = LBOUND(OutData%SStC_P_P_2_SD_P,1), UBOUND(OutData%SStC_P_P_2_SD_P,1) Buf_size=IntKiBuf( Int_Xferred ) Int_Xferred = Int_Xferred + 1 IF(Buf_size > 0) THEN @@ -41464,7 +41467,7 @@ SUBROUTINE FAST_UnPackModuleMapType( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrSta Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) Int_Xferred = Int_Xferred + Buf_size END IF - CALL NWTC_Library_Unpackmeshmaptype( Re_Buf, Db_Buf, Int_Buf, OutData%SrvD_P_P_2_SD_P(i1), ErrStat2, ErrMsg2 ) ! SrvD_P_P_2_SD_P + CALL NWTC_Library_Unpackmeshmaptype( Re_Buf, Db_Buf, Int_Buf, OutData%SStC_P_P_2_SD_P(i1), ErrStat2, ErrMsg2 ) ! SStC_P_P_2_SD_P CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN @@ -41473,20 +41476,20 @@ SUBROUTINE FAST_UnPackModuleMapType( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrSta IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) END DO END IF - IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! SDy3_P_2_SrvD_P_P not allocated + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! SDy3_P_2_SStC_P_P not allocated Int_Xferred = Int_Xferred + 1 ELSE Int_Xferred = Int_Xferred + 1 i1_l = IntKiBuf( Int_Xferred ) i1_u = IntKiBuf( Int_Xferred + 1) Int_Xferred = Int_Xferred + 2 - IF (ALLOCATED(OutData%SDy3_P_2_SrvD_P_P)) DEALLOCATE(OutData%SDy3_P_2_SrvD_P_P) - ALLOCATE(OutData%SDy3_P_2_SrvD_P_P(i1_l:i1_u),STAT=ErrStat2) + IF (ALLOCATED(OutData%SDy3_P_2_SStC_P_P)) DEALLOCATE(OutData%SDy3_P_2_SStC_P_P) + ALLOCATE(OutData%SDy3_P_2_SStC_P_P(i1_l:i1_u),STAT=ErrStat2) IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%SDy3_P_2_SrvD_P_P.', ErrStat, ErrMsg,RoutineName) + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%SDy3_P_2_SStC_P_P.', ErrStat, ErrMsg,RoutineName) RETURN END IF - DO i1 = LBOUND(OutData%SDy3_P_2_SrvD_P_P,1), UBOUND(OutData%SDy3_P_2_SrvD_P_P,1) + DO i1 = LBOUND(OutData%SDy3_P_2_SStC_P_P,1), UBOUND(OutData%SDy3_P_2_SStC_P_P,1) Buf_size=IntKiBuf( Int_Xferred ) Int_Xferred = Int_Xferred + 1 IF(Buf_size > 0) THEN @@ -41520,7 +41523,7 @@ SUBROUTINE FAST_UnPackModuleMapType( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrSta Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) Int_Xferred = Int_Xferred + Buf_size END IF - CALL NWTC_Library_Unpackmeshmaptype( Re_Buf, Db_Buf, Int_Buf, OutData%SDy3_P_2_SrvD_P_P(i1), ErrStat2, ErrMsg2 ) ! SDy3_P_2_SrvD_P_P + CALL NWTC_Library_Unpackmeshmaptype( Re_Buf, Db_Buf, Int_Buf, OutData%SDy3_P_2_SStC_P_P(i1), ErrStat2, ErrMsg2 ) ! SDy3_P_2_SStC_P_P CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN @@ -41529,6 +41532,46 @@ SUBROUTINE FAST_UnPackModuleMapType( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrSta IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) END DO END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Re_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Re_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Re_Buf = ReKiBuf( Re_Xferred:Re_Xferred+Buf_size-1 ) + Re_Xferred = Re_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Db_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Db_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Db_Buf = DbKiBuf( Db_Xferred:Db_Xferred+Buf_size-1 ) + Db_Xferred = Db_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Int_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Int_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) + Int_Xferred = Int_Xferred + Buf_size + END IF + CALL NWTC_Library_Unpackmeshmaptype( Re_Buf, Db_Buf, Int_Buf, OutData%ED_P_2_SrvD_P_P, ErrStat2, ErrMsg2 ) ! ED_P_2_SrvD_P_P + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) + IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) + IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! BDED_L_2_AD_L_B not allocated Int_Xferred = Int_Xferred + 1 ELSE @@ -42326,46 +42369,6 @@ SUBROUTINE FAST_UnPackModuleMapType( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrSta CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN - IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) - IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) - IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) - Buf_size=IntKiBuf( Int_Xferred ) - Int_Xferred = Int_Xferred + 1 - IF(Buf_size > 0) THEN - ALLOCATE(Re_Buf(Buf_size),STAT=ErrStat2) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating Re_Buf.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - Re_Buf = ReKiBuf( Re_Xferred:Re_Xferred+Buf_size-1 ) - Re_Xferred = Re_Xferred + Buf_size - END IF - Buf_size=IntKiBuf( Int_Xferred ) - Int_Xferred = Int_Xferred + 1 - IF(Buf_size > 0) THEN - ALLOCATE(Db_Buf(Buf_size),STAT=ErrStat2) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating Db_Buf.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - Db_Buf = DbKiBuf( Db_Xferred:Db_Xferred+Buf_size-1 ) - Db_Xferred = Db_Xferred + Buf_size - END IF - Buf_size=IntKiBuf( Int_Xferred ) - Int_Xferred = Int_Xferred + 1 - IF(Buf_size > 0) THEN - ALLOCATE(Int_Buf(Buf_size),STAT=ErrStat2) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating Int_Buf.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) - Int_Xferred = Int_Xferred + Buf_size - END IF - CALL MeshUnpack( OutData%u_ED_PlatformPtMesh_3, Re_Buf, Db_Buf, Int_Buf, ErrStat2, ErrMsg2 ) ! u_ED_PlatformPtMesh_3 - CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) - IF (ErrStat >= AbortErrLev) RETURN - IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) @@ -43015,8 +43018,11 @@ SUBROUTINE FAST_CopyExternInputType( SrcExternInputTypeData, DstExternInputTypeD DstExternInputTypeData%YawPosCom = SrcExternInputTypeData%YawPosCom DstExternInputTypeData%YawRateCom = SrcExternInputTypeData%YawRateCom DstExternInputTypeData%BlPitchCom = SrcExternInputTypeData%BlPitchCom + DstExternInputTypeData%BlAirfoilCom = SrcExternInputTypeData%BlAirfoilCom DstExternInputTypeData%HSSBrFrac = SrcExternInputTypeData%HSSBrFrac DstExternInputTypeData%LidarFocus = SrcExternInputTypeData%LidarFocus + DstExternInputTypeData%CableDeltaL = SrcExternInputTypeData%CableDeltaL + DstExternInputTypeData%CableDeltaLdot = SrcExternInputTypeData%CableDeltaLdot END SUBROUTINE FAST_CopyExternInputType SUBROUTINE FAST_DestroyExternInputType( ExternInputTypeData, ErrStat, ErrMsg ) @@ -43070,8 +43076,11 @@ SUBROUTINE FAST_PackExternInputType( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat Re_BufSz = Re_BufSz + 1 ! YawPosCom Re_BufSz = Re_BufSz + 1 ! YawRateCom Re_BufSz = Re_BufSz + SIZE(InData%BlPitchCom) ! BlPitchCom + Re_BufSz = Re_BufSz + SIZE(InData%BlAirfoilCom) ! BlAirfoilCom Re_BufSz = Re_BufSz + 1 ! HSSBrFrac Re_BufSz = Re_BufSz + SIZE(InData%LidarFocus) ! LidarFocus + Re_BufSz = Re_BufSz + SIZE(InData%CableDeltaL) ! CableDeltaL + Re_BufSz = Re_BufSz + SIZE(InData%CableDeltaLdot) ! CableDeltaLdot IF ( Re_BufSz .GT. 0 ) THEN ALLOCATE( ReKiBuf( Re_BufSz ), STAT=ErrStat2 ) IF (ErrStat2 /= 0) THEN @@ -43111,12 +43120,24 @@ SUBROUTINE FAST_PackExternInputType( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat ReKiBuf(Re_Xferred) = InData%BlPitchCom(i1) Re_Xferred = Re_Xferred + 1 END DO + DO i1 = LBOUND(InData%BlAirfoilCom,1), UBOUND(InData%BlAirfoilCom,1) + ReKiBuf(Re_Xferred) = InData%BlAirfoilCom(i1) + Re_Xferred = Re_Xferred + 1 + END DO ReKiBuf(Re_Xferred) = InData%HSSBrFrac Re_Xferred = Re_Xferred + 1 DO i1 = LBOUND(InData%LidarFocus,1), UBOUND(InData%LidarFocus,1) ReKiBuf(Re_Xferred) = InData%LidarFocus(i1) Re_Xferred = Re_Xferred + 1 END DO + DO i1 = LBOUND(InData%CableDeltaL,1), UBOUND(InData%CableDeltaL,1) + ReKiBuf(Re_Xferred) = InData%CableDeltaL(i1) + Re_Xferred = Re_Xferred + 1 + END DO + DO i1 = LBOUND(InData%CableDeltaLdot,1), UBOUND(InData%CableDeltaLdot,1) + ReKiBuf(Re_Xferred) = InData%CableDeltaLdot(i1) + Re_Xferred = Re_Xferred + 1 + END DO END SUBROUTINE FAST_PackExternInputType SUBROUTINE FAST_UnPackExternInputType( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrMsg ) @@ -43160,6 +43181,12 @@ SUBROUTINE FAST_UnPackExternInputType( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrS OutData%BlPitchCom(i1) = ReKiBuf(Re_Xferred) Re_Xferred = Re_Xferred + 1 END DO + i1_l = LBOUND(OutData%BlAirfoilCom,1) + i1_u = UBOUND(OutData%BlAirfoilCom,1) + DO i1 = LBOUND(OutData%BlAirfoilCom,1), UBOUND(OutData%BlAirfoilCom,1) + OutData%BlAirfoilCom(i1) = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + END DO OutData%HSSBrFrac = ReKiBuf(Re_Xferred) Re_Xferred = Re_Xferred + 1 i1_l = LBOUND(OutData%LidarFocus,1) @@ -43168,6 +43195,18 @@ SUBROUTINE FAST_UnPackExternInputType( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrS OutData%LidarFocus(i1) = ReKiBuf(Re_Xferred) Re_Xferred = Re_Xferred + 1 END DO + i1_l = LBOUND(OutData%CableDeltaL,1) + i1_u = UBOUND(OutData%CableDeltaL,1) + DO i1 = LBOUND(OutData%CableDeltaL,1), UBOUND(OutData%CableDeltaL,1) + OutData%CableDeltaL(i1) = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + END DO + i1_l = LBOUND(OutData%CableDeltaLdot,1) + i1_u = UBOUND(OutData%CableDeltaLdot,1) + DO i1 = LBOUND(OutData%CableDeltaLdot,1), UBOUND(OutData%CableDeltaLdot,1) + OutData%CableDeltaLdot(i1) = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + END DO END SUBROUTINE FAST_UnPackExternInputType SUBROUTINE FAST_CopyMisc( SrcMiscData, DstMiscData, CtrlCode, ErrStat, ErrMsg ) diff --git a/modules/servodyn/CMakeLists.txt b/modules/servodyn/CMakeLists.txt index 5dd7f191d5..342392810e 100644 --- a/modules/servodyn/CMakeLists.txt +++ b/modules/servodyn/CMakeLists.txt @@ -21,6 +21,7 @@ endif() set(SrvD_SOURCES src/BladedInterface.f90 + src/BladedInterface_EX.f90 src/UserSubs.f90 src/PitchCntrl_ACH.f90 src/StrucCtrl.f90 diff --git a/modules/servodyn/src/BladedInterface.f90 b/modules/servodyn/src/BladedInterface.f90 index 7040c4f49a..72d0bfb9a9 100644 --- a/modules/servodyn/src/BladedInterface.f90 +++ b/modules/servodyn/src/BladedInterface.f90 @@ -19,10 +19,10 @@ !********************************************************************************************************************************** MODULE BladedInterface - USE NWTC_Library - + USE NWTC_Library USE ServoDyn_Types - + USE BladedInterface_EX + USE, INTRINSIC :: ISO_C_Binding @@ -277,8 +277,8 @@ SUBROUTINE CallBladedLegacyDLL ( u, filt_fromSCglob, filt_fromSC, p, dll_data, E END SUBROUTINE CallBladedLegacyDLL !================================================================================================================================== !> This routine initializes variables used in the Bladed DLL interface. -SUBROUTINE BladedInterface_Init(u, p, m, xd, y, InputFileData, InitInp, ErrStat, ErrMsg) - +SUBROUTINE BladedInterface_Init(u, p, m, xd, y, InputFileData, InitInp, StC_CtrlChanInitInfo, UnSum, ErrStat, ErrMsg) + TYPE(SrvD_InputType), INTENT(INOUT) :: u !< An initial guess for the input; input mesh must be defined TYPE(SrvD_ParameterType), INTENT(INOUT) :: p !< Parameters TYPE(SrvD_MiscVarType), INTENT(INOUT) :: m !< Initial misc (optimization) variables @@ -287,6 +287,8 @@ SUBROUTINE BladedInterface_Init(u, p, m, xd, y, InputFileData, InitInp, ErrStat, !! only the output mesh is initialized) TYPE(SrvD_InputFile), INTENT(INOUT) :: InputFileData !< Data stored in the module's input file TYPE(SrvD_InitInputType), INTENT(IN ) :: InitInp !< Input data for initialization routine + type(StC_CtrlChanInitInfoType), intent(inout) :: StC_CtrlChanInitInfo !< initial values for StC damping, stiffness, etc to pass to controller (out so we can MOVE_ALLOC) + INTEGER(IntKi), INTENT(IN ) :: UnSum !< summary file number (>0 when set) INTEGER(IntKi), INTENT( OUT) :: ErrStat !< Error status of the operation CHARACTER(*), INTENT( OUT) :: ErrMsg !< Error message if ErrStat /= ErrID_None @@ -365,12 +367,23 @@ SUBROUTINE BladedInterface_Init(u, p, m, xd, y, InputFileData, InitInp, ErrStat, END IF IF ( ErrStat >= AbortErrLev ) RETURN - + + ! Set the Extended AVRswap flag + p%EXavrSWAP = InputFileData%EXavrSWAP ! Set status flag and initialize avrSWAP: m%dll_data%SimStatus = GH_DISCON_STATUS_INITIALISING - - CALL AllocAry( m%dll_data%avrSwap, R+(2*m%dll_data%DLL_NumTrq)-1 + MaxLoggingChannels, 'avrSwap', ErrStat2, ErrMsg2 ) + + if ( p%EXavrSWAP ) then + CALL AllocAry( m%dll_data%avrSwap, EXavrSWAP_Size, 'avrSwap', ErrStat2, ErrMsg2 ) + else + CALL AllocAry( m%dll_data%avrSwap, R+(2*m%dll_data%DLL_NumTrq)-1 + MaxLoggingChannels, 'avrSwap', ErrStat2, ErrMsg2 ) + if ((R+(2*m%dll_data%DLL_NumTrq)-1 + MaxLoggingChannels >= 1000) .and. p%EXavrSWAP)then + CALL CheckError( ErrID_Fatal, 'Too many combined torque lookup values ('//trim(Num2LStr((2*m%dll_data%DLL_NumTrq)))//' entries) '// & + 'and logging channels ('//trim(Num2LStr(MaxLoggingChannels))//') -- this overwrites the extended avrSWAP starting at channel 1000.') + RETURN + endif + endif CALL CheckError(ErrStat2,ErrMsg2) IF ( ErrStat >= AbortErrLev ) RETURN m%dll_data%avrSWAP = 0.0 @@ -407,7 +420,7 @@ SUBROUTINE BladedInterface_Init(u, p, m, xd, y, InputFileData, InitInp, ErrStat, p%DLL_Trgt%ProcName(2) = p%DLL_Trgt%ProcName(1) ! we won't call the separate controller_init routine the first time p%DLL_Trgt%ProcAddr(2) = p%DLL_Trgt%ProcAddr(1) elseif (ErrStat2 == ErrID_Fatal) then - CALL CheckError(ErrID_Info,'Error opening BLADED interface DLL. Checking for legacy DLL.') + CALL CheckError(ErrID_Info,'Unable to open BLADED interface DLL. Checking for legacy DLL.') CALL FreeDynamicLib( p%DLL_Trgt, ErrStat2, ErrMsg2 ) ! this doesn't do anything #ifdef STATIC_DLL_LOAD because p%DLL_Trgt is 0 (NULL) p%UseLegacyInterface = .true. ! Bladed checks for the legacy version if it can't find the CONTROLL function in the DLL, so that's what we'll have to do, too end if @@ -447,6 +460,22 @@ SUBROUTINE BladedInterface_Init(u, p, m, xd, y, InputFileData, InitInp, ErrStat, !-------------------------------------- #endif + !> get summary file info for legacy interface + if (p%UseLegacyInterface) then + if (UnSum > 0) then + call WrLegacyChannelInfoToSummaryFile(u, p, m%dll_data, UnSum, ErrStat2, ErrMsg2 ) + CALL CheckError(ErrStat2,ErrMsg2) + IF ( ErrStat >= AbortErrLev ) RETURN + endif + endif + + !> Initialize the extended avrSWAP if used + if (p%UseLegacyInterface .and. p%EXavrSWAP) then + call EXavrSWAP_Init( InitInp, u, p, y, m%dll_data, StC_CtrlChanInitInfo, UnSum, ErrStat2, ErrMsg2) + CALL CheckError(ErrStat2,ErrMsg2) + IF ( ErrStat >= AbortErrLev ) RETURN + endif + CONTAINS !............................................................................................................................... @@ -482,8 +511,181 @@ SUBROUTINE CheckError(ErrID,Msg) END SUBROUTINE CheckError END SUBROUTINE BladedInterface_Init !================================================================================================================================== -SUBROUTINE GetBladedLoggingChannels(u,p, xd, m, ErrStat, ErrMsg) +subroutine WrLegacyChannelInfoToSummaryFile(u,p,dll_data,UnSum,ErrStat,ErrMsg) + type(SrvD_InputType), intent(in ) :: u !< An initial guess for the input; input mesh must be defined + type(SrvD_ParameterType), intent(in ) :: p !< Parameters + type(BladedDLLType), intent(in ) :: dll_data ! Temporary copy of dll data -- only used for summary file writing + integer(IntKi), intent(in ) :: UnSum !< summary file number (>0 when set) + integer(IntKi), intent( out) :: ErrStat !< Error status of the operation + character(*), intent( out) :: ErrMsg !< Error message if ErrStat /= ErrID_None + character(1024), allocatable :: SumInfo(:) ! Description strings for each avrSWAP record -- only used for summary file writing + character(3), allocatable :: DataFlow(:) ! Direction of data flow -- only used for summary file writing + type(BladedDLLType) :: dll_data_tmp ! Temporary copy of dll data -- only used for summary file writing + integer(IntKi) :: K !< Generic counter + integer(IntKi) :: ErrStat2 !< Error status of the operation + character(ErrMsgLen) :: ErrMsg2 !< Error message if ErrStat /= ErrID_None + + ErrStat = ErrID_None + ErrMsg = '' + + if (UnSum <= 0) return + + call AllocAry(SumInfo,size(dll_data%avrSwap),'SumInfo array for bladed interface',ErrStat2,ErrMsg2) + if (Failed()) return + SumInfo = '' + call AllocAry(DataFlow,size(dll_data%avrSwap),'DataFlow array for bladed interface',ErrStat2,ErrMsg2) + if (Failed()) return + DataFlow = '' + + ! Channels with info sent to the DLL (from Fill_avrSWAP routine) + call WrSumInfoSend(1, 'Status flag set as follows: 0 if this is the first call, 1 for all subsequent time steps, -1 if this is the final call at the end of the simulation (-) ') + call WrSumInfoSend(2, 'Current time (sec) [t in single precision]') + call WrSumInfoSend(3, 'Communication interval (sec)') + call WrSumInfoSend(4, 'Blade 1 pitch angle (rad) [SrvD input]') + call WrSumInfoSend(5, 'Below-rated pitch angle set-point (rad) [SrvD Ptch_SetPnt parameter]') + call WrSumInfoSend(6, 'Minimum pitch angle (rad) [SrvD Ptch_Min parameter]') + call WrSumInfoSend(7, 'Maximum pitch angle (rad) [SrvD Ptch_Max parameter]') + call WrSumInfoSend(8, 'Minimum pitch rate (most negative value allowed) (rad/s) [SrvD PtchRate_Min parameter]') + call WrSumInfoSend(9, 'Maximum pitch rate (rad/s) [SrvD PtchRate_Max parameter]') + call WrSumInfoSend(10, '0 = pitch position actuator, 1 = pitch rate actuator (-) [must be 0 for ServoDyn]') + call WrSumInfoSend(11, 'Current demanded pitch angle (rad) [I am sending the previous value for blade 1 from the DLL, in the absence of any more information provided in Bladed documentation]') + call WrSumInfoSend(12, 'Current demanded pitch rate (rad/s) [always zero for ServoDyn]') + call WrSumInfoSend(13, 'Demanded power (W) [SrvD GenPwr_Dem parameter from input file]') + call WrSumInfoSend(14, 'Measured shaft power (W) [SrvD input]') + call WrSumInfoSend(15, 'Measured electrical power output (W) [SrvD calculation from previous step; should technically be a state] ') + call WrSumInfoSend(16, 'Optimal mode gain (Nm/(rad/s)^2) [if torque-speed table look-up not selected in input file, use SrvD Gain_OM parameter, otherwise use 0 (already overwritten in Init routine)]') + call WrSumInfoSend(17, 'Minimum generator speed (rad/s) [SrvD GenSpd_MinOM parameter]') + call WrSumInfoSend(18, 'Optimal mode maximum speed (rad/s) [SrvD GenSpd_MaxOMp arameter]') + call WrSumInfoSend(19, 'Demanded generator speed above rated (rad/s) [SrvD GenSpd_Dem parameter]') + call WrSumInfoSend(20, 'Measured generator speed (rad/s) [SrvD input]') + call WrSumInfoSend(21, 'Measured rotor speed (rad/s) [SrvD input]') + call WrSumInfoSend(22, 'Demanded generator torque above rated (Nm) [SrvD GenTrq_Dem parameter from input file]') + call WrSumInfoSend(23, 'Measured generator torque (Nm) [SrvD calculation from previous step; should technically be a state]') + call WrSumInfoSend(24, 'Measured yaw error (rad) [SrvD input]') + if (dll_data%DLL_NumTrq==0) then ! Torque-speed table look-up not selected + call WrSumInfoSend(25, 'Start of below-rated torque-speed look-up table (Lookup table not in use)') + else ! Torque-speed table look-up selected + call WrSumInfoSend(25, 'Start of below-rated torque-speed look-up table (Set to record no. '//trim(Num2LStr(R))//')') + endif + call WrSumInfoSend(26, 'No. of points in torque-speed look-up table (-) [SrvD DLL_NumTrq parameter]: ') + call WrSumInfoSend(27, 'Hub wind speed (m/s) [SrvD input]') + call WrSumInfoSend(28, 'Pitch control: 0 = collective, 1 = individual (-) [SrvD Ptch_Cntrl parameter]') + call WrSumInfoSend(29, 'Yaw control: 0 = yaw rate control, 1 = yaw torque control (-) [must be 0 for ServoDyn] ') + call WrSumInfoSend(30, 'Blade 1 root out-of-plane bending moment (Nm) [SrvD input]') + call WrSumInfoSend(31, 'Blade 2 root out-of-plane bending moment (Nm) [SrvD input]') + call WrSumInfoSend(32, 'Blade 3 root out-of-plane bending moment (Nm) [SrvD input]') + if (p%NumBl>1) call WrSumInfoSend(33, 'Blade 2 pitch angle (rad) [SrvD input]') + if (p%NumBl>2) call WrSumInfoSend(34, 'Blade 3 pitch angle (rad) [SrvD input]') + call WrSumInfoSend(37, 'Nacelle yaw angle from North (rad)') + call WrSumInfoSend(49, 'Maximum number of characters in the "MESSAGE" argument (-) [size of ErrMsg argument plus 1 (we add one for the C NULL CHARACTER)]') + call WrSumInfoSend(50, 'Number of characters in the "INFILE" argument (-) [trimmed length of DLL_InFile parameter plus 1 (we add one for the C NULL CHARACTER)]') + call WrSumInfoSend(51, 'Number of characters in the "OUTNAME" argument (-) [trimmed length of RootName parameter plus 1 (we add one for the C NULL CHARACTER)]') + call WrSumInfoSend(53, 'Tower top fore-aft acceleration (m/s^2) [SrvD input]') + call WrSumInfoSend(54, 'Tower top side-to-side acceleration (m/s^2) [SrvD input]') + call WrSumInfoSend(60, 'Rotor azimuth angle (rad) [SrvD input]') + call WrSumInfoSend(61, 'Number of blades (-) [SrvD NumBl parameter]') + call WrSumInfoSend(62, 'Maximum number of values which can be returned for logging (-) [set to '//trim(Num2LStr(MaxLoggingChannels))//']') + call WrSumInfoSend(63, 'Record number for start of logging output (-) [set to '//trim(Num2LStr(R + (2*dll_data%DLL_NumTrq)))//']') + call WrSumInfoSend(64, 'Maximum number of characters which can be returned in "OUTNAME" (-) [set to '//trim(Num2LStr(p%avcOUTNAME_LEN))//' (including the C NULL CHARACTER)]') + call WrSumInfoSend(66, 'Start of Platform motion -- 1001') + call WrSumInfoSend(69, 'Blade 1 root in-plane bending moment (Nm) [SrvD input]') + call WrSumInfoSend(70, 'Blade 2 root in-plane bending moment (Nm) [SrvD input]') + call WrSumInfoSend(71, 'Blade 3 root in-plane bending moment (Nm) [SrvD input]') + call WrSumInfoSend(73, 'Rotating hub My (GL co-ords) (Nm) [SrvD input]') + call WrSumInfoSend(74, 'Rotating hub Mz (GL co-ords) (Nm) [SrvD input]') + call WrSumInfoSend(75, 'Fixed hub My (GL co-ords) (Nm) [SrvD input]') + call WrSumInfoSend(76, 'Fixed hub Mz (GL co-ords) (Nm) [SrvD input]') + call WrSumInfoSend(77, 'Yaw bearing My (GL co-ords) (Nm) [SrvD input]') + call WrSumInfoSend(78, 'Yaw bearing Mz (GL co-ords) (Nm) [SrvD input]') + call WrSumInfoSend(82, 'Nacelle roll acceleration (rad/s^2) [SrvD input] -- this is in the shaft (tilted) coordinate system, instead of the nacelle (nontilted) coordinate system') + call WrSumInfoSend(83, 'Nacelle nodding acceleration (rad/s^2) [SrvD input] ') + call WrSumInfoSend(84, 'Nacelle yaw acceleration (rad/s^2) [SrvD input] -- this is in the shaft (tilted) coordinate system, instead of the nacelle (nontilted) coordinate system') + call WrSumInfoSend(95, 'Reserved (SrvD customization: set to SrvD AirDens parameter)') + call WrSumInfoSend(96, 'Reserved (SrvD customization: set to SrvD AvgWindSpeed parameter)') + call WrSumInfoSend(109, 'Shaft torque (=hub Mx for clockwise rotor) (Nm) [SrvD input]') + call WrSumInfoSend(117, 'Controller state [always set to 0]') + if (dll_data%DLL_NumTrq>0) call WrSumInfoSend(R-1, 'Start of generator speed torque lookup table') + if (dll_data%DLL_NumTrq>0) call WrSumInfoSend(R-1+dll_data%DLL_NumTrq,'End of generator speed torque lookup table') + call WrSumInfoSend(129, 'Maximum extent of the avrSWAP array: '//trim(Num2LStr(size(dll_data%avrSWAP))) ) + + ! Channels with info retrieved from the DLL (from Retrieve_avrSWAP routine) + call WrSumInfoBiDr(35, 'Generator contactor (-) [GenState from previous call to DLL (initialized to 1)]') + call WrSumInfoBiDr(36, 'Shaft brake status (-) [sent to DLL at the next call; anything other than 0 or 1 is an error] ') + call WrSumInfoRcvd(41, 'demanded yaw actuator torque [this output is ignored since record 29 is set to 0 by ServoDyn indicating yaw rate control]') + IF ( dll_data%Ptch_Cntrl == GH_DISCON_PITCH_CONTROL_INDIVIDUAL ) then + do K = 1,p%NumBl + call WrSumInfoRcvd(41+K, 'Blade '//trim(Num2LStr(K))//' demanded individual pitch position') + enddo + else + call WrSumInfoRcvd(45, 'Demanded pitch angle (Collective pitch) (rad)') + endif + call WrSumInfoRcvd(47, 'Demanded generator torque (Nm)') + call WrSumInfoRcvd(48, 'Demanded nacelle yaw rate (rad/s)') + call WrSumInfoRcvd(55, 'UNUSED: Pitch override [anything other than 0 is an error in ServoDyn]') + call WrSumInfoRcvd(56, 'UNUSED: Torque override [anything other than 0 is an error in ServoDyn]') + call WrSumInfoRcvd(65, 'Number of variables returned for logging [anything greater than MaxLoggingChannels is an error]') + if (dll_data%ShaftBrakeStatusBinaryFlag == 16) call WrSumInfoRcvd(107, 'Brake torque demand (used only when avrSWAP(36) is 16)') + call WrSumInfoRcvd(120, 'Airfoil command, blade 1') + call WrSumInfoRcvd(121, 'Airfoil command, blade 2') + call WrSumInfoRcvd(122, 'Airfoil command, blade 3') + call WrSumInfoRcvd(63,'Number logging channels') + + + ! Write to summary file + call WrBladedSumInfoToFile() + + ! Cleanup afterwards + call CleanUp() +contains + logical function Failed() + call SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, 'WrLegacyChannelInfoToSummaryFile') + Failed = ErrStat >= AbortErrLev + if (Failed) call CleanUp() + end function Failed + subroutine CleanUp() + if (allocated(SumInfo)) deallocate(SumInfo) + if (allocated(DataFlow)) deallocate(DataFlow) + call SrvD_DestroyBladedDLLType( dll_data_tmp, ErrStat2, ErrMsg2 ) + end subroutine CleanUp + subroutine WrBladedSumInfoToFile() + integer(IntKi) :: I !< generic counter + write(UnSum,'(A)') '' + write(UnSum,'(A)') ' Legacy Bladed DLL interface channel usage by SrvD:' + write(UnSum,'(A)') '' + write(UnSum,'(6x,8x,3x,A3,3x,A)') '-->','indicates from SrvD to DLL' + write(UnSum,'(6x,8x,3x,A3,3x,A)') '<--','indicates from DLL to SrvD' + write(UnSum,'(6x,8x,3x,A3,3x,A)') '<->','indicates from bidirectional' + write(UnSum,'(6x,A8,3x,A3,3x,A11)') 'Record #',' ','Description' + write(UnSum,'(6x,A8,3x,A3,3x,A11)') '--------',' ','-----------' + do I=1,size(SumInfo) + if (len_trim(SumInfo(I)) > 0 ) write(UnSum,'(8x,I4,5x,A4,2x,A)') I,DataFlow(I),trim(SumInfo(I)) + enddo + end subroutine WrBladedSumInfoToFile + subroutine WrSumInfoSend(Record,Desc) + integer(IntKi), intent(in ) :: Record + character(*), intent(in ) :: Desc + DataFlow(Record) = '-->' + SumInfo(Record) = trim(Desc(1:min(len_trim(Desc),len(SumInfo(1))))) ! prevent string length overrun + end subroutine WrSumInfoSend + subroutine WrSumInfoRcvd(Record,Desc) + integer(IntKi), intent(in ) :: Record + character(*), intent(in ) :: Desc + DataFlow(Record) = '<--' + SumInfo(Record) = trim(Desc(1:min(len_trim(Desc),len(SumInfo(1))))) ! prevent string length overrun + end subroutine WrSumInfoRcvd + subroutine WrSumInfoBiDr(Record,Desc) + integer(IntKi), intent(in ) :: Record + character(*), intent(in ) :: Desc + DataFlow(Record) = '<->' + SumInfo(Record) = trim(Desc(1:min(len_trim(Desc),len(SumInfo(1))))) ! prevent string length overrun + end subroutine WrSumInfoBiDr + +end subroutine WrLegacyChannelInfoToSummaryFile +!================================================================================================================================== +!================================================================================================================================== +SUBROUTINE GetBladedLoggingChannels(u,p, xd, m, ErrStat, ErrMsg) + TYPE(SrvD_InputType), INTENT(IN ) :: u !< An initial guess for the input; input mesh must be defined TYPE(SrvD_ParameterType), INTENT(INOUT) :: p !< Parameters TYPE(SrvD_DiscreteStateType), INTENT(IN ) :: xd !< Discrete states @@ -811,6 +1013,7 @@ SUBROUTINE Fill_avrSWAP( t, u, p, ErrMsgSz, dll_data ) dll_data%avrSWAP(64) = p%avcOUTNAME_LEN !> * Record 64: Maximum number of characters which can be returned in "OUTNAME" (-) [set to bladedinterface::MaxLoggingChannels * (2+nwtc_base::chanlen) + 1 (we add one for the C NULL CHARACTER)] ! Record 65 is output [see Retrieve_avrSWAP()] ! Records 66-68 are reserved + dll_data%avrSWAP(66) = 1001 !> * Record 66: start index of platform motions dll_data%avrSWAP(69) = u%RootMxc(1) !> * Record 69: Blade 1 root in-plane bending moment (Nm) [SrvD input] dll_data%avrSWAP(70) = u%RootMxc(2) !> * Record 70: Blade 2 root in-plane bending moment (Nm) [SrvD input] @@ -854,7 +1057,10 @@ SUBROUTINE Fill_avrSWAP( t, u, p, ErrMsgSz, dll_data ) !> * Records 120-129: User-defined variables 1-10; ignored in ServoDyn -! Records 130-142 are outputs [see Retrieve_avrSWAP()] + ! Records 120:122 are outputs [see Retrieve_avrSWAP()] + dll_data%avrSWAP(129) = size(dll_data%avrSWAP) !> * Record 129: Maximum extent of the avrSWAP array + +! Records 130-142 are outputs [see Retrieve_avrSWAP()] ! Records L1 and onward are outputs [see Retrieve_avrSWAP()] @@ -898,6 +1104,11 @@ SUBROUTINE Fill_CONTROL_vars( t, u, p, ErrMsgSz, dll_data ) call Fill_avrSWAP( t, u, p, ErrMsgSz, dll_data ) ! we'll set the avrSWAP variable, for the legacy version of the DLL, too. + ! set the values for the Extended avrSWAP variable, if using + if ( p%EXavrSWAP ) then + call Fill_EXavrSWAP( t, u, p, dll_data ) + endif + !> The following are values ServoDyn sends to the Bladed DLL. !! For variables returned from the DLL, see bladedinterface::retrieve_control_vars. @@ -1053,7 +1264,7 @@ SUBROUTINE Retrieve_avrSWAP( p, dll_data, ErrStat, ErrMsg ) ! (might be used for airfoil flap angles for example) dll_data%BlAirfoilCom(1) = dll_data%avrSWAP(120) dll_data%BlAirfoilCom(2) = dll_data%avrSWAP(121) - dll_data%BlAirFoilCom(3) = dll_data%avrSWAP(122) + dll_data%BlAirfoilCom(3) = dll_data%avrSWAP(122) !> * Records 130-142: Reserved @@ -1083,6 +1294,12 @@ SUBROUTINE CheckDLLReturnValues( p, dll_data, ErrStat, ErrMsg ) if (p%UseLegacyInterface) then CALL Retrieve_avrSWAP( p, dll_data, ErrStat, ErrMsg ) if (ErrStat >= AbortErrLev) return + + if (p%EXavrSWAP ) then + CALL Retrieve_EXavrSWAP( p, dll_data, ErrStat, ErrMsg ) + if (ErrStat >= AbortErrLev) return + endif + end if diff --git a/modules/servodyn/src/BladedInterface_EX.f90 b/modules/servodyn/src/BladedInterface_EX.f90 new file mode 100644 index 0000000000..19514b28b6 --- /dev/null +++ b/modules/servodyn/src/BladedInterface_EX.f90 @@ -0,0 +1,602 @@ +!********************************************************************************************************************************** +! LICENSING +! Copyright (C) 2013-2016 National Renewable Energy Laboratory +! +! This file is part of FAST's Controls and Electrical Drive Module, "ServoDyn". +! +! Licensed under the Apache License, Version 2.0 (the "License"); +! you may not use this file except in compliance with the License. +! You may obtain a copy of the License at +! +! http://www.apache.org/licenses/LICENSE-2.0 +! +! Unless required by applicable law or agreed to in writing, software +! distributed under the License is distributed on an "AS IS" BASIS, +! WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +! See the License for the specific language governing permissions and +! limitations under the License. +! +!********************************************************************************************************************************** +MODULE BladedInterface_EX + + USE NWTC_Library + USE ServoDyn_Types + + IMPLICIT NONE + + !> Extended AVRswap array -- This is an oversizing of the bladed 4.3 avrswap array to add an additional ~3000 communication channels + !! + !! This is intended as a stop-gap to get a much larger set of channels integrated. This is intended as a short term solution + !! until an entirely different architecture for the controller is adopted. But given how many things get built as temporary + !! and never updated to a better solution, we are adding some flexibility to it (a temp-o-permanent solution). + !! + !! Versioning: + !! It could be useful for the controller to know which version of the interface it is dealing with. For example, if + !! the controller is expecting a block listed below, it would be useful for it to check version info for compatibility. + !! The controller could still talk to newer interfaces since all channels are set, but not to older interfaces (like + !! when a new block is added here, but the controller is of an older protocol, it should still work ok). + !! Major: increment version to next integer when a block is added + !! Minor: increment version by 0.001 for a single channel addition within an existing block + !! Sub-Major change: if the whole organization of the blocks is changed, then increment to next 0.010 integer multiple. + !! + !! Extended array layout: + !! + !! | Index start | Index end | Channels in group | Description of array block | OpenFAST module | + !! | :----------: | :----------: | :----------------: | :----------------------------------------: | :-------------------: | + !! | 1000 | | 1 | Version info for compatibility checks | | + !! | 1001 | 2000 | 1000 | Sensor inputs (non-lidar) | | + !! | 2001 | 2500 | 500 | Lidar input measurements | LidarSim | + !! | 2501 | 2600 | 100 | Lidar control signals | LidarSim | + !! | 2601 | 2800 | 200 | Cable controls | MoorDyn, SubDyn | + !! | 2801 | 3000 | 200 | Tuned Mass dampers control | StrucCtrl | + !! | 3001 | 3300 | 300 | Aero controls (individual flaps, etc) | AeroDyn | + !! | | | | | | + !! + integer(IntKi), parameter :: EXavrSWAP_Size = 3300 !< size of the avrSWAP array with the extended array sizing (increment this as new blocks ar added) + real(ReKi), parameter :: EXavrSWAP_Ver = 1.000 !< Version. increment minor for new signal addition, increment major for new block addition + integer(IntKi), parameter :: ExSensors_StartIdx = 1001 !< Starting index for the non-lidar measurements group + integer(IntKi), parameter :: ExSensors_MaxChan = 1000 !< Maximum channels in non-lidar measurements group + integer(IntKi), parameter :: LidarMsr_StartIdx = 2001 !< Starting index for the lidar measurements + integer(IntKi), parameter :: LidarMsr_MaxChan = 500 !< Maximum channels in lidar measurements group + integer(IntKi), parameter :: LidarCtrl_StartIdx = 2501 !< Starting index for the lidar control + integer(IntKi), parameter :: LidarCtrl_MaxChan = 100 !< Maximum channels in lidar control group + integer(IntKi), parameter :: CableCtrl_StartIdx = 2601 !< Starting index for the cable control + integer(IntKi), parameter :: CableCtrl_MaxChan = 200 !< Maximum channels in cable control group + integer(IntKi), parameter :: StCCtrl_StartIdx = 2801 !< Starting index for the StC control + integer(IntKi), parameter :: StCCtrl_MaxChan = 200 !< Maximum channels in StC control group + integer(IntKi), parameter :: StCCtrl_ChanPerSet = 20 !< Channels needed per set (10 sets for total channels) + + +CONTAINS +!================================================================================================================================== +!> This routine sets the input and output necessary for the extended interface. +SUBROUTINE EXavrSWAP_Init( InitInp, u, p, y, dll_data, StC_CtrlChanInitInfo, UnSum, ErrStat, ErrMsg) + type(SrvD_InitInputType), intent(in ) :: InitInp !< Input data for initialization routine + type(SrvD_InputType), intent(inout) :: u !< Inputs at t (setting up mesh) + type(SrvD_ParameterType), intent(in ) :: p !< Parameters + type(SrvD_OutputType), intent(inout) :: y !< Initial system outputs (outputs are not calculated) + type(BladedDLLType), intent(inout) :: dll_data !< data for the Bladed DLL + type(StC_CtrlChanInitInfoType), intent(in ) :: StC_CtrlChanInitInfo !< initial values for StC damping, stiffness, etc to pass to controller + integer(IntKi), intent(in ) :: UnSum !< Unit number for summary file (>0 when active) + integer(IntKi), intent( out) :: ErrStat !< Error status of the operation + character(ErrMsgLen), intent( out) :: ErrMsg !< Error message if ErrStat /= ErrID_None + character(*), parameter :: RoutineName='EXavrSWAP_Init' + character(1024), allocatable :: SumInfo(:) ! Description strings for each avrSWAP record -- only used for summary file writing + character(3), allocatable :: DataFlow(:) ! Direction of data flow -- only used for summary file writing + character(64), allocatable :: Requestor(:) ! Info on module requesting the channel + integer(IntKi) :: ErrStat2 + character(ErrMsgLen) :: ErrMsg2 + + ! Initialize ErrStat and ErrMsg + ErrStat = ErrID_None + ErrMsg = '' + + + ! Make sure we didn't get here by mistake + if ( .not. p%EXavrSWAP .or. .not. allocated(dll_data%avrSWAP) ) return + + if (UnSum>0) then + call AllocAry(SumInfo,size(dll_data%avrSwap),'SumInfo array for bladed interface',ErrStat2,ErrMsg2) + if (Failed()) return + SumInfo = '' + call AllocAry(Requestor,size(dll_data%avrSwap),'Requestor array for bladed interface',ErrStat2,ErrMsg2) + if (Failed()) return + Requestor = '' + call AllocAry(DataFlow,size(dll_data%avrSwap),'DataFlow array for bladed interface',ErrStat2,ErrMsg2) + if (Failed()) return + DataFlow = '' + + ! Add generic information on blocks of channels + call WrSumInfoSend(1000, 'Version of extended avrSWAP: '//trim(Num2LStr(EXavrSWAP_Ver))) + call WrSumInfoSend(ExSensors_StartIdx, 'Starting index for the non-lidar measurements channel block') + call WrSumInfoSend(ExSensors_StartIdx+ExSensors_MaxChan-1, 'Ending index for the non-lidar measurements channel block') + call WrSumInfoSend(LidarMsr_StartIdx, 'Starting index for the lidar measurements channel block') + call WrSumInfoSend(LidarMsr_StartIdx+LidarMsr_MaxChan-1, 'Ending index for the lidar measurements channel block') + call WrSumInfoRcvd(LidarCtrl_StartIdx, '','Starting index for the lidar control channel block') + call WrSumInfoRcvd(LidarCtrl_StartIdx+LidarCtrl_MaxChan-1, '','Ending index for the lidar control channel block') + call WrSumInfoRcvd(CableCtrl_StartIdx, '','Starting index for the cable control channel block') + call WrSumInfoRcvd(CableCtrl_StartIdx+CableCtrl_MaxChan-1, '','Ending index for the cable control channel block') + call WrSumInfoRcvd(StCCtrl_StartIdx, '','Starting index for the StC control channel block') + call WrSumInfoRcvd(StCCtrl_StartIdx+StCCtrl_MaxChan-1, '','Ending index for the StC control channel block') + endif + + + ! non-lidar sensors -- These will always be set if the extended array is used + call InitPtfmMotionSensors() ! 1001:1018 + if (Failed()) return + call InitNonLidarSensors() ! 1018:2000 + if (Failed()) return + + ! Initialize cable controls (2601:2800) + if (InitInp%NumCableControl > 0) then + call InitCableCtrl() + if (Failed()) return + endif + + ! Initialize cable controls (2801:3000) + if (p%NumStC_Control > 0) then + call InitStCCtrl() + if (Failed()) return + endif + ! Add additional routines here as needed. + + ! Write to summary file + if (UnSum>0) call WrBladedSumInfoToFile() + + ! Cleanup afterwards + call Cleanup + + +contains + logical function Failed() + call SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + Failed = ErrStat >= AbortErrLev + if (Failed) call CleanUp() + end function Failed + + + subroutine CleanUp() + if (allocated(SumInfo)) deallocate(SumInfo) + if (allocated(Requestor)) deallocate(Requestor) + if (allocated(DataFlow)) deallocate(DataFlow) + end subroutine CleanUp + + + subroutine InitPtfmMotionSensors() ! Channels 1001:1018 + !-------------------------------------------------------------- + ! Setup a platform motion mesh point to pass through to the DLL + CALL MeshCreate( BlankMesh = u%PtfmMotionMesh, IOS=COMPONENT_INPUT, Nnodes=1, & + ErrStat=ErrStat2, ErrMess=ErrMsg2, & + TranslationDisp=.TRUE., Orientation=.TRUE., & + TranslationVel =.TRUE., RotationVel=.TRUE., & + TranslationAcc =.TRUE., RotationAcc=.TRUE.) + if (Failed()) return; + ! Create the node on the mesh + CALL MeshPositionNode ( u%PtfmMotionMesh,1, InitInp%PtfmRefPos(1:3), ErrStat2, ErrMsg2, InitInp%PtfmRefOrient ) + if (Failed()) return; + ! Create the mesh element + CALL MeshConstructElement ( u%PtfmMotionMesh, ELEMENT_POINT, ErrStat2, ErrMsg2, 1 ) + if (Failed()) return; + CALL MeshCommit ( u%PtfmMotionMesh, ErrStat2, ErrMsg2 ) + if (Failed()) return; + ! Set any initial offsets + u%PtfmMotionMesh%TranslationDisp(1:3,1) = InitInp%PtfmRefPos(1:3) + u%PtfmMotionMesh%Orientation(1:3,1:3,1) = InitInp%PtfmOrient(1:3,1:3) + ! Writing out info on channels + if (UnSum > 0) then + call WrSumInfoSend(1001, 'General channel group -- Platform motion -- Displacement TDX (m)') + call WrSumInfoSend(1002, 'General channel group -- Platform motion -- Displacement TDY (m)') + call WrSumInfoSend(1003, 'General channel group -- Platform motion -- Displacement TDZ (m)') + call WrSumInfoSend(1004, 'General channel group -- Platform motion -- Displacement RDX (rad)') + call WrSumInfoSend(1005, 'General channel group -- Platform motion -- Displacement RDY (rad)') + call WrSumInfoSend(1006, 'General channel group -- Platform motion -- Displacement RDZ (rad)') + call WrSumInfoSend(1007, 'General channel group -- Platform motion -- Velocity TVX (m/s)') + call WrSumInfoSend(1008, 'General channel group -- Platform motion -- Velocity TVY (m/s)') + call WrSumInfoSend(1009, 'General channel group -- Platform motion -- Velocity TVZ (m/s)') + call WrSumInfoSend(1010, 'General channel group -- Platform motion -- Velocity RVX (rad/s)') + call WrSumInfoSend(1011, 'General channel group -- Platform motion -- Velocity RVY (rad/s)') + call WrSumInfoSend(1012, 'General channel group -- Platform motion -- Velocity RVZ (rad/s)') + call WrSumInfoSend(1013, 'General channel group -- Platform motion -- Acceleration TAX (m/s^2)') + call WrSumInfoSend(1014, 'General channel group -- Platform motion -- Acceleration TAY (m/s^2)') + call WrSumInfoSend(1015, 'General channel group -- Platform motion -- Acceleration TAZ (m/s^2)') + call WrSumInfoSend(1016, 'General channel group -- Platform motion -- Acceleration RAX (rad/s^2)') + call WrSumInfoSend(1017, 'General channel group -- Platform motion -- Acceleration RAY (rad/s^2)') + call WrSumInfoSend(1018, 'General channel group -- Platform motion -- Acceleration RAZ (rad/s^2)') + endif + end subroutine InitPtfmMotionSensors + + + subroutine InitNonLidarSensors() ! Channels 1019:2000 + ! This is a placeholder for info about other sensor channels that are passed to the DLL + !call WrSumInfoSend(1019, 'Description of channel info sent to DLL') + end subroutine InitNonLidarSensors + + + subroutine InitCableCtrl() + integer(IntKi) :: I,J ! Generic counters + + ! Error check the Cable Ctrl + if (.not. allocated(InitInp%CableControlRequestor)) then + ErrStat2=ErrID_Fatal + ErrMsg2='Cable control string array indicating which module requested cable controls is missing (CableControlRequestor)' + if (Failed()) return + endif + if (size(InitInp%CableControlRequestor) /= InitInp%NumCableControl) then + ErrStat2=ErrID_Fatal + ErrMsg2='Size of cable control string array (CableControlRequestor) does not match the number of requested cable control channels.' + if (Failed()) return + endif + if ( InitInp%NumCableControl*2_IntKi > CableCtrl_MaxChan ) then + ErrStat2=ErrID_Fatal + ErrMsg2='Maximum number of cable control channels exceeded: requested '//trim(Num2LStr(InitInp%NumCableControl))// & + ' channel sets ('//trim(Num2LStr(InitInp%NumCableControl*2_IntKi))//' individual channels),'// & + ' but only '//trim(Num2LStr(CableCtrl_MaxChan))//' individual channels are available' + call WrSCr('Cable channels requested: ') + do I=1,size(InitInp%CableControlRequestor) + call WrScr(' '//trim(Num2LStr(I))//' '//trim(InitInp%CableControlRequestor(I))) + enddo + if (Failed()) return + endif + + ! Allocate arrays for cable control + ! dll_data for communication to DLL + call AllocAry( dll_data%CableDeltaL, p%NumCableControl, 'CableDeltaL', ErrStat2, ErrMsg2 ) + if (Failed()) return + call AllocAry( dll_data%CableDeltaLdot, p%NumCableControl, 'CableDeltaLdot', ErrStat2, ErrMsg2 ) + if (Failed()) return + ! previous DLL command for ramping + call AllocAry( dll_data%PrevCableDeltaL, p%NumCableControl, 'PrevCableDeltaL', ErrStat2, ErrMsg2 ) + if (Failed()) return + call AllocAry( dll_data%PrevCableDeltaLdot, p%NumCableControl, 'PrevCableDeltaLdot', ErrStat2, ErrMsg2 ) + if (Failed()) return + ! Initialize to zeros + y%CableDeltaL = 0.0_ReKi + y%CableDeltaLdot = 0.0_ReKi + dll_data%CableDeltaL = 0.0_SiKi + dll_data%CableDeltaLdot = 0.0_SiKi + dll_data%PrevCableDeltaL = 0.0_SiKi + dll_data%PrevCableDeltaLdot = 0.0_SiKi + + ! Create info for summary file about channels + if (UnSum > 0) then + do I=1,p%NumCableControl + J=CableCtrl_StartIdx + ((I-1)*2-1) ! Index into the full avrSWAP (minus 1 so counting is simpler) + call WrSumInfoRcvd(J+1,InitInp%CableControlRequestor(I),'Cable control channel group '//trim(Num2LStr(I))//' -- DeltaL') + call WrSumInfoRcvd(J+2,InitInp%CableControlRequestor(I),'Cable control channel group '//trim(Num2LStr(I))//' -- DeltaLdot') + enddo + endif + end subroutine InitCableCtrl + + + subroutine InitStCCtrl() + integer(IntKi) :: I,J ! Generic counters + + ! Error check the Cable Ctrl + if (.not. allocated(StC_CtrlChanInitInfo%Requestor)) then + ErrStat2=ErrID_Fatal + ErrMsg2='StC control string array indicating which module requested cable controls is missing (StC_CtrlChanInitInfo%Requestor)' + if (Failed()) return + endif + if (size(StC_CtrlChanInitInfo%Requestor) /= p%NumStC_Control) then + ErrStat2=ErrID_Fatal + ErrMsg2='Size of StC control string array (StC_CtrlChanInitInfo%Requestor) does not match the number of requested cable control channels.' + if (Failed()) return + endif + if ( (size(StC_CtrlChanInitInfo%InitMeasDisp,2) /= p%NumStC_Control) .or. & + (size(StC_CtrlChanInitInfo%InitMeasVel ,2) /= p%NumStC_Control) .or. & + (size(StC_CtrlChanInitInfo%InitStiff ,2) /= p%NumStC_Control) .or. & + (size(StC_CtrlChanInitInfo%InitDamp ,2) /= p%NumStC_Control) .or. & + (size(StC_CtrlChanInitInfo%InitBrake ,2) /= p%NumStC_Control) .or. & + (size(StC_CtrlChanInitInfo%InitForce ,2) /= p%NumStC_Control) ) then + ErrStat2=ErrID_Fatal + ErrMsg2='Size of StC control initialization arrays (StC_CtrlChanInitInfo%Init*) do not match the number of requested cable control channels. Programming error somewhere.' + if (Failed()) return + endif + if ( p%NumStC_Control*StCCtrl_ChanPerSet > StCCtrl_MaxChan ) then + ErrStat2=ErrID_Fatal + ErrMsg2='Maximum number of cable control channels exceeded: requested '//trim(Num2LStr(p%NumStC_Control))// & + ' channel sets ('//trim(Num2LStr(p%NumStC_Control*StCCtrl_ChanPerSet))//' individual channels),'// & + ' but only '//trim(Num2LStr(StCCtrl_MaxChan))//' individual channels are available' + call WrSCr('StC channels requested: ') + do I=1,size(StC_CtrlChanInitInfo%Requestor) + call WrScr(' '//trim(Num2LStr(I))//' '//trim(StC_CtrlChanInitInfo%Requestor(I))) + enddo + if (Failed()) return + endif + + ! Allocate arrays for StC control + ! dll_data for communication to DLL -- X,Y,Z for each channel + call AllocAry( dll_data%StCMeasDisp, 3, p%NumStC_Control, 'StCMeasDisp', ErrStat2, ErrMsg2 ) + if (Failed()) return + call AllocAry( dll_data%StCMeasVel, 3, p%NumStC_Control, 'StCMeasVel', ErrStat2, ErrMsg2 ) + if (Failed()) return + call AllocAry( dll_data%PrevStCCmdStiff, 3, p%NumStC_Control, 'PrevStCCmdStiff', ErrStat2, ErrMsg2 ) + if (Failed()) return + call AllocAry( dll_data%PrevStCCmdDamp, 3, p%NumStC_Control, 'PrevStCCmdDamp', ErrStat2, ErrMsg2 ) + if (Failed()) return + call AllocAry( dll_data%PrevStCCmdBrake, 3, p%NumStC_Control, 'PrevStCCmdBrake', ErrStat2, ErrMsg2 ) + if (Failed()) return + call AllocAry( dll_data%PrevStCCmdForce, 3, p%NumStC_Control, 'PrevStCCmdForce', ErrStat2, ErrMsg2 ) + if (Failed()) return + call AllocAry( dll_data%StCCmdStiff, 3, p%NumStC_Control, 'StCCmdStiff', ErrStat2, ErrMsg2 ) + if (Failed()) return + call AllocAry( dll_data%StCCmdDamp, 3, p%NumStC_Control, 'StCCmdDamp', ErrStat2, ErrMsg2 ) + if (Failed()) return + call AllocAry( dll_data%StCCmdBrake, 3, p%NumStC_Control, 'StCCmdBrake', ErrStat2, ErrMsg2 ) + if (Failed()) return + call AllocAry( dll_data%StCCmdForce, 3, p%NumStC_Control, 'StCCmdForce', ErrStat2, ErrMsg2 ) + if (Failed()) return + ! Initialize to values passed in + dll_data%StCMeasDisp = real(StC_CtrlChanInitInfo%InitMeasDisp,SiKi) + dll_data%StCMeasVel = real(StC_CtrlChanInitInfo%InitMeasVel ,SiKi) + dll_data%PrevStCCmdStiff = real(StC_CtrlChanInitInfo%InitStiff ,SiKi) + dll_data%PrevStCCmdDamp = real(StC_CtrlChanInitInfo%InitDamp ,SiKi) + dll_data%PrevStCCmdBrake = real(StC_CtrlChanInitInfo%InitBrake ,SiKi) + dll_data%PrevStCCmdForce = real(StC_CtrlChanInitInfo%InitForce ,SiKi) + dll_data%StCCmdStiff = real(StC_CtrlChanInitInfo%InitStiff ,SiKi) + dll_data%StCCmdDamp = real(StC_CtrlChanInitInfo%InitDamp ,SiKi) + dll_data%StCCmdBrake = real(StC_CtrlChanInitInfo%InitBrake ,SiKi) + dll_data%StCCmdForce = real(StC_CtrlChanInitInfo%InitForce ,SiKi) + + ! Create info for summary file about channels + if (UnSum > 0) then + do I=1,p%NumStC_Control + J=StCCtrl_StartIdx + ((I-1)*StCCtrl_ChanPerSet-1) ! Index into the full avrSWAP (minus 1 so counting is simpler) + call WrSumInfoSendFrom(J+1, StC_CtrlChanInitInfo%Requestor(I),'StC control channel group '//trim(Num2LStr(I))//' -- StC_Disp_X') + call WrSumInfoSendFrom(J+2, StC_CtrlChanInitInfo%Requestor(I),'StC control channel group '//trim(Num2LStr(I))//' -- StC_Disp_Y') + call WrSumInfoSendFrom(J+3, StC_CtrlChanInitInfo%Requestor(I),'StC control channel group '//trim(Num2LStr(I))//' -- StC_Disp_Z') + call WrSumInfoSendFrom(J+4, StC_CtrlChanInitInfo%Requestor(I),'StC control channel group '//trim(Num2LStr(I))//' -- StC_Vel_X') + call WrSumInfoSendFrom(J+5, StC_CtrlChanInitInfo%Requestor(I),'StC control channel group '//trim(Num2LStr(I))//' -- StC_Vel_Y') + call WrSumInfoSendFrom(J+6, StC_CtrlChanInitInfo%Requestor(I),'StC control channel group '//trim(Num2LStr(I))//' -- StC_Vel_Z') + call WrSumInfoRcvd( J+7, StC_CtrlChanInitInfo%Requestor(I),'StC control channel group '//trim(Num2LStr(I))//' -- StC_Stiff_X (override spring constant)') + call WrSumInfoRcvd( J+8, StC_CtrlChanInitInfo%Requestor(I),'StC control channel group '//trim(Num2LStr(I))//' -- StC_Stiff_Y (override spring constant)') + call WrSumInfoRcvd( J+9, StC_CtrlChanInitInfo%Requestor(I),'StC control channel group '//trim(Num2LStr(I))//' -- StC_Stiff_Z (override spring constant)') + call WrSumInfoRcvd( J+10,StC_CtrlChanInitInfo%Requestor(I),'StC control channel group '//trim(Num2LStr(I))//' -- StC_Damp_X (override damping constant)') + call WrSumInfoRcvd( J+11,StC_CtrlChanInitInfo%Requestor(I),'StC control channel group '//trim(Num2LStr(I))//' -- StC_Damp_Y (override damping constant)') + call WrSumInfoRcvd( J+12,StC_CtrlChanInitInfo%Requestor(I),'StC control channel group '//trim(Num2LStr(I))//' -- StC_Damp_Z (override damping constant)') + call WrSumInfoRcvd( J+13,StC_CtrlChanInitInfo%Requestor(I),'StC control channel group '//trim(Num2LStr(I))//' -- StC_Brake_X (braking force)') + call WrSumInfoRcvd( J+14,StC_CtrlChanInitInfo%Requestor(I),'StC control channel group '//trim(Num2LStr(I))//' -- StC_Brake_Y (braking force)') + call WrSumInfoRcvd( J+15,StC_CtrlChanInitInfo%Requestor(I),'StC control channel group '//trim(Num2LStr(I))//' -- StC_Brake_Z (braking force)') + call WrSumInfoRcvd( J+16,StC_CtrlChanInitInfo%Requestor(I),'StC control channel group '//trim(Num2LStr(I))//' -- StC_Force_X (additional force)') + call WrSumInfoRcvd( J+17,StC_CtrlChanInitInfo%Requestor(I),'StC control channel group '//trim(Num2LStr(I))//' -- StC_Force_Y (additional force)') + call WrSumInfoRcvd( J+18,StC_CtrlChanInitInfo%Requestor(I),'StC control channel group '//trim(Num2LStr(I))//' -- StC_Force_Z (additional force)') + call WrSumInfoRcvd( J+19,StC_CtrlChanInitInfo%Requestor(I),'StC control channel group '//trim(Num2LStr(I))//' -- Reserved for future') + call WrSumInfoRcvd( J+20,StC_CtrlChanInitInfo%Requestor(I),'StC control channel group '//trim(Num2LStr(I))//' -- Reserved for future') + enddo + endif + end subroutine InitStCCtrl + + + + subroutine WrBladedSumInfoToFile() + integer(IntKi) :: I !< generic counter + character(21) :: RqstrStr + write(UnSum,'(A)') '' + write(UnSum,'(A)') ' Legacy Bladed DLL interface with Extended avrSWAP' + write(UnSum,'(A)') ' channel usage by SrvD:' + write(UnSum,'(A)') '' + write(UnSum,'(6x,8x,3x,A3,3x,A)') '-->','indicates from SrvD to DLL' + write(UnSum,'(6x,8x,3x,A3,3x,A)') '<--','indicates from DLL to SrvD' + write(UnSum,'(6x,A8,3x,A3,3x,A21,3x,A11)') 'Record #',' ','Requested by ','Description' + write(UnSum,'(6x,A8,3x,A3,3x,A21,3x,A11)') '--------',' ','---------------------','-----------' + do I=1,size(SumInfo) + if (len_trim(SumInfo(I)) > 0 ) then + if (len_trim(Requestor(I)) <= 21) then + RqstrStr = trim(Requestor(I)) + write(UnSum,'(8x,I4,5x,A3,4x,A21,2x,A)') I,DataFlow(I),RqstrStr,trim(SumInfo(I)) + else + write(UnSum,'(8x,I4,5x,A3,4x,A,2x,A)') I,DataFlow(I),Requestor(I),trim(SumInfo(I)) + endif + endif + enddo + end subroutine WrBladedSumInfoToFile + + + subroutine WrSumInfoSend(Record,Desc) + integer(IntKi), intent(in ) :: Record + character(*), intent(in ) :: Desc + DataFlow(Record) = '-->' + SumInfo(Record) = trim(Desc(1:min(len(Desc),len(SumInfo(1))))) ! prevent string length overrun + end subroutine WrSumInfoSend + + subroutine WrSumInfoSendFrom(Record,Rqst,Desc) + integer(IntKi), intent(in ) :: Record + character(*), intent(in ) :: Rqst + character(*), intent(in ) :: Desc + DataFlow(Record) = '-->' + Requestor(Record) = trim(Rqst(1:min(len(Rqst),len(Requestor(1))))) ! prevent string length overrun + SumInfo(Record) = trim(Desc(1:min(len(Desc),len(SumInfo(1))))) ! prevent string length overrun + end subroutine WrSumInfoSendFrom + + subroutine WrSumInfoRcvd(Record,Rqst,Desc) + integer(IntKi), intent(in ) :: Record + character(*), intent(in ) :: Rqst + character(*), intent(in ) :: Desc + DataFlow(Record) = '<--' + Requestor(Record) = trim(Rqst(1:min(len(Rqst),len(Requestor(1))))) ! prevent string length overrun + SumInfo(Record) = trim(Desc(1:min(len(Desc),len(SumInfo(1))))) ! prevent string length overrun + end subroutine WrSumInfoRcvd + +END SUBROUTINE EXavrSWAP_Init + + + +!================================================================================================================================== +!> This routine fills the extended avrSWAP +!FIXME: Error handling is not complete in this routine!!! +SUBROUTINE Fill_EXavrSWAP( t, u, p, dll_data ) + real(DbKi), intent(in ) :: t !< Current simulation time in seconds + type(SrvD_InputType), intent(in ) :: u !< Inputs at t + type(SrvD_ParameterType), intent(in ) :: p !< Parameters + type(BladedDLLType), intent(inout) :: dll_data !< data for the Bladed DLL + + ! local variables: + integer(IntKi) :: I,J ! Loop counter + integer(IntKi) :: ErrStat2 ! Error status of the operation (occurs after initial error) + character(ErrMsgLen) :: ErrMsg2 ! Error message if ErrStat2 /= ErrID_None + real(ReKi) :: rotations(3) + + ! Make sure we didn't get here by mistake + if ( .not. p%EXavrSWAP ) return + + ! Set the version info on the extended avrswap if using + dll_data%avrswap(1000) = real(EXavrSWAP_Ver,SiKi) + + call SetEXavrSWAP_Sensors() + + call SetEXavrSWAP_LidarSensors() + + call SetEXavrStC_Sensors() ! Intermingled with StC control channels passed back from DLL +CONTAINS + + + !> Set the sensor inputs for non-lidar channels. + !! avrSWAP(1001:2000) + subroutine SetEXavrSWAP_Sensors() + ! in case something got set wrong, don't try to write beyond array + if (size(dll_data%avrswap) < (ExSensors_StartIdx + ExSensors_MaxChan - 1) ) return + + !------------------ + ! Platform motion + ! NOTE: we are assuming small angle, and assuming that the reference orientation is the identity + ! - this is the same assumption as in ED where the platform motion mesh is calculated + ! NOTE: we are ignoring any small angle conversion errors here. Any small angle violations + ! will be caught and reported in ED,HD, SD. + rotations = GetSmllRotAngs(u%PtfmMotionMesh%Orientation(:,:,1), ErrStat2, Errmsg2) + dll_data%avrswap(1001:1003) = u%PtfmMotionMesh%TranslationDisp(1:3,1) ! Platform motion -- Displacement TDX, TDY, TDZ (m) + dll_data%avrswap(1004:1006) = rotations ! Platform motion -- Displacement RDX, RDY, RDZ (rad) + dll_data%avrswap(1007:1009) = u%PtfmMotionMesh%TranslationVel (1:3,1) ! Platform motion -- Velocity TVX, TVY, TVZ (m/s) + dll_data%avrswap(1010:1012) = u%PtfmMotionMesh%RotationVel (1:3,1) ! Platform motion -- Velocity RVX, RVY, RVZ (rad/s) + dll_data%avrswap(1013:1015) = u%PtfmMotionMesh%TranslationAcc (1:3,1) ! Platform motion -- Acceleration TAX, TAY, TAZ (m/s^2) + dll_data%avrswap(1016:1018) = u%PtfmMotionMesh%RotationAcc (1:3,1) ! Platform motion -- Acceleration RAX, RAY, RAZ (rad/s^2) + + !------------------ + ! Set other sensors here (non-lidar measurements) + ! Add summary file descriptions about channels to InitNonLidarSensors as channels are added. + + end subroutine SetEXavrSWAP_Sensors + + + !> Set the Lidar related sensor inputs + !! avrSWAP(2001:2500) + subroutine SetEXavrSWAP_LidarSensors() + ! in case something got set wrong, don't try to write beyond array + if (size(dll_data%avrswap) < (LidarMsr_StartIdx + LidarMsr_MaxChan - 1) ) return + end subroutine SetEXavrSWAP_LidarSensors + + !> Set the Lidar related sensor inputs + !! avrSWAP(2801:3000) + subroutine SetEXavrStC_Sensors() + ! in case something got set wrong, don't try to write beyond array + if (size(dll_data%avrswap) < (StCCtrl_StartIdx + StCCtrl_MaxChan - 1) ) return + if (p%NumStC_Control <=0) return ! Nothing to set + + !------------------ + ! StC sensors if used + do I=1,p%NumStC_Control + J=StCCtrl_StartIdx + ((I-1)*StCCtrl_ChanPerSet-1) ! Index into the full avrSWAP (minus 1 so counting is simpler) + dll_data%avrswap(J+ 1:J+ 3) = dll_data%StCMeasDisp(1:3,I) ! StC displacement -- TDX, TDY, TDZ (m) + dll_data%avrswap(J+ 4:J+ 6) = dll_data%StCMeasVel( 1:3,I) ! StC velocity -- TVX, TVY, TVZ (m/s) + enddo + ! for first call, we want to set the values retrieved from the StC for Stiffness, Damping, and Brake + if (.not. dll_data%initialized) then + do I=1,p%NumStC_Control + J=StCCtrl_StartIdx + ((I-1)*StCCtrl_ChanPerSet-1) ! Index into the full avrSWAP (minus 1 so counting is simpler) + dll_data%avrswap(J+ 7:J+ 9) = dll_data%PrevStCCmdStiff(1:3,I) ! StC initial stiffness -- StC_Stiff_X, StC_Stiff_Y, StC_Stiff_Z (N/m) + dll_data%avrswap(J+10:J+12) = dll_data%PrevStCCmdDamp( 1:3,I) ! StC initial damping -- StC_Damp_X, StC_Damp_Y, StC_Damp_Z (N/(m/s)) + dll_data%avrswap(J+13:J+15) = dll_data%PrevStCCmdBrake(1:3,I) ! StC initial brake -- StC_Brake_X, StC_Brake_Y, StC_Brake_Z (N) + dll_data%avrswap(J+16:J+18) = dll_data%PrevStCCmdForce(1:3,I) ! StC initial brake -- StC_Force_X, StC_Force_Y, StC_Force_Z (N) + enddo + endif + end subroutine SetEXavrStC_Sensors +END SUBROUTINE Fill_EXavrSWAP + + + +!================================================================================================================================== +!> This routine retrieves the extended avrSWAP +SUBROUTINE Retrieve_EXavrSWAP( p, dll_data, ErrStat, ErrMsg ) + type(SrvD_ParameterType), intent(in ) :: p !< Parameters + type(BladedDLLType), intent(inout) :: dll_data !< data for the Bladed DLL + integer(IntKi), intent( out) :: ErrStat !< Error status of the operation + character(ErrMsgLen), intent( out) :: ErrMsg !< Error message if ErrStat /= ErrID_None + + ! local variables: + integer(IntKi) :: I,J ! Loop counter + character(*), parameter :: RoutineName = 'Retrieve_EXavrSWAP' + + ! Initialize ErrStat and ErrMsg + ErrStat = ErrID_None + ErrMsg = '' + + call Retrieve_EXavrSWAP_Lidar () + call Retrieve_EXavrSWAP_Cable () + call Retrieve_EXavrSWAP_StControls () + call Retrieve_EXavrSWAP_AeroControls () + + ! Add other relevant routines here. As routines are added, make sure info + ! is included in the Init for writing channel info to summary file. + ! Additional data handling will be necessary: + ! - relevant arrays in dll_data in registry (for dll timestep interpolation) + ! - relevant xyzControl_CalcOutput for dll timestep interpolation + ! - relevant y% arrays for passing control signals out to glue code from + ! corresponding xyzControl_CalcOutput routines (ServoDyn.f90) + +CONTAINS + + !> Controller signals to Lidar module + !! avrSWAP(2501:2600) + subroutine Retrieve_EXavrSWAP_Lidar () + ! in case something got set wrong, don't try to read beyond array + if (size(dll_data%avrswap) < 2000 ) return + end subroutine Retrieve_EXavrSWAP_Lidar + + + !> Controller signals to mooring systems (active mooring) + !! avrSWAP(2601:2800) + subroutine Retrieve_EXavrSWAP_Cable () + if (allocated(dll_data%CableDeltaL) .and. allocated(dll_data%CableDeltaLdot)) then + ! in case something got set wrong, don't try to read beyond array + if (size(dll_data%avrswap) < CableCtrl_StartIdx+CableCtrl_MaxChan-1 ) return + do I=1,p%NumCableControl + J=CableCtrl_StartIdx + ((I-1)*2) ! Index into the full avrSWAP + dll_data%CableDeltaL(I) = dll_data%avrSWAP(J) + dll_data%CableDeltaLdot(I) = dll_data%avrSWAP(J+1) + enddo + endif + end subroutine Retrieve_EXavrSWAP_Cable + + + !> Controller signals to substructure controls (actuators in substructure) + !! avrSWAP(3001:3200) + subroutine Retrieve_EXavrSWAP_StControls () + ! in case something got set wrong, don't try to read beyond array + if (size(dll_data%avrswap) < (StCCtrl_StartIdx + StCCtrl_MaxChan - 1) ) return + if (p%NumStC_Control <=0) return ! Nothing to set + + !------------------ + ! Retrieve StC control channels here + do I=1,p%NumStC_Control + J=StCCtrl_StartIdx + ((I-1)*StCCtrl_ChanPerSet-1) ! Index into the full avrSWAP (minus 1 so counting is simpler) + dll_data%StCCmdStiff(1:3,I) = dll_data%avrswap(J+ 7:J+ 9) ! StC commmanded stiffness -- StC_Stiff_X, StC_Stiff_Y, StC_Stiff_Z (N/m) + dll_data%StCCmdDamp( 1:3,I) = dll_data%avrswap(J+10:J+12) ! StC commmanded damping -- StC_Damp_X, StC_Damp_Y, StC_Damp_Z (N/(m/s)) + dll_data%StCCmdBrake(1:3,I) = dll_data%avrswap(J+13:J+15) ! StC commmanded brake -- StC_Brake_X, StC_Brake_Y, StC_Brake_Z (N) + dll_data%StCCmdForce(1:3,I) = dll_data%avrswap(J+16:J+18) ! StC commmanded brake -- StC_Force_X, StC_Force_Y, StC_Force_Z (N) + enddo + + end subroutine Retrieve_EXavrSWAP_StControls + + + !> Controller signals to active aero elements (aero actuators in blades) + !! avrSWAP(3201:3500) + subroutine Retrieve_EXavrSWAP_AeroControls () + ! in case something got set wrong, don't try to read beyond array + if (size(dll_data%avrswap) < 3500 ) return + end subroutine Retrieve_EXavrSWAP_AeroControls + + +END SUBROUTINE Retrieve_EXavrSWAP + + +!================================================================================================================================== +END MODULE BladedInterface_EX diff --git a/modules/servodyn/src/ServoDyn.f90 b/modules/servodyn/src/ServoDyn.f90 index 615d6d17a2..3253bea851 100644 --- a/modules/servodyn/src/ServoDyn.f90 +++ b/modules/servodyn/src/ServoDyn.f90 @@ -136,9 +136,11 @@ SUBROUTINE SrvD_Init( InitInp, u, p, x, xd, z, OtherState, y, m, Interval, InitO TYPE(SrvD_InputFile) :: InputFileData ! Data stored in the module's input file TYPE(StC_InitInputType) :: StC_InitInp ! data to initialize StC module TYPE(StC_InitOutputType) :: StC_InitOut ! data from StC module initialization (not used) + type(StC_CtrlChanInitInfoType) :: StC_CtrlChanInitInfo !< initial values for StC damping, stiffness, etc to pass to controller INTEGER(IntKi) :: i ! loop counter INTEGER(IntKi) :: j ! loop counter INTEGER(IntKi) :: K ! loop counter + INTEGER(IntKi) :: UnSum ! Summary file unit INTEGER(IntKi) :: ErrStat2 ! temporary Error status of the operation CHARACTER(ErrMsgLen) :: ErrMsg2 ! temporary Error message if ErrStat /= ErrID_None @@ -150,6 +152,7 @@ SUBROUTINE SrvD_Init( InitInp, u, p, x, xd, z, OtherState, y, m, Interval, InitO ErrStat = ErrID_None ErrMsg = "" + UnSum = -1_IntKi ! Initialize the NWTC Subroutine Library @@ -189,11 +192,25 @@ SUBROUTINE SrvD_Init( InitInp, u, p, x, xd, z, OtherState, y, m, Interval, InitO CALL ValidatePrimaryData( InitInp, InputFileData, ErrStat2, ErrMsg2 ) if (Failed()) return; + if ( (InitInp%NumCtrl2SC > 0 .and. InitInp%NumCtrl2SC <= 0) .or. & + (InitInp%NumSC2Ctrl <= 0 .and. InitInp%NumSC2Ctrl > 0) ) then + call SetErrStat( ErrID_Fatal, "If supercontroller is used, there must be at least one supercontroller input and one supercontroller output.",ErrStat,ErrMsg,RoutineName) + call Cleanup() + return + end if + + !............................................................................................ + ! Start a summary file (if requested): + !............................................................................................ + call InitializeSummaryFile( InputFileData, TRIM(InitInp%RootName), UnSum, ErrStat2, ErrMsg2 ) + if (Failed()) return; + !............................................................................................ ! Define parameters here: !............................................................................................ - CALL SrvD_SetParameters( InputFileData, p, ErrStat2, ErrMsg2 ) + CALL SrvD_SetParameters( InputFileData, p, UnSum, ErrStat2, ErrMsg2 ) if (Failed()) return; + p%InterpOrder = InitInp%InterpOrder ! Store this for setting StC input array sizes stored in MiscVars%u_xStC ! Set and verify BlPitchInit, which comes from InitInputData (not the inputfiledata) CALL AllocAry( p%BlPitchInit, p%NumBl, 'BlPitchInit', ErrStat2, ErrMsg2 ) @@ -205,6 +222,55 @@ SUBROUTINE SrvD_Init( InitInp, u, p, x, xd, z, OtherState, y, m, Interval, InitO call Cleanup() END IF + + !............................................................................................ + ! Setup and initialize the StC submodule (possibly multiple instances at each location) + !............................................................................................ + if (UnSum >0) then + write(UnSum, '(A)') '' + write(UnSum, '(A)') SectionDivide + write(UnSum, '(A)') ' Structural controls' + endif + call StC_Blade_Setup(InitInp,p,InputFileData,u,y,m%SrvD_MeshMap,m%u_BStC,p%BStC,x%BStC,xd%BStC,z%BStC,OtherState%BStC,m%y_BStC,m%BStC,UnSum,ErrStat2,ErrMsg2) + if (Failed()) return; + + call StC_Nacelle_Setup(InitInp,p,InputFileData,u,y,m%SrvD_MeshMap,m%u_NStC,p%NStC,x%NStC,xd%NStC,z%NStC,OtherState%NStC,m%y_NStC,m%NStC,UnSum,ErrStat2,ErrMsg2) + if (Failed()) return; + + call StC_Tower_Setup(InitInp,p,InputFileData,u,y,m%SrvD_MeshMap,m%u_TStC,p%TStC,x%TStC,xd%TStC,z%TStC,OtherState%TStC,m%y_TStC,m%TStC,UnSum,ErrStat2,ErrMsg2) + if (Failed()) return; + + call StC_Substruc_Setup(InitInp,p,InputFileData,u,y,m%SrvD_MeshMap,m%u_SStC,p%SStC,x%SStC,xd%SStC,z%SStC,OtherState%SStC,m%y_SStC,m%SStC,UnSum,ErrStat2,ErrMsg2) + if (Failed()) return; + + !............................................................................................ + ! Setup and initialize the StC controls interface + !............................................................................................ + + ! Setup the StC_CtrlChans + call StC_CtrlChan_Setup(m,p,StC_CtrlChanInitInfo,UnSum,ErrStat2,ErrMsg2) + if (Failed()) return; + + + !............................................. + ! Determine if the BladedDLL should be called + ! this must be done after StC initialization, + ! so can't do this in the set parameters routine + !............................................. + + IF ( p%PCMode == ControlMode_DLL .OR. & + p%YCMode == ControlMode_DLL .OR. & + p%VSContrl == ControlMode_DLL .OR. & + p%HSSBrMode == ControlMode_DLL .OR. & + p%AfCmode == ControlMode_DLL .OR. & + p%CCmode == ControlMode_DLL .OR. & + p%StCCMode == ControlMode_DLL ) THEN + p%UseBladedInterface = .TRUE. + ELSE + p%UseBladedInterface = .FALSE. + END IF + + !............................................................................................ ! Define initial system states here: !............................................................................................ @@ -274,6 +340,9 @@ SUBROUTINE SrvD_Init( InitInp, u, p, x, xd, z, OtherState, y, m, Interval, InitO end if END IF + CALL AllocAry( u%ExternalBlAirfoilCom, p%NumBl, 'ExternalBlAirfoilCom', ErrStat2, ErrMsg2 ) + if (Failed()) return; + IF (p%UseBladedInterface) THEN CALL AllocAry( u%fromSCglob, InitInp%NumSC2CtrlGlob, 'u%fromSCglob', ErrStat2, ErrMsg2 ) if (Failed()) return; @@ -297,6 +366,7 @@ SUBROUTINE SrvD_Init( InitInp, u, p, x, xd, z, OtherState, y, m, Interval, InitO u%ExternalGenTrq = 0. u%ExternalElecPwr = 0. u%ExternalHSSBrFrac = 0. + u%ExternalBlAirfoilCom = 0. u%TwrAccel = 0. u%YawErr = 0. @@ -376,7 +446,33 @@ SUBROUTINE SrvD_Init( InitInp, u, p, x, xd, z, OtherState, y, m, Interval, InitO ! this module must be called here: !............................................................................................ - Interval = p%DT + Interval = p%DT + + + !............................................................................................ + ! Setup and initialize the cable controls -- could be from Simulink or DLL + !............................................................................................ + p%NumCableControl = InitInp%NumCableControl + ! Outputs from SrvD -- we allocate this if any cable control signals were requested. + ! -- only allocate what is needed -- OpenFAST glue code has logic for this + if (p%NumCableControl > 0) then + call AllocAry( y%CableDeltaL, p%NumCableControl, 'CableDeltaL', ErrStat2, ErrMsg2 ) + if (Failed()) return + call AllocAry( y%CableDeltaLdot, p%NumCableControl, 'CableDeltaLdot', ErrStat2, ErrMsg2 ) + if (Failed()) return + + call AllocAry( u%ExternalCableDeltaL, p%NumCableControl, 'ExternalCableDeltaL', ErrStat2, ErrMsg2 ) + if (Failed()) return + call AllocAry( u%ExternalCableDeltaLdot, p%NumCableControl, 'ExternalCableDeltaLdot', ErrStat2, ErrMsg2 ) + if (Failed()) return + + y%CableDeltaL = 0.0_ReKi + y%CableDeltaLdot = 0.0_ReKi + u%ExternalCableDeltaL = 0.0_ReKi + u%ExternalCableDeltaLdot = 0.0_ReKi + endif + + !............................................................................................ ! After we've set up all the data for everything else, we'll call the routines to initialize the Bladed Interface @@ -384,11 +480,16 @@ SUBROUTINE SrvD_Init( InitInp, u, p, x, xd, z, OtherState, y, m, Interval, InitO !............................................................................................ IF ( p%UseBladedInterface ) THEN + if (UnSum >0) then + write(UnSum, '(A)') '' + write(UnSum, '(A)') SectionDivide + write(UnSum, '(A)') ' Bladed Interface: in use' + endif p%AirDens = InitInp%AirDens p%AvgWindSpeed = InitInp%AvgWindSpeed - - CALL BladedInterface_Init(u, p, m, xd, y, InputFileData, InitInp, ErrStat2, ErrMsg2 ) + + CALL BladedInterface_Init(u, p, m, xd, y, InputFileData, InitInp, StC_CtrlChanInitInfo, UnSum, ErrStat2, ErrMsg2 ) if (Failed()) return; m%LastTimeCalled = - m%dll_data%DLL_DT ! we'll initialize the last time the DLL was called as -1 DLL_DT. @@ -400,26 +501,24 @@ SUBROUTINE SrvD_Init( InitInp, u, p, x, xd, z, OtherState, y, m, Interval, InitO p%DLL_Trgt%FileName = "" p%DLL_Trgt%ProcName = "" - + + if (UnSum >0) then + write(UnSum, '(A)') '' + write(UnSum, '(A)') SectionDivide + write(UnSum, '(A)') ' Bladed Interface: not used' + endif END IF - - + + !............................................................................................ - ! Setup and initialize the StC submodule (possibly multiple instances at each location) + ! If we are using the Simulink interface, add info to summary file. !............................................................................................ - call StC_Nacelle_Setup(InitInp,p,InputFileData,u%NStC,p%NStC,x%NStC,xd%NStC,z%NStC,OtherState%NStC,y%NStC,m%NStC,ErrStat2,ErrMsg2) - if (Failed()) return; - - call StC_Tower_Setup(InitInp,p,InputFileData,u%TStC,p%TStC,x%TStC,xd%TStC,z%TStC,OtherState%TStC,y%TStC,m%TStC,ErrStat2,ErrMsg2) - if (Failed()) return; - - call StC_Blade_Setup(InitInp,p,InputFileData,u%BStC,p%BStC,x%BStC,xd%BStC,z%BStC,OtherState%BStC,y%BStC,m%BStC,ErrStat2,ErrMsg2) - if (Failed()) return; - - call StC_S_Setup(InitInp,p,InputFileData,u%SStC,p%SStC,x%SStC,xd%SStC,z%SStC,OtherState%SStC,y%SStC,m%SStC,ErrStat2,ErrMsg2) - if (Failed()) return; + if (UnSum >0 .and. Cmpl4SFun) then + call WrSumInfo4Simulink(p,ControlMode_EXTERN,UnSum) + END IF + !............................................................................................ ! Set Init outputs for linearization (after StrucCtrl, in case we ever add the StrucCtrl to the linearization features): !............................................................................................ @@ -517,6 +616,12 @@ SUBROUTINE SrvD_Init( InitInp, u, p, x, xd, z, OtherState, y, m, Interval, InitO END IF + !............................................................................................ + ! Close summary file: + !............................................................................................ + call SrvD_CloseSum( UnSum, ErrStat2, ErrMsg2 ) + call SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) + !............................................................................................ ! Clean up the local variables: !............................................................................................ @@ -532,20 +637,25 @@ logical function Failed() if (Failed) call Cleanup() end function Failed subroutine Cleanup() ! Ignore any errors here + if (UnSum > 0) close(UnSum) CALL SrvD_DestroyInputFile(InputFileData, ErrStat2, ErrMsg2 ) CALL StC_DestroyInitInput(StC_InitInp, ErrStat2, ErrMsg2 ) CALL StC_DestroyInitOutput(StC_InitOut, ErrStat2, ErrMsg2 ) + CALL StC_DestroyCtrlChanInitInfoType(StC_CtrlChanInitInfo, ErrStat2, ErrMsg2 ) end subroutine Cleanup END SUBROUTINE SrvD_Init !---------------------------------------------------------------------------------------------------------------------------------- !---------------------------------------------------------------------------------------------------------------------------------- !> This routine sets the data structures for the structural control (StC) module -- Nacelle Instances -subroutine StC_Nacelle_Setup(SrvD_InitInp,SrvD_p,InputFileData,u,p,x,xd,z,OtherState,y,m,ErrStat,ErrMsg) +subroutine StC_Nacelle_Setup(SrvD_InitInp,SrvD_p,InputFileData,SrvD_u,SrvD_y,SrvD_MeshMap,u,p,x,xd,z,OtherState,y,m,UnSum,ErrStat,ErrMsg) type(SrvD_InitInputType), intent(in ) :: SrvD_InitInp !< Input data for initialization routine type(SrvD_ParameterType), intent(in ) :: SrvD_p !< Parameters - TYPE(SrvD_InputFile), intent(in ) :: InputFileData ! Data stored in the module's input file - type(StC_InputType), allocatable,intent( out) :: u(:) !< An initial guess for the input; input mesh must be defined + type(SrvD_InputFile), intent(in ) :: InputFileData ! Data stored in the module's input file + type(SrvD_InputType), intent(inout) :: SrvD_u !< SrvD inputs (for setting up meshes) + type(SrvD_OutputType), intent(inout) :: SrvD_y !< SrvD outputs (for setting up meshes) + type(SrvD_ModuleMapType), intent(inout) :: SrvD_MeshMap !< Mesh mapping + type(StC_InputType), allocatable,intent( out) :: u(:,:) !< An initial guess for the input; input mesh must be defined type(StC_ParameterType), allocatable,intent( out) :: p(:) !< Parameters type(StC_ContinuousStateType), allocatable,intent( out) :: x(:) !< Initial continuous states type(StC_DiscreteStateType), allocatable,intent( out) :: xd(:) !< Initial discrete states @@ -553,11 +663,13 @@ subroutine StC_Nacelle_Setup(SrvD_InitInp,SrvD_p,InputFileData,u,p,x,xd,z,OtherS type(StC_OtherStateType), allocatable,intent( out) :: OtherState(:) !< Initial other states type(StC_OutputType), allocatable,intent( out) :: y(:) !< Initial system outputs (outputs are not calculated; type(StC_MiscVarType), allocatable,intent( out) :: m(:) !< Misc (optimization) variables + integer(IntKi), intent(in ) :: UnSum !< summary file number (>0 when set) integer(IntKi), intent( out) :: ErrStat !< Error status of the operation character(*), intent( out) :: ErrMsg !< Error message if ErrStat /= ErrID_None integer(IntKi) :: ErrStat2 ! temporary Error status of the operation character(ErrMsgLen) :: ErrMsg2 ! temporary Error message if ErrStat /= ErrID_None + integer(IntKi) :: i ! Counter for the input interp order integer(IntKi) :: j ! Counter for the instances real(DbKi) :: Interval !< Coupling interval in seconds from StC type(StC_InitInputType) :: StC_InitInp !< data to initialize StC module @@ -568,7 +680,8 @@ subroutine StC_Nacelle_Setup(SrvD_InitInp,SrvD_p,InputFileData,u,p,x,xd,z,OtherS ErrMsg = "" if (SrvD_p%NumNStC > 0_IntKi) then - allocate(u(SrvD_p%NumNStC), STAT=ErrStat2); if ( AllErr('Could not allocate StrucCtrl input array, u') ) return; + ! StC types + allocate(u(SrvD_p%InterpOrder+1,SrvD_p%NumNStC), STAT=ErrStat2); if ( AllErr('Could not allocate StrucCtrl input array, u') ) return; allocate(p(SrvD_p%NumNStC), STAT=ErrStat2); if ( AllErr('Could not allocate StrucCtrl input array, p') ) return; allocate(x(SrvD_p%NumNStC), STAT=ErrStat2); if ( AllErr('Could not allocate StrucCtrl input array, x') ) return; allocate(xd(SrvD_p%NumNStC),STAT=ErrStat2); if ( AllErr('Could not allocate StrucCtrl input array, xd') ) return; @@ -576,6 +689,11 @@ subroutine StC_Nacelle_Setup(SrvD_InitInp,SrvD_p,InputFileData,u,p,x,xd,z,OtherS allocate(OtherState(SrvD_p%NumNStC), STAT=ErrStat2); if ( AllErr('Could not allocate StrucCtrl input array, OtherState') ) return; allocate(y(SrvD_p%NumNStC), STAT=ErrStat2); if ( AllErr('Could not allocate StrucCtrl input array, y') ) return; allocate(m(SrvD_p%NumNStC), STAT=ErrStat2); if ( AllErr('Could not allocate StrucCtrl input array, m') ) return; + ! SrvD mesh stuff + allocate(SrvD_u%NStCMotionMesh(SrvD_p%NumNStC), SrvD_y%NStCLoadMesh(SrvD_p%NumNStC), STAT=ErrStat2) + if ( AllErr('Could not allocate motion u%NStCMotionMesh and y%NStCLoadMesh') ) return; + allocate(SrvD_MeshMap%u_NStC_Mot2_NStC(SrvD_p%NumNStC), SrvD_MeshMap%NStC_Frc2_y_NStC(SrvD_p%NumNStC), STAT=ErrStat2) + if ( AllErr('Could not allocate motion nacelle mesh mappings' ) ) return; do j=1,SrvD_p%NumNStC StC_InitInp%InputFile = InputFileData%NStCfiles(j) @@ -584,18 +702,56 @@ subroutine StC_Nacelle_Setup(SrvD_InitInp,SrvD_p,InputFileData,u,p,x,xd,z,OtherS StC_InitInp%NumMeshPts = 1_IntKi ! single point mesh for Nacelle Interval = SrvD_p%DT ! Pass the ServoDyn DT - CALL AllocAry( StC_InitInp%InitPosition, 3, StC_InitInp%NumMeshPts, 'StC_InitInp%InitPosition', errStat2, ErrMsg2); if (Failed()) return; - CALL AllocAry( StC_InitInp%InitOrientation,3, 3, StC_InitInp%NumMeshPts, 'StC_InitInp%InitOrientation', errStat2, ErrMsg2); if (Failed()) return; - StC_InitInp%InitPosition(:,1) = SrvD_InitInp%NacPosition - StC_InitInp%InitOrientation(:,:,1) = SrvD_InitInp%NacOrientation + CALL AllocAry( StC_InitInp%InitRefPos, 3, StC_InitInp%NumMeshPts, 'StC_InitInp%InitRefPos', errStat2, ErrMsg2); if (Failed()) return; + CALL AllocAry( StC_InitInp%InitTransDisp, 3, StC_InitInp%NumMeshPts, 'StC_InitInp%InitTransDisp', errStat2, ErrMsg2); if (Failed()) return; + CALL AllocAry( StC_InitInp%InitRefOrient, 3, 3, StC_InitInp%NumMeshPts, 'StC_InitInp%InitRefOrient', errStat2, ErrMsg2); if (Failed()) return; + CALL AllocAry( StC_InitInp%InitOrient, 3, 3, StC_InitInp%NumMeshPts, 'StC_InitInp%InitOrient', errStat2, ErrMsg2); if (Failed()) return; + StC_InitInp%InitRefPos(1:3,1) = SrvD_InitInp%NacRefPos(1:3) + StC_InitInp%InitTransDisp(1:3,1) = SrvD_InitInp%NacTransDisp(1:3) + StC_InitInp%InitRefOrient(1:3,1:3,1) = SrvD_InitInp%NacRefOrient(1:3,1:3) + StC_InitInp%InitOrient(1:3,1:3,1) = SrvD_InitInp%NacOrient(1:3,1:3) - CALL StC_Init( StC_InitInp, u(j), p(j), x(j), xd(j), z(j), OtherState(j), y(j), m(j), Interval, StC_InitOut, ErrStat2, ErrMsg2 ) + + CALL StC_Init( StC_InitInp, u(1,j), p(j), x(j), xd(j), z(j), OtherState(j), y(j), m(j), Interval, StC_InitOut, ErrStat2, ErrMsg2 ) if (Failed()) return; - IF (.NOT. EqualRealNos( Interval, SrvD_p%DT ) ) & - CALL SetErrStat( ErrID_Fatal, "Nacelle StrucCtrl (instance "//trim(num2lstr(j))//") time step differs from SrvD time step.",ErrStat,ErrMsg,RoutineName ) + IF (.NOT. EqualRealNos( Interval, SrvD_p%DT ) ) then + ErrStat2=ErrID_Fatal + ErrMsg2="Nacelle StrucCtrl (instance "//trim(num2lstr(j))//") time step differs from SrvD time step." + endif if (Failed()) return; + ! Copy u(1,:) to all input so interp works correctly in StC + do i = 2, SrvD_p%InterpOrder + 1 + call StC_CopyInput (u(1,j), u(i,j), MESH_NEWCOPY, Errstat2, ErrMsg2) + if (Failed()) return; + enddo + + ! SrvD meshes <-> NStC meshes -- only one Mesh point per NStC instance + call MeshCopy( SrcMesh=u(1,j)%Mesh(1), DestMesh=SrvD_u%NStCMotionMesh(j), CtrlCode=MESH_COUSIN, & + IOS=COMPONENT_INPUT, ErrStat=ErrStat2, ErrMess=ErrMsg2, & + TranslationDisp = .TRUE., Orientation = .TRUE., & + TranslationVel = .TRUE., RotationVel = .TRUE., & + TranslationAcc = .TRUE., RotationAcc = .TRUE.) + if (Failed()) return + call MeshMapCreate( u(1,j)%Mesh(1), SrvD_u%NStCMotionMesh(j), SrvD_MeshMap%u_NStC_Mot2_NStC(j), ErrStat2, ErrMsg2 ) + if (Failed()) return + call MeshCopy( SrcMesh=y(j)%Mesh(1), DestMesh=SrvD_y%NStCLoadMesh(j), CtrlCode=MESH_COUSIN, & + IOS=COMPONENT_OUTPUT, ErrStat=ErrStat2, ErrMess=ErrMsg2, Force=.True., Moment=.True.) + if (Failed()) return + call MeshMapCreate( y(j)%Mesh(1), SrvD_y%NStCLoadMesh(j), SrvD_MeshMap%NStC_Frc2_y_NStC(j), ErrStat2, ErrMsg2 ) + if (Failed()) return + + ! A little bit of information about the StC location + if (unsum >0) then + write(UnSum, '(A26,i2)') ' Nacelle StC instance: ',j + write(UnSum, '(10x,A)') 'Input file: '//trim(InputFileData%NStCfiles(j)) + write(UnSum, '(10x,A36)') 'Initial location (global/inertial): ' + write(UnSum, '(20x,3(2x,ES10.3e2))') u(1,j)%Mesh(1)%Position(1:3,1) + write(UnSum, '(10x,A60)') 'Initial location relative to nacelle (nacelle coordinates): ' + write(UnSum, '(20x,3(2x,ES10.3e2))') StC_InitOut%RelPosition(1:3,1) + endif + call Cleanup() enddo endif @@ -620,11 +776,14 @@ end subroutine Cleanup end subroutine StC_Nacelle_Setup !---------------------------------------------------------------------------------------------------------------------------------- !> This routine sets the data structures for the structural control (StC) module -- Tower instances -subroutine StC_Tower_Setup(SrvD_InitInp,SrvD_p,InputFileData,u,p,x,xd,z,OtherState,y,m,ErrStat,ErrMsg) +subroutine StC_Tower_Setup(SrvD_InitInp,SrvD_p,InputFileData,SrvD_u,SrvD_y,SrvD_MeshMap,u,p,x,xd,z,OtherState,y,m,UnSum,ErrStat,ErrMsg) type(SrvD_InitInputType), intent(in ) :: SrvD_InitInp !< Input data for initialization routine type(SrvD_ParameterType), intent(in ) :: SrvD_p !< Parameters - TYPE(SrvD_InputFile), intent(in ) :: InputFileData ! Data stored in the module's input file - type(StC_InputType), allocatable,intent( out) :: u(:) !< An initial guess for the input; input mesh must be defined + type(SrvD_InputFile), intent(in ) :: InputFileData ! Data stored in the module's input file + type(SrvD_InputType), intent(inout) :: SrvD_u !< SrvD inputs (for setting up meshes) + type(SrvD_OutputType), intent(inout) :: SrvD_y !< SrvD outputs (for setting up meshes) + type(SrvD_ModuleMapType), intent(inout) :: SrvD_MeshMap !< Mesh mapping + type(StC_InputType), allocatable,intent( out) :: u(:,:) !< An initial guess for the input; input mesh must be defined type(StC_ParameterType), allocatable,intent( out) :: p(:) !< Parameters type(StC_ContinuousStateType), allocatable,intent( out) :: x(:) !< Initial continuous states type(StC_DiscreteStateType), allocatable,intent( out) :: xd(:) !< Initial discrete states @@ -632,11 +791,13 @@ subroutine StC_Tower_Setup(SrvD_InitInp,SrvD_p,InputFileData,u,p,x,xd,z,OtherSta type(StC_OtherStateType), allocatable,intent( out) :: OtherState(:) !< Initial other states type(StC_OutputType), allocatable,intent( out) :: y(:) !< Initial system outputs (outputs are not calculated; type(StC_MiscVarType), allocatable,intent( out) :: m(:) !< Misc (optimization) variables + integer(IntKi), intent(in ) :: UnSum !< summary file number (>0 when set) integer(IntKi), intent( out) :: ErrStat !< Error status of the operation character(*), intent( out) :: ErrMsg !< Error message if ErrStat /= ErrID_None integer(IntKi) :: ErrStat2 ! temporary Error status of the operation character(ErrMsgLen) :: ErrMsg2 ! temporary Error message if ErrStat /= ErrID_None + integer(IntKi) :: i ! Counter for the input interp order integer(IntKi) :: j ! Counter for the instances real(DbKi) :: Interval !< Coupling interval in seconds from StC type(StC_InitInputType) :: StC_InitInp !< data to initialize StC module @@ -647,7 +808,8 @@ subroutine StC_Tower_Setup(SrvD_InitInp,SrvD_p,InputFileData,u,p,x,xd,z,OtherSta ErrMsg = "" if (SrvD_p%NumTStC > 0_IntKi) then - allocate(u(SrvD_p%NumTStC), STAT=ErrStat2); if ( AllErr('Could not allocate StrucCtrl input array, u') ) return; + ! StC types + allocate(u(SrvD_p%InterpOrder+1,SrvD_p%NumTStC), STAT=ErrStat2); if ( AllErr('Could not allocate StrucCtrl input array, u') ) return; allocate(p(SrvD_p%NumTStC), STAT=ErrStat2); if ( AllErr('Could not allocate StrucCtrl input array, p') ) return; allocate(x(SrvD_p%NumTStC), STAT=ErrStat2); if ( AllErr('Could not allocate StrucCtrl input array, x') ) return; allocate(xd(SrvD_p%NumTStC),STAT=ErrStat2); if ( AllErr('Could not allocate StrucCtrl input array, xd') ) return; @@ -655,6 +817,11 @@ subroutine StC_Tower_Setup(SrvD_InitInp,SrvD_p,InputFileData,u,p,x,xd,z,OtherSta allocate(OtherState(SrvD_p%NumTStC), STAT=ErrStat2); if ( AllErr('Could not allocate StrucCtrl input array, OtherState') ) return; allocate(y(SrvD_p%NumTStC), STAT=ErrStat2); if ( AllErr('Could not allocate StrucCtrl input array, y') ) return; allocate(m(SrvD_p%NumTStC), STAT=ErrStat2); if ( AllErr('Could not allocate StrucCtrl input array, m') ) return; + ! SrvD mesh stuff + allocate(SrvD_u%TStCMotionMesh(SrvD_p%NumTStC), SrvD_y%TStCLoadMesh(SrvD_p%NumTStC), STAT=ErrStat2) + if ( AllErr('Could not allocate motion u%TStCMotionMesh and y%TStCLoadMesh') ) return; + allocate(SrvD_MeshMap%u_TStC_Mot2_TStC(SrvD_p%NumTStC), SrvD_MeshMap%TStC_Frc2_y_TStC(SrvD_p%NumTStC), STAT=ErrStat2) + if ( AllErr('Could not allocate motion tower mesh mappings' ) ) return; do j=1,SrvD_p%NumTStC StC_InitInp%InputFile = InputFileData%TStCfiles(j) @@ -663,18 +830,53 @@ subroutine StC_Tower_Setup(SrvD_InitInp,SrvD_p,InputFileData,u,p,x,xd,z,OtherSta StC_InitInp%NumMeshPts = 1_IntKi ! single point mesh for Tower Interval = SrvD_p%DT ! Pass the ServoDyn DT - CALL AllocAry( StC_InitInp%InitPosition, 3, StC_InitInp%NumMeshPts, 'StC_InitInp%InitPosition', errStat2, ErrMsg2); if (Failed()) return; - CALL AllocAry( StC_InitInp%InitOrientation,3, 3, StC_InitInp%NumMeshPts, 'StC_InitInp%InitOrientation', errStat2, ErrMsg2); if (Failed()) return; - StC_InitInp%InitPosition(:,1) = SrvD_InitInp%TwrBasePos - StC_InitInp%InitOrientation(:,:,1) = SrvD_InitInp%TwrBaseOrient + CALL AllocAry( StC_InitInp%InitRefPos, 3, StC_InitInp%NumMeshPts, 'StC_InitInp%InitRefPos', errStat2, ErrMsg2); if (Failed()) return; + CALL AllocAry( StC_InitInp%InitTransDisp, 3, StC_InitInp%NumMeshPts, 'StC_InitInp%InitTransDisp', errStat2, ErrMsg2); if (Failed()) return; + CALL AllocAry( StC_InitInp%InitRefOrient, 3, 3, StC_InitInp%NumMeshPts, 'StC_InitInp%InitRefOrient', errStat2, ErrMsg2); if (Failed()) return; + CALL AllocAry( StC_InitInp%InitOrient, 3, 3, StC_InitInp%NumMeshPts, 'StC_InitInp%InitOrient', errStat2, ErrMsg2); if (Failed()) return; + StC_InitInp%InitRefPos(1:3,1) = SrvD_InitInp%TwrBaseRefPos(1:3) + StC_InitInp%InitTransDisp(1:3,1) = SrvD_InitInp%TwrBaseTransDisp(1:3) + StC_InitInp%InitRefOrient(1:3,1:3,1) = SrvD_InitInp%TwrBaseRefOrient(1:3,1:3) + StC_InitInp%InitOrient(1:3,1:3,1) = SrvD_InitInp%TwrBaseOrient(1:3,1:3) - CALL StC_Init( StC_InitInp, u(j), p(j), x(j), xd(j), z(j), OtherState(j), y(j), m(j), Interval, StC_InitOut, ErrStat2, ErrMsg2 ) + CALL StC_Init( StC_InitInp, u(1,j), p(j), x(j), xd(j), z(j), OtherState(j), y(j), m(j), Interval, StC_InitOut, ErrStat2, ErrMsg2 ) if (Failed()) return; IF (.NOT. EqualRealNos( Interval, SrvD_p%DT ) ) & CALL SetErrStat( ErrID_Fatal, "Tower StrucCtrl (instance "//trim(num2lstr(j))//") time step differs from SrvD time step.",ErrStat,ErrMsg,RoutineName ) if (Failed()) return; + ! Copy u(1,:) to all input so interp works correctly in StC + do i = 2, SrvD_p%InterpOrder + 1 + call StC_CopyInput (u(1,j), u(i,j), MESH_NEWCOPY, Errstat2, ErrMsg2) + if (Failed()) return; + enddo + + ! SrvD meshes <-> TStC meshes -- only one Mesh point per TStC instance + call MeshCopy( SrcMesh=u(1,j)%Mesh(1), DestMesh=SrvD_u%TStCMotionMesh(j), CtrlCode=MESH_COUSIN, & + IOS=COMPONENT_INPUT, ErrStat=ErrStat2, ErrMess=ErrMsg2, & + TranslationDisp = .TRUE., Orientation = .TRUE., & + TranslationVel = .TRUE., RotationVel = .TRUE., & + TranslationAcc = .TRUE., RotationAcc = .TRUE.) + if (Failed()) return + call MeshMapCreate( u(1,j)%Mesh(1), SrvD_u%TStCMotionMesh(j), SrvD_MeshMap%u_TStC_Mot2_TStC(j), ErrStat2, ErrMsg2 ) + if (Failed()) return + call MeshCopy( SrcMesh=y(j)%Mesh(1), DestMesh=SrvD_y%TStCLoadMesh(j), CtrlCode=MESH_COUSIN, & + IOS=COMPONENT_OUTPUT, ErrStat=ErrStat2, ErrMess=ErrMsg2, Force=.True., Moment=.True.) + if (Failed()) return + call MeshMapCreate( y(j)%Mesh(1), SrvD_y%TStCLoadMesh(j), SrvD_MeshMap%TStC_Frc2_y_TStC(j), ErrStat2, ErrMsg2 ) + if (Failed()) return + + ! A little bit of information about the StC location + if (unsum >0) then + write(UnSum, '(A24,i2)') ' Tower StC instance: ',j + write(UnSum, '(10x,A)') 'Input file: '//trim(InputFileData%NStCfiles(j)) + write(UnSum, '(10x,A36)') 'Initial location (global/inertial): ' + write(UnSum, '(20x,3(2x,ES10.3e2))') u(1,j)%Mesh(1)%Position(1:3,1) + write(UnSum, '(10x,A61)') 'Initial location relative to tower base (tower coordinates): ' + write(UnSum, '(20x,3(2x,ES10.3e2))') StC_InitOut%RelPosition(1:3,1) + endif + call Cleanup() enddo endif @@ -699,11 +901,14 @@ end subroutine Cleanup end subroutine StC_Tower_Setup !---------------------------------------------------------------------------------------------------------------------------------- !> This routine sets the data structures for the structural control (StC) module -- Blade instances -subroutine StC_Blade_Setup(SrvD_InitInp,SrvD_p,InputFileData,u,p,x,xd,z,OtherState,y,m,ErrStat,ErrMsg) +subroutine StC_Blade_Setup(SrvD_InitInp,SrvD_p,InputFileData,SrvD_u,SrvD_y,SrvD_MeshMap,u,p,x,xd,z,OtherState,y,m,UnSum,ErrStat,ErrMsg) type(SrvD_InitInputType), intent(in ) :: SrvD_InitInp !< Input data for initialization routine type(SrvD_ParameterType), intent(in ) :: SrvD_p !< Parameters - TYPE(SrvD_InputFile), intent(in ) :: InputFileData ! Data stored in the module's input file - type(StC_InputType), allocatable,intent( out) :: u(:) !< An initial guess for the input; input mesh must be defined + type(SrvD_InputFile), intent(in ) :: InputFileData ! Data stored in the module's input file + type(SrvD_InputType), intent(inout) :: SrvD_u !< SrvD inputs (for setting up meshes) + type(SrvD_OutputType), intent(inout) :: SrvD_y !< SrvD outputs (for setting up meshes) + type(SrvD_ModuleMapType), intent(inout) :: SrvD_MeshMap !< Mesh mapping + type(StC_InputType), allocatable,intent( out) :: u(:,:) !< An initial guess for the input; input mesh must be defined type(StC_ParameterType), allocatable,intent( out) :: p(:) !< Parameters type(StC_ContinuousStateType), allocatable,intent( out) :: x(:) !< Initial continuous states type(StC_DiscreteStateType), allocatable,intent( out) :: xd(:) !< Initial discrete states @@ -711,11 +916,13 @@ subroutine StC_Blade_Setup(SrvD_InitInp,SrvD_p,InputFileData,u,p,x,xd,z,OtherSta type(StC_OtherStateType), allocatable,intent( out) :: OtherState(:) !< Initial other states type(StC_OutputType), allocatable,intent( out) :: y(:) !< Initial system outputs (outputs are not calculated; type(StC_MiscVarType), allocatable,intent( out) :: m(:) !< Misc (optimization) variables + integer(IntKi), intent(in ) :: UnSum !< summary file number (>0 when set) integer(IntKi), intent( out) :: ErrStat !< Error status of the operation character(*), intent( out) :: ErrMsg !< Error message if ErrStat /= ErrID_None integer(IntKi) :: ErrStat2 ! temporary Error status of the operation character(ErrMsgLen) :: ErrMsg2 ! temporary Error message if ErrStat /= ErrID_None + integer(IntKi) :: i ! Counter for the input interp order integer(IntKi) :: j ! Counter for the instances integer(IntKi) :: k ! Counter for the blade real(DbKi) :: Interval !< Coupling interval in seconds from StC @@ -727,7 +934,8 @@ subroutine StC_Blade_Setup(SrvD_InitInp,SrvD_p,InputFileData,u,p,x,xd,z,OtherSta ErrMsg = "" if (SrvD_p%NumBStC > 0_IntKi) then - allocate(u(SrvD_p%NumBStC), STAT=ErrStat2); if ( AllErr('Could not allocate StrucCtrl input array, u') ) return; + ! StC types + allocate(u(SrvD_p%InterpOrder+1,SrvD_p%NumBStC), STAT=ErrStat2); if ( AllErr('Could not allocate StrucCtrl input array, u') ) return; allocate(p(SrvD_p%NumBStC), STAT=ErrStat2); if ( AllErr('Could not allocate StrucCtrl input array, p') ) return; allocate(x(SrvD_p%NumBStC), STAT=ErrStat2); if ( AllErr('Could not allocate StrucCtrl input array, x') ) return; allocate(xd(SrvD_p%NumBStC),STAT=ErrStat2); if ( AllErr('Could not allocate StrucCtrl input array, xd') ) return; @@ -735,6 +943,11 @@ subroutine StC_Blade_Setup(SrvD_InitInp,SrvD_p,InputFileData,u,p,x,xd,z,OtherSta allocate(OtherState(SrvD_p%NumBStC), STAT=ErrStat2); if ( AllErr('Could not allocate StrucCtrl input array, OtherState') ) return; allocate(y(SrvD_p%NumBStC), STAT=ErrStat2); if ( AllErr('Could not allocate StrucCtrl input array, y') ) return; allocate(m(SrvD_p%NumBStC), STAT=ErrStat2); if ( AllErr('Could not allocate StrucCtrl input array, m') ) return; + ! SrvD mesh stuff + allocate(SrvD_u%BStCMotionMesh(SrvD_p%NumBl,SrvD_p%NumBStC), SrvD_y%BStCLoadMesh(SrvD_p%NumBl,SrvD_p%NumBStC), STAT=ErrStat2) + if ( AllErr('Could not allocate motion u%BStCMotionMesh and y%BStCLoadMesh') ) return; + allocate(SrvD_MeshMap%u_BStC_Mot2_BStC(SrvD_p%NumBl,SrvD_p%NumBStC), SrvD_MeshMap%BStC_Frc2_y_BStC(SrvD_p%NumBl,SrvD_p%NumBStC), STAT=ErrStat2) + if ( AllErr('Could not allocate motion nacelle mesh mappings' ) ) return; do j=1,SrvD_p%NumBStC StC_InitInp%InputFile = InputFileData%BStCfiles(j) @@ -743,20 +956,61 @@ subroutine StC_Blade_Setup(SrvD_InitInp,SrvD_p,InputFileData,u,p,x,xd,z,OtherSta StC_InitInp%NumMeshPts = SrvD_p%NumBl ! p%NumBl points for blades Interval = SrvD_p%DT ! Pass the ServoDyn DT - CALL AllocAry( StC_InitInp%InitPosition, 3, StC_InitInp%NumMeshPts, 'StC_InitInp%InitPosition', errStat2, ErrMsg2); if (Failed()) return; - CALL AllocAry( StC_InitInp%InitOrientation,3, 3, StC_InitInp%NumMeshPts, 'StC_InitInp%InitOrientation', errStat2, ErrMsg2); if (Failed()) return; + CALL AllocAry( StC_InitInp%InitRefPos, 3, StC_InitInp%NumMeshPts, 'StC_InitInp%InitRefPos', errStat2, ErrMsg2); if (Failed()) return; + CALL AllocAry( StC_InitInp%InitTransDisp, 3, StC_InitInp%NumMeshPts, 'StC_InitInp%InitTransDisp', errStat2, ErrMsg2); if (Failed()) return; + CALL AllocAry( StC_InitInp%InitRefOrient, 3, 3, StC_InitInp%NumMeshPts, 'StC_InitInp%InitRefOrient', errStat2, ErrMsg2); if (Failed()) return; + CALL AllocAry( StC_InitInp%InitOrient, 3, 3, StC_InitInp%NumMeshPts, 'StC_InitInp%InitOrient', errStat2, ErrMsg2); if (Failed()) return; do k=1,StC_InitInp%NumMeshPts - StC_InitInp%InitPosition(:,k) = SrvD_InitInp%BladeRootPosition(:,k) - StC_InitInp%InitOrientation(:,:,k) = SrvD_InitInp%BladeRootOrientation(:,:,k) + StC_InitInp%InitRefPos(1:3,k) = SrvD_InitInp%BladeRootRefPos(1:3,k) + StC_InitInp%InitTransDisp(1:3,k) = SrvD_InitInp%BladeRootTransDisp(1:3,k) + StC_InitInp%InitRefOrient(1:3,1:3,k) = SrvD_InitInp%BladeRootRefOrient(1:3,1:3,k) + StC_InitInp%InitOrient(1:3,1:3,k) = SrvD_InitInp%BladeRootOrient(1:3,1:3,k) enddo - CALL StC_Init( StC_InitInp, u(j), p(j), x(j), xd(j), z(j), OtherState(j), y(j), m(j), Interval, StC_InitOut, ErrStat2, ErrMsg2 ) + CALL StC_Init( StC_InitInp, u(1,j), p(j), x(j), xd(j), z(j), OtherState(j), y(j), m(j), Interval, StC_InitOut, ErrStat2, ErrMsg2 ) if (Failed()) return; - IF (.NOT. EqualRealNos( Interval, SrvD_p%DT ) ) & - CALL SetErrStat( ErrID_Fatal, "Blade StrucCtrl (instance "//trim(num2lstr(j))//") time step differs from SrvD time step.",ErrStat,ErrMsg,RoutineName ) + IF (.NOT. EqualRealNos( Interval, SrvD_p%DT ) ) then + ErrStat2=ErrID_Fatal + ErrMsg2="Blade StrucCtrl (instance "//trim(num2lstr(j))//") time step differs from SrvD time step." + endif if (Failed()) return; + ! Copy u(1,:) to all input so interp works correctly in StC + do i = 2, SrvD_p%InterpOrder + 1 + call StC_CopyInput (u(1,j), u(i,j), MESH_NEWCOPY, Errstat2, ErrMsg2) + if (Failed()) return; + enddo + + ! SrvD meshes <-> BStC meshes -- NumBl Mesh point per BStC instance + do k=1,StC_InitInp%NumMeshPts + call MeshCopy( SrcMesh=u(1,j)%Mesh(k), DestMesh=SrvD_u%BStCMotionMesh(k,j), CtrlCode=MESH_COUSIN, & + IOS=COMPONENT_INPUT, ErrStat=ErrStat2, ErrMess=ErrMsg2, & + TranslationDisp = .TRUE., Orientation = .TRUE., & + TranslationVel = .TRUE., RotationVel = .TRUE., & + TranslationAcc = .TRUE., RotationAcc = .TRUE.) + if (Failed()) return + call MeshMapCreate( u(1,j)%Mesh(k), SrvD_u%BStCMotionMesh(k,j), SrvD_MeshMap%u_BStC_Mot2_BStC(k,j), ErrStat2, ErrMsg2 ) + if (Failed()) return + call MeshCopy( SrcMesh=y(j)%Mesh(k), DestMesh=SrvD_y%BStCLoadMesh(k,j), CtrlCode=MESH_COUSIN, & + IOS=COMPONENT_OUTPUT, ErrStat=ErrStat2, ErrMess=ErrMsg2, Force=.True., Moment=.True.) + if (Failed()) return + call MeshMapCreate( y(j)%Mesh(k), SrvD_y%BStCLoadMesh(k,j), SrvD_MeshMap%BStC_Frc2_y_BStC(k,j), ErrStat2, ErrMsg2 ) + if (Failed()) return + enddo + + ! A little bit of information about the StC location + if (unsum >0) then + write(UnSum, '(A24,i2)') ' Blade StC instance: ',j + write(UnSum, '(10x,A)') 'Input file: '//trim(InputFileData%NStCfiles(j)) + do k=1,StC_InitInp%NumMeshPts + write(UnSum, '(10x,A6,I1,A29)') 'Blade ',k,' location (global/inertial): ' + write(UnSum, '(20x,3(2x,ES10.3e2))') u(1,j)%Mesh(k)%Position(1:3,1) + write(UnSum, '(10x,A6,I1,A54)') 'Blade ',k,' location relative to blade root (blade coordinates): ' + write(UnSum, '(20x,3(2x,ES10.3e2))') StC_InitOut%RelPosition(1:3,k) + enddo + endif + call Cleanup() enddo endif @@ -780,12 +1034,15 @@ subroutine Cleanup() ! Ignore any errors here end subroutine Cleanup end subroutine StC_Blade_Setup !---------------------------------------------------------------------------------------------------------------------------------- -!> This routine sets the data structures for the structural control (StC) module -- hydrodynamics platform instances -subroutine StC_S_Setup(SrvD_InitInp,SrvD_p,InputFileData,u,p,x,xd,z,OtherState,y,m,ErrStat,ErrMsg) +!> This routine sets the data structures for the structural control (StC) module -- substructure instances +subroutine StC_Substruc_Setup(SrvD_InitInp,SrvD_p,InputFileData,SrvD_u,SrvD_y,SrvD_MeshMap,u,p,x,xd,z,OtherState,y,m,UnSum,ErrStat,ErrMsg) type(SrvD_InitInputType), intent(in ) :: SrvD_InitInp !< Input data for initialization routine type(SrvD_ParameterType), intent(in ) :: SrvD_p !< Parameters - TYPE(SrvD_InputFile), intent(in ) :: InputFileData ! Data stored in the module's input file - type(StC_InputType), allocatable,intent( out) :: u(:) !< An initial guess for the input; input mesh must be defined + type(SrvD_InputFile), intent(in ) :: InputFileData ! Data stored in the module's input file + type(SrvD_InputType), intent(inout) :: SrvD_u !< SrvD inputs (for setting up meshes) + type(SrvD_OutputType), intent(inout) :: SrvD_y !< SrvD outputs (for setting up meshes) + type(SrvD_ModuleMapType), intent(inout) :: SrvD_MeshMap !< Mesh mapping + type(StC_InputType), allocatable,intent( out) :: u(:,:) !< An initial guess for the input; input mesh must be defined type(StC_ParameterType), allocatable,intent( out) :: p(:) !< Parameters type(StC_ContinuousStateType), allocatable,intent( out) :: x(:) !< Initial continuous states type(StC_DiscreteStateType), allocatable,intent( out) :: xd(:) !< Initial discrete states @@ -793,22 +1050,25 @@ subroutine StC_S_Setup(SrvD_InitInp,SrvD_p,InputFileData,u,p,x,xd,z,OtherState,y type(StC_OtherStateType), allocatable,intent( out) :: OtherState(:) !< Initial other states type(StC_OutputType), allocatable,intent( out) :: y(:) !< Initial system outputs (outputs are not calculated; type(StC_MiscVarType), allocatable,intent( out) :: m(:) !< Misc (optimization) variables + integer(IntKi), intent(in ) :: UnSum !< summary file number (>0 when set) integer(IntKi), intent( out) :: ErrStat !< Error status of the operation character(*), intent( out) :: ErrMsg !< Error message if ErrStat /= ErrID_None integer(IntKi) :: ErrStat2 ! temporary Error status of the operation character(ErrMsgLen) :: ErrMsg2 ! temporary Error message if ErrStat /= ErrID_None + integer(IntKi) :: i ! Counter for the input interp order integer(IntKi) :: j ! Counter for the instances real(DbKi) :: Interval !< Coupling interval in seconds from StC type(StC_InitInputType) :: StC_InitInp !< data to initialize StC module type(StC_InitOutputType) :: StC_InitOut !< data from StC module initialization (not currently used) - character(*), parameter :: RoutineName = 'StC_S_Setup' + character(*), parameter :: RoutineName = 'StC_Substruc_Setup' ErrStat = ErrID_None ErrMsg = "" if (SrvD_p%NumSStC > 0_IntKi) then - allocate(u(SrvD_p%NumSStC), STAT=ErrStat2); if ( AllErr('Could not allocate StrucCtrl input array, u') ) return; + ! StC types + allocate(u(SrvD_p%InterpOrder+1,SrvD_p%NumSStC), STAT=ErrStat2); if ( AllErr('Could not allocate StrucCtrl input array, u') ) return; allocate(p(SrvD_p%NumSStC), STAT=ErrStat2); if ( AllErr('Could not allocate StrucCtrl input array, p') ) return; allocate(x(SrvD_p%NumSStC), STAT=ErrStat2); if ( AllErr('Could not allocate StrucCtrl input array, x') ) return; allocate(xd(SrvD_p%NumSStC),STAT=ErrStat2); if ( AllErr('Could not allocate StrucCtrl input array, xd') ) return; @@ -816,6 +1076,11 @@ subroutine StC_S_Setup(SrvD_InitInp,SrvD_p,InputFileData,u,p,x,xd,z,OtherState,y allocate(OtherState(SrvD_p%NumSStC), STAT=ErrStat2); if ( AllErr('Could not allocate StrucCtrl input array, OtherState') ) return; allocate(y(SrvD_p%NumSStC), STAT=ErrStat2); if ( AllErr('Could not allocate StrucCtrl input array, y') ) return; allocate(m(SrvD_p%NumSStC), STAT=ErrStat2); if ( AllErr('Could not allocate StrucCtrl input array, m') ) return; + ! SrvD mesh stuff + allocate(SrvD_u%SStCMotionMesh(SrvD_p%NumSStC), SrvD_y%SStCLoadMesh(SrvD_p%NumSStC), STAT=ErrStat2) + if ( AllErr('Could not allocate motion u%SStCMotionMesh and y%SStCLoadMesh') ) return; + allocate(SrvD_MeshMap%u_SStC_Mot2_SStC(SrvD_p%NumSStC), SrvD_MeshMap%SStC_Frc2_y_SStC(SrvD_p%NumSStC), STAT=ErrStat2) + if ( AllErr('Could not allocate motion substructure mesh mappings' ) ) return; do j=1,SrvD_p%NumSStC StC_InitInp%InputFile = InputFileData%SStCfiles(j) @@ -824,18 +1089,53 @@ subroutine StC_S_Setup(SrvD_InitInp,SrvD_p,InputFileData,u,p,x,xd,z,OtherState,y StC_InitInp%NumMeshPts = 1_IntKi ! single point mesh for Platform Interval = SrvD_p%DT ! Pass the ServoDyn DT - CALL AllocAry( StC_InitInp%InitPosition, 3, StC_InitInp%NumMeshPts, 'StC_InitInp%InitPosition', errStat2, ErrMsg2); if (Failed()) return; - CALL AllocAry( StC_InitInp%InitOrientation,3, 3, StC_InitInp%NumMeshPts, 'StC_InitInp%InitOrientation', errStat2, ErrMsg2); if (Failed()) return; - StC_InitInp%InitPosition(1:3,1) = SrvD_InitInp%PlatformPos(1:3) - StC_InitInp%InitOrientation(:,:,1) = SrvD_InitInp%PlatformOrient + CALL AllocAry( StC_InitInp%InitRefPos, 3, StC_InitInp%NumMeshPts, 'StC_InitInp%InitRefPos', errStat2, ErrMsg2); if (Failed()) return; + CALL AllocAry( StC_InitInp%InitTransDisp, 3, StC_InitInp%NumMeshPts, 'StC_InitInp%InitTransDisp', errStat2, ErrMsg2); if (Failed()) return; + CALL AllocAry( StC_InitInp%InitRefOrient, 3, 3, StC_InitInp%NumMeshPts, 'StC_InitInp%InitRefOrient', errStat2, ErrMsg2); if (Failed()) return; + CALL AllocAry( StC_InitInp%InitOrient, 3, 3, StC_InitInp%NumMeshPts, 'StC_InitInp%InitOrient', errStat2, ErrMsg2); if (Failed()) return; + StC_InitInp%InitRefPos(1:3,1) = SrvD_InitInp%PtfmRefPos(1:3) + StC_InitInp%InitTransDisp(1:3,1) = SrvD_InitInp%PtfmTransDisp(1:3) + StC_InitInp%InitRefOrient(1:3,1:3,1) = SrvD_InitInp%PtfmRefOrient + StC_InitInp%InitOrient(1:3,1:3,1) = SrvD_InitInp%PtfmOrient - CALL StC_Init( StC_InitInp, u(j), p(j), x(j), xd(j), z(j), OtherState(j), y(j), m(j), Interval, StC_InitOut, ErrStat2, ErrMsg2 ) + CALL StC_Init( StC_InitInp, u(1,j), p(j), x(j), xd(j), z(j), OtherState(j), y(j), m(j), Interval, StC_InitOut, ErrStat2, ErrMsg2 ) if (Failed()) return; IF (.NOT. EqualRealNos( Interval, SrvD_p%DT ) ) & CALL SetErrStat( ErrID_Fatal, "Platform StrucCtrl (instance "//trim(num2lstr(j))//") time step differs from SrvD time step.",ErrStat,ErrMsg,RoutineName ) if (Failed()) return; + ! Copy u(1,:) to all input so interp works correctly in StC + do i = 2, SrvD_p%InterpOrder + 1 + call StC_CopyInput (u(1,j), u(i,j), MESH_NEWCOPY, Errstat2, ErrMsg2) + if (Failed()) return; + enddo + + ! SrvD meshes <-> SStC meshes -- only one Mesh point per SStC instance + call MeshCopy( SrcMesh=u(1,j)%Mesh(1), DestMesh=SrvD_u%SStCMotionMesh(j), CtrlCode=MESH_COUSIN, & + IOS=COMPONENT_INPUT, ErrStat=ErrStat2, ErrMess=ErrMsg2, & + TranslationDisp = .TRUE., Orientation = .TRUE., & + TranslationVel = .TRUE., RotationVel = .TRUE., & + TranslationAcc = .TRUE., RotationAcc = .TRUE.) + if (Failed()) return + call MeshMapCreate( u(1,j)%Mesh(1), SrvD_u%SStCMotionMesh(j), SrvD_MeshMap%u_SStC_Mot2_SStC(j), ErrStat2, ErrMsg2 ) + if (Failed()) return + call MeshCopy( SrcMesh=y(j)%Mesh(1), DestMesh=SrvD_y%SStCLoadMesh(j), CtrlCode=MESH_COUSIN, & + IOS=COMPONENT_OUTPUT, ErrStat=ErrStat2, ErrMess=ErrMsg2, Force=.True., Moment=.True.) + if (Failed()) return + call MeshMapCreate( y(j)%Mesh(1), SrvD_y%SStCLoadMesh(j), SrvD_MeshMap%SStC_Frc2_y_SStC(j), ErrStat2, ErrMsg2 ) + if (Failed()) return + + ! A little bit of information about the StC location + if (unsum >0) then + write(UnSum, '(A31,i2)') ' Substructure StC instance: ',j + write(UnSum, '(10x,A)') 'Input file: '//trim(InputFileData%SStCfiles(j)) + write(UnSum, '(10x,A36)') 'Initial location (global/inertial): ' + write(UnSum, '(20x,3(2x,ES10.3e2))') u(1,j)%Mesh(1)%Position(1:3,1) + write(UnSum, '(10x,A76)') 'Initial location relative to platform reference point (global coordinates): ' + write(UnSum, '(20x,3(2x,ES10.3e2))') StC_InitOut%RelPosition(1:3,1) + endif + call Cleanup() enddo endif @@ -857,7 +1157,159 @@ subroutine Cleanup() ! Ignore any errors here CALL StC_DestroyInitInput(StC_InitInp, ErrStat2, ErrMsg2 ) CALL StC_DestroyInitOutput(StC_InitOut, ErrStat2, ErrMsg2 ) end subroutine Cleanup -end subroutine StC_S_Setup +end subroutine StC_Substruc_Setup + +!---------------------------------------------------------------------------------------------------------------------------------- +!> This routine sets the control channels for the StCs +!! These control channel signals are then passed back to all StC and they will pick out only the channels they are linking to +subroutine StC_CtrlChan_Setup(m,p,CtrlChanInitInfo,UnSum,ErrStat,ErrMsg) + type(SrvD_ParameterType), intent(inout) :: p !< Parameters + type(SrvD_MiscVarType), intent(inout) :: m !< Misc (optimization) variables -- contains u and y for StCs where resizing may occur + type(StC_CtrlChanInitInfoType), intent( out) :: CtrlChanInitInfo !< initial values for damping, stiffness, etc to pass to controller + integer(IntKi), intent(in ) :: UnSum !< summary file number (>0 when set) + integer(IntKi), intent( out) :: ErrStat !< Error status of the operation + character(*), intent( out) :: ErrMsg !< Error message if ErrStat /= ErrID_None + + integer(IntKi) :: ErrStat2 ! temporary Error status of the operation + character(ErrMsgLen) :: ErrMsg2 ! temporary Error message if ErrStat /= ErrID_None + integer(IntKi) :: i ! Counter for the input interp order + integer(IntKi) :: j ! Counter for the instances + character(*), parameter :: RoutineName = 'StC_CtrlChan_Setup' + + ErrStat = ErrID_None + ErrMsg = "" + + ! NOTE: For now we only have the option of the StC requesting the bladed interface + ! at the the ServoDyn level. If we later add a Simulink interface, the logic + ! below for checking if the DLL interface was requested will need updating. + ! At that point it might be necessary to set an array for the p%StCCMode so + ! it is possible to tell which channel is from Simulink and which is from + ! the DLL. But for now, we only allow the DLL. + ! NOTE: Internally, each StC may have a semi-active control mode, but that is not + ! passed to ServoDyn, so we don't check for that here. + + ! Step through all StC instances to find the highest number channel requested + p%NumStC_Control = 0_IntKi + p%StCCMode = 0_IntKi + do i=1,p%NumBStC ! Blade + p%NumStC_Control = max(p%NumStC_Control,maxval(p%BStC(i)%StC_CChan)) + if (p%BStC(i)%StC_CMode == ControlMode_DLL) p%StCCMode = ControlMode_DLL + enddo + do i=1,p%NumNStC ! Nacelle + p%NumStC_Control = max(p%NumStC_Control,maxval(p%NStC(i)%StC_CChan)) + if (p%NStC(i)%StC_CMode == ControlMode_DLL) p%StCCMode = ControlMode_DLL + enddo + do i=1,p%NumTStC ! Tower + p%NumStC_Control = max(p%NumStC_Control,maxval(p%TStC(i)%StC_CChan)) + if (p%TStC(i)%StC_CMode == ControlMode_DLL) p%StCCMode = ControlMode_DLL + enddo + do i=1,p%NumSStC ! SubStructure + p%NumStC_Control = max(p%NumStC_Control,maxval(p%SStC(i)%StC_CChan)) + if (p%SStC(i)%StC_CMode == ControlMode_DLL) p%StCCMode = ControlMode_DLL + enddo + + if (p%NumStC_Control==0) return ! No reason to do anything else + + ! Allocate StC averaging info (if multiple StC's request same channel, average the measured data for those channels + allocate(p%StCMeasNumPerChan(p%NumStC_Control), STAT=ErrStat2); if ( AllErr('Could not allocate StCMeasNumPerChan') ) return; + p%StCMeasNumPerChan = 0 + ! Allocate data to pass to dll initialization -- we need to populate this data now so initial values get to controller at init + allocate(CtrlChanInitInfo%Requestor( p%NumStC_Control), STAT=ErrStat2); if ( AllErr('Could not allocate Requestor array') ) return; + allocate(CtrlChanInitInfo%InitStiff( 3,p%NumStC_Control), STAT=ErrStat2); if ( AllErr('Could not allocate InitStiff array') ) return; + allocate(CtrlChanInitInfo%InitDamp( 3,p%NumStC_Control), STAT=ErrStat2); if ( AllErr('Could not allocate InitDamp array') ) return; + allocate(CtrlChanInitInfo%InitBrake( 3,p%NumStC_Control), STAT=ErrStat2); if ( AllErr('Could not allocate InitBrake array') ) return; + allocate(CtrlChanInitInfo%InitForce( 3,p%NumStC_Control), STAT=ErrStat2); if ( AllErr('Could not allocate InitForce array') ) return; + allocate(CtrlChanInitInfo%InitMeasDisp(3,p%NumStC_Control), STAT=ErrStat2); if ( AllErr('Could not allocate InitMeasDisp array') ) return; + allocate(CtrlChanInitInfo%InitMeasVel( 3,p%NumStC_Control), STAT=ErrStat2); if ( AllErr('Could not allocate InitMeasVel array') ) return; + CtrlChanInitInfo%Requestor = "" + CtrlChanInitInfo%InitStiff = 0.0_SiKi + CtrlChanInitInfo%InitDamp = 0.0_SiKi + CtrlChanInitInfo%InitBrake = 0.0_SiKi + CtrlChanInitInfo%InitForce = 0.0_SiKi + CtrlChanInitInfo%InitMeasDisp = 0.0_SiKi + CtrlChanInitInfo%InitMeasVel = 0.0_SiKi + + ! Set info about which StC requested which channel + do i=1,p%NumBStC ! Blade + call ChanCheck(i,'B',p%BStC(i)%StC_CChan) + enddo + do i=1,p%NumNStC ! Nacelle + call ChanCheck(i,'N',p%NStC(i)%StC_CChan) + enddo + do i=1,p%NumTStC ! Tower + call ChanCheck(i,'T',p%TStC(i)%StC_CChan) + enddo + do i=1,p%NumSStC ! SubStructure + call ChanCheck(i,'S',p%SStC(i)%StC_CChan) + enddo + + ! Warn about duplicate channels + do i=1,p%NumStC_Control + if (p%StCMeasNumPerChan(i)>1) then + call SetErrStat(ErrID_Warn,NewLine//' Multiple StC instances using StC control channel '//& + '#'//trim(Num2LStr(i))//' from controller: '//trim(CtrlChanInitInfo%Requestor(i))//'.'//& + ' StC outputs to controller will be averaged.',ErrStat,ErrMsg,RoutineName) + endif + enddo + + ! Put inflo in summary file + if (unsum >0) then + if (p%NumStC_Control > 0) then + write(UnSum, '(A53)') ' StCs controlled by Bladed DLL interface: ' + write(UnSum, '(A53)') ' StC control group StC instances ' + write(UnSum, '(A53)') ' ----------------- --------------------------' + do i=1,p%NumStC_Control + if (p%StCMeasNumPerChan(i)==1) then + write(UnSum,'(9x,I2,21x,A)') i,trim(CtrlChanInitInfo%Requestor(i)) + elseif (p%StCMeasNumPerChan(i)>1) then + write(UnSum,'(9x,I2,A1,20x,A)') i,'*',trim(CtrlChanInitInfo%Requestor(i)) + endif + enddo + if (maxval(p%StCMeasNumPerChan)>1) then + write(UnSum,'(7x,A)') '* indicates channel measurements will be averaged from the requesting StC instances' + endif + endif + endif + + ! Set all the initial values to pass to the controller for first call and ensure all inputs/outputs for control are sized same + call StC_SetDLLinputs(p,m,CtrlChanInitInfo%InitMeasDisp,CtrlChanInitInfo%InitMeasVel,ErrStat2,ErrMsg2,.TRUE.) ! Do resizing if needed + if (Failed()) return; + call StC_SetInitDLLinputs(p,m,CtrlChanInitInfo%InitStiff,CtrlChanInitInfo%InitDamp,CtrlChanInitInfo%InitBrake,CtrlChanInitInfo%InitForce,ErrStat2,ErrMsg2) + if (Failed()) return; + ! Duplicates the Cmd channel data (so that they are allocated for first UpdateStates routine) + call StC_InitExtrapInputs(p,m,ErrStat2,ErrMsg2) + if (Failed()) return; + +contains + subroutine ChanCheck(iNum,Location,CChan) ! Assemble info about who requested which channel + integer(IntKi), intent(in) :: iNum ! instance number + character(1), intent(in) :: Location ! Type of StC + integer(IntKi), allocatable, intent(in) :: CChan(:) ! Channel request set from that StC instance + do j=1,size(CChan) + if (CChan(j) > 0) then + p%StCMeasNumPerChan(CChan(j)) = p%StCMeasNumPerChan(CChan(j)) + 1 + if (len_trim(CtrlChanInitInfo%Requestor(CChan(j)))>1) then + CtrlChanInitInfo%Requestor(CChan(j)) = trim(CtrlChanInitInfo%Requestor(CChan(j)))//', '//Location//'StC'//trim(Num2LStr(iNum)) + else + CtrlChanInitInfo%Requestor(CChan(j)) = Location//'StC'//trim(Num2LStr(iNum)) + endif + ! Name blade number if needed -- i.e. BStC1_B2 + if (Location=='B') CtrlChanInitInfo%Requestor(CChan(j)) = trim(CtrlChanInitInfo%Requestor(CChan(j)))//'_B'//trim(Num2LStr(j)) + endif + enddo + end subroutine ChanCheck + logical function Failed() + CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) + Failed = ErrStat >= AbortErrLev + end function Failed + logical function AllErr(Msg) + character(*), intent(in) :: Msg + if(ErrStat2 /= 0) then + CALL SetErrStat( ErrID_Fatal, Msg, ErrStat, ErrMsg, RoutineName ) + endif + AllErr = ErrStat >= AbortErrLev + end function AllErr +end subroutine StC_CtrlChan_Setup !---------------------------------------------------------------------------------------------------------------------------------- !> This routine is called at the end of the simulation. @@ -884,24 +1336,25 @@ SUBROUTINE SrvD_End( u, p, x, xd, z, OtherState, y, m, ErrStat, ErrMsg ) END IF ! StrucCtrl -- since all StC data is stored in SrvD types, we don't technically need to call StC_End directly - if (allocated(u%NStC)) then - do j=1,p%NumNStC ! Nacelle - call StC_End( u%NStC(j), p%NStC(j), x%NStC(j), xd%NStC(j), z%NStC(j), OtherState%NStC(j), y%NStC(j), m%NStC(j), ErrStat, ErrMsg ) + ! -- Note: not entirely certian why only the first time in u is destroyed and not the others. This is also true at the glue code level for whatever reason. + if (allocated(m%u_BStC)) then + do j=1,p%NumBStC ! Blades + call StC_End( m%u_BStC(1,j), p%BStC(j), x%BStC(j), xd%BStC(j), z%BStC(j), OtherState%BStC(j), m%y_BStC(j), m%BStC(j), ErrStat, ErrMsg ) enddo endif - if (allocated(u%TStC)) then - do j=1,p%NumTStC ! Tower - call StC_End( u%TStC(j), p%TStC(j), x%TStC(j), xd%TStC(j), z%TStC(j), OtherState%TStC(j), y%TStC(j), m%TStC(j), ErrStat, ErrMsg ) + if (allocated(m%u_NStC)) then + do j=1,p%NumNStC ! Nacelle + call StC_End( m%u_NStC(1,j), p%NStC(j), x%NStC(j), xd%NStC(j), z%NStC(j), OtherState%NStC(j), m%y_NStC(j), m%NStC(j), ErrStat, ErrMsg ) enddo endif - if (allocated(u%BStC)) then - do j=1,p%NumBStC ! Blades - call StC_End( u%BStC(j), p%BStC(j), x%BStC(j), xd%BStC(j), z%BStC(j), OtherState%BStC(j), y%BStC(j), m%BStC(j), ErrStat, ErrMsg ) + if (allocated(m%u_TStC)) then + do j=1,p%NumTStC ! Tower + call StC_End( m%u_TStC(1,j), p%TStC(j), x%TStC(j), xd%TStC(j), z%TStC(j), OtherState%TStC(j), m%y_TStC(j), m%TStC(j), ErrStat, ErrMsg ) enddo endif - if (allocated(u%SStC)) then + if (allocated(m%u_SStC)) then do j=1,p%NumSStC ! Platform - call StC_End( u%SStC(j), p%SStC(j), x%SStC(j), xd%SStC(j), z%SStC(j), OtherState%SStC(j), y%SStC(j), m%SStC(j), ErrStat, ErrMsg ) + call StC_End( m%u_SStC(1,j), p%SStC(j), x%SStC(j), xd%SStC(j), z%SStC(j), OtherState%SStC(j), m%y_SStC(j), m%SStC(j), ErrStat, ErrMsg ) enddo endif @@ -954,13 +1407,15 @@ SUBROUTINE SrvD_UpdateStates( t, n, Inputs, InputTimes, p, x, xd, z, OtherState, CHARACTER(*), INTENT( OUT) :: ErrMsg !< Error message if ErrStat /= ErrID_None ! Local variables - TYPE(StC_InputType),ALLOCATABLE :: u(:) ! Inputs at t INTEGER(IntKi) :: i ! loop counter INTEGER(IntKi) :: j ! loop counter for StC instance of type + INTEGER(IntKi) :: k ! loop counter for blade in BStC INTEGER(IntKi) :: order TYPE(SrvD_InputType) :: u_interp ! interpolated input - ! Local variables: - + REAL(ReKi), ALLOCATABLE :: StC_CmdStiff(:,:) !< StC_CmdStiff command signals (3,p%NumStC_Control) -- used only if p%NumStC_Ctrl > 0 + REAL(ReKi), ALLOCATABLE :: StC_CmdDamp(:,:) !< StC_CmdDamp command signals (3,p%NumStC_Control) -- used only if p%NumStC_Ctrl > 0 + REAL(ReKi), ALLOCATABLE :: StC_CmdBrake(:,:) !< StC_CmdBrake command signals (3,p%NumStC_Control) -- used only if p%NumStC_Ctrl > 0 + REAL(ReKi), ALLOCATABLE :: StC_CmdForce(:,:) !< StC_CmdForce command signals (3,p%NumStC_Control) -- used only if p%NumStC_Ctrl > 0 INTEGER(IntKi) :: ErrStat2 ! Error status of the operation (occurs after initial error) CHARACTER(ErrMsgLen) :: ErrMsg2 ! Error message if ErrStat2 /= ErrID_None @@ -972,92 +1427,6 @@ SUBROUTINE SrvD_UpdateStates( t, n, Inputs, InputTimes, p, x, xd, z, OtherState, ErrStat = ErrID_None ErrMsg = "" - !............................................................................................................................... - ! update states in StrucCtrl submodule, if necessary: - !............................................................................................................................... - - IF ((p%NumNStC + p%NumTStC + p%NumBStC + p%NumSStC) > 0_IntKi) THEN - order = SIZE(Inputs) - allocate(u(order), STAT=ErrStat2) - if (ErrStat2 /= 0) then - CALL SetErrStat( ErrID_Fatal, 'Could not allocate StrucCtrl input array, u', ErrStat, ErrMsg, RoutineName ) - if (Failed()) return; - endif - ENDIF - - - ! Nacelle StrucCtrl - do j=1,p%NumNStC - do i=1,order - call StC_CopyInput( Inputs(i)%NStC(j), u(i), MESH_NEWCOPY, ErrStat2, ErrMsg2 ) - if (Failed()) return; - enddo - - call StC_UpdateStates( t, n, u, InputTimes, p%NStC(j), x%NStC(j), xd%NStC(j), z%NStC(j), OtherState%NStC(j), m%NStC(j), ErrStat2, ErrMsg2 ) - if (Failed()) return; - - ! destroy these for the next call to StC_UpdateStates (reset for next StC instance) - do i=1,SIZE(u) - call StC_DestroyInput(u(i), ErrStat2, ErrMsg2) - if (Failed()) return; - enddo - enddo - - - ! Tower StrucCtrl - do j=1,p%NumTStC - do i=1,order - call StC_CopyInput( Inputs(i)%TStC(j), u(i), MESH_NEWCOPY, ErrStat2, ErrMsg2 ) - if (Failed()) return; - enddo - - call StC_UpdateStates( t, n, u, InputTimes, p%TStC(j), x%TStC(j), xd%TStC(j), z%TStC(j), OtherState%TStC(j), m%TStC(j), ErrStat2, ErrMsg2 ) - if (Failed()) return; - - ! destroy these for the next call to StC_UpdateStates (reset for next StC instance) - do i=1,SIZE(u) - call StC_DestroyInput(u(i), ErrStat2, ErrMsg2) - if (Failed()) return; - enddo - enddo - - - ! Blade StrucCtrl - do j=1,p%NumBStC - do i=1,order - call StC_CopyInput( Inputs(i)%BStC(j), u(i), MESH_NEWCOPY, ErrStat2, ErrMsg2 ) - if (Failed()) return; - enddo - - call StC_UpdateStates( t, n, u, InputTimes, p%BStC(j), x%BStC(j), xd%BStC(j), z%BStC(j), OtherState%BStC(j), m%BStC(j), ErrStat2, ErrMsg2 ) - if (Failed()) return; - - ! destroy these for the next call to StC_UpdateStates (reset for next StC instance) - do i=1,SIZE(u) - call StC_DestroyInput(u(i), ErrStat2, ErrMsg2) - if (Failed()) return; - enddo - enddo - - - ! Platform StrucCtrl - do j=1,p%NumSStC - do i=1,order - call StC_CopyInput( Inputs(i)%SStC(j), u(i), MESH_NEWCOPY, ErrStat2, ErrMsg2 ) - if (Failed()) return; - enddo - - call StC_UpdateStates( t, n, u, InputTimes, p%SStC(j), x%SStC(j), xd%SStC(j), z%SStC(j), OtherState%SStC(j), m%SStC(j), ErrStat2, ErrMsg2 ) - if (Failed()) return; - - ! destroy these for the next call to StC_UpdateStates (reset for next StC instance) - do i=1,SIZE(u) - call StC_DestroyInput(u(i), ErrStat2, ErrMsg2) - if (Failed()) return; - enddo - enddo - - !............................................................................................................................... ! get inputs at t: !............................................................................................................................... @@ -1109,6 +1478,80 @@ SUBROUTINE SrvD_UpdateStates( t, n, Inputs, InputTimes, p, x, xd, z, OtherState, CALL TipBrake_UpdateStates( t_next, u_interp, p, x, xd, z, OtherState, m, ErrStat2, ErrMsg2 ) if (Failed()) return; + !............................................................................................................................... + ! update states in StrucCtrl submodule, if necessary: + !............................................................................................................................... + ! Calculate the StC control chan for t_next, and save that in temporary. + if ( p%NumStC_Control > 0 ) then + call AllocAry(StC_CmdStiff, 3, p%NumStC_Control, 'StC_CmdStiff', ErrStat2, ErrMsg2 ); if (Failed()) return; + call AllocAry(StC_CmdDamp, 3, p%NumStC_Control, 'StC_CmdDamp' , ErrStat2, ErrMsg2 ); if (Failed()) return; + call AllocAry(StC_CmdBrake, 3, p%NumStC_Control, 'StC_CmdBrake', ErrStat2, ErrMsg2 ); if (Failed()) return; + call AllocAry(StC_CmdForce, 3, p%NumStC_Control, 'StC_CmdForce', ErrStat2, ErrMsg2 ); if (Failed()) return; + call StCControl_CalcOutput( t_next, p, StC_CmdStiff, StC_CmdDamp, StC_CmdBrake, StC_CmdForce, m, ErrStat2, ErrMsg2 ) + if (Failed()) return; + endif + + ! Blade StrucCtrl + do j=1,p%NumBStC + do k=1,p%NumBl ! number of blades + ! update the StC inputs with SrvD u(:) values + do i=1,p%InterpOrder+1 + CALL Transfer_Point_to_Point( Inputs(i)%BStCMotionMesh(k,j), m%u_BStC(i,j)%Mesh(k), m%SrvD_MeshMap%u_BStC_Mot2_BStC(k,j), ErrStat2, ErrMsg2 ) + if (Failed()) return; + enddo + enddo + ! update commanded signals (if exist) + call SetStCInput_CtrlChans(m%u_BStC(:,j)) + ! Now call updatestates + call StC_UpdateStates( t, n, m%u_BStC(:,j), InputTimes, p%BStC(j), x%BStC(j), xd%BStC(j), z%BStC(j), OtherState%BStC(j), m%BStC(j), ErrStat2, ErrMsg2 ) + if (Failed()) return; + enddo + + ! Nacelle StrucCtrl + do j=1,p%NumNStC + ! update the StC inputs with SrvD u(:) values. + do i=1,p%InterpOrder+1 + CALL Transfer_Point_to_Point( Inputs(i)%NStCMotionMesh(j), m%u_NStC(i,j)%Mesh(1), m%SrvD_MeshMap%u_NStC_Mot2_NStC(j), ErrStat2, ErrMsg2 ) + if (Failed()) return; + enddo + ! update commanded signals (if exist) + call SetStCInput_CtrlChans(m%u_NStC(:,j)) + ! Now call updatestates + call StC_UpdateStates( t, n, m%u_NStC(:,j), InputTimes, p%NStC(j), x%NStC(j), xd%NStC(j), z%NStC(j), OtherState%NStC(j), m%NStC(j), ErrStat2, ErrMsg2 ) + if (Failed()) return; + enddo + + ! Tower StrucCtrl + do j=1,p%NumTStC + ! update the StC inputs with SrvD u(:) values + do i=1,p%InterpOrder+1 + CALL Transfer_Point_to_Point( Inputs(i)%TStCMotionMesh(j), m%u_TStC(i,j)%Mesh(1), m%SrvD_MeshMap%u_TStC_Mot2_TStC(j), ErrStat2, ErrMsg2 ) + if (Failed()) return; + enddo + ! update commanded signals (if exist) + call SetStCInput_CtrlChans(m%u_TStC(:,j)) + ! Now call updatestates + call StC_UpdateStates( t, n, m%u_TStC(:,j), InputTimes, p%TStC(j), x%TStC(j), xd%TStC(j), z%TStC(j), OtherState%TStC(j), m%TStC(j), ErrStat2, ErrMsg2 ) + if (Failed()) return; + enddo + + ! Platform StrucCtrl + do j=1,p%NumSStC + ! update the StC inputs with SrvD u(:) values + do i=1,p%InterpOrder+1 + CALL Transfer_Point_to_Point( Inputs(i)%SStCMotionMesh(j), m%u_SStC(i,j)%Mesh(1), m%SrvD_MeshMap%u_SStC_Mot2_SStC(j), ErrStat2, ErrMsg2 ) + if (Failed()) return; + enddo + ! update commanded signals (if exist) + call SetStCInput_CtrlChans(m%u_SStC(:,j)) + ! Now call updatestates + call StC_UpdateStates( t, n, m%u_SStC(:,j), InputTimes, p%SStC(j), x%SStC(j), xd%SStC(j), z%SStC(j), OtherState%SStC(j), m%SStC(j), ErrStat2, ErrMsg2 ) + if (Failed()) return; + enddo + + ! If we incrimented timestep, save this info so we can properly set the control channel inputs for next time + if ( n > m%PrevTstepNcall ) m%PrevTstepNcall = n + !................................................................... ! Compute ElecPwr and GenTrq for controller (and DLL needs this saved): !................................................................... @@ -1132,19 +1575,33 @@ logical function Failed() if (Failed) call Cleanup() end function Failed SUBROUTINE Cleanup() - - IF (ALLOCATED(u)) THEN - DO i=1,SIZE(u) - CALL StC_DestroyInput(u(i), ErrStat2, ErrMsg2) - CALL SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) - END DO - DEALLOCATE(u) - END IF - CALL SrvD_DestroyInput(u_interp, ErrStat2, ErrMsg2) CALL SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) - + if (allocated(StC_CmdStiff)) deallocate(StC_CmdStiff) + if (allocated(StC_CmdDamp)) deallocate(StC_CmdDamp) + if (allocated(StC_CmdBrake)) deallocate(StC_CmdBrake) + if (allocated(StC_CmdForce)) deallocate(StC_CmdForce) END SUBROUTINE Cleanup + subroutine SetStCInput_CtrlChans(u_StC) + type(StC_InputType), intent(inout) :: u_StC(:) !< Inputs at InputTimes + ! -- not all StC instances will necessarily be looking for this, so these inputs might not be allocated) + if (allocated(u_StC(1)%CmdStiff) .and. allocated(u_StC(1)%CmdDamp) .and. allocated(u_StC(1)%CmdBrake) .and. allocated(u_StC(1)%CmdForce)) then + if ( n > m%PrevTstepNcall ) then + ! Cycle u%CmdStiff and others -- we are at a new timestep. + do i=p%InterpOrder,1,-1 ! shift back in time in reverse order -- oldest (InterpOrder+1) to newest (1) + u_StC(i+1)%CmdStiff = u_StC(i)%CmdStiff + u_StC(i+1)%CmdDamp = u_StC(i)%CmdDamp + u_StC(i+1)%CmdBrake = u_StC(i)%CmdBrake + u_StC(i+1)%CmdForce = u_StC(i)%CmdForce + enddo + endif + ! Now set the current commanded values + u_StC(1)%CmdStiff(1:3,1:p%NumStC_Control) = StC_CmdStiff(1:3,1:p%NumStC_Control) + u_StC(1)%CmdDamp( 1:3,1:p%NumStC_Control) = StC_CmdDamp( 1:3,1:p%NumStC_Control) + u_StC(1)%CmdBrake(1:3,1:p%NumStC_Control) = StC_CmdBrake(1:3,1:p%NumStC_Control) + u_StC(1)%CmdForce(1:3,1:p%NumStC_Control) = StC_CmdForce(1:3,1:p%NumStC_Control) + endif + end subroutine SetStCInput_CtrlChans END SUBROUTINE SrvD_UpdateStates !---------------------------------------------------------------------------------------------------------------------------------- @@ -1190,7 +1647,7 @@ SUBROUTINE DLL_controller_call(t, u, p, x, xd, z, OtherState, m, ErrStat, ErrMsg m%FirstWarn = .FALSE. END IF ELSE - m%dll_data%PrevBlPitch(1:p%NumBl) = m%dll_data%BlPitchCom(1:p%NumBl) ! used for linear ramp of delayed signal + call StorePrevDLLdata() m%LastTimeCalled = t CALL BladedInterface_CalcOutput( t, u, p, m, xd, ErrStat2, ErrMsg2 ) @@ -1201,6 +1658,27 @@ SUBROUTINE DLL_controller_call(t, u, p, x, xd, z, OtherState, m, ErrStat, ErrMsg !END IF +CONTAINS + ! Store old values for linear ramping + subroutine StorePrevDLLdata() + m%dll_data%PrevBlPitch(1:p%NumBl) = m%dll_data%BlPitchCom(1:p%NumBl) + ! airfoil controls: + if (p%AFCmode == ControlMode_DLL) then + m%dll_data%PrevBlAirfoilCom(1:p%NumBl) = m%dll_data%BlAirfoilCom(1:p%NumBl) + endif + ! for Cable controls: + if (p%NumCableControl > 0) then + m%dll_data%PrevCableDeltaL( 1:p%NumCableControl) = m%dll_data%CableDeltaL( 1:p%NumCableControl) + m%dll_data%PrevCableDeltaLdot(1:p%NumCableControl) = m%dll_data%CableDeltaLdot(1:p%NumCableControl) + endif + ! for StC active controls: + if (p%NumStC_Control > 0) then + m%dll_data%PrevStCCmdStiff(1:3,1:p%NumStC_Control) = m%dll_data%StCCmdStiff(1:3,1:p%NumStC_Control) + m%dll_data%PrevStCCmdDamp( 1:3,1:p%NumStC_Control) = m%dll_data%StCCmdDamp( 1:3,1:p%NumStC_Control) + m%dll_data%PrevStCCmdBrake(1:3,1:p%NumStC_Control) = m%dll_data%StCCmdBrake(1:3,1:p%NumStC_Control) + endif + end subroutine StorePrevDLLdata + END SUBROUTINE DLL_controller_call !---------------------------------------------------------------------------------------------------------------------------------- !> Routine for computing outputs, used in both loose and tight coupling. @@ -1225,6 +1703,10 @@ SUBROUTINE SrvD_CalcOutput( t, u, p, x, xd, z, OtherState, y, m, ErrStat, ErrMsg INTEGER(IntKi) :: I ! Generic loop index INTEGER(IntKi) :: K ! Blade index INTEGER(IntKi) :: J ! Structural control instance at location + REAL(ReKi), ALLOCATABLE :: StC_CmdStiff(:,:) !< StC_CmdStiff command signals (3,p%NumStC_Control) -- used only if p%NumStC_Ctrl > 0 + REAL(ReKi), ALLOCATABLE :: StC_CmdDamp(:,:) !< StC_CmdDamp command signals (3,p%NumStC_Control) -- used only if p%NumStC_Ctrl > 0 + REAL(ReKi), ALLOCATABLE :: StC_CmdBrake(:,:) !< StC_CmdBrake command signals (3,p%NumStC_Control) -- used only if p%NumStC_Ctrl > 0 + REAL(ReKi), ALLOCATABLE :: StC_CmdForce(:,:) !< StC_CmdForce command signals (3,p%NumStC_Control) -- used only if p%NumStC_Ctrl > 0 INTEGER(IntKi) :: ErrStat2 CHARACTER(ErrMsgLen) :: ErrMsg2 CHARACTER(*), PARAMETER :: RoutineName = 'SrvD_CalcOutput' @@ -1234,24 +1716,7 @@ SUBROUTINE SrvD_CalcOutput( t, u, p, x, xd, z, OtherState, y, m, ErrStat, ErrMsg ErrStat = ErrID_None ErrMsg = "" - ! StrucCtrl - do j=1,p%NumNStC ! Nacelle - CALL StC_CalcOutput( t, u%NStC(j), p%NStC(j), x%NStC(j), xd%NStC(j), z%NStC(j), OtherState%NStC(j), y%NStC(j), m%NStC(j), ErrStat2, ErrMsg2 ) - CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) - enddo - do j=1,p%NumTStC ! Tower - CALL StC_CalcOutput( t, u%TStC(j), p%TStC(j), x%TStC(j), xd%TStC(j), z%TStC(j), OtherState%TStC(j), y%TStC(j), m%TStC(j), ErrStat2, ErrMsg2 ) - CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) - enddo - do j=1,p%NumBStC ! Blades - CALL StC_CalcOutput( t, u%BStC(j), p%BStC(j), x%BStC(j), xd%BStC(j), z%BStC(j), OtherState%BStC(j), y%BStC(j), m%BStC(j), ErrStat2, ErrMsg2 ) - CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) - enddo - do j=1,p%NumSStC ! Platform - CALL StC_CalcOutput( t, u%SStC(j), p%SStC(j), x%SStC(j), xd%SStC(j), z%SStC(j), OtherState%SStC(j), y%SStC(j), m%SStC(j), ErrStat2, ErrMsg2 ) - CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) - enddo - + !............................................................................................................................... ! Get the demanded values from the external Bladed dynamic link library, if necessary: !............................................................................................................................... @@ -1260,7 +1725,7 @@ SUBROUTINE SrvD_CalcOutput( t, u, p, x, xd, z, OtherState, y, m, ErrStat, ErrMsg ! Initialize the DLL controller in CalcOutput ONLY if it hasn't already been initialized in SrvD_UpdateStates IF (.NOT. m%dll_data%initialized) THEN CALL DLL_controller_call(t, u, p, x, xd, z, OtherState, m, ErrStat2, ErrMsg2 ) - CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) + if (Failed()) return; END IF ! Commanded Airfoil UserProp for blade (must be same units as given in AD15 airfoil tables) @@ -1280,24 +1745,101 @@ SUBROUTINE SrvD_CalcOutput( t, u, p, x, xd, z, OtherState, y, m, ErrStat, ErrMsg ! Torque control: CALL Torque_CalcOutput( t, u, p, x, xd, z, OtherState, y, m, ErrStat2, ErrMsg2 ) ! calculates ElecPwr, which Pitch_CalcOutput will use in the user pitch routine - CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) - IF (ErrStat >= AbortErrLev) RETURN + if (Failed()) return; ! Pitch control: CALL Pitch_CalcOutput( t, u, p, x, xd, z, OtherState, y%BlPitchCom, y%ElecPwr, m, ErrStat2, ErrMsg2 ) - CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) - IF (ErrStat >= AbortErrLev) RETURN + if (Failed()) return; ! Yaw control: CALL Yaw_CalcOutput( t, u, p, x, xd, z, OtherState, y, m,ErrStat2, ErrMsg2 ) - CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) - IF (ErrStat >= AbortErrLev) RETURN + if (Failed()) return; ! Tip brake control: CALL TipBrake_CalcOutput( t, u, p, x, xd, z, OtherState, y, m, ErrStat2, ErrMsg2 ) - CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) - IF (ErrStat >= AbortErrLev) RETURN + if (Failed()) return; + ! Airfoil control: + CALL AirfoilControl_CalcOutput( t, u, p, x, xd, z, OtherState, y%BlAirfoilCom, m, ErrStat, ErrMsg ) + if (Failed()) return; + + ! Cable control: + CALL CableControl_CalcOutput( t, u, p, x, xd, z, OtherState, y%CableDeltaL, y%CableDeltaLdot, m, ErrStat, ErrMsg ) + if (Failed()) return; + + + !............................................................................................................................... + ! Compute the StrucCtrl outputs + !............................................................................................................................... + ! Calculate the StC control chan for t_next, and save that in temporary. + if ( p%NumStC_Control > 0 ) then + call AllocAry(StC_CmdStiff, 3, p%NumStC_Control, 'StC_CmdStiff', ErrStat2, ErrMsg2 ); if (Failed()) return; + call AllocAry(StC_CmdDamp, 3, p%NumStC_Control, 'StC_CmdDamp' , ErrStat2, ErrMsg2 ); if (Failed()) return; + call AllocAry(StC_CmdBrake, 3, p%NumStC_Control, 'StC_CmdBrake', ErrStat2, ErrMsg2 ); if (Failed()) return; + call AllocAry(StC_CmdForce, 3, p%NumStC_Control, 'StC_CmdForce', ErrStat2, ErrMsg2 ); if (Failed()) return; + call StCControl_CalcOutput( t, p, StC_CmdStiff, StC_CmdDamp, StC_CmdBrake, StC_CmdForce, m, ErrStat2, ErrMsg2 ) + if (Failed()) return; + endif + do j=1,p%NumBStC ! Blades + ! Set inputs + do k=1,p%NumBl + CALL Transfer_Point_to_Point( u%BStCMotionMesh(k,j), m%u_BStC(1,j)%Mesh(k), m%SrvD_MeshMap%u_BStC_Mot2_BStC(k,j), ErrStat2, ErrMsg2 ) + if (Failed()) return; + enddo + ! Set StC control channels + call SetStCInput_CtrlChans(m%u_BStC(1,j)) + ! call Calc + CALL StC_CalcOutput( t, m%u_BStC(1,j), p%BStC(j), x%BStC(j), xd%BStC(j), z%BStC(j), OtherState%BStC(j), m%y_BStC(j), m%BStC(j), ErrStat2, ErrMsg2 ) + if (Failed()) return; + ! Set BStC outputs + do k=1,p%NumBl + CALL Transfer_Point_to_Point( m%y_BStC(j)%Mesh(k), y%BStCLoadMesh(k,j), m%SrvD_MeshMap%BStC_Frc2_y_BStC(k,j), ErrStat2, ErrMsg2, u%BStCMotionMesh(k,j), u%BStCMotionMesh(k,j) ) + if (Failed()) return; + enddo + enddo + do j=1,p%NumNStC ! Nacelle + ! Set inputs + CALL Transfer_Point_to_Point( u%NStCMotionMesh(j), m%u_NStC(1,j)%Mesh(1), m%SrvD_MeshMap%u_NStC_Mot2_NStC(j), ErrStat2, ErrMsg2 ) + if (Failed()) return; + ! Set StC control channels + call SetStCInput_CtrlChans(m%u_NStC(1,j)) + ! call Calc + CALL StC_CalcOutput( t, m%u_NStC(1,j), p%NStC(j), x%NStC(j), xd%NStC(j), z%NStC(j), OtherState%NStC(j), m%y_NStC(j), m%NStC(j), ErrStat2, ErrMsg2 ) + if (Failed()) return; + ! Set NStC outputs + CALL Transfer_Point_to_Point( m%y_NStC(j)%Mesh(1), y%NStCLoadMesh(j), m%SrvD_MeshMap%NStC_Frc2_y_NStC(j), ErrStat2, ErrMsg2, u%NStCMotionMesh(j), u%NStCMotionMesh(j) ) + if (Failed()) return; + enddo + do j=1,p%NumTStC ! Tower + CALL Transfer_Point_to_Point( u%TStCMotionMesh(j), m%u_TStC(1,j)%Mesh(1), m%SrvD_MeshMap%u_TStC_Mot2_TStC(j), ErrStat2, ErrMsg2 ) + if (Failed()) return; + ! Set StC control channels + call SetStCInput_CtrlChans(m%u_TStC(1,j)) + ! call Calc + CALL StC_CalcOutput( t, m%u_TStC(1,j), p%TStC(j), x%TStC(j), xd%TStC(j), z%TStC(j), OtherState%TStC(j), m%y_TStC(j), m%TStC(j), ErrStat2, ErrMsg2 ) + if (Failed()) return; + ! Set TStC outputs + CALL Transfer_Point_to_Point( m%y_TStC(j)%Mesh(1), y%TStCLoadMesh(j), m%SrvD_MeshMap%TStC_Frc2_y_TStC(j), ErrStat2, ErrMsg2, u%TStCMotionMesh(j), u%TStCMotionMesh(j) ) + if (Failed()) return; + enddo + do j=1,p%NumSStC ! Platform + ! Set inputs + CALL Transfer_Point_to_Point( u%SStCMotionMesh(j), m%u_SStC(1,j)%Mesh(1), m%SrvD_MeshMap%u_SStC_Mot2_SStC(j), ErrStat2, ErrMsg2 ) + if (Failed()) return; + ! Set StC control channels + call SetStCInput_CtrlChans(m%u_SStC(1,j)) + ! call Calc + CALL StC_CalcOutput( t, m%u_SStC(1,j), p%SStC(j), x%SStC(j), xd%SStC(j), z%SStC(j), OtherState%SStC(j), m%y_SStC(j), m%SStC(j), ErrStat2, ErrMsg2 ) + if (Failed()) return; + ! Set SStC outputs + CALL Transfer_Point_to_Point( m%y_SStC(j)%Mesh(1), y%SStCLoadMesh(j), m%SrvD_MeshMap%SStC_Frc2_y_SStC(j), ErrStat2, ErrMsg2, u%SStCMotionMesh(j), u%SStCMotionMesh(j) ) + if (Failed()) return; + enddo + + ! Set StC info for DLL controller -- subroutine will check criteria + call StC_SetDLLinputs(p,m,m%dll_data%StCMeasDisp,m%dll_data%StCMeasVel,ErrStat2,ErrMsg2) + if (Failed()) return; + !............................................................................................................................... ! Place the selected output channels into the WriteOutput(:) array with the proper sign: @@ -1307,10 +1849,10 @@ SUBROUTINE SrvD_CalcOutput( t, u, p, x, xd, z, OtherState, y, m, ErrStat, ErrMsg call Set_SrvD_Outs( p, y, m, AllOuts ) - if (p%NumNStC>0) call Set_NStC_Outs( p, x%NStC, m%NStC, y%NStC, AllOuts ) - if (p%NumTStC>0) call Set_TStC_Outs( p, x%TStC, m%TStC, y%TStC, AllOuts ) - if (p%NumBStC>0) call Set_BStC_Outs( p, x%BStC, m%BStC, y%BStC, AllOuts ) - if (p%NumSStC>0) call Set_SStC_Outs( p, x%SStC, m%SStC, y%SStC, AllOuts ) + if (p%NumBStC>0) call Set_BStC_Outs( p, x%BStC, m%BStC, m%y_BStC, AllOuts ) + if (p%NumNStC>0) call Set_NStC_Outs( p, x%NStC, m%NStC, m%y_NStC, AllOuts ) + if (p%NumTStC>0) call Set_TStC_Outs( p, x%TStC, m%TStC, m%y_TStC, AllOuts ) + if (p%NumSStC>0) call Set_SStC_Outs( p, x%SStC, m%SStC, m%y_SStC, AllOuts ) DO I = 1,p%NumOuts ! Loop through all selected output channels y%WriteOutput(I) = p%OutParam(I)%SignM * AllOuts( p%OutParam(I)%Indx ) @@ -1320,7 +1862,34 @@ SUBROUTINE SrvD_CalcOutput( t, u, p, x, xd, z, OtherState, y, m, ErrStat, ErrMsg y%WriteOutput(I+p%NumOuts) = m%dll_data%LogChannels( I ) ENDDO + + call Cleanup() + RETURN + +CONTAINS + logical function Failed() + CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) + Failed = ErrStat >= AbortErrLev + if (Failed) call Cleanup() + end function Failed + SUBROUTINE Cleanup() + if (allocated(StC_CmdStiff)) deallocate(StC_CmdStiff) + if (allocated(StC_CmdDamp)) deallocate(StC_CmdDamp) + if (allocated(StC_CmdBrake)) deallocate(StC_CmdBrake) + if (allocated(StC_CmdForce)) deallocate(StC_CmdForce) + END SUBROUTINE Cleanup + subroutine SetStCInput_CtrlChans(u_StC) + type(StC_InputType), intent(inout) :: u_StC !< Inputs at InputTimes + ! -- not all StC instances will necessarily be looking for this, so these inputs might not be allocated) + if (allocated(u_StC%CmdStiff) .and. allocated(u_StC%CmdDamp) .and. allocated(u_StC%CmdBrake) .and. allocated(u_StC%CmdForce)) then + u_StC%CmdStiff(1:3,1:p%NumStC_Control) = StC_CmdStiff(1:3,1:p%NumStC_Control) + u_StC%CmdDamp( 1:3,1:p%NumStC_Control) = StC_CmdDamp( 1:3,1:p%NumStC_Control) + u_StC%CmdBrake(1:3,1:p%NumStC_Control) = StC_CmdBrake(1:3,1:p%NumStC_Control) + u_StC%CmdForce(1:3,1:p%NumStC_Control) = StC_CmdForce(1:3,1:p%NumStC_Control) + endif + end subroutine SetStCInput_CtrlChans + END SUBROUTINE SrvD_CalcOutput !---------------------------------------------------------------------------------------------------------------------------------- !> Tight coupling routine for computing derivatives of continuous states. @@ -1355,20 +1924,20 @@ SUBROUTINE SrvD_CalcContStateDeriv( t, u, p, x, xd, z, OtherState, m, dxdt, ErrS dxdt%DummyContState = 0.0_ReKi ! StrucCtrl - do j=1,p%NumNStC ! Nacelle - CALL StC_CalcContStateDeriv( t, u%NStC(j), p%NStC(j), x%NStC(j), xd%NStC(j), z%NStC(j), OtherState%NStC(j), m%NStC(j), dxdt%NStC(j), ErrStat2, ErrMsg2 ) + do j=1,p%NumBStC ! Blade + CALL StC_CalcContStateDeriv( t, m%u_BStC(1,j), p%BStC(j), x%BStC(j), xd%BStC(j), z%BStC(j), OtherState%BStC(j), m%BStC(j), dxdt%BStC(j), ErrStat2, ErrMsg2 ) call SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) enddo - do j=1,p%NumTStC ! Tower - CALL StC_CalcContStateDeriv( t, u%TStC(j), p%TStC(j), x%TStC(j), xd%TStC(j), z%TStC(j), OtherState%TStC(j), m%TStC(j), dxdt%TStC(j), ErrStat2, ErrMsg2 ) + do j=1,p%NumNStC ! Nacelle + CALL StC_CalcContStateDeriv( t, m%u_NStC(1,j), p%NStC(j), x%NStC(j), xd%NStC(j), z%NStC(j), OtherState%NStC(j), m%NStC(j), dxdt%NStC(j), ErrStat2, ErrMsg2 ) call SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) enddo - do j=1,p%NumBStC ! Blade - CALL StC_CalcContStateDeriv( t, u%BStC(j), p%BStC(j), x%BStC(j), xd%BStC(j), z%BStC(j), OtherState%BStC(j), m%BStC(j), dxdt%BStC(j), ErrStat2, ErrMsg2 ) + do j=1,p%NumTStC ! Tower + CALL StC_CalcContStateDeriv( t, m%u_TStC(1,j), p%TStC(j), x%TStC(j), xd%TStC(j), z%TStC(j), OtherState%TStC(j), m%TStC(j), dxdt%TStC(j), ErrStat2, ErrMsg2 ) call SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) enddo do j=1,p%NumSStC ! Platform - CALL StC_CalcContStateDeriv( t, u%SStC(j), p%SStC(j), x%SStC(j), xd%SStC(j), z%SStC(j), OtherState%SStC(j), m%SStC(j), dxdt%SStC(j), ErrStat2, ErrMsg2 ) + CALL StC_CalcContStateDeriv( t, m%u_SStC(1,j), p%SStC(j), x%SStC(j), xd%SStC(j), z%SStC(j), OtherState%SStC(j), m%SStC(j), dxdt%SStC(j), ErrStat2, ErrMsg2 ) call SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) enddo @@ -1427,20 +1996,20 @@ SUBROUTINE SrvD_UpdateDiscState( t, u, p, x, xd, z, OtherState, m, ErrStat, ErrM !end if ! Update discrete states for StrucCtrl --- StC does not currently support this -! do j=1,p%NumNStC ! Nacelle -! CALL StC_UpdateDiscState( t, u%NStC(j), p%NStC(j), x%NStC(j), xd%NStC(j), z%NStC(j), OtherState%NStC(j), m%NStC(j), ErrStat, ErrMsg ) +! do j=1,p%NumBStC ! Blade +! CALL StC_UpdateDiscState( t, m%u_BStC(1,j), p%BStC(j), x%BStC(j), xd%BStC(j), z%BStC(j), OtherState%BStC(j), m%BStC(j), ErrStat, ErrMsg ) ! call SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) ! enddo -! do j=1,p%NumTStC ! tower -! CALL StC_UpdateDiscState( t, u%TStC(j), p%TStC(j), x%TStC(j), xd%TStC(j), z%TStC(j), OtherState%TStC(j), m%TStC(j), ErrStat, ErrMsg ) +! do j=1,p%NumNStC ! Nacelle +! CALL StC_UpdateDiscState( t, m%u_NStC(1,j), p%NStC(j), x%NStC(j), xd%NStC(j), z%NStC(j), OtherState%NStC(j), m%NStC(j), ErrStat, ErrMsg ) ! call SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) ! enddo -! do j=1,p%NumBStC ! Blade -! CALL StC_UpdateDiscState( t, u%BStC(j), p%BStC(j), x%BStC(j), xd%BStC(j), z%BStC(j), OtherState%BStC(j), m%BStC(j), ErrStat, ErrMsg ) +! do j=1,p%NumTStC ! tower +! CALL StC_UpdateDiscState( t, m%u_TStC(1,j), p%TStC(j), x%TStC(j), xd%TStC(j), z%TStC(j), OtherState%TStC(j), m%TStC(j), ErrStat, ErrMsg ) ! call SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) ! enddo ! do j=1,p%NumSStC ! Platform -! CALL StC_UpdateDiscState( t, u%SStC(j), p%SStC(j), x%SStC(j), xd%SStC(j), z%SStC(j), OtherState%SStC(j), m%SStC(j), ErrStat, ErrMsg ) +! CALL StC_UpdateDiscState( t, m%u_SStC(1,j), p%SStC(j), x%SStC(j), xd%SStC(j), z%SStC(j), OtherState%SStC(j), m%SStC(j), ErrStat, ErrMsg ) ! call SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) ! enddo @@ -1475,20 +2044,20 @@ SUBROUTINE SrvD_CalcConstrStateResidual( t, u, p, x, xd, z, OtherState, m, z_res ! Solve for the constraint states for StrucCtrl --- StC does not currently support this -! do j=1,p%NumNStC ! Nacelle -! CALL StC_CalcConstrStateResidual( t, u%NStC(j), p%NStC(j), x%NStC(j), xd%NStC(j), z%NStC(j), OtherState%NStC(j), m%NStC(j), z_residual%NStC(j), ErrStat, ErrMsg ) +! do j=1,p%NumBStC ! Blade +! CALL StC_CalcConstrStateResidual( t, m%u_BStC(1,j), p%BStC(j), x%BStC(j), xd%BStC(j), z%BStC(j), OtherState%BStC(j), m%BStC(j), z_residual%BStC(j), ErrStat, ErrMsg ) ! call SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) ! enddo -! do j=1,p%NumTStC ! Tower -! CALL StC_CalcConstrStateResidual( t, u%TStC(j), p%TStC(j), x%TStC(j), xd%TStC(j), z%TStC(j), OtherState%TStC(j), m%TStC(j), z_residual%TStC(j), ErrStat, ErrMsg ) +! do j=1,p%NumNStC ! Nacelle +! CALL StC_CalcConstrStateResidual( t, m%u_NStC(1,j), p%NStC(j), x%NStC(j), xd%NStC(j), z%NStC(j), OtherState%NStC(j), m%NStC(j), z_residual%NStC(j), ErrStat, ErrMsg ) ! call SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) ! enddo -! do j=1,p%NumBStC ! Blade -! CALL StC_CalcConstrStateResidual( t, u%BStC(j), p%BStC(j), x%BStC(j), xd%BStC(j), z%BStC(j), OtherState%BStC(j), m%BStC(j), z_residual%BStC(j), ErrStat, ErrMsg ) +! do j=1,p%NumTStC ! Tower +! CALL StC_CalcConstrStateResidual( t, m%u_TStC(1,j), p%TStC(j), x%TStC(j), xd%TStC(j), z%TStC(j), OtherState%TStC(j), m%TStC(j), z_residual%TStC(j), ErrStat, ErrMsg ) ! call SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) ! enddo ! do j=1,p%NumSStC ! Platform -! CALL StC_CalcConstrStateResidual( t, u%SStC(j), p%SStC(j), x%SStC(j), xd%SStC(j), z%SStC(j), OtherState%SStC(j), m%SStC(j), z_residual%SStC(j), ErrStat, ErrMsg ) +! CALL StC_CalcConstrStateResidual( t, m%u_SStC(1,j), p%SStC(j), x%SStC(j), xd%SStC(j), z%SStC(j), OtherState%SStC(j), m%SStC(j), z_residual%SStC(j), ErrStat, ErrMsg ) ! call SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) ! enddo @@ -1979,6 +2548,8 @@ SUBROUTINE ValidatePrimaryData( InitInp, InputFileData, ErrStat, ErrMsg ) CALL HSSBr_ValidateData() !FIXME: add validation for StC inputs ! CALL StC_ValidateData() + CALL AfC_ValidateData() ! Airfoil controls + CALL CC_ValidateData() ! Cable controls ! Checks for linearization: if ( InitInp%Linearize ) then @@ -2020,7 +2591,12 @@ SUBROUTINE ValidatePrimaryData( InitInp, InputFileData, ErrStat, ErrMsg ) IF (InputFileData%PCMode /= ControlMode_EXTERN) CALL SetErrStat( ErrID_Info, 'Pitch angles are not commanded from Simulink model.', ErrStat, ErrMsg, RoutineName ) IF (InputFileData%VSContrl /= ControlMode_EXTERN) CALL SetErrStat( ErrID_Info, 'Generator torque and power are not commanded from Simulink model.', ErrStat, ErrMsg, RoutineName ) IF (InputFileData%HSSBrMode /= ControlMode_EXTERN) CALL SetErrStat( ErrID_Info, 'HSS brake is not commanded from Simulink model.', ErrStat, ErrMsg, RoutineName ) + IF (InputFileData%AfCmode /= ControlMode_EXTERN) CALL SetErrStat( ErrID_Info, 'Airfoil control is not commanded from Simulink model.', ErrStat, ErrMsg, RoutineName ) + IF (InputFileData%CCmode /= ControlMode_EXTERN) CALL SetErrStat( ErrID_Info, 'Cable control is not commanded from Simulink model.', ErrStat, ErrMsg, RoutineName ) END IF + + +!FIXME: add checks on the EXavrSWAP entries RETURN @@ -2234,15 +2810,39 @@ SUBROUTINE HSSBr_ValidateData( ) IF ( InputFileData%HSSBrTqF < 0.0_ReKi ) CALL SetErrStat( ErrID_Fatal, 'HSSBrTqF must not be negative.', ErrStat, ErrMsg, RoutineName ) END SUBROUTINE HSSBr_ValidateData + !------------------------------------------------------------------------------------------------------------------------------- + !> This routine performs the checks on inputs for the flap control. + SUBROUTINE AfC_ValidateData( ) + IF ( InputFileData%AfCMode /= ControlMode_NONE .and. InputFileData%AfCMode /= ControlMode_Simple .and. & + InputFileData%AfCMode /= ControlMode_EXTERN .and. InputFileData%AfCMode /= ControlMode_DLL ) THEN + CALL SetErrStat( ErrID_Fatal, 'AfCMode must be 0, 1, 4, or 5.', ErrStat, ErrMsg, RoutineName ) + ENDIF + if ( InputFileData%AfCMode == ControlMode_Simple ) then + if ( InputFileData%AfC_phase < -TwoPi .and. InputFileData%AfC_phase > TwoPi ) then + call SetErrStat( ErrID_Fatal, 'AfC_phase must be between -360 and 360 degrees.', ErrStat, ErrMsg, RoutineName) + endif + endif + END SUBROUTINE AfC_ValidateData + + !------------------------------------------------------------------------------------------------------------------------------- + !> This routine performs the checks on inputs for the flap control. + SUBROUTINE CC_ValidateData( ) + IF ( InputFileData%CCMode /= ControlMode_NONE .and. & + InputFileData%CCMode /= ControlMode_EXTERN .and. InputFileData%CCMode /= ControlMode_DLL ) THEN + CALL SetErrStat( ErrID_Fatal, 'CCMode must be 0, 4, or 5.', ErrStat, ErrMsg, RoutineName ) + ENDIF + END SUBROUTINE CC_ValidateData + END SUBROUTINE ValidatePrimaryData !---------------------------------------------------------------------------------------------------------------------------------- !> This subroutine sets the parameters, based on the data stored in InputFileData. -SUBROUTINE SrvD_SetParameters( InputFileData, p, ErrStat, ErrMsg ) +SUBROUTINE SrvD_SetParameters( InputFileData, p, UnSum, ErrStat, ErrMsg ) !.................................................................................................................................. TYPE(SrvD_InputFile), INTENT(INOUT) :: InputFileData !< Data stored in the module's input file (intent OUT for MOVE_ALLOC) TYPE(SrvD_ParameterType), INTENT(INOUT) :: p !< The module's parameter data + INTEGER(IntKi), INTENT(IN ) :: UnSum !< summary file number (>0 when set) INTEGER(IntKi), INTENT(OUT) :: ErrStat !< The error status code CHARACTER(*), INTENT(OUT) :: ErrMsg !< The error message, if an error occurred @@ -2257,15 +2857,14 @@ SUBROUTINE SrvD_SetParameters( InputFileData, p, ErrStat, ErrMsg ) CHARACTER(*), PARAMETER :: RoutineName = 'SrvD_SetParameters' - ! Initialize variables - ErrStat = ErrID_None ErrMsg = '' - - p%DT = InputFileData%DT + ! Extended avrSWAP array + p%EXavrSWAP = InputFiledata%EXavrSWAP + !............................................. ! Pitch control parameters !............................................. @@ -2283,6 +2882,18 @@ SUBROUTINE SrvD_SetParameters( InputFileData, p, ErrStat, ErrMsg ) p%BlPitchF = InputFileData%BlPitchF( 1:min(p%NumBl,size(InputFileData%BlPitchF))) p%PitManRat = InputFileData%PitManRat(1:min(p%NumBl,size(InputFileData%PitManRat))) + if (UnSum >0) then + write(UnSum, '(A)') ' Unless specified, units are consistent with Input units, [SI] system is advised.' + write(UnSum, '(A)') SectionDivide + write(UnSum, '(A)') ' Pitch control mode {0: none, 3: user-defined from routine PitchCntrl, 4: user-defined from Simulink/Labview, 5: user-defined from Bladed-style DLL} (switch)' + write(UnSum, '(A43,I2)') ' PCMode -- Pitch control mode: ',p%PCMode + write(UnSum, '(A43,ES20.12e3)') ' TPCOn -- pitch control start time: ',p%TPCOn + write(UnSum, '(A)') ' -------------------' + write(UnSum, '(A43,3ES12.5e2)') ' TPitManS -- pitch override start time: ',p%TPitManS( 1:min(p%NumBl,size(InputFileData%TPitManS))) + write(UnSum, '(A43,3ES12.5e2)') ' BlPitchF -- pitch override final pos: ',p%BlPitchF( 1:min(p%NumBl,size(InputFileData%BlPitchF))) + write(UnSum, '(A43,3ES12.5e2)') ' PitManRat -- pitch override rate: ',p%PitManRat(1:min(p%NumBl,size(InputFileData%PitManRat))) + write(UnSum, '(A)') '' + endif !............................................. ! Set generator and torque control parameters: !............................................. @@ -2297,8 +2908,24 @@ SUBROUTINE SrvD_SetParameters( InputFileData, p, ErrStat, ErrMsg ) p%THSSBrFl = InputFileData%THSSBrDp + InputFileData%HSSBrDT ! Time at which shaft brake is fully deployed + + if (UnSum >0) then + write(UnSum, '(A)') SectionDivide + write(UnSum, '(A)') ' Variable-speed control mode {0: none, 1: simple VS, 3: user-defined from routine UserVSCont, 4: user-defined from Simulink/Labview, 5: user-defined from Bladed-style DLL} (switch)' + write(UnSum, '(A41,I2)') ' VSContrl -- speed control mode: ',p%VSContrl + write(UnSum, '(A)') ' -------------------' + write(UnSum, '(A18,I2)') ' GenModel: ',p%GenModel + write(UnSum, '(A55,ES12.5e2)') ' GenEff -- efficiency (%): ',p%GenEff + if (p%GenTiStr) then + write(UnSum, '(A55,ES12.5e2)') ' GenTiStr -- Timed generator start (s): ',p%TimGenOn + else + write(UnSum, '(A55,ES12.5e2)') ' SpdGenOn -- Gen speed to turn on the gen (rpm): ',p%SpdGenOn + endif + if (p%GenTiStp) & + write(UnSum, '(A55,ES12.5e2)') ' GenTiStp -- Timed generator stop (s): ',p%TimGenOf + endif - SELECT CASE ( p%VSContrl ) + SELECT CASE ( p%VSContrl ) CASE ( ControlMode_NONE ) ! None IF ( p%GenModel == ControlMode_SIMPLE ) THEN ! Simple induction generator @@ -2309,6 +2936,16 @@ SUBROUTINE SrvD_SetParameters( InputFileData, p, ErrStat, ErrMsg ) p%SIG_Slop = InputFileData%SIG_RtTq/( SIG_RtSp - InputFileData%SIG_SySp ) ! SIG torque/speed slope p%SIG_SySp = InputFileData%SIG_SySp + + if (UnSum >0) then + write(UnSum, '(A41)') ' Simple generator model ' + write(UnSum, '(A55,ES12.5e2)') ' SIG_RtSp -- Rated speed ',SIG_RtSp + write(UnSum, '(A55,ES12.5e2)') ' SIG_POSl -- Pullout slip ',p%SIG_POSl + write(UnSum, '(A55,ES12.5e2)') ' SIG_POTq -- Pullout torque ',p%SIG_POTq + write(UnSum, '(A55,ES12.5e2)') ' SIG_Slop -- Torque/speed slope ',p%SIG_Slop + write(UnSum, '(A55,ES12.5e2)') ' SIG_SySp -- Synchronous gen speed ',p%SIG_SySp + endif + ELSEIF ( p%GenModel == ControlMode_ADVANCED ) THEN ! Thevenin-equivalent induction generator ComDenom = InputFileData%TEC_SRes**2 + ( InputFileData%TEC_SLR + InputFileData%TEC_MR )**2 ! common denominator used in many of the following equations @@ -2331,6 +2968,25 @@ SUBROUTINE SrvD_SetParameters( InputFileData, p, ErrStat, ErrMsg ) p%TEC_SRes = InputFileData%TEC_SRes p%TEC_VLL = InputFileData%TEC_VLL + if (UnSum >0) then + write(UnSum, '(A55)') ' Advanced Thevenin equivalent generator model ' + write(UnSum, '(A55,ES12.5e2)') ' TEC_Re1 -- stator resistance (ohms) ',p%TEC_Re1 + write(UnSum, '(A55,ES12.5e2)') ' TEC_Xe1 -- stator leakage reactance (ohms) ',p%TEC_Xe1 + write(UnSum, '(A55,ES12.5e2)') ' TEC_V1a -- source voltage ',p%TEC_V1a + write(UnSum, '(A55,ES12.5e2)') ' TEC_SySp -- synchronous speed ',p%TEC_SySp + write(UnSum, '(A55,ES12.5e2)') ' TEC_K1 -- K1 term ', TEC_K1 + write(UnSum, '(A55,ES12.5e2)') ' TEC_K2 -- K2 term ', TEC_K2 + write(UnSum, '(A55,ES12.5e2)') ' TEC_A0 -- A0 term ',p%TEC_A0 + write(UnSum, '(A55,ES12.5e2)') ' TEC_C0 -- C0 term ',p%TEC_C0 + write(UnSum, '(A55,ES12.5e2)') ' TEC_C1 -- C1 term ',p%TEC_C1 + write(UnSum, '(A55,ES12.5e2)') ' TEC_C2 -- C2 term ',p%TEC_C2 + write(UnSum, '(A55,ES12.5e2)') ' TEC_MR -- Magnetizing reactance (ohms) ',p%TEC_MR + write(UnSum, '(A55,ES12.5e2)') ' TEC_RLR -- Rotor leakage reactance (ohms) ',p%TEC_RLR + write(UnSum, '(A55,ES12.5e2)') ' TEC_RRes -- Rotor resistance (ohms) ',p%TEC_RRes + write(UnSum, '(A55,ES12.5e2)') ' TEC_SRes -- Stator resistance (ohms) ',p%TEC_SRes + write(UnSum, '(A55,ES12.5e2)') ' TEC_VLL -- Line-to-line RMS voltage (volts) ',p%TEC_VLL + endif + ENDIF @@ -2353,8 +3009,19 @@ SUBROUTINE SrvD_SetParameters( InputFileData, p, ErrStat, ErrMsg ) p%VS_Rgn2K = InputFileData%VS_Rgn2K p%VS_RtGnSp = InputFileData%VS_RtGnSp p%VS_RtTq = InputFileData%VS_RtTq + + if (UnSum >0) then + write(UnSum, '(A55)') ' Simple variable speed control ' + write(UnSum, '(A55,ES12.5e2)') ' VS_SySp -- region 2.5 synchronous gen speed ',p%VS_SySp + write(UnSum, '(A55,ES12.5e2)') ' VS_Slope -- Torque/speed slope of region 2.5 ',p%VS_Slope + write(UnSum, '(A55,ES12.5e2)') ' mVS_TrGnSp -- region 2 -> 2.5 trans gen speed ',p%VS_TrGnSp + write(UnSum, '(A55,ES12.5e2)') ' VS_Rgn2K -- Gen torque constant region 2 ',p%VS_Rgn2K + write(UnSum, '(A55,ES12.5e2)') ' VS_RtGnSp -- Rated gen speed ',p%VS_RtGnSp + write(UnSum, '(A55,ES12.5e2)') ' VS_RtTq -- Rated gen torque ',p%VS_RtTq + endif + + END SELECT - END SELECT !............................................. ! High-speed shaft brake parameters @@ -2364,6 +3031,18 @@ SUBROUTINE SrvD_SetParameters( InputFileData, p, ErrStat, ErrMsg ) p%HSSBrDT = InputFileData%HSSBrDT p%HSSBrTqF = InputFileData%HSSBrTqF + if (UnSum >0) then + write(UnSum, '(A)') '' + write(UnSum, '(A)') SectionDivide + write(UnSum, '(A)') ' HSS brake model {0: none, 1: simple, 3: user-defined from routine UserHSSBr, 4: user-defined from Simulink/Labview, 5: user-defined from Bladed-style DLL} (switch)' + write(UnSum, '(A45,I2)') ' HSSBrMode -- high speed shaft brake mode ',p%HSSBrMode + if (p%HSSBrMode > 0) then + write(UnSum, '(A56,ES12.5e2)') ' THSSBrDp -- Time to initiate deployment (s) ',p%THSSBrDp + write(UnSum, '(A56,ES12.5e2)') ' HSSBrDT -- Time full deployment once initiated (s) ',p%HSSBrDT + write(UnSum, '(A56,ES12.5e2)') ' HSSBrTqF -- Fully deployed HSS-brake torque (N-m) ',p%HSSBrTqF + endif + endif + !............................................. ! Nacelle-yaw control parameters !............................................. @@ -2377,6 +3056,25 @@ SUBROUTINE SrvD_SetParameters( InputFileData, p, ErrStat, ErrMsg ) p%NacYawF = InputFileData%NacYawF p%YawManRat = InputFileData%YawManRat ! we change the sign of this variable later + if (UnSum >0) then + write(UnSum, '(A)') '' + write(UnSum, '(A)') SectionDivide + write(UnSum, '(A)') ' Yaw control mode {0: none, 3: user-defined from routine UserYawCont, 4: user-defined from Simulink/Labview, 5: user-defined from Bladed-style DLL} (switch)' + write(UnSum, '(A32,I2)') ' YCMode -- yaw control mode ',p%YCMode + if (p%YCMode > 0) & + write(UnSum, '(A55,ES12.5e2)') ' TYCOn -- Time to enable active yaw control (s) ',p%TYCOn + write(UnSum, '(A)') ' -------------------' + write(UnSum, '(A)') ' Yaw spring characteristics' + write(UnSum, '(A55,ES12.5e2)') ' YawNeut -- neutral spring position (degrees) ',p%YawNeut + write(UnSum, '(A55,ES12.5e2)') ' YawSpr -- spring constant (N-m/rad) ',p%YawSpr + write(UnSum, '(A55,ES12.5e2)') ' YawDamp -- damping constant (N-m/(rad/s)) ',p%YawDamp + write(UnSum, '(A)') ' -------------------' + write(UnSum, '(A)') ' Prescribed yaw motion' + write(UnSum, '(A55,ES12.5e2)') ' TYawManS -- yaw maneuver start time (s) ',p%TYawManS + write(UnSum, '(A55,ES12.5e2)') ' YawManRat -- yaw maneuver rate (deg/s) ',p%YawManRat + write(UnSum, '(A55,ES12.5e2)') ' NacYawF -- Final yaw angle for override (deg) ',p%NacYawF + endif + !............................................. ! tip-brake parameters (not used in this version) !............................................. @@ -2390,30 +3088,56 @@ SUBROUTINE SrvD_SetParameters( InputFileData, p, ErrStat, ErrMsg ) p%TpBrDT = HUGE(p%TpBrDT) ! Time for tip brakes to reach full deployment, once deployed p%TBDrConN = 0.0_ReKi ! tip-drag constant during normal operation p%TBDrConD = 0.0_ReKi ! tip-drag constant during fully deployed operation - - + + if (UnSum >0) then + write(UnSum, '(A)') '' + write(UnSum, '(A)') SectionDivide + write(UnSum, '(A)') ' Tip Brake (not available)' + endif + !............................................. ! Tuned-mass damper parameters + ! -- summary file info written later !............................................. - p%NumBStC = InputFileData%NumBStC - p%NumNStC = InputFileData%NumNStC - p%NumTStC = InputFileData%NumTStC - p%NumSStC = InputFileData%NumSStC + p%NumBStC = InputFileData%NumBStC + p%NumNStC = InputFileData%NumNStC + p%NumTStC = InputFileData%NumTStC + p%NumSStC = InputFileData%NumSStC !............................................. - ! Determine if the BladedDLL should be called + ! Save values for AfCmode - Airfoil control !............................................. + p%AfCmode = InputFileData%AfCmode + p%AfC_Mean = InputFileData%AfC_Mean + p%AfC_Amp = InputFileData%AfC_Amp + p%AfC_phase = InputFileData%AfC_phase + + if (UnSum >0) then + write(UnSum, '(A)') '' + write(UnSum, '(A)') SectionDivide + write(UnSum, '(A)') ' Airfoil control' + write(UnSum, '(A37,I2)') ' AfCMode -- Airfoil control mode ',p%AfCMode + if (p%AfCMode == ControlMode_SIMPLE) then + write(UnSum, '(A)') ' -------------------' + write(UnSum, '(A)') ' Simple cosine signal' + write(UnSum, '(A115,ES12.5e2)') ' AfC_Mean -- Mean level for cocosine cycling or steady value (-) ',p%AfC_Mean + write(UnSum, '(A115,ES12.5e2)') ' AfC_Amp -- Amplitude for for cocosine cycling of flap signal (-) ',p%AfC_Amp + write(UnSum, '(A115,ES12.5e2)') ' AfC_Phase -- Phase relative to the blade azimuth (0 is vertical) for for cosine cycling of flap signal (deg) ',p%AfC_Phase + endif + endif - IF ( p%PCMode == ControlMode_DLL .OR. & - p%YCMode == ControlMode_DLL .OR. & - p%VSContrl == ControlMode_DLL .OR. & - p%HSSBrMode == ControlMode_DLL ) THEN - - p%UseBladedInterface = .TRUE. + !............................................. + ! Save values for CCmode - Cable control + !............................................. + p%CCmode = InputFileData%CCmode + + if (UnSum >0) then + write(UnSum, '(A)') '' + write(UnSum, '(A)') SectionDivide + write(UnSum, '(A)') ' Cable control' + write(UnSum, '(A34,I2)') ' CCMode -- cable control mode ',p%CCMode + endif - ELSE - p%UseBladedInterface = .FALSE. - END IF !............................................. ! Parameters for file output (not including Bladed DLL logging outputs) @@ -2429,8 +3153,7 @@ SUBROUTINE SrvD_SetParameters( InputFileData, p, ErrStat, ErrMsg ) p%Delim = TAB ELSE p%Delim = ' ' - END IF - + END IF END SUBROUTINE SrvD_SetParameters !---------------------------------------------------------------------------------------------------------------------------------- @@ -3563,7 +4286,500 @@ SUBROUTINE CalculateTorqueJacobian( t, u, p, m, GenTrq_du, ElecPwr_du, ErrStat, END SUBROUTINE CalculateTorqueJacobian !---------------------------------------------------------------------------------------------------------------------------------- +!---------------------------------------------------------------------------------------------------------------------------------- +!> Routine for computing the airfoil commands +! Commanded Airfoil UserProp for blade (must be same units as given in AD15 airfoil tables) +! This is passed to AD15 to be interpolated with the airfoil table userprop column +! (might be used for airfoil flap angles for example) +SUBROUTINE AirfoilControl_CalcOutput( t, u, p, x, xd, z, OtherState, BlAirfoilCom, m, ErrStat, ErrMsg ) + REAL(DbKi), INTENT(IN ) :: t !< Current simulation time in seconds + TYPE(SrvD_InputType), INTENT(IN ) :: u !< Inputs at t + TYPE(SrvD_ParameterType), INTENT(IN ) :: p !< Parameters + TYPE(SrvD_ContinuousStateType), INTENT(IN ) :: x !< Continuous states at t + TYPE(SrvD_DiscreteStateType), INTENT(IN ) :: xd !< Discrete states at t + TYPE(SrvD_ConstraintStateType), INTENT(IN ) :: z !< Constraint states at t + TYPE(SrvD_OtherStateType), INTENT(IN ) :: OtherState !< Other states at t + REAL(ReKi), INTENT(INOUT) :: BlAirfoilCom(:) !< Airfoil command signals + TYPE(SrvD_MiscVarType), INTENT(INOUT) :: m !< Misc (optimization) variables + INTEGER(IntKi), INTENT( OUT) :: ErrStat !< Error status of the operation + CHARACTER(*), INTENT( OUT) :: ErrMsg !< Error message if ErrStat /= ErrID_None + REAL(ReKi) :: factor + REAL(ReKi) :: Azimuth !< Azimuth of this blade for simple control + INTEGER(IntKi) :: i + + ! Initialize ErrStat -- This isn't curently needed, but if a user routine is created, it might be wanted then + ErrStat = ErrID_None + ErrMsg = "" + + !................................................................... + ! Calculate the airfoil commands: + !................................................................... + SELECT CASE ( p%AfCmode ) ! Which airfoil control mode are we using? + CASE ( ControlMode_NONE ) ! None control + BlAirfoilCom(1:p%NumBl) = 0.0_ReKi + CASE ( ControlMode_SIMPLE ) ! Simple, built-in cosine wave control routine. + do i=1,p%NumBl + Azimuth = u%LSSTipPxa + TwoPi*(i-1)/p%NumBl ! assuming all blades evenly spaced on rotor + BlAirfoilCom(i) = p%AfC_Mean + p%AfC_Amp*cos( Azimuth + p%AfC_phase) + enddo + CASE ( ControlMode_EXTERN ) ! User-defined from Simulink or LabVIEW. + BlAirfoilCom = u%ExternalBlAirfoilCom ! copy entire array + CASE ( ControlMode_DLL ) ! User-defined pitch control from Bladed-style DLL + if (p%DLL_Ramp) then + factor = (t - m%LastTimeCalled) / m%dll_data%DLL_DT + BlAirfoilCom(1:p%NumBl) = m%dll_data%PrevBlAirfoilCom(1:p%NumBl) + & + factor * ( m%dll_data%BlAirfoilCom(1:p%NumBl) - m%dll_data%PrevBlAirfoilCom(1:p%NumBl) ) + else + BlAirfoilCom(1:p%NumBl) = m%dll_data%BlAirfoilCom(1:p%NumBl) + end if + END SELECT +END SUBROUTINE AirfoilControl_CalcOutput + +!---------------------------------------------------------------------------------------------------------------------------------- +!> Routine for computing the cable control commands +! The commanded CableDeltaL and CableDeltaLdot are passed back to the glue code for passing to MD or SD +SUBROUTINE CableControl_CalcOutput( t, u, p, x, xd, z, OtherState, CableDeltaL, CableDeltaLdot, m, ErrStat, ErrMsg ) + REAL(DbKi), INTENT(IN ) :: t !< Current simulation time in seconds + TYPE(SrvD_InputType), INTENT(IN ) :: u !< Inputs at t + TYPE(SrvD_ParameterType), INTENT(IN ) :: p !< Parameters + TYPE(SrvD_ContinuousStateType), INTENT(IN ) :: x !< Continuous states at t + TYPE(SrvD_DiscreteStateType), INTENT(IN ) :: xd !< Discrete states at t + TYPE(SrvD_ConstraintStateType), INTENT(IN ) :: z !< Constraint states at t + TYPE(SrvD_OtherStateType), INTENT(IN ) :: OtherState !< Other states at t + REAL(ReKi), ALLOCATABLE, INTENT(INOUT) :: CableDeltaL(:) !< CableDeltaL command signals + REAL(ReKi), ALLOCATABLE, INTENT(INOUT) :: CableDeltaLdot(:) !< CableDeltaLdot command signals + TYPE(SrvD_MiscVarType), INTENT(INOUT) :: m !< Misc (optimization) variables + INTEGER(IntKi), INTENT( OUT) :: ErrStat !< Error status of the operation + CHARACTER(*), INTENT( OUT) :: ErrMsg !< Error message if ErrStat /= ErrID_None + REAL(ReKi) :: factor + + ! Initialize ErrStat -- This isn't curently needed, but if a user routine is created, it might be wanted then + ErrStat = ErrID_None + ErrMsg = "" + + if (.not. allocated(CableDeltaL) .or. .not. allocated(CableDeltaLdot) .or. (p%NumCableControl<=0)) return + + + !................................................................... + ! Calculate the cable control channels + !................................................................... + SELECT CASE ( p%CCmode ) ! Which cable control are we using? + ! Nothing. Note that these might be allocated if no control signals were requested from any modules + CASE ( ControlMode_NONE ) + CableDeltaL = 0.0_ReKi + CableDeltaLdot = 0.0_ReKi + ! User-defined from Simulink or LabVIEW. + CASE ( ControlMode_EXTERN ) + if (allocated(u%ExternalCableDeltaL)) then + CableDeltaL( 1:p%NumCableControl) = u%ExternalCableDeltaL( 1:p%NumCableControl) + endif + if (allocated(u%ExternalCableDeltaLdot)) then + CableDeltaLdot(1:p%NumCableControl) = u%ExternalCableDeltaLdot(1:p%NumCableControl) + endif + ! User-defined cable control from Bladed-style DLL + CASE ( ControlMode_DLL ) + if (allocated(m%dll_data%PrevCableDeltaL)) then + if (p%DLL_Ramp) then + factor = (t - m%LastTimeCalled) / m%dll_data%DLL_DT + CableDeltaL(1:p%NumCableControl) = m%dll_data%PrevCableDeltaL( 1:p%NumCableControl) + & + factor * ( m%dll_data%CableDeltaL( 1:p%NumCableControl) - m%dll_data%PrevCableDeltaL( 1:p%NumCableControl) ) + else + CableDeltaL( 1:p%NumCableControl) = m%dll_data%CableDeltaL( 1:p%NumCableControl) + end if + else + CableDeltaL = 0.0_ReKi + endif + if (allocated(m%dll_data%PrevCableDeltaLdot)) then + if (p%DLL_Ramp) then + factor = (t - m%LastTimeCalled) / m%dll_data%DLL_DT + CableDeltaLdot(1:p%NumCableControl) = m%dll_data%PrevCableDeltaLdot(1:p%NumCableControl) + & + factor * ( m%dll_data%CableDeltaLdot(1:p%NumCableControl) - m%dll_data%PrevCableDeltaLdot(1:p%NumCableControl) ) + else + CableDeltaLdot(1:p%NumCableControl) = m%dll_data%CableDeltaLdot(1:p%NumCableControl) + endif + else + CableDeltaLdot = 0.0_ReKi + endif + END SELECT + +END SUBROUTINE CableControl_CalcOutput + +!---------------------------------------------------------------------------------------------------------------------------------- +!> Routine for computing the StC control commands +! Commanded Airfoil UserProp for blade (must be same units as given in AD15 airfoil tables) +! This is passed to AD15 to be interpolated with the airfoil table userprop column +! (might be used for airfoil flap angles for example) +SUBROUTINE StCControl_CalcOutput( t, p, StC_CmdStiff, StC_CmdDamp, StC_CmdBrake, StC_CmdForce, m, ErrStat, ErrMsg ) + REAL(DbKi), INTENT(IN ) :: t !< Current simulation time in seconds + TYPE(SrvD_ParameterType), INTENT(IN ) :: p !< Parameters + REAL(ReKi), ALLOCATABLE, INTENT(INOUT) :: StC_CmdStiff(:,:) !< StC_CmdStiff command signals (3,p%NumStC_Control) + REAL(ReKi), ALLOCATABLE, INTENT(INOUT) :: StC_CmdDamp(:,:) !< StC_CmdDamp command signals (3,p%NumStC_Control) + REAL(ReKi), ALLOCATABLE, INTENT(INOUT) :: StC_CmdBrake(:,:) !< StC_CmdBrake command signals (3,p%NumStC_Control) + REAL(ReKi), ALLOCATABLE, INTENT(INOUT) :: StC_CmdForce(:,:) !< StC_CmdForce command signals (3,p%NumStC_Control) + TYPE(SrvD_MiscVarType), INTENT(INOUT) :: m !< Misc (optimization) variables + INTEGER(IntKi), INTENT( OUT) :: ErrStat !< Error status of the operation + CHARACTER(*), INTENT( OUT) :: ErrMsg !< Error message if ErrStat /= ErrID_None + REAL(ReKi) :: factor + + ! Initialize ErrStat -- This isn't curently needed, but if a user routine is created, it might be wanted then + ErrStat = ErrID_None + ErrMsg = "" + + ! Only proceed if we have have StC controls with the extended swap and legacy interface + if ((p%NumStC_Control <= 0) .or. (.not. p%EXavrSWAP)) return + if (.not. allocated(StC_CmdStiff) .or. .not. allocated(StC_CmdDamp) .or. .not. allocated(StC_CmdBrake) .or. .not. allocated(StC_CmdForce)) then + ErrStat = ErrID_Fatal + ErrMsg = "StC control signal matrices not allocated. Programming error somewhere." + return + endif + + !................................................................... + ! Calculate the cable control channels -- NOTE: each StC instance will only use the channel data if StC_CMODE is set to + !................................................................... + ! User-defined cable control from Bladed-style DLL + if (p%DLL_Ramp) then + factor = (t - m%LastTimeCalled) / m%dll_data%DLL_DT + if (allocated(StC_CmdStiff)) then + StC_CmdStiff(1:3,1:p%NumStC_Control) = m%dll_data%PrevStCCmdStiff(1:3,1:p%NumStC_Control) + & + factor * ( m%dll_data%StCCmdStiff(1:3,1:p%NumStC_Control) - m%dll_data%PrevStCCmdStiff(1:3,1:p%NumStC_Control) ) + endif + if (allocated(StC_CmdDamp)) then + StC_CmdDamp(1:3,1:p%NumStC_Control) = m%dll_data%PrevStCCmdDamp(1:3,1:p%NumStC_Control) + & + factor * ( m%dll_data%StCCmdDamp(1:3,1:p%NumStC_Control) - m%dll_data%PrevStCCmdDamp(1:3,1:p%NumStC_Control) ) + endif + if (allocated(StC_CmdBrake)) then + StC_CmdBrake(1:3,1:p%NumStC_Control) = m%dll_data%PrevStCCmdBrake(1:3,1:p%NumStC_Control) + & + factor * ( m%dll_data%StCCmdBrake(1:3,1:p%NumStC_Control) - m%dll_data%PrevStCCmdBrake(1:3,1:p%NumStC_Control) ) + endif + if (allocated(StC_CmdForce)) then + StC_CmdForce(1:3,1:p%NumStC_Control) = m%dll_data%PrevStCCmdForce(1:3,1:p%NumStC_Control) + & + factor * ( m%dll_data%StCCmdForce(1:3,1:p%NumStC_Control) - m%dll_data%PrevStCCmdForce(1:3,1:p%NumStC_Control) ) + endif + else + if (allocated(StC_CmdStiff)) StC_CmdStiff(1:3,1:p%NumStC_Control) = m%dll_data%StCCmdStiff(1:3,1:p%NumStC_Control) + if (allocated(StC_CmdDamp)) StC_CmdDamp( 1:3,1:p%NumStC_Control) = m%dll_data%StCCmdDamp( 1:3,1:p%NumStC_Control) + if (allocated(StC_CmdBrake)) StC_CmdBrake(1:3,1:p%NumStC_Control) = m%dll_data%StCCmdBrake(1:3,1:p%NumStC_Control) + if (allocated(StC_CmdForce)) StC_CmdForce(1:3,1:p%NumStC_Control) = m%dll_data%StCCmdForce(1:3,1:p%NumStC_Control) + end if +END SUBROUTINE StCControl_CalcOutput + +subroutine StC_SetDLLinputs(p,m,MeasDisp,MeasVel,ErrStat,ErrMsg,InitResize) + type(SrvD_ParameterType), intent(in ) :: p !< Parameters + type(SrvD_MiscVarType), intent(inout) :: m !< Misc (optimization) variables + real(SiKi), allocatable, intent(inout) :: MeasDisp(:,:) !< StC measured displacement signals to DLL (3,p%NumStC_Control) + real(SiKi), allocatable, intent(inout) :: MeasVel(:,:) !< StC measured velocity signals to DLL (3,p%NumStC_Control) + integer(IntKi), intent( out) :: ErrStat !< Error status of the operation + character(*), intent( out) :: ErrMsg !< Error message if ErrStat /= ErrID_None + logical, optional, intent(in ) :: InitResize !< resize arrays during initialization? + + integer(IntKi) :: i,j !< Generic counters + type(StC_OutputType) :: y_tmp ! copy of y -- for resizing as needed. + character(*), parameter :: RoutineName = 'StC_SetDLLinputs' + integer(IntKi) :: ErrStat2 ! temporary Error status of the operation + character(ErrMsgLen) :: ErrMsg2 ! temporary Error message if ErrStat /= ErrID_None + + ! Initialize ErrStat + ErrStat = ErrID_None + ErrMsg = "" + + ! Only proceed if we have have StC controls with the extended swap and legacy interface + if ((p%NumStC_Control <= 0) .or. (.not. p%EXavrSWAP)) return + if (.not. allocated(MeasDisp) .or. .not. allocated(MeasVel)) then + ErrStat2 = ErrID_Fatal + ErrMsg2 = "StC control signal matrices not allocated. Programming error somewhere." + if (Failed()) return + endif + + if (present(InitResize)) then + if (InitResize) then + ! Resize the u% arrays from each StC and copy its original data back in if + ! needed -- we will size these all the same for simpler calculations later + do i=1,p%NumBStC ! Blade + call ResizeStCoutput( i,m%y_BStC(i)) + enddo + do i=1,p%NumNStC ! Nacelle + call ResizeStCoutput( i,m%y_NStC(i)) + enddo + do i=1,p%NumTStC ! Tower + call ResizeStCoutput( i,m%y_TStC(i)) + enddo + do i=1,p%NumSStC ! SubStructure + call ResizeStCoutput( i,m%y_SStC(i)) + enddo + endif + endif + + ! Retrieve the data from each StC instance + do i=1,p%NumBStC ! Blade + call GetMeas(i,p%BStC(i)%StC_CChan,m%y_BStC(i)) + enddo + do i=1,p%NumNStC ! Nacelle + call GetMeas(i,p%NStC(i)%StC_CChan,m%y_NStC(i)) + enddo + do i=1,p%NumTStC ! Tower + call GetMeas(i,p%TStC(i)%StC_CChan,m%y_TStC(i)) + enddo + do i=1,p%NumSStC ! SubStructure + call GetMeas(i,p%SStC(i)%StC_CChan,m%y_SStC(i)) + enddo + + ! If any of the channels are serving multiple StC instances, average them + do i=1,p%NumStC_Control + if (p%StCMeasNumPerChan(i)>1) then + MeasDisp(1:3,i) = MeasDisp(1:3,i) / real(p%StCMeasNumPerChan(i),SiKi) + MeasVel( 1:3,i) = MeasVel( 1:3,i) / real(p%StCMeasNumPerChan(i),SiKi) + endif + enddo + +contains + subroutine ResizeStCoutput(iNum,y) ! Assemble info about who requested which channel + integer(IntKi), intent(in ) :: iNum ! instance number + type(StC_OutputType), intent(inout) :: y ! outputs from the StC instance -- will contain allocated Cmd output values if used + type(StC_OutputType) :: y_tmp ! copy of y -- for resizing as needed + integer(IntKi) :: i_local + if (allocated(y%MeasDisp) .and. allocated(y%MeasVel)) then ! either all or none will be allocated + if (p%NumStC_Control > min(size(y%MeasDisp,2),size(y%MeasVel,2))) then + call StC_CopyOutput(y,y_tmp,MESH_NEWCOPY,ErrStat2,ErrMsg2); if (Failed()) return; + + if (allocated(y%MeasDisp)) deallocate(y%MeasDisp) + call AllocAry(y%MeasDisp,3,p%NumStC_Control,"y%MeasDisp",ErrStat2,ErrMsg2); if (Failed()) return; + y%MeasDisp = 0.0_ReKi + do i_local=1,min(p%NumStC_Control,size(y_tmp%MeasDisp,2)) + y%MeasDisp(1:3,i_local) = y_tmp%MeasDisp(1:3,i_local) + enddo + + if (allocated(y%MeasVel)) deallocate(y%MeasVel) + call AllocAry(y%MeasVel,3,p%NumStC_Control,"y%MeasVel",ErrStat2,ErrMsg2); if (Failed()) return; + y%MeasVel = 0.0_ReKi + do i_local=1,min(p%NumStC_Control,size(y_tmp%MeasVel,2)) + y%MeasVel(1:3,i_local) = y_tmp%MeasVel(1:3,i_local) + enddo + + call Cleanup() + endif + else + if (.not. allocated(y%MeasDisp)) then + call AllocAry(y%MeasDisp,3,p%NumStC_Control,"y%MeasDisp",ErrStat2,ErrMsg2); if (Failed()) return; + y%MeasDisp = 0.0_ReKi + endif + if (.not. allocated(y%MeasVel)) then + call AllocAry(y%MeasVel, 3,p%NumStC_Control,"y%MeasVel", ErrStat2,ErrMsg2); if (Failed()) return; + y%MeasVel = 0.0_ReKi + endif + endif + end subroutine ResizeStCoutput + logical function Failed() + CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) + Failed = ErrStat >= AbortErrLev + if (Failed) call Cleanup() + end function Failed + subroutine Cleanup() + call StC_DestroyOutput(y_tmp,ErrStat2,ErrMsg2) ! ignore error messages + end subroutine Cleanup + subroutine GetMeas(iNum,CChan,y) ! Assemble info about who requested which channel + integer(IntKi), intent(in) :: iNum ! instance number + integer(IntKi), allocatable,intent(in) :: CChan(:) ! Channel request set from that StC instance + type(StC_OutputType), intent(in) :: y ! outputs from the StC instance + do j=1,size(CChan) + if (CChan(j) > 0) then + MeasDisp(1:3,CChan(j)) = MeasDisp(1:3,CChan(j)) + real(y%MeasDisp(1:3,CChan(j)),SiKi) + MeasVel( 1:3,CChan(j)) = MeasVel( 1:3,CChan(j)) + real(y%MeasVel( 1:3,CChan(j)),SiKi) + endif + enddo + end subroutine GetMeas +end subroutine StC_SetDLLinputs + +subroutine StC_SetInitDLLinputs(p,m,InitStiff,InitDamp,InitBrake,InitForce,ErrStat,ErrMsg) + type(SrvD_ParameterType), intent(in ) :: p !< Parameters + type(SrvD_MiscVarType), intent(inout) :: m !< Misc (optimization) variables + real(SiKi), allocatable, intent(inout) :: InitStiff(:,:) !< initial stiffness -- from input file normally output of DLL (3,p%NumStC_Control) + real(SiKi), allocatable, intent(inout) :: InitDamp(:,:) !< Initial damping -- from input file normally output of DLL (3,p%NumStC_Control) + real(SiKi), allocatable, intent(inout) :: InitBrake(:,:) !< Initial brake -- from input file (?) normally output of DLL (3,p%NumStC_Control) + real(SiKi), allocatable, intent(inout) :: InitForce(:,:) !< Initial brake -- from input file (?) normally output of DLL (3,p%NumStC_Control) + integer(IntKi), intent( out) :: ErrStat !< Error status of the operation + character(*), intent( out) :: ErrMsg !< Error message if ErrStat /= ErrID_None + + integer(IntKi) :: i,j !< Generic counters + type(StC_InputType) :: u_tmp ! copy of u -- for resizing as needed. + character(*), parameter :: RoutineName = 'StC_SetInitDLLinputs' + integer(IntKi) :: ErrStat2 ! temporary Error status of the operation + character(ErrMsgLen) :: ErrMsg2 ! temporary Error message if ErrStat /= ErrID_None + + + ! Initialize ErrStat + ErrStat = ErrID_None + ErrMsg = "" + + ! Only proceed if we have have StC controls with the extended swap + if ((p%NumStC_Control <= 0) .or. (.not. p%EXavrSWAP)) return + if ((.not. allocated(InitStiff)) .or. (.not. allocated(InitDamp)) .or. (.not. allocated(InitBrake)) .or. (.not. allocated(InitForce))) then + ErrStat2 = ErrID_Fatal + ErrMsg2 = "StC control signal matrices not allocated. Programming error somewhere." + if (Failed()) return + endif + + ! Resize the u% arrays from each StC and copy its original data back in if + ! needed -- we will size these all the same for simpler calculations later + do i=1,p%NumBStC ! Blade + call ResizeStCinput( i,m%u_BStC(1,i)) + enddo + do i=1,p%NumNStC ! Nacelle + call ResizeStCinput( i,m%u_NStC(1,i)) + enddo + do i=1,p%NumTStC ! Tower + call ResizeStCinput( i,m%u_TStC(1,i)) + enddo + do i=1,p%NumSStC ! SubStructure + call ResizeStCinput( i,m%u_SStC(1,i)) + enddo + + ! Retrieve the data from each StC instance + do i=1,p%NumBStC ! Blade + call GetMeas(i,p%BStC(i)%StC_CChan,m%u_BStC(1,i)) + enddo + do i=1,p%NumNStC ! Nacelle + call GetMeas(i,p%NStC(i)%StC_CChan,m%u_NStC(1,i)) + enddo + do i=1,p%NumTStC ! Tower + call GetMeas(i,p%TStC(i)%StC_CChan,m%u_TStC(1,i)) + enddo + do i=1,p%NumSStC ! SubStructure + call GetMeas(i,p%SStC(i)%StC_CChan,m%u_SStC(1,i)) + enddo + + ! If any of the channels are serving multiple StC instances, average them + do i=1,p%NumStC_Control + if (p%StCMeasNumPerChan(i)>1) then + InitStiff(1:3,i) = InitStiff(1:3,i) / real(p%StCMeasNumPerChan(i),SiKi) + InitDamp( 1:3,i) = InitDamp( 1:3,i) / real(p%StCMeasNumPerChan(i),SiKi) + InitBrake(1:3,i) = InitBrake(1:3,i) / real(p%StCMeasNumPerChan(i),SiKi) + endif + enddo + InitForce = 0.0_ReKi + +contains + subroutine ResizeStCinput(iNum,u) ! Assemble info about who requested which channel + integer(IntKi), intent(in ) :: iNum ! instance number + type(StC_InputType), intent(inout) :: u ! inputs from the StC instance -- will contain allocated Cmd input values if used + type(StC_InputType) :: u_tmp ! copy of u -- for resizing as needed + integer(IntKi) :: i_local + if (allocated(u%CmdStiff) .and. allocated(u%CmdDamp) .and. allocated(u%CmdBrake) .and. allocated(u%CmdForce)) then ! either all or none will be allocated + if (p%NumStC_Control > min(size(u%CmdStiff,2),size(u%CmdDamp,2),size(u%CmdBrake,2),size(u%CmdForce,2))) then + call StC_CopyInput(u,u_tmp,MESH_NEWCOPY,ErrStat2,ErrMsg2); if (Failed()) return; + + if (allocated(u%CmdStiff)) deallocate(u%CmdStiff) + call AllocAry(u%CmdStiff,3,p%NumStC_Control,"u%CmdStiff",ErrStat2,ErrMsg2); if (Failed()) return; + u%CmdStiff = 0.0_ReKi + do i_local=1,min(p%NumStC_Control,size(u_tmp%CmdStiff,2)) + u%CmdStiff(1:3,i_local) = u_tmp%CmdStiff(1:3,i_local) + enddo + + if (allocated(u%CmdDamp)) deallocate(u%CmdDamp) + call AllocAry(u%CmdDamp,3,p%NumStC_Control,"u%CmdDamp",ErrStat2,ErrMsg2); if (Failed()) return; + u%CmdDamp = 0.0_ReKi + do i_local=1,min(p%NumStC_Control,size(u_tmp%CmdDamp,2)) + u%CmdDamp(1:3,i_local) = u_tmp%CmdDamp(1:3,i_local) + enddo + + if (allocated(u%CmdBrake)) deallocate(u%CmdBrake) + call AllocAry(u%CmdBrake,3,p%NumStC_Control,"u%CmdBrake",ErrStat2,ErrMsg2); if (Failed()) return; + u%CmdBrake = 0.0_ReKi + do i_local=1,min(p%NumStC_Control,size(u_tmp%CmdBrake,2)) + u%CmdBrake(1:3,i_local) = u_tmp%CmdBrake(1:3,i_local) + enddo + + if (allocated(u%CmdForce)) deallocate(u%CmdForce) + call AllocAry(u%CmdForce,3,p%NumStC_Control,"u%CmdForce",ErrStat2,ErrMsg2); if (Failed()) return; + u%CmdForce = 0.0_ReKi + do i_local=1,min(p%NumStC_Control,size(u_tmp%CmdForce,2)) + u%CmdForce(1:3,i_local) = u_tmp%CmdForce(1:3,i_local) + enddo + + call Cleanup() + endif + else + if (.not. allocated(u%CmdStiff)) then + call AllocAry(u%CmdStiff,3,p%NumStC_Control,"u%CmdStiff",ErrStat2,ErrMsg2); if (Failed()) return; + u%CmdStiff = 0.0_ReKi + endif + if (.not. allocated(u%CmdDamp)) then + call AllocAry(u%CmdDamp, 3,p%NumStC_Control,"u%CmdDamp", ErrStat2,ErrMsg2); if (Failed()) return; + u%CmdDamp = 0.0_ReKi + endif + if (.not. allocated(u%CmdBrake)) then + call AllocAry(u%CmdBrake,3,p%NumStC_Control,"u%CmdBrake",ErrStat2,ErrMsg2); if (Failed()) return; + u%CmdBrake = 0.0_ReKi + endif + if (.not. allocated(u%CmdForce)) then + call AllocAry(u%CmdForce,3,p%NumStC_Control,"u%CmdForce",ErrStat2,ErrMsg2); if (Failed()) return; + u%CmdForce = 0.0_ReKi + endif + endif + end subroutine ResizeStCinput + subroutine GetMeas(iNum,CChan,u) ! Assemble info about who requested which channel + integer(IntKi), intent(in) :: iNum ! instance number + integer(IntKi), allocatable,intent(in) :: CChan(:) ! Channel request set from that StC instance + type(StC_InputType), intent(in) :: u ! inputs from the StC instance -- will contain allocated Cmd input values if used + do j=1,min(p%NumStC_Control,size(CChan)) ! the channel request list for a given StC instance may be smaller than the total channel set + if (CChan(j) > 0) then + InitStiff(1:3,CChan(j)) = InitStiff(1:3,CChan(j)) + real(u%CmdStiff(1:3,CChan(j)),SiKi) + InitDamp( 1:3,CChan(j)) = InitDamp( 1:3,CChan(j)) + real(u%CmdDamp( 1:3,CChan(j)),SiKi) + InitBrake(1:3,CChan(j)) = InitBrake(1:3,CChan(j)) + real(u%CmdBrake(1:3,CChan(j)),SiKi) + InitForce(1:3,CChan(j)) = InitForce(1:3,CChan(j)) + real(u%CmdForce(1:3,CChan(j)),SiKi) + endif + enddo + end subroutine GetMeas + logical function Failed() + CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) + Failed = ErrStat >= AbortErrLev + if (Failed) call Cleanup() + end function Failed + subroutine Cleanup() + call StC_DestroyInput(u_tmp,ErrStat2,ErrMsg2) ! ignore error messages + end subroutine Cleanup +end subroutine StC_SetInitDLLinputs + +subroutine StC_InitExtrapInputs(p,m,ErrStat,ErrMsg) + type(SrvD_ParameterType), intent(in ) :: p !< Parameters + type(SrvD_MiscVarType), intent(inout) :: m !< Misc (optimization) variables + integer(IntKi), intent( out) :: ErrStat !< Error status of the operation + character(*), intent( out) :: ErrMsg !< Error message if ErrStat /= ErrID_None + integer(IntKi) :: i,j !< Generic counters + character(*), parameter :: RoutineName = 'StC_InitExtrapInputs' + integer(IntKi) :: ErrStat2 ! temporary Error status of the operation + character(ErrMsgLen) :: ErrMsg2 ! temporary Error message if ErrStat /= ErrID_None + + ! Initialize ErrStat + ErrStat = ErrID_None + ErrMsg = "" + ! Copy the inputs(1) to the others (this copies the measured data over as well) + do i=1,p%NumBStC ! Blade + do j=2,p%InterpOrder+1 + call StC_CopyInput(m%u_BStC(1,i),m%u_BStC(j,i),MESH_NEWCOPY,ErrStat2,ErrMsg2); if (Failed()) return; + enddo + enddo + do i=1,p%NumNStC ! Nacelle + do j=2,p%InterpOrder+1 + call StC_CopyInput(m%u_NStC(1,i),m%u_NStC(j,i),MESH_NEWCOPY,ErrStat2,ErrMsg2); if (Failed()) return; + enddo + enddo + do i=1,p%NumTStC ! Tower + do j=2,p%InterpOrder+1 + call StC_CopyInput(m%u_TStC(1,i),m%u_TStC(j,i),MESH_NEWCOPY,ErrStat2,ErrMsg2); if (Failed()) return; + enddo + enddo + do i=1,p%NumSStC ! SubStructure + do j=2,p%InterpOrder+1 + call StC_CopyInput(m%u_SStC(1,i),m%u_SStC(j,i),MESH_NEWCOPY,ErrStat2,ErrMsg2); if (Failed()) return; + enddo + enddo +contains + logical function Failed() + CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) + Failed = ErrStat >= AbortErrLev + end function Failed +end subroutine StC_InitExtrapInputs END MODULE ServoDyn !********************************************************************************************************************************** diff --git a/modules/servodyn/src/ServoDyn_Driver.f90 b/modules/servodyn/src/ServoDyn_Driver.f90 index 3d9734eaa5..6bc6d0ef47 100644 --- a/modules/servodyn/src/ServoDyn_Driver.f90 +++ b/modules/servodyn/src/ServoDyn_Driver.f90 @@ -91,32 +91,61 @@ PROGRAM SrvD_Driver InitInData%gravity = 9.81 !m/s^2 !FIXME: why are these hard coded!!!? ! StrucCtrl nacelle position - InitInData%NacPosition = (/ 90.0, 0.0, 0.0 /) ! m, position of nacelle (for NStC) - InitInData%NacOrientation= 0.0_R8Ki + InitInData%NacRefPos = (/ 90.0, 0.0, 0.0 /) ! m, reference position of nacelle (for NStC) + InitInData%NacTransDisp = (/ 0.0, 0.0, 0.0 /) ! m, initial displacement of nacelle (for NStC) + InitInData%NacRefOrient = 0.0_R8Ki + InitInData%NacOrient = 0.0_R8Ki do j=1,3 - InitInData%NacOrientation(j,j) = 1.0_R8Ki + InitInData%NacRefOrient(j,j) = 1.0_R8Ki + InitInData%NacOrient(j,j) = 1.0_R8Ki enddo ! StrucCtrl tower - InitInData%TwrBasePos = (/ 0.0, 0.0, 0.0 /) ! m, position of tower base (for TStC) - InitInData%TwrBaseOrient = 0.0_R8Ki + InitInData%TwrBaseRefPos = (/ 0.0, 0.0, 0.0 /) ! m, reference position of tower base (for TStC) + InitInData%TwrBaseTransDisp = (/ 0.0, 0.0, 0.0 /) ! m, initial displacement tower base (for TStC) + InitInData%TwrBaseRefOrient = 0.0_R8Ki + InitInData%TwrBaseOrient = 0.0_R8Ki do j=1,3 - InitInData%TwrBaseOrient(j,j) = 1.0_R8Ki + InitInData%TwrBaseRefOrient(j,j) = 1.0_R8Ki + InitInData%TwrBaseOrient(j,j) = 1.0_R8Ki enddo ! StrucCtrl single blade - call AllocAry(InitInData%BladeRootPosition, 3,1, 'InitInData%BladeRootPosition', ErrStat,ErrMsg) + call AllocAry(InitInData%BladeRootRefPos, 3,1, 'InitInData%BladeRootRefPos', ErrStat,ErrMsg) IF ( ErrStat /= ErrID_None ) THEN CALL WrScr( ErrMsg ) IF (ErrStat >= AbortErrLev) call ProgAbort('') END IF - call AllocAry(InitInData%BladeRootOrientation, 3,3,1, 'InitInData%BladeRootOrientation',ErrStat,ErrMsg) + call AllocAry(InitInData%BladeRootTransDisp, 3,1, 'InitInData%BladeRootTransDisp', ErrStat,ErrMsg) IF ( ErrStat /= ErrID_None ) THEN CALL WrScr( ErrMsg ) IF (ErrStat >= AbortErrLev) call ProgAbort('') END IF - InitInData%BladeRootPosition(1:3,1) = (/ 0.0, 0.0, 0.0 /) ! m, position of blade root (for BStC) - InitInData%BladeRootOrientation = 0.0_R8Ki + call AllocAry(InitInData%BladeRootRefOrient, 3,3,1, 'InitInData%BladeRootRefOrient', ErrStat,ErrMsg) + IF ( ErrStat /= ErrID_None ) THEN + CALL WrScr( ErrMsg ) + IF (ErrStat >= AbortErrLev) call ProgAbort('') + END IF + call AllocAry(InitInData%BladeRootOrient, 3,3,1, 'InitInData%BladeRootOrient', ErrStat,ErrMsg) + IF ( ErrStat /= ErrID_None ) THEN + CALL WrScr( ErrMsg ) + IF (ErrStat >= AbortErrLev) call ProgAbort('') + END IF +! FIXME: This isn't a very useful position to put a blade + InitInData%BladeRootRefPos(1:3,1) = (/ 0.0, 0.0, 0.0 /) ! m, reference position of blade root (for BStC) + InitInData%BladeRootTransDisp(1:3,1) = (/ 0.0, 0.0, 0.0 /) ! m, initial dispalcement of blade root (for BStC) + InitInData%BladeRootRefOrient = 0.0_R8Ki + InitInData%BladeRootOrient = 0.0_R8Ki + do j=1,3 + InitInData%BladeRootRefOrient(j,j,1) = 1.0_R8Ki + InitInData%BladeRootOrient(j,j,1) = 1.0_R8Ki + enddo + ! StrucCtrl substructure + InitInData%PtfmRefPos = (/ 0.0, 0.0, 0.0 /) ! m, reference position of Ptfm + InitInData%PtfmTransDisp = (/ 0.0, 0.0, 0.0 /) ! m, initial displacement of Ptfm + InitInData%PtfmRefOrient = 0.0_R8Ki + InitInData%PtfmOrient = 0.0_R8Ki do j=1,3 - InitInData%BladeRootOrientation(j,j,1) = 1.0_R8Ki + InitInData%PtfmRefOrient(j,j) = 1.0_R8Ki + InitInData%PtfmOrient(j,j) = 1.0_R8Ki enddo InitInData%TMax = 10.0 !s InitInData%AirDens = 1.225 !kg/m^3 diff --git a/modules/servodyn/src/ServoDyn_IO.f90 b/modules/servodyn/src/ServoDyn_IO.f90 index b9e01b6e7f..e01b085c6b 100644 --- a/modules/servodyn/src/ServoDyn_IO.f90 +++ b/modules/servodyn/src/ServoDyn_IO.f90 @@ -28,6 +28,9 @@ MODULE ServoDyn_IO IMPLICIT NONE + + character(*),parameter :: SectionDivide = '____________________________________________________________________________________________________' + ! =================================================================================================== ! NOTE: The following lines of code were generated by a Matlab script called "Write_ChckOutLst.m" ! using the parameters listed in the "OutListParameters.xlsx" Excel file. Any changes to these @@ -1196,6 +1199,28 @@ subroutine ParseInputFileInfo( PriPath, InputFile, OutFileRoot, FileInfo_In, Inp InputFileData%NacYawF = InputFileData%NacYawF*D2R + !---------------------- Aerodynamic Flow Control -------------------------------- + if ( InputFileData%Echo ) WRITE(UnEcho, '(A)') FileInfo_In%Lines(CurLine) ! Write section break to echo + CurLine = CurLine + 1 + ! AfCmode - Airfoil control mode { + ! 0: none + ! 1: cosine wave cycle + ! 4: user-defined from Simulink/Labview + ! 5: user-defined from Bladed-style DLL} + call ParseVar( FileInfo_In, CurLine, 'AfCmode', InputFileData%AfCmode, ErrStat2, ErrMsg2, UnEcho ) + if (Failed()) return; + ! AfC_Mean - Mean level for sinusoidal cycling or steady value (-) [used only with AfCmode==1] + call ParseVar( FileInfo_In, CurLine, 'AfC_Mean', InputFileData%AfC_mean, ErrStat2, ErrMsg2, UnEcho ) + if (Failed()) return; + ! AfC_amplitude - Amplitude for for cosine cycling of flap signal (AfC = AfC_Amp*cos(Azimuth+phase)+AfC_mean) (-) [used only with AfCmode==1] + call ParseVar( FileInfo_In, CurLine, 'AfC_Amp', InputFileData%AfC_Amp, ErrStat2, ErrMsg2, UnEcho ) + if (Failed()) return; + ! AfC_phase - Phase relative to the blade azimuth (0 is vertical) for for cosine cycling of flap signal (deg) [used only with AfCmode==1] + call ParseVar( FileInfo_In, CurLine, 'AfC_Phase', InputFileData%AfC_Phase, ErrStat2, ErrMsg2, UnEcho ) + if (Failed()) return; + InputFileData%AfC_phase = InputFileData%AfC_phase*D2R + + !---------------------- TUNED MASS DAMPER ---------------------------------------- if ( InputFileData%Echo ) WRITE(UnEcho, '(A)') FileInfo_In%Lines(CurLine) ! Write section break to echo CurLine = CurLine + 1 @@ -1248,6 +1273,17 @@ subroutine ParseInputFileInfo( PriPath, InputFile, OutFileRoot, FileInfo_In, Inp enddo + !---------------------- Cable Control ------------------------------------------- + if ( InputFileData%Echo ) WRITE(UnEcho, '(A)') FileInfo_In%Lines(CurLine) ! Write section break to echo + CurLine = CurLine + 1 + ! CCmode - Cable control mode { + ! 0: none + ! 4: user-defined from Simulink/Labview + ! 5: user-defined from Bladed-style DLL} + call ParseVar( FileInfo_In, CurLine, 'CCmode', InputFileData%CCmode, ErrStat2, ErrMsg2, UnEcho ) + if (Failed()) return; + + !---------------------- BLADED INTERFACE ---------------------------------------- if ( InputFileData%Echo ) WRITE(UnEcho, '(A)') FileInfo_In%Lines(CurLine) ! Write section break to echo CurLine = CurLine + 1 @@ -1271,6 +1307,10 @@ subroutine ParseInputFileInfo( PriPath, InputFile, OutFileRoot, FileInfo_In, Inp ! BPCutoff - Cuttoff frequency for low-pass filter on blade pitch from DLL (Hz) [used only with Bladed Interface] call ParseVar( FileInfo_In, CurLine, 'BPCutoff', InputFileData%BPCutoff, ErrStat2, ErrMsg2, UnEcho ) if (Failed()) return; +! ! EXavrSWAP - Use extended avrSWAP with Records 1000-3500 (flag) [may not be compatible with all controllers] +! call ParseVar( FileInfo_In, CurLine, 'EXavrSWAP', InputFileData%EXavrSWAP, ErrStat2, ErrMsg2, UnEcho ) + InputFileData%EXavrSWAP = .TRUE. ! Hard coding this, but leaving this read in case we want to enable control of this later + if (Failed()) return; ! NacYaw_North - Reference yaw angle of the nacelle when the upwind end points due North (deg) [used only with Bladed Interface] call ParseVar( FileInfo_In, CurLine, 'NacYaw_North', InputFileData%NacYaw_North, ErrStat2, ErrMsg2, UnEcho ) if (Failed()) return; @@ -1348,7 +1388,6 @@ subroutine ParseInputFileInfo( PriPath, InputFile, OutFileRoot, FileInfo_In, Inp endif - !---------------------- OUTPUT -------------------------------------------------- if ( InputFileData%Echo ) WRITE(UnEcho, '(A)') FileInfo_In%Lines(CurLine) ! Write section break to echo CurLine = CurLine + 1 @@ -2302,5 +2341,109 @@ END SUBROUTINE SetOutParam !---------------------------------------------------------------------------------------------------------------------------------- !End of code generated by Matlab script !********************************************************************************************************************************** + + +!==================================================================================================== +subroutine InitializeSummaryFile(InputFileData,OutfileRoot,UnSum,ErrStat,ErrMsg) + type(SrvD_InputFile), intent(in ) :: InputFileData !< Data stored in the module's input file + character(*), intent(in ) :: OutFileRoot !< Rootname (including path) for writing summary file + integer(IntKi), intent(inout) :: UnSum !< summary file number (>0 when set) + integer(IntKi), intent( out) :: ErrStat !< The error status code + character(ErrMsgLen), intent( out) :: ErrMsg !< The error message, if an error occurred + integer(IntKi) :: ErrStat2 ! Temporary error ID + character(ErrMsgLen) :: ErrMsg2 ! Temporary message describing error + character(*), parameter :: RoutineName = 'InitializeSummaryFile' + ! init vars + ErrStat = ErrID_None + ErrMsg = '' + if ( InputFileData%SumPrint ) then + call GetNewUnit( UnSum ) + CALL OpenEcho ( UnSum, TRIM(OutFileRoot)//'.sum', ErrStat2, ErrMsg2 ) + CALL SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + else + return + endif + ! Put some header info into the summary file + WRITE (UnSum,'(/,A/)', IOSTAT=ErrStat2) 'This summary file was generated by ServoDyn'//& + ' on '//CurDate()//' at '//CurTime()//'.' +end subroutine InitializeSummaryFile +!==================================================================================================== +subroutine SrvD_CloseSum( UnSum, ErrStat, ErrMsg ) + integer, intent(inout) :: UnSum ! the unit number for the SubDyn summary file + integer, intent( out) :: ErrStat ! returns a non-zero value when an error occurs + character(*), intent( out) :: ErrMsg ! Error message if ErrStat /= ErrID_None + ! Local variables + integer :: Stat ! status from I/) operation + ErrStat = ErrID_None + ErrMsg = "" + ! Write any closing information in the summary file + IF ( UnSum > 0 ) THEN + WRITE (UnSum,'(/,A/)', IOSTAT=Stat) 'This summary file was closed on '//CurDate()//' at '//CurTime()//'.' + IF (Stat /= 0) THEN + ErrStat = ErrID_FATAL + ErrMsg = ' Problem writing to summary file.' + END IF + ! Close the file + CLOSE( UnSum, IOSTAT=Stat ) + IF (Stat /= 0) THEN + ErrStat = ErrID_FATAL + ErrMsg = TRIM(ErrMsg)//' Problem closing summary file.' + END IF + IF ( ErrStat /= ErrID_None ) ErrMsg = 'SrvD_CloseSum'//TRIM(ErrMsg) + UnSum=-1 + END IF +end subroutine SrvD_CloseSum +!==================================================================================================== +!> Write info about the simulink interface to the summary file if compiled for Simulink +!! NOTE: Check the FAST_Library.f90 file for the authority on this!!!! This file could be out of date!!!! +subroutine WrSumInfo4Simulink(p,SimulinkCtrlMode,UnSum) + type(SrvD_ParameterType), intent(in ) :: p !< Parameters + integer, intent(in ) :: SimulinkCtrlMode !< ControlMode_EXTERN value (we don't have that in here) + integer, intent(in ) :: UnSum ! the unit number for the SubDyn summary file + + if (UnSum > 0) then + write(UnSum, '(A)') '' + write(UnSum, '(A)') SectionDivide + write(UnSum, '(A)') ' Simulink Interface used for:' + call WrCtrlInfo( p%YCMode ==SimulinkCtrlMode,'Nacelle yaw control ','(YawPosCom,YawRateCom) ') + call WrCtrlInfo( p%YCMode ==SimulinkCtrlMode,'Nacelle yaw control ','(YawPosCom,YawRateCom) ') + call WrCtrlInfo( p%PCMode ==SimulinkCtrlMode,'Blade pitch cotrol ','(BlPitchCom) ') + call WrCtrlInfo( p%VSContrl ==SimulinkCtrlMode,'Variable generator speed ','(GenTrq,ElecPwr) ') + call WrCtrlInfo( p%HSSBrMode ==SimulinkCtrlMode,'High speed shaft brake ','(HSSBrFrac) ') + call WrCtrlInfo( p%AfCmode ==SimulinkCtrlMode,'Airfoil commands (flaps) ','(BlAirfoilCom) ') + call WrCtrlInfo( p%CCmode ==SimulinkCtrlMode,'Cable actuator control ','(CableDeltaL,CableDeltaLdot) ') + write(UnSum, '(A)') '' + write(UnSum, '(A)') ' Simulink inteface to OpenFAST library InputAry:' + write(UnSum, '(A)') ' (check FAST_Library.f90 if errors) ' + write(UnSum, '(A)') '' + write(UnSum, '(6x,8x,3x,A3,3x,A)') '<--','indicates from Simulink to SrvD' + write(UnSum, '(6x,A8,3x,A3,3x,A11)') 'Record #',' ','Description' + write(UnSum, '(6x,A8,3x,A3,3x,A11)') '--------',' ','-----------' + write(UnSum, '(8x,A5,4x,A3,3x,A)') '1 ','<--','GenTrq ' + write(UnSum, '(8x,A5,4x,A3,3x,A)') '2 ','<--','ElecPwr ' + write(UnSum, '(8x,A5,4x,A3,3x,A)') '3 ','<--','YawPosCom ' + write(UnSum, '(8x,A5,4x,A3,3x,A)') '4 ','<--','YawRateCom ' + write(UnSum, '(8x,A5,4x,A3,3x,A)') '5:7 ','<--','BlPitchCom ' + write(UnSum, '(8x,A5,4x,A3,3x,A)') '8 ','<--','HSSBrFrac ' + write(UnSum, '(8x,A5,4x,A3,3x,A)') '9:11 ','<--','BlAirfoilCom ' + write(UnSum, '(8x,A5,4x,A3,3x,A)') '12:31 ','<--','CableDeltaL ' + write(UnSum, '(8x,A5,4x,A3,3x,A)') '32:51 ','<--','CableDektaLdot ' + write(UnSum, '(8x,A5,4x,A3,3x,A)') '52:54 ','<--','Lidar focus (optional) ' + endif +contains + subroutine WrCtrlInfo( IsControlled, Desc, DataChans ) + logical, intent(in ) :: IsControlled + character(30), intent(in ) :: Desc + character(30), intent(in ) :: DataChans + if (IsControlled) then + write(UnSum, '(9x,A30,6x,A30)') Desc,DataChans + else + write(UnSum, '(9x,A30,6x,A30)') Desc,'NOT ACTIVE' + endif + end subroutine WrCtrlInfo +end subroutine WrSumInfo4Simulink + + END MODULE ServoDyn_IO !********************************************************************************************************************************** diff --git a/modules/servodyn/src/ServoDyn_Registry.txt b/modules/servodyn/src/ServoDyn_Registry.txt index 527552d2ff..7b145279fc 100644 --- a/modules/servodyn/src/ServoDyn_Registry.txt +++ b/modules/servodyn/src/ServoDyn_Registry.txt @@ -22,12 +22,18 @@ typedef ^ InitInputType IntKi NumBl - - - "Number of blades on the turbine" - typedef ^ InitInputType CHARACTER(1024) RootName - - - "RootName for writing output files" - typedef ^ InitInputType ReKi BlPitchInit {:} - - "Initial blade pitch" - typedef ^ InitInputType ReKi Gravity {3} - - "Gravitational acceleration vector" m/s^2 -typedef ^ InitInputType ReKi NacPosition {3} - - "nacelle origin for setting up mesh" m -typedef ^ InitInputType R8Ki NacOrientation {3}{3} - - "nacelle orientation for setting up mesh" - -typedef ^ InitInputType ReKi TwrBasePos {3} - - "tower base origin for setting up mesh" m +typedef ^ InitInputType ReKi NacRefPos {3} - - "nacelle origin for setting up mesh" m +typedef ^ InitInputType R8Ki NacTransDisp {3} - - "nacelle displacement from origin at init for setting up mesh" m +typedef ^ InitInputType R8Ki NacOrient {3}{3} - - "nacelle orientation for setting up mesh" - +typedef ^ InitInputType R8Ki NacRefOrient {3}{3} - - "nacelle reference orientation for setting up mesh" - +typedef ^ InitInputType ReKi TwrBaseRefPos {3} - - "tower base origin for setting up mesh" m +typedef ^ InitInputType R8Ki TwrBaseTransDisp {3} - - "tower base translation from origin at init for setting up mesh" m typedef ^ InitInputType R8Ki TwrBaseOrient {3}{3} - - "tower base orientation for setting up mesh" m -typedef ^ InitInputType ReKi PlatformPos {3} - - "platform origin for setting up mesh" m -typedef ^ InitInputType R8Ki PlatformOrient {3}{3} - - "platform orientation for setting up mesh" m +typedef ^ InitInputType R8Ki TwrBaseRefOrient {3}{3} - - "tower reference orientation for setting up mesh" m +typedef ^ InitInputType ReKi PtfmRefPos {3} - - "platform origin for setting up mesh" m +typedef ^ InitInputType R8Ki PtfmTransDisp {3} - - "platform displacement from origin for setting up mesh" m +typedef ^ InitInputType R8Ki PtfmOrient {3}{3} - - "platform orientation for setting up mesh" m +typedef ^ InitInputType R8Ki PtfmRefOrient {3}{3} - - "platform reference orientation for setting up mesh" m typedef ^ InitInputType DbKi Tmax - - - "max time from glue code" s typedef ^ InitInputType ReKi AvgWindSpeed - - - "average wind speed for the simulation" m/s typedef ^ InitInputType ReKi AirDens - - - "air density" kg/m^3 @@ -37,11 +43,17 @@ typedef ^ InitInputType IntKi NumCtrl2SC - - - "number of controller outputs [to typedef ^ InitInputType IntKi TrimCase - - - "Controller parameter to be trimmed {1:yaw; 2:torque; 3:pitch} [used only if CalcSteady=True]" - typedef ^ InitInputType ReKi TrimGain - - - "Proportional gain for the rotational speed error (>0) [used only if TrimCase>0]" "rad/(rad/s) for yaw or pitch; Nm/(rad/s) for torque" typedef ^ InitInputType ReKi RotSpeedRef - - - "Reference rotor speed" "rad/s" -typedef ^ InitInputType ReKi BladeRootPosition {:}{:} - - "X-Y-Z reference position of each blade root (3 x NumBlades)" m -typedef ^ InitInputType R8Ki BladeRootOrientation {:}{:}{:} - - "DCM reference orientation of blade roots (3x3 x NumBlades)" - +typedef ^ InitInputType ReKi BladeRootRefPos {:}{:} - - "X-Y-Z reference position of each blade root (3 x NumBlades)" m +typedef ^ InitInputType R8Ki BladeRootTransDisp {:}{:} - - "X-Y-Z translation from reference position at init of each blade root (3 x NumBlades)" m +typedef ^ InitInputType R8Ki BladeRootOrient {:}{:}{:} - - "DCM reference orientation of blade roots (3x3 x NumBlades)" - +typedef ^ InitInputType R8Ki BladeRootRefOrient {:}{:}{:} - - "DCM reference orientation of blade roots (3x3 x NumBlades)" - typedef ^ InitInputType LOGICAL UseInputFile - .TRUE. - "read input from input file" - typedef ^ InitInputType FileInfoType PassedPrimaryInputData - - - "Primary input file as FileInfoType (set by driver/glue code)" - #ADD in the TMD submodule input file passing here +typedef ^ InitInputType IntKi NumCableControl - - - "Number of cable control channels requested" - +typedef ^ InitInputType CHARACTER(64) CableControlRequestor {:} - - "Array with text info about which module requested the cable control channel (size of NumCableControl). This is just for diagnostics." - +typedef ^ InitInputType IntKi InterpOrder - - - "Interpolation order from glue code -- required to set m%u_xStC sizes" - +#ADD in the TMD submodule input file passing here typedef ^ InitInputType ReKi fromSCGlob {:} - - "Initial global inputs to the controller [from the supercontroller]" - typedef ^ InitInputType ReKi fromSC {:} - - "Initial turbine specific inputs to the controller [from the supercontroller]" - @@ -146,6 +158,15 @@ typedef ^ SrvD_InputFile CHARACTER(1024) TStCfiles {:} - - "Name of the files fo typedef ^ SrvD_InputFile IntKi NumSStC - - - "Number of substructure structural controllers (integer)" - typedef ^ SrvD_InputFile CHARACTER(1024) SStCfiles {:} - - "Name of the files for subtructure structural controllers (quoted strings) [unused when NumSStC==0]" - +typedef ^ SrvD_InputFile IntKi AfCmode - - - "Airfoil control mode {0: none, 1: sine wave cycle, 4: user-defined from Simulink/Labview, 5: user-defined from Bladed-style DLL}" - +typedef ^ SrvD_InputFile ReKi AfC_Mean - - - "Mean level for cosine cycling or steady value [used only with AfCmode==1]" - +typedef ^ SrvD_InputFile ReKi AfC_Amp - - - "Amplitude for for cosine cycling of flap signal (-) [used only with AfCmode==1]" - +typedef ^ SrvD_InputFile ReKi AfC_Phase - - - "Phase relative to the blade azimuth (0 is vertical) for for cosine cycling of flap signal (deg) [used only with AfCmode==1]" deg + +typedef ^ SrvD_InputFile IntKi CCmode - - - "Cable control control mode {0: none, 4: user-defined from Simulink/Labview, 5: user-defined from Bladed-style DLL}" - + +typedef ^ SrvD_InputFile Logical EXavrSWAP - - - "Use extendend AVR swap" - + # ..... Data for using Bladed DLLs ....................................................................................................... typedef ^ BladedDLLType SiKi avrSWAP {:} - - "The swap array: used to pass data to and from the DLL controller" "see Bladed DLL documentation" typedef ^ BladedDLLType ReKi HSSBrTrqDemand - - - "Demanded braking torque - from Bladed DLL" - @@ -155,6 +176,7 @@ typedef ^ BladedDLLType IntKi GenState - - - "Generator state from Bladed DLL" - typedef ^ BladedDLLType ReKi BlPitchCom 3 - - "Commanded blade pitch angles" radians typedef ^ BladedDLLType ReKi PrevBlPitch 3 - - "Previously commanded blade pitch angles" radians typedef ^ BladedDLLType ReKi BlAirfoilCom 3 - - "Commanded Airfoil UserProp for blade. Passed to AD15 for airfoil interpolation (must be same units as given in AD15 airfoil tables)" - +typedef ^ BladedDLLType ReKi PrevBlAirfoilCom 3 - - "Previously commanded Airfoil UserProp for blade. Passed to AD15 for airfoil interpolation (must be same units as given in AD15 airfoil tables)" - typedef ^ BladedDLLType ReKi ElecPwr_prev - - - "Electrical power (from previous step), sent to Bladed DLL" W typedef ^ BladedDLLType ReKi GenTrq_prev - - - "Electrical generator torque (from previous step), sent to Bladed DLL" N-m typedef ^ BladedDLLType SiKi toSC {:} - - "controller output to supercontroller" - @@ -218,6 +240,25 @@ typedef ^ BladedDLLType ReKi GenSpd_TLU {:} - - "Table (array) containing DLL_Nu typedef ^ BladedDLLType ReKi GenTrq_TLU {:} - - "Table (array) containing DLL_NumTrq generator torques for the torque-speed table look-up (TLU) -- this should be defined using an array constructor, for example, if DLL_NumTrq = 3, GenTrq_TLU(DLL_NumTrq) = (/ 0.0, 10, 200.0 /)" Nm typedef ^ BladedDLLType IntKi Yaw_Cntrl - - - "Yaw control: 0 = rate; 1 = torque" - +typedef ^ BladedDLLType SiKi PrevCableDeltaL {:} - - "Previous value for ramping for cable tensioning DeltaL using extended avrSWAP [see EXavrSWAP documentation in BladededInterface_EX]" m +typedef ^ BladedDLLType SiKi PrevCableDeltaLdot {:} - - "Previous value for ramping for cable tensioning DeltaLdot using extended avrSWAP [see EXavrSWAP documentation in BladededInterface_EX]" m/s +typedef ^ BladedDLLType SiKi CableDeltaL {:} - - "The swap array: used to pass data from the DLL controller for cable tensioning DeltaL using extended avrSWAP [see EXavrSWAP documentation in BladededInterface_EX]" m +typedef ^ BladedDLLType SiKi CableDeltaLdot {:} - - "The swap array: used to pass data from the DLL controller for cable tensioning DeltaLdot using extended avrSWAP [see EXavrSWAP documentation in BladededInterface_EX]" m/s +typedef ^ BladedDLLType SiKi PrevStCCmdStiff {:}{:} - - "Previous value for ramping StC stiffness from controller (3,NumStC_Control)" "N/m" +typedef ^ BladedDLLType SiKi PrevStCCmdDamp {:}{:} - - "Previous value for ramping StC damping from controller (3,NumStC_Control)" "N/(m/s)" +typedef ^ BladedDLLType SiKi PrevStCCmdBrake {:}{:} - - "Previous value for ramping StC braking signal (3,NumStC_Control)" "N/(m/s)" +typedef ^ BladedDLLType SiKi PrevStCCmdForce {:}{:} - - "Previous value for ramping StC force signal (3,NumStC_Control)" "N/(m/s)" +typedef ^ BladedDLLType SiKi StCCmdStiff {:}{:} - - "StC stiffness from controller (3,NumStC_Control)" "N/m" +typedef ^ BladedDLLType SiKi StCCmdDamp {:}{:} - - "StC damping from controller (3,NumStC_Control)" "N/(m/s)" +typedef ^ BladedDLLType SiKi StCCmdBrake {:}{:} - - "StC braking signal (3,NumStC_Control)" "N" +typedef ^ BladedDLLType SiKi StCCmdForce {:}{:} - - "StC commanded force signal (3,NumStC_Control)" "N" +typedef ^ BladedDLLType SiKi StCMeasDisp {:}{:} - - "StC measured local displacement signal from StC (3,NumStC_Control)" "m" +typedef ^ BladedDLLType SiKi StCMeasVel {:}{:} - - "StC measured local velocity signal from StC (3,NumStC_Control)" "m/s" + +#Placeholders for future development +#typedef ^ BladedDLLType SiKi EXavrSWAP_Lidar {:} - - "The swap array: used to pass data from the DLL controller for Lidar using extended avrSWAP [see EXavrSWAP documentation in BladededInterface_EX]" - +#typedef ^ BladedDLLType SiKi EXavrSWAP_AeroControls {:} - - "The swap array: used to pass data from the DLL controller for AeroControls using extended avrSWAP [see EXavrSWAP documentation in BladededInterface_EX]" - + # ..... States .................................................................................................................... # Define continuous (differentiable) states here: typedef ^ ContinuousStateType ReKi DummyContState - - - "Remove this variable if you have continuous states" - @@ -264,6 +305,16 @@ typedef ^ OtherStateType StC_OtherStateType NStC {:} - - "StC module states - na typedef ^ OtherStateType StC_OtherStateType TStC {:} - - "StC module states - tower" - typedef ^ OtherStateType StC_OtherStateType SStC {:} - - "StC module inputs - substructure" - +# ..... SrvD_ModuleMapType............................................................................................................. +typedef ^ SrvD_ModuleMapType MeshMapType u_BStC_Mot2_BStC {:}{:} - - "Map motions: u%BStCMotionMesh to m%u_BSTC%MotionMesh" +typedef ^ SrvD_ModuleMapType MeshMapType u_NStC_Mot2_NStC {:} - - "Map motions: u%NStCMotionMesh to m%u_NStC%MotionMesh" +typedef ^ SrvD_ModuleMapType MeshMapType u_TStC_Mot2_TStC {:} - - "Map motions: u%TStCMotionMesh to m%u_TStC%MotionMesh" +typedef ^ SrvD_ModuleMapType MeshMapType u_SStC_Mot2_SStC {:} - - "Map motions: u%SStCMotionMesh to m%u_SStC%MotionMesh" +typedef ^ SrvD_ModuleMapType MeshMapType BStC_Frc2_y_BStC {:}{:} - - "Map loads: m%y_BStCLoadMesh to y%BSTC%LoadMesh" +typedef ^ SrvD_ModuleMapType MeshMapType NStC_Frc2_y_NStC {:} - - "Map loads: m%y_NStCLoadMesh to y%NStC%LoadMesh" +typedef ^ SrvD_ModuleMapType MeshMapType TStC_Frc2_y_TStC {:} - - "Map loads: m%y_TStCLoadMesh to y%TStC%LoadMesh" +typedef ^ SrvD_ModuleMapType MeshMapType SStC_Frc2_y_SStC {:} - - "Map loads: m%y_SStCLoadMesh to y%SStC%LoadMesh" + # ..... Misc Variables ................................................................................................................ typedef ^ MiscVarType DbKi LastTimeCalled - - - "last time the CalcOutput/Bladed DLL was called" s typedef ^ MiscVarType BladedDLLType dll_data - - - "data used for Bladed DLL" - @@ -274,6 +325,16 @@ typedef ^ MiscVarType StC_MiscVarType BStC {:} - - "StC module misc vars - blade typedef ^ MiscVarType StC_MiscVarType NStC {:} - - "StC module misc vars - nacelle" - typedef ^ MiscVarType StC_MiscVarType TStC {:} - - "StC module misc vars - tower" - typedef ^ MiscVarType StC_MiscVarType SStC {:} - - "StC module misc vars - substructure" - +typedef ^ MiscVarType StC_InputType u_BStC {:}{:} - - "StC module inputs - blade size:(interpOrder,NumBStC)" - +typedef ^ MiscVarType StC_InputType u_NStC {:}{:} - - "StC module inputs - nacelle size:(interpOrder,NumNStC)" - +typedef ^ MiscVarType StC_InputType u_TStC {:}{:} - - "StC module inputs - tower size:(interpOrder,NumTStC)" - +typedef ^ MiscVarType StC_InputType u_SStC {:}{:} - - "StC module inputs - substructure size:(interpOrder,NumSStC)" - +typedef ^ MiscVarType StC_OutputType y_BStC {:} - - "StC module outputs - blade" - +typedef ^ MiscVarType StC_OutputType y_NStC {:} - - "StC module outputs - nacelle" - +typedef ^ MiscVarType StC_OutputType y_TStC {:} - - "StC module outputs - tower" - +typedef ^ MiscVarType StC_OutputType y_SStC {:} - - "StC module outputs - substructure" - +typedef ^ MiscVarType SrvD_ModuleMapType SrvD_MeshMap - - - "Mesh mapping from inputs/output meshes to StC input/output meshes" - +typedef ^ MiscVarType IntKi PrevTstepNcall - -1 - "Previous timestep N for tracking when in predictor/corrector loop for setting StC u values" - # ..... Parameters ................................................................................................................ # Define parameters here: @@ -343,6 +404,12 @@ typedef ^ ParameterType IntKi NumBStC - - - "Number of blade structural controll typedef ^ ParameterType IntKi NumNStC - - - "Number of nacelle structural controllers (integer)" - typedef ^ ParameterType IntKi NumTStC - - - "Number of tower structural controllers (integer)" - typedef ^ ParameterType IntKi NumSStC - - - "Number of substructure structural controllers (integer)" - +typedef ^ ParameterType IntKi AfCmode - - - "Airfoil control mode {0: none, 1: sine wave cycle, 4: user-defined from Simulink/Labview, 5: user-defined from Bladed-style DLL}" - +typedef ^ ParameterType ReKi AfC_Mean - - - "Mean level for cosine cycling or steady value [used only with AfCmode==1]" - +typedef ^ ParameterType ReKi AfC_Amp - - - "Amplitude for for cosine cycling of flap signal (-) [used only with AfCmode==1]" - +typedef ^ ParameterType ReKi AfC_Phase - - - "Phase relative to the blade azimuth (0 is vertical) for for cosine cycling of flap signal (deg) [used only with AfCmode==1]" deg +typedef ^ ParameterType IntKi CCmode - - - "Cable control control mode {0: none, 4: user-defined from Simulink/Labview, 5: user-defined from Bladed-style DLL}" - +typedef ^ ParameterType IntKi StCCmode - - - "Structural control control mode {0: none, 4: user-defined from Simulink/Labview, 5: user-defined from Bladed-style DLL}" - # parameters for output typedef ^ ParameterType IntKi NumOuts - - - "Number of parameters in the output list (number of outputs requested)" - typedef ^ ParameterType IntKi NumOuts_DLL - - - "Number of logging channels output from the DLL (set at initialization)" - @@ -369,6 +436,11 @@ typedef ^ ParameterType StC_ParameterType BStC {:} - - "StC module parameters - typedef ^ ParameterType StC_ParameterType NStC {:} - - "StC module parameters - nacelle" - typedef ^ ParameterType StC_ParameterType TStC {:} - - "StC module parameters - tower" - typedef ^ ParameterType StC_ParameterType SStC {:} - - "StC module parameters - substructure" - +typedef ^ ParameterType IntKi InterpOrder - - - "Interpolation order from glue code -- required to set m%u_xStC sizes" - +typedef ^ ParameterType Logical EXavrSWAP - - - "Use extendend avr SWAP" - +typedef ^ ParameterType IntKi NumCableControl - - - "Number of cable control channels requested" - +typedef ^ ParameterType IntKi NumStC_Control - - - "Number of cable StC channels requested" - +typedef ^ ParameterType IntKi StCMeasNumPerChan {:} - - "Number of cable StC channel to average on each control channel sent to DLL" - typedef ^ ParameterType LOGICAL UseSC - - - "Supercontroller on/off flag" - # ..... Inputs .................................................................................................................... @@ -385,6 +457,9 @@ typedef ^ InputType ReKi ExternalBlPitchCom {:} - 2pi "Commanded blade pitch fro typedef ^ InputType ReKi ExternalGenTrq - - - "Electrical generator torque from Simulink or LabVIEW" N-m typedef ^ InputType ReKi ExternalElecPwr - - - "Electrical power from Simulink or LabVIEW" W typedef ^ InputType ReKi ExternalHSSBrFrac - - - "Fraction of full braking torque: 0 (off) <= HSSBrFrac <= 1 (full) from Simulink or LabVIEW" - +typedef ^ InputType ReKi ExternalBlAirfoilCom {:} - - "Commanded Airfoil UserProp for blade. Passed to AD15 for airfoil interpolation (must be same units as given in AD15 airfoil tables)" - +typedef ^ InputType ReKi ExternalCableDeltaL {:} - - "Commanded Cable controlo DeltaL" m +typedef ^ InputType ReKi ExternalCableDeltaLdot {:} - - "Commanded Cable controlo DeltaLdot" m/s typedef ^ InputType ReKi TwrAccel - - - "Tower acceleration for tower feedback control (user routine only)" m/s^2 typedef ^ InputType ReKi YawErr - - 2pi "Yaw error" radians typedef ^ InputType ReKi WindDir - - 2pi "Wind direction" radians @@ -406,13 +481,15 @@ typedef ^ InputType ReKi NcIMURAzs - - - "Nacelle inertial measurement unit angu typedef ^ InputType ReKi RotPwr - - - "Rotor power (this is equivalent to the low-speed shaft power)" W typedef ^ InputType ReKi HorWindV - - - "Horizontal hub-height wind velocity magnitude" m/s typedef ^ InputType ReKi YawAngle - - 2pi "Estimate of yaw (nacelle + platform)" radians -typedef ^ InputType StC_InputType BStC {:} - - "StC module inputs - blade" - -typedef ^ InputType StC_InputType NStC {:} - - "StC module inputs - nacelle" - -typedef ^ InputType StC_InputType TStC {:} - - "StC module inputs - tower" - -typedef ^ InputType StC_InputType SStC {:} - - "StC module inputs - substructure" - typedef ^ InputType SiKi fromSC {:} - - "A swap array: used to pass turbine specific input data to the DLL controller from the supercontroller" - typedef ^ InputType SiKi fromSCglob {:} - - "A swap array: used to pass global input data to the DLL controller from the supercontroller" - typedef ^ InputType SiKi Lidar {:} - - "A swap array: used to pass input data to the DLL controller from the Lidar" - +typedef ^ InputType MeshType PtfmMotionMesh - - - "Platform motion mesh at platform reference point" - +typedef ^ InputType MeshType BStCMotionMesh {:}{:} - - "StC module blade input motion mesh" - +typedef ^ InputType MeshType NStCMotionMesh {:} - - "StC module nacelle input motion mesh" - +typedef ^ InputType MeshType TStCMotionMesh {:} - - "StC module tower input motion mesh" - +typedef ^ InputType MeshType SStCMotionMesh {:} - - "StC module substructure input motion mesh" - + # ..... Outputs ................................................................................................................... # Define outputs that are contained on the mesh here: @@ -426,9 +503,11 @@ typedef ^ OutputType ReKi GenTrq - - - "Electrical generator torque" N-m typedef ^ OutputType ReKi HSSBrTrqC - - - "Commanded HSS brake torque" N-m typedef ^ OutputType ReKi ElecPwr - - - "Electrical power" W typedef ^ OutputType ReKi TBDrCon {:} - - "Instantaneous tip-brake drag constant, Cd*Area" -typedef ^ OutputType StC_OutputType BStC {:} - - "StC module outputs - blade" - -typedef ^ OutputType StC_OutputType NStC {:} - - "StC module outputs - nacelle" - -typedef ^ OutputType StC_OutputType TStC {:} - - "StC module outputs - tower" - -typedef ^ OutputType StC_OutputType SStC {:} - - "StC module outputs - substructure" - -typedef ^ OutputType SiKi toSC {:} - - "A swap array: used to pass output data from the DLL controller to the supercontroller" - typedef ^ OutputType SiKi Lidar {:} - - "A swap array: used to pass output data from the DLL controller to the Lidar" - +typedef ^ OutputType ReKi CableDeltaL {:} - - "Cable control -- Length change request (passed to MD or SD)" m +typedef ^ OutputType ReKi CableDeltaLdot {:} - - "Cable control -- Length change rate request (passed to MD or SD)" m/s +typedef ^ OutputType MeshType BStCLoadMesh {:}{:} - - "StC module blade output load mesh (NumBl,NumBStC)" - +typedef ^ OutputType MeshType NStCLoadMesh {:} - - "StC module nacelle output load mesh" - +typedef ^ OutputType MeshType TStCLoadMesh {:} - - "StC module tower output load mesh" - +typedef ^ OutputType MeshType SStCLoadMesh {:} - - "StC module substructure output load mesh" - +typedef ^ OutputType SiKi toSC {:} - - "A swap array: used to pass output data from the DLL controller to the supercontroller" - diff --git a/modules/servodyn/src/ServoDyn_Types.f90 b/modules/servodyn/src/ServoDyn_Types.f90 index 0f4a7b28ef..ba93e4640d 100644 --- a/modules/servodyn/src/ServoDyn_Types.f90 +++ b/modules/servodyn/src/ServoDyn_Types.f90 @@ -42,12 +42,18 @@ MODULE ServoDyn_Types CHARACTER(1024) :: RootName !< RootName for writing output files [-] REAL(ReKi) , DIMENSION(:), ALLOCATABLE :: BlPitchInit !< Initial blade pitch [-] REAL(ReKi) , DIMENSION(1:3) :: Gravity !< Gravitational acceleration vector [m/s^2] - REAL(ReKi) , DIMENSION(1:3) :: NacPosition !< nacelle origin for setting up mesh [m] - REAL(R8Ki) , DIMENSION(1:3,1:3) :: NacOrientation !< nacelle orientation for setting up mesh [-] - REAL(ReKi) , DIMENSION(1:3) :: TwrBasePos !< tower base origin for setting up mesh [m] + REAL(ReKi) , DIMENSION(1:3) :: NacRefPos !< nacelle origin for setting up mesh [m] + REAL(R8Ki) , DIMENSION(1:3) :: NacTransDisp !< nacelle displacement from origin at init for setting up mesh [m] + REAL(R8Ki) , DIMENSION(1:3,1:3) :: NacOrient !< nacelle orientation for setting up mesh [-] + REAL(R8Ki) , DIMENSION(1:3,1:3) :: NacRefOrient !< nacelle reference orientation for setting up mesh [-] + REAL(ReKi) , DIMENSION(1:3) :: TwrBaseRefPos !< tower base origin for setting up mesh [m] + REAL(R8Ki) , DIMENSION(1:3) :: TwrBaseTransDisp !< tower base translation from origin at init for setting up mesh [m] REAL(R8Ki) , DIMENSION(1:3,1:3) :: TwrBaseOrient !< tower base orientation for setting up mesh [m] - REAL(ReKi) , DIMENSION(1:3) :: PlatformPos !< platform origin for setting up mesh [m] - REAL(R8Ki) , DIMENSION(1:3,1:3) :: PlatformOrient !< platform orientation for setting up mesh [m] + REAL(R8Ki) , DIMENSION(1:3,1:3) :: TwrBaseRefOrient !< tower reference orientation for setting up mesh [m] + REAL(ReKi) , DIMENSION(1:3) :: PtfmRefPos !< platform origin for setting up mesh [m] + REAL(R8Ki) , DIMENSION(1:3) :: PtfmTransDisp !< platform displacement from origin for setting up mesh [m] + REAL(R8Ki) , DIMENSION(1:3,1:3) :: PtfmOrient !< platform orientation for setting up mesh [m] + REAL(R8Ki) , DIMENSION(1:3,1:3) :: PtfmRefOrient !< platform reference orientation for setting up mesh [m] REAL(DbKi) :: Tmax !< max time from glue code [s] REAL(ReKi) :: AvgWindSpeed !< average wind speed for the simulation [m/s] REAL(ReKi) :: AirDens !< air density [kg/m^3] @@ -57,10 +63,15 @@ MODULE ServoDyn_Types INTEGER(IntKi) :: TrimCase !< Controller parameter to be trimmed {1:yaw; 2:torque; 3:pitch} [used only if CalcSteady=True] [-] REAL(ReKi) :: TrimGain !< Proportional gain for the rotational speed error (>0) [used only if TrimCase>0] [rad/(rad/s) for yaw or pitch; Nm/(rad/s) for torque] REAL(ReKi) :: RotSpeedRef !< Reference rotor speed [rad/s] - REAL(ReKi) , DIMENSION(:,:), ALLOCATABLE :: BladeRootPosition !< X-Y-Z reference position of each blade root (3 x NumBlades) [m] - REAL(R8Ki) , DIMENSION(:,:,:), ALLOCATABLE :: BladeRootOrientation !< DCM reference orientation of blade roots (3x3 x NumBlades) [-] + REAL(ReKi) , DIMENSION(:,:), ALLOCATABLE :: BladeRootRefPos !< X-Y-Z reference position of each blade root (3 x NumBlades) [m] + REAL(R8Ki) , DIMENSION(:,:), ALLOCATABLE :: BladeRootTransDisp !< X-Y-Z translation from reference position at init of each blade root (3 x NumBlades) [m] + REAL(R8Ki) , DIMENSION(:,:,:), ALLOCATABLE :: BladeRootOrient !< DCM reference orientation of blade roots (3x3 x NumBlades) [-] + REAL(R8Ki) , DIMENSION(:,:,:), ALLOCATABLE :: BladeRootRefOrient !< DCM reference orientation of blade roots (3x3 x NumBlades) [-] LOGICAL :: UseInputFile = .TRUE. !< read input from input file [-] TYPE(FileInfoType) :: PassedPrimaryInputData !< Primary input file as FileInfoType (set by driver/glue code) [-] + INTEGER(IntKi) :: NumCableControl !< Number of cable control channels requested [-] + CHARACTER(64) , DIMENSION(:), ALLOCATABLE :: CableControlRequestor !< Array with text info about which module requested the cable control channel (size of NumCableControl). This is just for diagnostics. [-] + INTEGER(IntKi) :: InterpOrder !< Interpolation order from glue code -- required to set m%u_xStC sizes [-] REAL(ReKi) , DIMENSION(:), ALLOCATABLE :: fromSCGlob !< Initial global inputs to the controller [from the supercontroller] [-] REAL(ReKi) , DIMENSION(:), ALLOCATABLE :: fromSC !< Initial turbine specific inputs to the controller [from the supercontroller] [-] END TYPE SrvD_InitInputType @@ -162,6 +173,12 @@ MODULE ServoDyn_Types CHARACTER(1024) , DIMENSION(:), ALLOCATABLE :: TStCfiles !< Name of the files for tower structural controllers (quoted strings) [unused when NumTStC==0] [-] INTEGER(IntKi) :: NumSStC !< Number of substructure structural controllers (integer) [-] CHARACTER(1024) , DIMENSION(:), ALLOCATABLE :: SStCfiles !< Name of the files for subtructure structural controllers (quoted strings) [unused when NumSStC==0] [-] + INTEGER(IntKi) :: AfCmode !< Airfoil control mode {0: none, 1: sine wave cycle, 4: user-defined from Simulink/Labview, 5: user-defined from Bladed-style DLL} [-] + REAL(ReKi) :: AfC_Mean !< Mean level for cosine cycling or steady value [used only with AfCmode==1] [-] + REAL(ReKi) :: AfC_Amp !< Amplitude for for cosine cycling of flap signal (-) [used only with AfCmode==1] [-] + REAL(ReKi) :: AfC_Phase !< Phase relative to the blade azimuth (0 is vertical) for for cosine cycling of flap signal (deg) [used only with AfCmode==1] [deg] + INTEGER(IntKi) :: CCmode !< Cable control control mode {0: none, 4: user-defined from Simulink/Labview, 5: user-defined from Bladed-style DLL} [-] + LOGICAL :: EXavrSWAP !< Use extendend AVR swap [-] END TYPE SrvD_InputFile ! ======================= ! ========= BladedDLLType ======= @@ -174,6 +191,7 @@ MODULE ServoDyn_Types REAL(ReKi) , DIMENSION(1:3) :: BlPitchCom !< Commanded blade pitch angles [radians] REAL(ReKi) , DIMENSION(1:3) :: PrevBlPitch !< Previously commanded blade pitch angles [radians] REAL(ReKi) , DIMENSION(1:3) :: BlAirfoilCom !< Commanded Airfoil UserProp for blade. Passed to AD15 for airfoil interpolation (must be same units as given in AD15 airfoil tables) [-] + REAL(ReKi) , DIMENSION(1:3) :: PrevBlAirfoilCom !< Previously commanded Airfoil UserProp for blade. Passed to AD15 for airfoil interpolation (must be same units as given in AD15 airfoil tables) [-] REAL(ReKi) :: ElecPwr_prev !< Electrical power (from previous step), sent to Bladed DLL [W] REAL(ReKi) :: GenTrq_prev !< Electrical generator torque (from previous step), sent to Bladed DLL [N-m] REAL(SiKi) , DIMENSION(:), ALLOCATABLE :: toSC !< controller output to supercontroller [-] @@ -234,6 +252,20 @@ MODULE ServoDyn_Types REAL(ReKi) , DIMENSION(:), ALLOCATABLE :: GenSpd_TLU !< Table (array) containing DLL_NumTrq generator speeds for the torque-speed table look-up (TLU) -- this should be defined using an array constructor; for example, if DLL_NumTrq = 3, GenSpd_TLU(DLL_NumTrq) = (/ 0.0, 99.9, 999.9 /) [rad/s] REAL(ReKi) , DIMENSION(:), ALLOCATABLE :: GenTrq_TLU !< Table (array) containing DLL_NumTrq generator torques for the torque-speed table look-up (TLU) -- this should be defined using an array constructor, for example, if DLL_NumTrq = 3, GenTrq_TLU(DLL_NumTrq) = (/ 0.0, 10, 200.0 /) [Nm] INTEGER(IntKi) :: Yaw_Cntrl !< Yaw control: 0 = rate; 1 = torque [-] + REAL(SiKi) , DIMENSION(:), ALLOCATABLE :: PrevCableDeltaL !< Previous value for ramping for cable tensioning DeltaL using extended avrSWAP [see EXavrSWAP documentation in BladededInterface_EX] [m] + REAL(SiKi) , DIMENSION(:), ALLOCATABLE :: PrevCableDeltaLdot !< Previous value for ramping for cable tensioning DeltaLdot using extended avrSWAP [see EXavrSWAP documentation in BladededInterface_EX] [m/s] + REAL(SiKi) , DIMENSION(:), ALLOCATABLE :: CableDeltaL !< The swap array: used to pass data from the DLL controller for cable tensioning DeltaL using extended avrSWAP [see EXavrSWAP documentation in BladededInterface_EX] [m] + REAL(SiKi) , DIMENSION(:), ALLOCATABLE :: CableDeltaLdot !< The swap array: used to pass data from the DLL controller for cable tensioning DeltaLdot using extended avrSWAP [see EXavrSWAP documentation in BladededInterface_EX] [m/s] + REAL(SiKi) , DIMENSION(:,:), ALLOCATABLE :: PrevStCCmdStiff !< Previous value for ramping StC stiffness from controller (3,NumStC_Control) [N/m] + REAL(SiKi) , DIMENSION(:,:), ALLOCATABLE :: PrevStCCmdDamp !< Previous value for ramping StC damping from controller (3,NumStC_Control) [N/(m/s)] + REAL(SiKi) , DIMENSION(:,:), ALLOCATABLE :: PrevStCCmdBrake !< Previous value for ramping StC braking signal (3,NumStC_Control) [N/(m/s)] + REAL(SiKi) , DIMENSION(:,:), ALLOCATABLE :: PrevStCCmdForce !< Previous value for ramping StC force signal (3,NumStC_Control) [N/(m/s)] + REAL(SiKi) , DIMENSION(:,:), ALLOCATABLE :: StCCmdStiff !< StC stiffness from controller (3,NumStC_Control) [N/m] + REAL(SiKi) , DIMENSION(:,:), ALLOCATABLE :: StCCmdDamp !< StC damping from controller (3,NumStC_Control) [N/(m/s)] + REAL(SiKi) , DIMENSION(:,:), ALLOCATABLE :: StCCmdBrake !< StC braking signal (3,NumStC_Control) [N] + REAL(SiKi) , DIMENSION(:,:), ALLOCATABLE :: StCCmdForce !< StC commanded force signal (3,NumStC_Control) [N] + REAL(SiKi) , DIMENSION(:,:), ALLOCATABLE :: StCMeasDisp !< StC measured local displacement signal from StC (3,NumStC_Control) [m] + REAL(SiKi) , DIMENSION(:,:), ALLOCATABLE :: StCMeasVel !< StC measured local velocity signal from StC (3,NumStC_Control) [m/s] END TYPE BladedDLLType ! ======================= ! ========= SrvD_ContinuousStateType ======= @@ -283,6 +315,18 @@ MODULE ServoDyn_Types TYPE(StC_OtherStateType) , DIMENSION(:), ALLOCATABLE :: SStC !< StC module inputs - substructure [-] END TYPE SrvD_OtherStateType ! ======================= +! ========= SrvD_ModuleMapType ======= + TYPE, PUBLIC :: SrvD_ModuleMapType + TYPE(MeshMapType) , DIMENSION(:,:), ALLOCATABLE :: u_BStC_Mot2_BStC !< Map motions: u%BStCMotionMesh to m%u_BSTC%MotionMesh [-] + TYPE(MeshMapType) , DIMENSION(:), ALLOCATABLE :: u_NStC_Mot2_NStC !< Map motions: u%NStCMotionMesh to m%u_NStC%MotionMesh [-] + TYPE(MeshMapType) , DIMENSION(:), ALLOCATABLE :: u_TStC_Mot2_TStC !< Map motions: u%TStCMotionMesh to m%u_TStC%MotionMesh [-] + TYPE(MeshMapType) , DIMENSION(:), ALLOCATABLE :: u_SStC_Mot2_SStC !< Map motions: u%SStCMotionMesh to m%u_SStC%MotionMesh [-] + TYPE(MeshMapType) , DIMENSION(:,:), ALLOCATABLE :: BStC_Frc2_y_BStC !< Map loads: m%y_BStCLoadMesh to y%BSTC%LoadMesh [-] + TYPE(MeshMapType) , DIMENSION(:), ALLOCATABLE :: NStC_Frc2_y_NStC !< Map loads: m%y_NStCLoadMesh to y%NStC%LoadMesh [-] + TYPE(MeshMapType) , DIMENSION(:), ALLOCATABLE :: TStC_Frc2_y_TStC !< Map loads: m%y_TStCLoadMesh to y%TStC%LoadMesh [-] + TYPE(MeshMapType) , DIMENSION(:), ALLOCATABLE :: SStC_Frc2_y_SStC !< Map loads: m%y_SStCLoadMesh to y%SStC%LoadMesh [-] + END TYPE SrvD_ModuleMapType +! ======================= ! ========= SrvD_MiscVarType ======= TYPE, PUBLIC :: SrvD_MiscVarType REAL(DbKi) :: LastTimeCalled !< last time the CalcOutput/Bladed DLL was called [s] @@ -294,6 +338,16 @@ MODULE ServoDyn_Types TYPE(StC_MiscVarType) , DIMENSION(:), ALLOCATABLE :: NStC !< StC module misc vars - nacelle [-] TYPE(StC_MiscVarType) , DIMENSION(:), ALLOCATABLE :: TStC !< StC module misc vars - tower [-] TYPE(StC_MiscVarType) , DIMENSION(:), ALLOCATABLE :: SStC !< StC module misc vars - substructure [-] + TYPE(StC_InputType) , DIMENSION(:,:), ALLOCATABLE :: u_BStC !< StC module inputs - blade size:(interpOrder,NumBStC) [-] + TYPE(StC_InputType) , DIMENSION(:,:), ALLOCATABLE :: u_NStC !< StC module inputs - nacelle size:(interpOrder,NumNStC) [-] + TYPE(StC_InputType) , DIMENSION(:,:), ALLOCATABLE :: u_TStC !< StC module inputs - tower size:(interpOrder,NumTStC) [-] + TYPE(StC_InputType) , DIMENSION(:,:), ALLOCATABLE :: u_SStC !< StC module inputs - substructure size:(interpOrder,NumSStC) [-] + TYPE(StC_OutputType) , DIMENSION(:), ALLOCATABLE :: y_BStC !< StC module outputs - blade [-] + TYPE(StC_OutputType) , DIMENSION(:), ALLOCATABLE :: y_NStC !< StC module outputs - nacelle [-] + TYPE(StC_OutputType) , DIMENSION(:), ALLOCATABLE :: y_TStC !< StC module outputs - tower [-] + TYPE(StC_OutputType) , DIMENSION(:), ALLOCATABLE :: y_SStC !< StC module outputs - substructure [-] + TYPE(SrvD_ModuleMapType) :: SrvD_MeshMap !< Mesh mapping from inputs/output meshes to StC input/output meshes [-] + INTEGER(IntKi) :: PrevTstepNcall = -1 !< Previous timestep N for tracking when in predictor/corrector loop for setting StC u values [-] END TYPE SrvD_MiscVarType ! ======================= ! ========= SrvD_ParameterType ======= @@ -363,6 +417,12 @@ MODULE ServoDyn_Types INTEGER(IntKi) :: NumNStC !< Number of nacelle structural controllers (integer) [-] INTEGER(IntKi) :: NumTStC !< Number of tower structural controllers (integer) [-] INTEGER(IntKi) :: NumSStC !< Number of substructure structural controllers (integer) [-] + INTEGER(IntKi) :: AfCmode !< Airfoil control mode {0: none, 1: sine wave cycle, 4: user-defined from Simulink/Labview, 5: user-defined from Bladed-style DLL} [-] + REAL(ReKi) :: AfC_Mean !< Mean level for cosine cycling or steady value [used only with AfCmode==1] [-] + REAL(ReKi) :: AfC_Amp !< Amplitude for for cosine cycling of flap signal (-) [used only with AfCmode==1] [-] + REAL(ReKi) :: AfC_Phase !< Phase relative to the blade azimuth (0 is vertical) for for cosine cycling of flap signal (deg) [used only with AfCmode==1] [deg] + INTEGER(IntKi) :: CCmode !< Cable control control mode {0: none, 4: user-defined from Simulink/Labview, 5: user-defined from Bladed-style DLL} [-] + INTEGER(IntKi) :: StCCmode !< Structural control control mode {0: none, 4: user-defined from Simulink/Labview, 5: user-defined from Bladed-style DLL} [-] INTEGER(IntKi) :: NumOuts !< Number of parameters in the output list (number of outputs requested) [-] INTEGER(IntKi) :: NumOuts_DLL !< Number of logging channels output from the DLL (set at initialization) [-] CHARACTER(1024) :: RootName !< RootName for writing output files [-] @@ -385,6 +445,11 @@ MODULE ServoDyn_Types TYPE(StC_ParameterType) , DIMENSION(:), ALLOCATABLE :: NStC !< StC module parameters - nacelle [-] TYPE(StC_ParameterType) , DIMENSION(:), ALLOCATABLE :: TStC !< StC module parameters - tower [-] TYPE(StC_ParameterType) , DIMENSION(:), ALLOCATABLE :: SStC !< StC module parameters - substructure [-] + INTEGER(IntKi) :: InterpOrder !< Interpolation order from glue code -- required to set m%u_xStC sizes [-] + LOGICAL :: EXavrSWAP !< Use extendend avr SWAP [-] + INTEGER(IntKi) :: NumCableControl !< Number of cable control channels requested [-] + INTEGER(IntKi) :: NumStC_Control !< Number of cable StC channels requested [-] + INTEGER(IntKi) , DIMENSION(:), ALLOCATABLE :: StCMeasNumPerChan !< Number of cable StC channel to average on each control channel sent to DLL [-] LOGICAL :: UseSC !< Supercontroller on/off flag [-] END TYPE SrvD_ParameterType ! ======================= @@ -402,6 +467,9 @@ MODULE ServoDyn_Types REAL(ReKi) :: ExternalGenTrq !< Electrical generator torque from Simulink or LabVIEW [N-m] REAL(ReKi) :: ExternalElecPwr !< Electrical power from Simulink or LabVIEW [W] REAL(ReKi) :: ExternalHSSBrFrac !< Fraction of full braking torque: 0 (off) <= HSSBrFrac <= 1 (full) from Simulink or LabVIEW [-] + REAL(ReKi) , DIMENSION(:), ALLOCATABLE :: ExternalBlAirfoilCom !< Commanded Airfoil UserProp for blade. Passed to AD15 for airfoil interpolation (must be same units as given in AD15 airfoil tables) [-] + REAL(ReKi) , DIMENSION(:), ALLOCATABLE :: ExternalCableDeltaL !< Commanded Cable controlo DeltaL [m] + REAL(ReKi) , DIMENSION(:), ALLOCATABLE :: ExternalCableDeltaLdot !< Commanded Cable controlo DeltaLdot [m/s] REAL(ReKi) :: TwrAccel !< Tower acceleration for tower feedback control (user routine only) [m/s^2] REAL(ReKi) :: YawErr !< Yaw error [radians] REAL(ReKi) :: WindDir !< Wind direction [radians] @@ -423,13 +491,14 @@ MODULE ServoDyn_Types REAL(ReKi) :: RotPwr !< Rotor power (this is equivalent to the low-speed shaft power) [W] REAL(ReKi) :: HorWindV !< Horizontal hub-height wind velocity magnitude [m/s] REAL(ReKi) :: YawAngle !< Estimate of yaw (nacelle + platform) [radians] - TYPE(StC_InputType) , DIMENSION(:), ALLOCATABLE :: BStC !< StC module inputs - blade [-] - TYPE(StC_InputType) , DIMENSION(:), ALLOCATABLE :: NStC !< StC module inputs - nacelle [-] - TYPE(StC_InputType) , DIMENSION(:), ALLOCATABLE :: TStC !< StC module inputs - tower [-] - TYPE(StC_InputType) , DIMENSION(:), ALLOCATABLE :: SStC !< StC module inputs - substructure [-] REAL(SiKi) , DIMENSION(:), ALLOCATABLE :: fromSC !< A swap array: used to pass turbine specific input data to the DLL controller from the supercontroller [-] REAL(SiKi) , DIMENSION(:), ALLOCATABLE :: fromSCglob !< A swap array: used to pass global input data to the DLL controller from the supercontroller [-] REAL(SiKi) , DIMENSION(:), ALLOCATABLE :: Lidar !< A swap array: used to pass input data to the DLL controller from the Lidar [-] + TYPE(MeshType) :: PtfmMotionMesh !< Platform motion mesh at platform reference point [-] + TYPE(MeshType) , DIMENSION(:,:), ALLOCATABLE :: BStCMotionMesh !< StC module blade input motion mesh [-] + TYPE(MeshType) , DIMENSION(:), ALLOCATABLE :: NStCMotionMesh !< StC module nacelle input motion mesh [-] + TYPE(MeshType) , DIMENSION(:), ALLOCATABLE :: TStCMotionMesh !< StC module tower input motion mesh [-] + TYPE(MeshType) , DIMENSION(:), ALLOCATABLE :: SStCMotionMesh !< StC module substructure input motion mesh [-] END TYPE SrvD_InputType ! ======================= ! ========= SrvD_OutputType ======= @@ -442,12 +511,14 @@ MODULE ServoDyn_Types REAL(ReKi) :: HSSBrTrqC !< Commanded HSS brake torque [N-m] REAL(ReKi) :: ElecPwr !< Electrical power [W] REAL(ReKi) , DIMENSION(:), ALLOCATABLE :: TBDrCon !< Instantaneous tip-brake drag constant, Cd*Area [-] - TYPE(StC_OutputType) , DIMENSION(:), ALLOCATABLE :: BStC !< StC module outputs - blade [-] - TYPE(StC_OutputType) , DIMENSION(:), ALLOCATABLE :: NStC !< StC module outputs - nacelle [-] - TYPE(StC_OutputType) , DIMENSION(:), ALLOCATABLE :: TStC !< StC module outputs - tower [-] - TYPE(StC_OutputType) , DIMENSION(:), ALLOCATABLE :: SStC !< StC module outputs - substructure [-] - REAL(SiKi) , DIMENSION(:), ALLOCATABLE :: toSC !< A swap array: used to pass output data from the DLL controller to the supercontroller [-] REAL(SiKi) , DIMENSION(:), ALLOCATABLE :: Lidar !< A swap array: used to pass output data from the DLL controller to the Lidar [-] + REAL(ReKi) , DIMENSION(:), ALLOCATABLE :: CableDeltaL !< Cable control -- Length change request (passed to MD or SD) [m] + REAL(ReKi) , DIMENSION(:), ALLOCATABLE :: CableDeltaLdot !< Cable control -- Length change rate request (passed to MD or SD) [m/s] + TYPE(MeshType) , DIMENSION(:,:), ALLOCATABLE :: BStCLoadMesh !< StC module blade output load mesh (NumBl,NumBStC) [-] + TYPE(MeshType) , DIMENSION(:), ALLOCATABLE :: NStCLoadMesh !< StC module nacelle output load mesh [-] + TYPE(MeshType) , DIMENSION(:), ALLOCATABLE :: TStCLoadMesh !< StC module tower output load mesh [-] + TYPE(MeshType) , DIMENSION(:), ALLOCATABLE :: SStCLoadMesh !< StC module substructure output load mesh [-] + REAL(SiKi) , DIMENSION(:), ALLOCATABLE :: toSC !< A swap array: used to pass output data from the DLL controller to the supercontroller [-] END TYPE SrvD_OutputType ! ======================= CONTAINS @@ -485,12 +556,18 @@ SUBROUTINE SrvD_CopyInitInput( SrcInitInputData, DstInitInputData, CtrlCode, Err DstInitInputData%BlPitchInit = SrcInitInputData%BlPitchInit ENDIF DstInitInputData%Gravity = SrcInitInputData%Gravity - DstInitInputData%NacPosition = SrcInitInputData%NacPosition - DstInitInputData%NacOrientation = SrcInitInputData%NacOrientation - DstInitInputData%TwrBasePos = SrcInitInputData%TwrBasePos + DstInitInputData%NacRefPos = SrcInitInputData%NacRefPos + DstInitInputData%NacTransDisp = SrcInitInputData%NacTransDisp + DstInitInputData%NacOrient = SrcInitInputData%NacOrient + DstInitInputData%NacRefOrient = SrcInitInputData%NacRefOrient + DstInitInputData%TwrBaseRefPos = SrcInitInputData%TwrBaseRefPos + DstInitInputData%TwrBaseTransDisp = SrcInitInputData%TwrBaseTransDisp DstInitInputData%TwrBaseOrient = SrcInitInputData%TwrBaseOrient - DstInitInputData%PlatformPos = SrcInitInputData%PlatformPos - DstInitInputData%PlatformOrient = SrcInitInputData%PlatformOrient + DstInitInputData%TwrBaseRefOrient = SrcInitInputData%TwrBaseRefOrient + DstInitInputData%PtfmRefPos = SrcInitInputData%PtfmRefPos + DstInitInputData%PtfmTransDisp = SrcInitInputData%PtfmTransDisp + DstInitInputData%PtfmOrient = SrcInitInputData%PtfmOrient + DstInitInputData%PtfmRefOrient = SrcInitInputData%PtfmRefOrient DstInitInputData%Tmax = SrcInitInputData%Tmax DstInitInputData%AvgWindSpeed = SrcInitInputData%AvgWindSpeed DstInitInputData%AirDens = SrcInitInputData%AirDens @@ -500,40 +577,84 @@ SUBROUTINE SrvD_CopyInitInput( SrcInitInputData, DstInitInputData, CtrlCode, Err DstInitInputData%TrimCase = SrcInitInputData%TrimCase DstInitInputData%TrimGain = SrcInitInputData%TrimGain DstInitInputData%RotSpeedRef = SrcInitInputData%RotSpeedRef -IF (ALLOCATED(SrcInitInputData%BladeRootPosition)) THEN - i1_l = LBOUND(SrcInitInputData%BladeRootPosition,1) - i1_u = UBOUND(SrcInitInputData%BladeRootPosition,1) - i2_l = LBOUND(SrcInitInputData%BladeRootPosition,2) - i2_u = UBOUND(SrcInitInputData%BladeRootPosition,2) - IF (.NOT. ALLOCATED(DstInitInputData%BladeRootPosition)) THEN - ALLOCATE(DstInitInputData%BladeRootPosition(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating DstInitInputData%BladeRootPosition.', ErrStat, ErrMsg,RoutineName) +IF (ALLOCATED(SrcInitInputData%BladeRootRefPos)) THEN + i1_l = LBOUND(SrcInitInputData%BladeRootRefPos,1) + i1_u = UBOUND(SrcInitInputData%BladeRootRefPos,1) + i2_l = LBOUND(SrcInitInputData%BladeRootRefPos,2) + i2_u = UBOUND(SrcInitInputData%BladeRootRefPos,2) + IF (.NOT. ALLOCATED(DstInitInputData%BladeRootRefPos)) THEN + ALLOCATE(DstInitInputData%BladeRootRefPos(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstInitInputData%BladeRootRefPos.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DstInitInputData%BladeRootRefPos = SrcInitInputData%BladeRootRefPos +ENDIF +IF (ALLOCATED(SrcInitInputData%BladeRootTransDisp)) THEN + i1_l = LBOUND(SrcInitInputData%BladeRootTransDisp,1) + i1_u = UBOUND(SrcInitInputData%BladeRootTransDisp,1) + i2_l = LBOUND(SrcInitInputData%BladeRootTransDisp,2) + i2_u = UBOUND(SrcInitInputData%BladeRootTransDisp,2) + IF (.NOT. ALLOCATED(DstInitInputData%BladeRootTransDisp)) THEN + ALLOCATE(DstInitInputData%BladeRootTransDisp(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstInitInputData%BladeRootTransDisp.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DstInitInputData%BladeRootTransDisp = SrcInitInputData%BladeRootTransDisp +ENDIF +IF (ALLOCATED(SrcInitInputData%BladeRootOrient)) THEN + i1_l = LBOUND(SrcInitInputData%BladeRootOrient,1) + i1_u = UBOUND(SrcInitInputData%BladeRootOrient,1) + i2_l = LBOUND(SrcInitInputData%BladeRootOrient,2) + i2_u = UBOUND(SrcInitInputData%BladeRootOrient,2) + i3_l = LBOUND(SrcInitInputData%BladeRootOrient,3) + i3_u = UBOUND(SrcInitInputData%BladeRootOrient,3) + IF (.NOT. ALLOCATED(DstInitInputData%BladeRootOrient)) THEN + ALLOCATE(DstInitInputData%BladeRootOrient(i1_l:i1_u,i2_l:i2_u,i3_l:i3_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstInitInputData%BladeRootOrient.', ErrStat, ErrMsg,RoutineName) RETURN END IF END IF - DstInitInputData%BladeRootPosition = SrcInitInputData%BladeRootPosition + DstInitInputData%BladeRootOrient = SrcInitInputData%BladeRootOrient ENDIF -IF (ALLOCATED(SrcInitInputData%BladeRootOrientation)) THEN - i1_l = LBOUND(SrcInitInputData%BladeRootOrientation,1) - i1_u = UBOUND(SrcInitInputData%BladeRootOrientation,1) - i2_l = LBOUND(SrcInitInputData%BladeRootOrientation,2) - i2_u = UBOUND(SrcInitInputData%BladeRootOrientation,2) - i3_l = LBOUND(SrcInitInputData%BladeRootOrientation,3) - i3_u = UBOUND(SrcInitInputData%BladeRootOrientation,3) - IF (.NOT. ALLOCATED(DstInitInputData%BladeRootOrientation)) THEN - ALLOCATE(DstInitInputData%BladeRootOrientation(i1_l:i1_u,i2_l:i2_u,i3_l:i3_u),STAT=ErrStat2) +IF (ALLOCATED(SrcInitInputData%BladeRootRefOrient)) THEN + i1_l = LBOUND(SrcInitInputData%BladeRootRefOrient,1) + i1_u = UBOUND(SrcInitInputData%BladeRootRefOrient,1) + i2_l = LBOUND(SrcInitInputData%BladeRootRefOrient,2) + i2_u = UBOUND(SrcInitInputData%BladeRootRefOrient,2) + i3_l = LBOUND(SrcInitInputData%BladeRootRefOrient,3) + i3_u = UBOUND(SrcInitInputData%BladeRootRefOrient,3) + IF (.NOT. ALLOCATED(DstInitInputData%BladeRootRefOrient)) THEN + ALLOCATE(DstInitInputData%BladeRootRefOrient(i1_l:i1_u,i2_l:i2_u,i3_l:i3_u),STAT=ErrStat2) IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating DstInitInputData%BladeRootOrientation.', ErrStat, ErrMsg,RoutineName) + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstInitInputData%BladeRootRefOrient.', ErrStat, ErrMsg,RoutineName) RETURN END IF END IF - DstInitInputData%BladeRootOrientation = SrcInitInputData%BladeRootOrientation + DstInitInputData%BladeRootRefOrient = SrcInitInputData%BladeRootRefOrient ENDIF DstInitInputData%UseInputFile = SrcInitInputData%UseInputFile CALL NWTC_Library_Copyfileinfotype( SrcInitInputData%PassedPrimaryInputData, DstInitInputData%PassedPrimaryInputData, CtrlCode, ErrStat2, ErrMsg2 ) CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) IF (ErrStat>=AbortErrLev) RETURN + DstInitInputData%NumCableControl = SrcInitInputData%NumCableControl +IF (ALLOCATED(SrcInitInputData%CableControlRequestor)) THEN + i1_l = LBOUND(SrcInitInputData%CableControlRequestor,1) + i1_u = UBOUND(SrcInitInputData%CableControlRequestor,1) + IF (.NOT. ALLOCATED(DstInitInputData%CableControlRequestor)) THEN + ALLOCATE(DstInitInputData%CableControlRequestor(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstInitInputData%CableControlRequestor.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DstInitInputData%CableControlRequestor = SrcInitInputData%CableControlRequestor +ENDIF + DstInitInputData%InterpOrder = SrcInitInputData%InterpOrder IF (ALLOCATED(SrcInitInputData%fromSCGlob)) THEN i1_l = LBOUND(SrcInitInputData%fromSCGlob,1) i1_u = UBOUND(SrcInitInputData%fromSCGlob,1) @@ -572,13 +693,22 @@ SUBROUTINE SrvD_DestroyInitInput( InitInputData, ErrStat, ErrMsg ) IF (ALLOCATED(InitInputData%BlPitchInit)) THEN DEALLOCATE(InitInputData%BlPitchInit) ENDIF -IF (ALLOCATED(InitInputData%BladeRootPosition)) THEN - DEALLOCATE(InitInputData%BladeRootPosition) +IF (ALLOCATED(InitInputData%BladeRootRefPos)) THEN + DEALLOCATE(InitInputData%BladeRootRefPos) +ENDIF +IF (ALLOCATED(InitInputData%BladeRootTransDisp)) THEN + DEALLOCATE(InitInputData%BladeRootTransDisp) ENDIF -IF (ALLOCATED(InitInputData%BladeRootOrientation)) THEN - DEALLOCATE(InitInputData%BladeRootOrientation) +IF (ALLOCATED(InitInputData%BladeRootOrient)) THEN + DEALLOCATE(InitInputData%BladeRootOrient) +ENDIF +IF (ALLOCATED(InitInputData%BladeRootRefOrient)) THEN + DEALLOCATE(InitInputData%BladeRootRefOrient) ENDIF CALL NWTC_Library_Destroyfileinfotype( InitInputData%PassedPrimaryInputData, ErrStat, ErrMsg ) +IF (ALLOCATED(InitInputData%CableControlRequestor)) THEN + DEALLOCATE(InitInputData%CableControlRequestor) +ENDIF IF (ALLOCATED(InitInputData%fromSCGlob)) THEN DEALLOCATE(InitInputData%fromSCGlob) ENDIF @@ -632,12 +762,18 @@ SUBROUTINE SrvD_PackInitInput( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrM Re_BufSz = Re_BufSz + SIZE(InData%BlPitchInit) ! BlPitchInit END IF Re_BufSz = Re_BufSz + SIZE(InData%Gravity) ! Gravity - Re_BufSz = Re_BufSz + SIZE(InData%NacPosition) ! NacPosition - Db_BufSz = Db_BufSz + SIZE(InData%NacOrientation) ! NacOrientation - Re_BufSz = Re_BufSz + SIZE(InData%TwrBasePos) ! TwrBasePos + Re_BufSz = Re_BufSz + SIZE(InData%NacRefPos) ! NacRefPos + Db_BufSz = Db_BufSz + SIZE(InData%NacTransDisp) ! NacTransDisp + Db_BufSz = Db_BufSz + SIZE(InData%NacOrient) ! NacOrient + Db_BufSz = Db_BufSz + SIZE(InData%NacRefOrient) ! NacRefOrient + Re_BufSz = Re_BufSz + SIZE(InData%TwrBaseRefPos) ! TwrBaseRefPos + Db_BufSz = Db_BufSz + SIZE(InData%TwrBaseTransDisp) ! TwrBaseTransDisp Db_BufSz = Db_BufSz + SIZE(InData%TwrBaseOrient) ! TwrBaseOrient - Re_BufSz = Re_BufSz + SIZE(InData%PlatformPos) ! PlatformPos - Db_BufSz = Db_BufSz + SIZE(InData%PlatformOrient) ! PlatformOrient + Db_BufSz = Db_BufSz + SIZE(InData%TwrBaseRefOrient) ! TwrBaseRefOrient + Re_BufSz = Re_BufSz + SIZE(InData%PtfmRefPos) ! PtfmRefPos + Db_BufSz = Db_BufSz + SIZE(InData%PtfmTransDisp) ! PtfmTransDisp + Db_BufSz = Db_BufSz + SIZE(InData%PtfmOrient) ! PtfmOrient + Db_BufSz = Db_BufSz + SIZE(InData%PtfmRefOrient) ! PtfmRefOrient Db_BufSz = Db_BufSz + 1 ! Tmax Re_BufSz = Re_BufSz + 1 ! AvgWindSpeed Re_BufSz = Re_BufSz + 1 ! AirDens @@ -647,15 +783,25 @@ SUBROUTINE SrvD_PackInitInput( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrM Int_BufSz = Int_BufSz + 1 ! TrimCase Re_BufSz = Re_BufSz + 1 ! TrimGain Re_BufSz = Re_BufSz + 1 ! RotSpeedRef - Int_BufSz = Int_BufSz + 1 ! BladeRootPosition allocated yes/no - IF ( ALLOCATED(InData%BladeRootPosition) ) THEN - Int_BufSz = Int_BufSz + 2*2 ! BladeRootPosition upper/lower bounds for each dimension - Re_BufSz = Re_BufSz + SIZE(InData%BladeRootPosition) ! BladeRootPosition - END IF - Int_BufSz = Int_BufSz + 1 ! BladeRootOrientation allocated yes/no - IF ( ALLOCATED(InData%BladeRootOrientation) ) THEN - Int_BufSz = Int_BufSz + 2*3 ! BladeRootOrientation upper/lower bounds for each dimension - Db_BufSz = Db_BufSz + SIZE(InData%BladeRootOrientation) ! BladeRootOrientation + Int_BufSz = Int_BufSz + 1 ! BladeRootRefPos allocated yes/no + IF ( ALLOCATED(InData%BladeRootRefPos) ) THEN + Int_BufSz = Int_BufSz + 2*2 ! BladeRootRefPos upper/lower bounds for each dimension + Re_BufSz = Re_BufSz + SIZE(InData%BladeRootRefPos) ! BladeRootRefPos + END IF + Int_BufSz = Int_BufSz + 1 ! BladeRootTransDisp allocated yes/no + IF ( ALLOCATED(InData%BladeRootTransDisp) ) THEN + Int_BufSz = Int_BufSz + 2*2 ! BladeRootTransDisp upper/lower bounds for each dimension + Db_BufSz = Db_BufSz + SIZE(InData%BladeRootTransDisp) ! BladeRootTransDisp + END IF + Int_BufSz = Int_BufSz + 1 ! BladeRootOrient allocated yes/no + IF ( ALLOCATED(InData%BladeRootOrient) ) THEN + Int_BufSz = Int_BufSz + 2*3 ! BladeRootOrient upper/lower bounds for each dimension + Db_BufSz = Db_BufSz + SIZE(InData%BladeRootOrient) ! BladeRootOrient + END IF + Int_BufSz = Int_BufSz + 1 ! BladeRootRefOrient allocated yes/no + IF ( ALLOCATED(InData%BladeRootRefOrient) ) THEN + Int_BufSz = Int_BufSz + 2*3 ! BladeRootRefOrient upper/lower bounds for each dimension + Db_BufSz = Db_BufSz + SIZE(InData%BladeRootRefOrient) ! BladeRootRefOrient END IF Int_BufSz = Int_BufSz + 1 ! UseInputFile ! Allocate buffers for subtypes, if any (we'll get sizes from these) @@ -676,6 +822,13 @@ SUBROUTINE SrvD_PackInitInput( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrM Int_BufSz = Int_BufSz + SIZE( Int_Buf ) DEALLOCATE(Int_Buf) END IF + Int_BufSz = Int_BufSz + 1 ! NumCableControl + Int_BufSz = Int_BufSz + 1 ! CableControlRequestor allocated yes/no + IF ( ALLOCATED(InData%CableControlRequestor) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! CableControlRequestor upper/lower bounds for each dimension + Int_BufSz = Int_BufSz + SIZE(InData%CableControlRequestor)*LEN(InData%CableControlRequestor) ! CableControlRequestor + END IF + Int_BufSz = Int_BufSz + 1 ! InterpOrder Int_BufSz = Int_BufSz + 1 ! fromSCGlob allocated yes/no IF ( ALLOCATED(InData%fromSCGlob) ) THEN Int_BufSz = Int_BufSz + 2*1 ! fromSCGlob upper/lower bounds for each dimension @@ -744,33 +897,63 @@ SUBROUTINE SrvD_PackInitInput( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrM ReKiBuf(Re_Xferred) = InData%Gravity(i1) Re_Xferred = Re_Xferred + 1 END DO - DO i1 = LBOUND(InData%NacPosition,1), UBOUND(InData%NacPosition,1) - ReKiBuf(Re_Xferred) = InData%NacPosition(i1) + DO i1 = LBOUND(InData%NacRefPos,1), UBOUND(InData%NacRefPos,1) + ReKiBuf(Re_Xferred) = InData%NacRefPos(i1) Re_Xferred = Re_Xferred + 1 END DO - DO i2 = LBOUND(InData%NacOrientation,2), UBOUND(InData%NacOrientation,2) - DO i1 = LBOUND(InData%NacOrientation,1), UBOUND(InData%NacOrientation,1) - DbKiBuf(Db_Xferred) = InData%NacOrientation(i1,i2) + DO i1 = LBOUND(InData%NacTransDisp,1), UBOUND(InData%NacTransDisp,1) + DbKiBuf(Db_Xferred) = InData%NacTransDisp(i1) + Db_Xferred = Db_Xferred + 1 + END DO + DO i2 = LBOUND(InData%NacOrient,2), UBOUND(InData%NacOrient,2) + DO i1 = LBOUND(InData%NacOrient,1), UBOUND(InData%NacOrient,1) + DbKiBuf(Db_Xferred) = InData%NacOrient(i1,i2) + Db_Xferred = Db_Xferred + 1 + END DO + END DO + DO i2 = LBOUND(InData%NacRefOrient,2), UBOUND(InData%NacRefOrient,2) + DO i1 = LBOUND(InData%NacRefOrient,1), UBOUND(InData%NacRefOrient,1) + DbKiBuf(Db_Xferred) = InData%NacRefOrient(i1,i2) Db_Xferred = Db_Xferred + 1 END DO END DO - DO i1 = LBOUND(InData%TwrBasePos,1), UBOUND(InData%TwrBasePos,1) - ReKiBuf(Re_Xferred) = InData%TwrBasePos(i1) + DO i1 = LBOUND(InData%TwrBaseRefPos,1), UBOUND(InData%TwrBaseRefPos,1) + ReKiBuf(Re_Xferred) = InData%TwrBaseRefPos(i1) Re_Xferred = Re_Xferred + 1 END DO + DO i1 = LBOUND(InData%TwrBaseTransDisp,1), UBOUND(InData%TwrBaseTransDisp,1) + DbKiBuf(Db_Xferred) = InData%TwrBaseTransDisp(i1) + Db_Xferred = Db_Xferred + 1 + END DO DO i2 = LBOUND(InData%TwrBaseOrient,2), UBOUND(InData%TwrBaseOrient,2) DO i1 = LBOUND(InData%TwrBaseOrient,1), UBOUND(InData%TwrBaseOrient,1) DbKiBuf(Db_Xferred) = InData%TwrBaseOrient(i1,i2) Db_Xferred = Db_Xferred + 1 END DO END DO - DO i1 = LBOUND(InData%PlatformPos,1), UBOUND(InData%PlatformPos,1) - ReKiBuf(Re_Xferred) = InData%PlatformPos(i1) + DO i2 = LBOUND(InData%TwrBaseRefOrient,2), UBOUND(InData%TwrBaseRefOrient,2) + DO i1 = LBOUND(InData%TwrBaseRefOrient,1), UBOUND(InData%TwrBaseRefOrient,1) + DbKiBuf(Db_Xferred) = InData%TwrBaseRefOrient(i1,i2) + Db_Xferred = Db_Xferred + 1 + END DO + END DO + DO i1 = LBOUND(InData%PtfmRefPos,1), UBOUND(InData%PtfmRefPos,1) + ReKiBuf(Re_Xferred) = InData%PtfmRefPos(i1) Re_Xferred = Re_Xferred + 1 END DO - DO i2 = LBOUND(InData%PlatformOrient,2), UBOUND(InData%PlatformOrient,2) - DO i1 = LBOUND(InData%PlatformOrient,1), UBOUND(InData%PlatformOrient,1) - DbKiBuf(Db_Xferred) = InData%PlatformOrient(i1,i2) + DO i1 = LBOUND(InData%PtfmTransDisp,1), UBOUND(InData%PtfmTransDisp,1) + DbKiBuf(Db_Xferred) = InData%PtfmTransDisp(i1) + Db_Xferred = Db_Xferred + 1 + END DO + DO i2 = LBOUND(InData%PtfmOrient,2), UBOUND(InData%PtfmOrient,2) + DO i1 = LBOUND(InData%PtfmOrient,1), UBOUND(InData%PtfmOrient,1) + DbKiBuf(Db_Xferred) = InData%PtfmOrient(i1,i2) + Db_Xferred = Db_Xferred + 1 + END DO + END DO + DO i2 = LBOUND(InData%PtfmRefOrient,2), UBOUND(InData%PtfmRefOrient,2) + DO i1 = LBOUND(InData%PtfmRefOrient,1), UBOUND(InData%PtfmRefOrient,1) + DbKiBuf(Db_Xferred) = InData%PtfmRefOrient(i1,i2) Db_Xferred = Db_Xferred + 1 END DO END DO @@ -792,46 +975,91 @@ SUBROUTINE SrvD_PackInitInput( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrM Re_Xferred = Re_Xferred + 1 ReKiBuf(Re_Xferred) = InData%RotSpeedRef Re_Xferred = Re_Xferred + 1 - IF ( .NOT. ALLOCATED(InData%BladeRootPosition) ) THEN + IF ( .NOT. ALLOCATED(InData%BladeRootRefPos) ) THEN IntKiBuf( Int_Xferred ) = 0 Int_Xferred = Int_Xferred + 1 ELSE IntKiBuf( Int_Xferred ) = 1 Int_Xferred = Int_Xferred + 1 - IntKiBuf( Int_Xferred ) = LBOUND(InData%BladeRootPosition,1) - IntKiBuf( Int_Xferred + 1) = UBOUND(InData%BladeRootPosition,1) + IntKiBuf( Int_Xferred ) = LBOUND(InData%BladeRootRefPos,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%BladeRootRefPos,1) Int_Xferred = Int_Xferred + 2 - IntKiBuf( Int_Xferred ) = LBOUND(InData%BladeRootPosition,2) - IntKiBuf( Int_Xferred + 1) = UBOUND(InData%BladeRootPosition,2) + IntKiBuf( Int_Xferred ) = LBOUND(InData%BladeRootRefPos,2) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%BladeRootRefPos,2) Int_Xferred = Int_Xferred + 2 - DO i2 = LBOUND(InData%BladeRootPosition,2), UBOUND(InData%BladeRootPosition,2) - DO i1 = LBOUND(InData%BladeRootPosition,1), UBOUND(InData%BladeRootPosition,1) - ReKiBuf(Re_Xferred) = InData%BladeRootPosition(i1,i2) + DO i2 = LBOUND(InData%BladeRootRefPos,2), UBOUND(InData%BladeRootRefPos,2) + DO i1 = LBOUND(InData%BladeRootRefPos,1), UBOUND(InData%BladeRootRefPos,1) + ReKiBuf(Re_Xferred) = InData%BladeRootRefPos(i1,i2) Re_Xferred = Re_Xferred + 1 END DO END DO END IF - IF ( .NOT. ALLOCATED(InData%BladeRootOrientation) ) THEN + IF ( .NOT. ALLOCATED(InData%BladeRootTransDisp) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%BladeRootTransDisp,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%BladeRootTransDisp,1) + Int_Xferred = Int_Xferred + 2 + IntKiBuf( Int_Xferred ) = LBOUND(InData%BladeRootTransDisp,2) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%BladeRootTransDisp,2) + Int_Xferred = Int_Xferred + 2 + + DO i2 = LBOUND(InData%BladeRootTransDisp,2), UBOUND(InData%BladeRootTransDisp,2) + DO i1 = LBOUND(InData%BladeRootTransDisp,1), UBOUND(InData%BladeRootTransDisp,1) + DbKiBuf(Db_Xferred) = InData%BladeRootTransDisp(i1,i2) + Db_Xferred = Db_Xferred + 1 + END DO + END DO + END IF + IF ( .NOT. ALLOCATED(InData%BladeRootOrient) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%BladeRootOrient,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%BladeRootOrient,1) + Int_Xferred = Int_Xferred + 2 + IntKiBuf( Int_Xferred ) = LBOUND(InData%BladeRootOrient,2) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%BladeRootOrient,2) + Int_Xferred = Int_Xferred + 2 + IntKiBuf( Int_Xferred ) = LBOUND(InData%BladeRootOrient,3) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%BladeRootOrient,3) + Int_Xferred = Int_Xferred + 2 + + DO i3 = LBOUND(InData%BladeRootOrient,3), UBOUND(InData%BladeRootOrient,3) + DO i2 = LBOUND(InData%BladeRootOrient,2), UBOUND(InData%BladeRootOrient,2) + DO i1 = LBOUND(InData%BladeRootOrient,1), UBOUND(InData%BladeRootOrient,1) + DbKiBuf(Db_Xferred) = InData%BladeRootOrient(i1,i2,i3) + Db_Xferred = Db_Xferred + 1 + END DO + END DO + END DO + END IF + IF ( .NOT. ALLOCATED(InData%BladeRootRefOrient) ) THEN IntKiBuf( Int_Xferred ) = 0 Int_Xferred = Int_Xferred + 1 ELSE IntKiBuf( Int_Xferred ) = 1 Int_Xferred = Int_Xferred + 1 - IntKiBuf( Int_Xferred ) = LBOUND(InData%BladeRootOrientation,1) - IntKiBuf( Int_Xferred + 1) = UBOUND(InData%BladeRootOrientation,1) + IntKiBuf( Int_Xferred ) = LBOUND(InData%BladeRootRefOrient,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%BladeRootRefOrient,1) Int_Xferred = Int_Xferred + 2 - IntKiBuf( Int_Xferred ) = LBOUND(InData%BladeRootOrientation,2) - IntKiBuf( Int_Xferred + 1) = UBOUND(InData%BladeRootOrientation,2) + IntKiBuf( Int_Xferred ) = LBOUND(InData%BladeRootRefOrient,2) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%BladeRootRefOrient,2) Int_Xferred = Int_Xferred + 2 - IntKiBuf( Int_Xferred ) = LBOUND(InData%BladeRootOrientation,3) - IntKiBuf( Int_Xferred + 1) = UBOUND(InData%BladeRootOrientation,3) + IntKiBuf( Int_Xferred ) = LBOUND(InData%BladeRootRefOrient,3) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%BladeRootRefOrient,3) Int_Xferred = Int_Xferred + 2 - DO i3 = LBOUND(InData%BladeRootOrientation,3), UBOUND(InData%BladeRootOrientation,3) - DO i2 = LBOUND(InData%BladeRootOrientation,2), UBOUND(InData%BladeRootOrientation,2) - DO i1 = LBOUND(InData%BladeRootOrientation,1), UBOUND(InData%BladeRootOrientation,1) - DbKiBuf(Db_Xferred) = InData%BladeRootOrientation(i1,i2,i3) + DO i3 = LBOUND(InData%BladeRootRefOrient,3), UBOUND(InData%BladeRootRefOrient,3) + DO i2 = LBOUND(InData%BladeRootRefOrient,2), UBOUND(InData%BladeRootRefOrient,2) + DO i1 = LBOUND(InData%BladeRootRefOrient,1), UBOUND(InData%BladeRootRefOrient,1) + DbKiBuf(Db_Xferred) = InData%BladeRootRefOrient(i1,i2,i3) Db_Xferred = Db_Xferred + 1 END DO END DO @@ -867,6 +1095,27 @@ SUBROUTINE SrvD_PackInitInput( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrM ELSE IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 ENDIF + IntKiBuf(Int_Xferred) = InData%NumCableControl + Int_Xferred = Int_Xferred + 1 + IF ( .NOT. ALLOCATED(InData%CableControlRequestor) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%CableControlRequestor,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%CableControlRequestor,1) + Int_Xferred = Int_Xferred + 2 + + DO i1 = LBOUND(InData%CableControlRequestor,1), UBOUND(InData%CableControlRequestor,1) + DO I = 1, LEN(InData%CableControlRequestor) + IntKiBuf(Int_Xferred) = ICHAR(InData%CableControlRequestor(i1)(I:I), IntKi) + Int_Xferred = Int_Xferred + 1 + END DO ! I + END DO + END IF + IntKiBuf(Int_Xferred) = InData%InterpOrder + Int_Xferred = Int_Xferred + 1 IF ( .NOT. ALLOCATED(InData%fromSCGlob) ) THEN IntKiBuf( Int_Xferred ) = 0 Int_Xferred = Int_Xferred + 1 @@ -964,28 +1213,50 @@ SUBROUTINE SrvD_UnPackInitInput( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, E OutData%Gravity(i1) = ReKiBuf(Re_Xferred) Re_Xferred = Re_Xferred + 1 END DO - i1_l = LBOUND(OutData%NacPosition,1) - i1_u = UBOUND(OutData%NacPosition,1) - DO i1 = LBOUND(OutData%NacPosition,1), UBOUND(OutData%NacPosition,1) - OutData%NacPosition(i1) = ReKiBuf(Re_Xferred) + i1_l = LBOUND(OutData%NacRefPos,1) + i1_u = UBOUND(OutData%NacRefPos,1) + DO i1 = LBOUND(OutData%NacRefPos,1), UBOUND(OutData%NacRefPos,1) + OutData%NacRefPos(i1) = ReKiBuf(Re_Xferred) Re_Xferred = Re_Xferred + 1 END DO - i1_l = LBOUND(OutData%NacOrientation,1) - i1_u = UBOUND(OutData%NacOrientation,1) - i2_l = LBOUND(OutData%NacOrientation,2) - i2_u = UBOUND(OutData%NacOrientation,2) - DO i2 = LBOUND(OutData%NacOrientation,2), UBOUND(OutData%NacOrientation,2) - DO i1 = LBOUND(OutData%NacOrientation,1), UBOUND(OutData%NacOrientation,1) - OutData%NacOrientation(i1,i2) = REAL(DbKiBuf(Db_Xferred), R8Ki) + i1_l = LBOUND(OutData%NacTransDisp,1) + i1_u = UBOUND(OutData%NacTransDisp,1) + DO i1 = LBOUND(OutData%NacTransDisp,1), UBOUND(OutData%NacTransDisp,1) + OutData%NacTransDisp(i1) = REAL(DbKiBuf(Db_Xferred), R8Ki) + Db_Xferred = Db_Xferred + 1 + END DO + i1_l = LBOUND(OutData%NacOrient,1) + i1_u = UBOUND(OutData%NacOrient,1) + i2_l = LBOUND(OutData%NacOrient,2) + i2_u = UBOUND(OutData%NacOrient,2) + DO i2 = LBOUND(OutData%NacOrient,2), UBOUND(OutData%NacOrient,2) + DO i1 = LBOUND(OutData%NacOrient,1), UBOUND(OutData%NacOrient,1) + OutData%NacOrient(i1,i2) = REAL(DbKiBuf(Db_Xferred), R8Ki) + Db_Xferred = Db_Xferred + 1 + END DO + END DO + i1_l = LBOUND(OutData%NacRefOrient,1) + i1_u = UBOUND(OutData%NacRefOrient,1) + i2_l = LBOUND(OutData%NacRefOrient,2) + i2_u = UBOUND(OutData%NacRefOrient,2) + DO i2 = LBOUND(OutData%NacRefOrient,2), UBOUND(OutData%NacRefOrient,2) + DO i1 = LBOUND(OutData%NacRefOrient,1), UBOUND(OutData%NacRefOrient,1) + OutData%NacRefOrient(i1,i2) = REAL(DbKiBuf(Db_Xferred), R8Ki) Db_Xferred = Db_Xferred + 1 END DO END DO - i1_l = LBOUND(OutData%TwrBasePos,1) - i1_u = UBOUND(OutData%TwrBasePos,1) - DO i1 = LBOUND(OutData%TwrBasePos,1), UBOUND(OutData%TwrBasePos,1) - OutData%TwrBasePos(i1) = ReKiBuf(Re_Xferred) + i1_l = LBOUND(OutData%TwrBaseRefPos,1) + i1_u = UBOUND(OutData%TwrBaseRefPos,1) + DO i1 = LBOUND(OutData%TwrBaseRefPos,1), UBOUND(OutData%TwrBaseRefPos,1) + OutData%TwrBaseRefPos(i1) = ReKiBuf(Re_Xferred) Re_Xferred = Re_Xferred + 1 END DO + i1_l = LBOUND(OutData%TwrBaseTransDisp,1) + i1_u = UBOUND(OutData%TwrBaseTransDisp,1) + DO i1 = LBOUND(OutData%TwrBaseTransDisp,1), UBOUND(OutData%TwrBaseTransDisp,1) + OutData%TwrBaseTransDisp(i1) = REAL(DbKiBuf(Db_Xferred), R8Ki) + Db_Xferred = Db_Xferred + 1 + END DO i1_l = LBOUND(OutData%TwrBaseOrient,1) i1_u = UBOUND(OutData%TwrBaseOrient,1) i2_l = LBOUND(OutData%TwrBaseOrient,2) @@ -996,19 +1267,45 @@ SUBROUTINE SrvD_UnPackInitInput( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, E Db_Xferred = Db_Xferred + 1 END DO END DO - i1_l = LBOUND(OutData%PlatformPos,1) - i1_u = UBOUND(OutData%PlatformPos,1) - DO i1 = LBOUND(OutData%PlatformPos,1), UBOUND(OutData%PlatformPos,1) - OutData%PlatformPos(i1) = ReKiBuf(Re_Xferred) + i1_l = LBOUND(OutData%TwrBaseRefOrient,1) + i1_u = UBOUND(OutData%TwrBaseRefOrient,1) + i2_l = LBOUND(OutData%TwrBaseRefOrient,2) + i2_u = UBOUND(OutData%TwrBaseRefOrient,2) + DO i2 = LBOUND(OutData%TwrBaseRefOrient,2), UBOUND(OutData%TwrBaseRefOrient,2) + DO i1 = LBOUND(OutData%TwrBaseRefOrient,1), UBOUND(OutData%TwrBaseRefOrient,1) + OutData%TwrBaseRefOrient(i1,i2) = REAL(DbKiBuf(Db_Xferred), R8Ki) + Db_Xferred = Db_Xferred + 1 + END DO + END DO + i1_l = LBOUND(OutData%PtfmRefPos,1) + i1_u = UBOUND(OutData%PtfmRefPos,1) + DO i1 = LBOUND(OutData%PtfmRefPos,1), UBOUND(OutData%PtfmRefPos,1) + OutData%PtfmRefPos(i1) = ReKiBuf(Re_Xferred) Re_Xferred = Re_Xferred + 1 END DO - i1_l = LBOUND(OutData%PlatformOrient,1) - i1_u = UBOUND(OutData%PlatformOrient,1) - i2_l = LBOUND(OutData%PlatformOrient,2) - i2_u = UBOUND(OutData%PlatformOrient,2) - DO i2 = LBOUND(OutData%PlatformOrient,2), UBOUND(OutData%PlatformOrient,2) - DO i1 = LBOUND(OutData%PlatformOrient,1), UBOUND(OutData%PlatformOrient,1) - OutData%PlatformOrient(i1,i2) = REAL(DbKiBuf(Db_Xferred), R8Ki) + i1_l = LBOUND(OutData%PtfmTransDisp,1) + i1_u = UBOUND(OutData%PtfmTransDisp,1) + DO i1 = LBOUND(OutData%PtfmTransDisp,1), UBOUND(OutData%PtfmTransDisp,1) + OutData%PtfmTransDisp(i1) = REAL(DbKiBuf(Db_Xferred), R8Ki) + Db_Xferred = Db_Xferred + 1 + END DO + i1_l = LBOUND(OutData%PtfmOrient,1) + i1_u = UBOUND(OutData%PtfmOrient,1) + i2_l = LBOUND(OutData%PtfmOrient,2) + i2_u = UBOUND(OutData%PtfmOrient,2) + DO i2 = LBOUND(OutData%PtfmOrient,2), UBOUND(OutData%PtfmOrient,2) + DO i1 = LBOUND(OutData%PtfmOrient,1), UBOUND(OutData%PtfmOrient,1) + OutData%PtfmOrient(i1,i2) = REAL(DbKiBuf(Db_Xferred), R8Ki) + Db_Xferred = Db_Xferred + 1 + END DO + END DO + i1_l = LBOUND(OutData%PtfmRefOrient,1) + i1_u = UBOUND(OutData%PtfmRefOrient,1) + i2_l = LBOUND(OutData%PtfmRefOrient,2) + i2_u = UBOUND(OutData%PtfmRefOrient,2) + DO i2 = LBOUND(OutData%PtfmRefOrient,2), UBOUND(OutData%PtfmRefOrient,2) + DO i1 = LBOUND(OutData%PtfmRefOrient,1), UBOUND(OutData%PtfmRefOrient,1) + OutData%PtfmRefOrient(i1,i2) = REAL(DbKiBuf(Db_Xferred), R8Ki) Db_Xferred = Db_Xferred + 1 END DO END DO @@ -1030,7 +1327,7 @@ SUBROUTINE SrvD_UnPackInitInput( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, E Re_Xferred = Re_Xferred + 1 OutData%RotSpeedRef = ReKiBuf(Re_Xferred) Re_Xferred = Re_Xferred + 1 - IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! BladeRootPosition not allocated + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! BladeRootRefPos not allocated Int_Xferred = Int_Xferred + 1 ELSE Int_Xferred = Int_Xferred + 1 @@ -1040,20 +1337,71 @@ SUBROUTINE SrvD_UnPackInitInput( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, E i2_l = IntKiBuf( Int_Xferred ) i2_u = IntKiBuf( Int_Xferred + 1) Int_Xferred = Int_Xferred + 2 - IF (ALLOCATED(OutData%BladeRootPosition)) DEALLOCATE(OutData%BladeRootPosition) - ALLOCATE(OutData%BladeRootPosition(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) + IF (ALLOCATED(OutData%BladeRootRefPos)) DEALLOCATE(OutData%BladeRootRefPos) + ALLOCATE(OutData%BladeRootRefPos(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%BladeRootPosition.', ErrStat, ErrMsg,RoutineName) + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%BladeRootRefPos.', ErrStat, ErrMsg,RoutineName) RETURN END IF - DO i2 = LBOUND(OutData%BladeRootPosition,2), UBOUND(OutData%BladeRootPosition,2) - DO i1 = LBOUND(OutData%BladeRootPosition,1), UBOUND(OutData%BladeRootPosition,1) - OutData%BladeRootPosition(i1,i2) = ReKiBuf(Re_Xferred) + DO i2 = LBOUND(OutData%BladeRootRefPos,2), UBOUND(OutData%BladeRootRefPos,2) + DO i1 = LBOUND(OutData%BladeRootRefPos,1), UBOUND(OutData%BladeRootRefPos,1) + OutData%BladeRootRefPos(i1,i2) = ReKiBuf(Re_Xferred) Re_Xferred = Re_Xferred + 1 END DO END DO END IF - IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! BladeRootOrientation not allocated + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! BladeRootTransDisp not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + i2_l = IntKiBuf( Int_Xferred ) + i2_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%BladeRootTransDisp)) DEALLOCATE(OutData%BladeRootTransDisp) + ALLOCATE(OutData%BladeRootTransDisp(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%BladeRootTransDisp.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i2 = LBOUND(OutData%BladeRootTransDisp,2), UBOUND(OutData%BladeRootTransDisp,2) + DO i1 = LBOUND(OutData%BladeRootTransDisp,1), UBOUND(OutData%BladeRootTransDisp,1) + OutData%BladeRootTransDisp(i1,i2) = REAL(DbKiBuf(Db_Xferred), R8Ki) + Db_Xferred = Db_Xferred + 1 + END DO + END DO + END IF + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! BladeRootOrient not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + i2_l = IntKiBuf( Int_Xferred ) + i2_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + i3_l = IntKiBuf( Int_Xferred ) + i3_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%BladeRootOrient)) DEALLOCATE(OutData%BladeRootOrient) + ALLOCATE(OutData%BladeRootOrient(i1_l:i1_u,i2_l:i2_u,i3_l:i3_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%BladeRootOrient.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i3 = LBOUND(OutData%BladeRootOrient,3), UBOUND(OutData%BladeRootOrient,3) + DO i2 = LBOUND(OutData%BladeRootOrient,2), UBOUND(OutData%BladeRootOrient,2) + DO i1 = LBOUND(OutData%BladeRootOrient,1), UBOUND(OutData%BladeRootOrient,1) + OutData%BladeRootOrient(i1,i2,i3) = REAL(DbKiBuf(Db_Xferred), R8Ki) + Db_Xferred = Db_Xferred + 1 + END DO + END DO + END DO + END IF + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! BladeRootRefOrient not allocated Int_Xferred = Int_Xferred + 1 ELSE Int_Xferred = Int_Xferred + 1 @@ -1066,16 +1414,16 @@ SUBROUTINE SrvD_UnPackInitInput( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, E i3_l = IntKiBuf( Int_Xferred ) i3_u = IntKiBuf( Int_Xferred + 1) Int_Xferred = Int_Xferred + 2 - IF (ALLOCATED(OutData%BladeRootOrientation)) DEALLOCATE(OutData%BladeRootOrientation) - ALLOCATE(OutData%BladeRootOrientation(i1_l:i1_u,i2_l:i2_u,i3_l:i3_u),STAT=ErrStat2) + IF (ALLOCATED(OutData%BladeRootRefOrient)) DEALLOCATE(OutData%BladeRootRefOrient) + ALLOCATE(OutData%BladeRootRefOrient(i1_l:i1_u,i2_l:i2_u,i3_l:i3_u),STAT=ErrStat2) IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%BladeRootOrientation.', ErrStat, ErrMsg,RoutineName) + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%BladeRootRefOrient.', ErrStat, ErrMsg,RoutineName) RETURN END IF - DO i3 = LBOUND(OutData%BladeRootOrientation,3), UBOUND(OutData%BladeRootOrientation,3) - DO i2 = LBOUND(OutData%BladeRootOrientation,2), UBOUND(OutData%BladeRootOrientation,2) - DO i1 = LBOUND(OutData%BladeRootOrientation,1), UBOUND(OutData%BladeRootOrientation,1) - OutData%BladeRootOrientation(i1,i2,i3) = REAL(DbKiBuf(Db_Xferred), R8Ki) + DO i3 = LBOUND(OutData%BladeRootRefOrient,3), UBOUND(OutData%BladeRootRefOrient,3) + DO i2 = LBOUND(OutData%BladeRootRefOrient,2), UBOUND(OutData%BladeRootRefOrient,2) + DO i1 = LBOUND(OutData%BladeRootRefOrient,1), UBOUND(OutData%BladeRootRefOrient,1) + OutData%BladeRootRefOrient(i1,i2,i3) = REAL(DbKiBuf(Db_Xferred), R8Ki) Db_Xferred = Db_Xferred + 1 END DO END DO @@ -1123,6 +1471,30 @@ SUBROUTINE SrvD_UnPackInitInput( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, E IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) + OutData%NumCableControl = IntKiBuf(Int_Xferred) + Int_Xferred = Int_Xferred + 1 + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! CableControlRequestor not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%CableControlRequestor)) DEALLOCATE(OutData%CableControlRequestor) + ALLOCATE(OutData%CableControlRequestor(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%CableControlRequestor.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i1 = LBOUND(OutData%CableControlRequestor,1), UBOUND(OutData%CableControlRequestor,1) + DO I = 1, LEN(OutData%CableControlRequestor) + OutData%CableControlRequestor(i1)(I:I) = CHAR(IntKiBuf(Int_Xferred)) + Int_Xferred = Int_Xferred + 1 + END DO ! I + END DO + END IF + OutData%InterpOrder = IntKiBuf(Int_Xferred) + Int_Xferred = Int_Xferred + 1 IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! fromSCGlob not allocated Int_Xferred = Int_Xferred + 1 ELSE @@ -1944,6 +2316,12 @@ SUBROUTINE SrvD_CopyInputFile( SrcInputFileData, DstInputFileData, CtrlCode, Err END IF DstInputFileData%SStCfiles = SrcInputFileData%SStCfiles ENDIF + DstInputFileData%AfCmode = SrcInputFileData%AfCmode + DstInputFileData%AfC_Mean = SrcInputFileData%AfC_Mean + DstInputFileData%AfC_Amp = SrcInputFileData%AfC_Amp + DstInputFileData%AfC_Phase = SrcInputFileData%AfC_Phase + DstInputFileData%CCmode = SrcInputFileData%CCmode + DstInputFileData%EXavrSWAP = SrcInputFileData%EXavrSWAP END SUBROUTINE SrvD_CopyInputFile SUBROUTINE SrvD_DestroyInputFile( InputFileData, ErrStat, ErrMsg ) @@ -2122,6 +2500,12 @@ SUBROUTINE SrvD_PackInputFile( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrM Int_BufSz = Int_BufSz + 2*1 ! SStCfiles upper/lower bounds for each dimension Int_BufSz = Int_BufSz + SIZE(InData%SStCfiles)*LEN(InData%SStCfiles) ! SStCfiles END IF + Int_BufSz = Int_BufSz + 1 ! AfCmode + Re_BufSz = Re_BufSz + 1 ! AfC_Mean + Re_BufSz = Re_BufSz + 1 ! AfC_Amp + Re_BufSz = Re_BufSz + 1 ! AfC_Phase + Int_BufSz = Int_BufSz + 1 ! CCmode + Int_BufSz = Int_BufSz + 1 ! EXavrSWAP IF ( Re_BufSz .GT. 0 ) THEN ALLOCATE( ReKiBuf( Re_BufSz ), STAT=ErrStat2 ) IF (ErrStat2 /= 0) THEN @@ -2426,6 +2810,18 @@ SUBROUTINE SrvD_PackInputFile( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrM END DO ! I END DO END IF + IntKiBuf(Int_Xferred) = InData%AfCmode + Int_Xferred = Int_Xferred + 1 + ReKiBuf(Re_Xferred) = InData%AfC_Mean + Re_Xferred = Re_Xferred + 1 + ReKiBuf(Re_Xferred) = InData%AfC_Amp + Re_Xferred = Re_Xferred + 1 + ReKiBuf(Re_Xferred) = InData%AfC_Phase + Re_Xferred = Re_Xferred + 1 + IntKiBuf(Int_Xferred) = InData%CCmode + Int_Xferred = Int_Xferred + 1 + IntKiBuf(Int_Xferred) = TRANSFER(InData%EXavrSWAP, IntKiBuf(1)) + Int_Xferred = Int_Xferred + 1 END SUBROUTINE SrvD_PackInputFile SUBROUTINE SrvD_UnPackInputFile( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrMsg ) @@ -2759,6 +3155,18 @@ SUBROUTINE SrvD_UnPackInputFile( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, E END DO ! I END DO END IF + OutData%AfCmode = IntKiBuf(Int_Xferred) + Int_Xferred = Int_Xferred + 1 + OutData%AfC_Mean = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + OutData%AfC_Amp = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + OutData%AfC_Phase = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + OutData%CCmode = IntKiBuf(Int_Xferred) + Int_Xferred = Int_Xferred + 1 + OutData%EXavrSWAP = TRANSFER(IntKiBuf(Int_Xferred), OutData%EXavrSWAP) + Int_Xferred = Int_Xferred + 1 END SUBROUTINE SrvD_UnPackInputFile SUBROUTINE SrvD_CopyBladedDLLType( SrcBladedDLLTypeData, DstBladedDLLTypeData, CtrlCode, ErrStat, ErrMsg ) @@ -2770,6 +3178,7 @@ SUBROUTINE SrvD_CopyBladedDLLType( SrcBladedDLLTypeData, DstBladedDLLTypeData, C ! Local INTEGER(IntKi) :: i,j,k INTEGER(IntKi) :: i1, i1_l, i1_u ! bounds (upper/lower) for an array dimension 1 + INTEGER(IntKi) :: i2, i2_l, i2_u ! bounds (upper/lower) for an array dimension 2 INTEGER(IntKi) :: ErrStat2 CHARACTER(ErrMsgLen) :: ErrMsg2 CHARACTER(*), PARAMETER :: RoutineName = 'SrvD_CopyBladedDLLType' @@ -2795,6 +3204,7 @@ SUBROUTINE SrvD_CopyBladedDLLType( SrcBladedDLLTypeData, DstBladedDLLTypeData, C DstBladedDLLTypeData%BlPitchCom = SrcBladedDLLTypeData%BlPitchCom DstBladedDLLTypeData%PrevBlPitch = SrcBladedDLLTypeData%PrevBlPitch DstBladedDLLTypeData%BlAirfoilCom = SrcBladedDLLTypeData%BlAirfoilCom + DstBladedDLLTypeData%PrevBlAirfoilCom = SrcBladedDLLTypeData%PrevBlAirfoilCom DstBladedDLLTypeData%ElecPwr_prev = SrcBladedDLLTypeData%ElecPwr_prev DstBladedDLLTypeData%GenTrq_prev = SrcBladedDLLTypeData%GenTrq_prev IF (ALLOCATED(SrcBladedDLLTypeData%toSC)) THEN @@ -2925,6 +3335,194 @@ SUBROUTINE SrvD_CopyBladedDLLType( SrcBladedDLLTypeData, DstBladedDLLTypeData, C DstBladedDLLTypeData%GenTrq_TLU = SrcBladedDLLTypeData%GenTrq_TLU ENDIF DstBladedDLLTypeData%Yaw_Cntrl = SrcBladedDLLTypeData%Yaw_Cntrl +IF (ALLOCATED(SrcBladedDLLTypeData%PrevCableDeltaL)) THEN + i1_l = LBOUND(SrcBladedDLLTypeData%PrevCableDeltaL,1) + i1_u = UBOUND(SrcBladedDLLTypeData%PrevCableDeltaL,1) + IF (.NOT. ALLOCATED(DstBladedDLLTypeData%PrevCableDeltaL)) THEN + ALLOCATE(DstBladedDLLTypeData%PrevCableDeltaL(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstBladedDLLTypeData%PrevCableDeltaL.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DstBladedDLLTypeData%PrevCableDeltaL = SrcBladedDLLTypeData%PrevCableDeltaL +ENDIF +IF (ALLOCATED(SrcBladedDLLTypeData%PrevCableDeltaLdot)) THEN + i1_l = LBOUND(SrcBladedDLLTypeData%PrevCableDeltaLdot,1) + i1_u = UBOUND(SrcBladedDLLTypeData%PrevCableDeltaLdot,1) + IF (.NOT. ALLOCATED(DstBladedDLLTypeData%PrevCableDeltaLdot)) THEN + ALLOCATE(DstBladedDLLTypeData%PrevCableDeltaLdot(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstBladedDLLTypeData%PrevCableDeltaLdot.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DstBladedDLLTypeData%PrevCableDeltaLdot = SrcBladedDLLTypeData%PrevCableDeltaLdot +ENDIF +IF (ALLOCATED(SrcBladedDLLTypeData%CableDeltaL)) THEN + i1_l = LBOUND(SrcBladedDLLTypeData%CableDeltaL,1) + i1_u = UBOUND(SrcBladedDLLTypeData%CableDeltaL,1) + IF (.NOT. ALLOCATED(DstBladedDLLTypeData%CableDeltaL)) THEN + ALLOCATE(DstBladedDLLTypeData%CableDeltaL(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstBladedDLLTypeData%CableDeltaL.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DstBladedDLLTypeData%CableDeltaL = SrcBladedDLLTypeData%CableDeltaL +ENDIF +IF (ALLOCATED(SrcBladedDLLTypeData%CableDeltaLdot)) THEN + i1_l = LBOUND(SrcBladedDLLTypeData%CableDeltaLdot,1) + i1_u = UBOUND(SrcBladedDLLTypeData%CableDeltaLdot,1) + IF (.NOT. ALLOCATED(DstBladedDLLTypeData%CableDeltaLdot)) THEN + ALLOCATE(DstBladedDLLTypeData%CableDeltaLdot(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstBladedDLLTypeData%CableDeltaLdot.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DstBladedDLLTypeData%CableDeltaLdot = SrcBladedDLLTypeData%CableDeltaLdot +ENDIF +IF (ALLOCATED(SrcBladedDLLTypeData%PrevStCCmdStiff)) THEN + i1_l = LBOUND(SrcBladedDLLTypeData%PrevStCCmdStiff,1) + i1_u = UBOUND(SrcBladedDLLTypeData%PrevStCCmdStiff,1) + i2_l = LBOUND(SrcBladedDLLTypeData%PrevStCCmdStiff,2) + i2_u = UBOUND(SrcBladedDLLTypeData%PrevStCCmdStiff,2) + IF (.NOT. ALLOCATED(DstBladedDLLTypeData%PrevStCCmdStiff)) THEN + ALLOCATE(DstBladedDLLTypeData%PrevStCCmdStiff(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstBladedDLLTypeData%PrevStCCmdStiff.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DstBladedDLLTypeData%PrevStCCmdStiff = SrcBladedDLLTypeData%PrevStCCmdStiff +ENDIF +IF (ALLOCATED(SrcBladedDLLTypeData%PrevStCCmdDamp)) THEN + i1_l = LBOUND(SrcBladedDLLTypeData%PrevStCCmdDamp,1) + i1_u = UBOUND(SrcBladedDLLTypeData%PrevStCCmdDamp,1) + i2_l = LBOUND(SrcBladedDLLTypeData%PrevStCCmdDamp,2) + i2_u = UBOUND(SrcBladedDLLTypeData%PrevStCCmdDamp,2) + IF (.NOT. ALLOCATED(DstBladedDLLTypeData%PrevStCCmdDamp)) THEN + ALLOCATE(DstBladedDLLTypeData%PrevStCCmdDamp(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstBladedDLLTypeData%PrevStCCmdDamp.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DstBladedDLLTypeData%PrevStCCmdDamp = SrcBladedDLLTypeData%PrevStCCmdDamp +ENDIF +IF (ALLOCATED(SrcBladedDLLTypeData%PrevStCCmdBrake)) THEN + i1_l = LBOUND(SrcBladedDLLTypeData%PrevStCCmdBrake,1) + i1_u = UBOUND(SrcBladedDLLTypeData%PrevStCCmdBrake,1) + i2_l = LBOUND(SrcBladedDLLTypeData%PrevStCCmdBrake,2) + i2_u = UBOUND(SrcBladedDLLTypeData%PrevStCCmdBrake,2) + IF (.NOT. ALLOCATED(DstBladedDLLTypeData%PrevStCCmdBrake)) THEN + ALLOCATE(DstBladedDLLTypeData%PrevStCCmdBrake(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstBladedDLLTypeData%PrevStCCmdBrake.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DstBladedDLLTypeData%PrevStCCmdBrake = SrcBladedDLLTypeData%PrevStCCmdBrake +ENDIF +IF (ALLOCATED(SrcBladedDLLTypeData%PrevStCCmdForce)) THEN + i1_l = LBOUND(SrcBladedDLLTypeData%PrevStCCmdForce,1) + i1_u = UBOUND(SrcBladedDLLTypeData%PrevStCCmdForce,1) + i2_l = LBOUND(SrcBladedDLLTypeData%PrevStCCmdForce,2) + i2_u = UBOUND(SrcBladedDLLTypeData%PrevStCCmdForce,2) + IF (.NOT. ALLOCATED(DstBladedDLLTypeData%PrevStCCmdForce)) THEN + ALLOCATE(DstBladedDLLTypeData%PrevStCCmdForce(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstBladedDLLTypeData%PrevStCCmdForce.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DstBladedDLLTypeData%PrevStCCmdForce = SrcBladedDLLTypeData%PrevStCCmdForce +ENDIF +IF (ALLOCATED(SrcBladedDLLTypeData%StCCmdStiff)) THEN + i1_l = LBOUND(SrcBladedDLLTypeData%StCCmdStiff,1) + i1_u = UBOUND(SrcBladedDLLTypeData%StCCmdStiff,1) + i2_l = LBOUND(SrcBladedDLLTypeData%StCCmdStiff,2) + i2_u = UBOUND(SrcBladedDLLTypeData%StCCmdStiff,2) + IF (.NOT. ALLOCATED(DstBladedDLLTypeData%StCCmdStiff)) THEN + ALLOCATE(DstBladedDLLTypeData%StCCmdStiff(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstBladedDLLTypeData%StCCmdStiff.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DstBladedDLLTypeData%StCCmdStiff = SrcBladedDLLTypeData%StCCmdStiff +ENDIF +IF (ALLOCATED(SrcBladedDLLTypeData%StCCmdDamp)) THEN + i1_l = LBOUND(SrcBladedDLLTypeData%StCCmdDamp,1) + i1_u = UBOUND(SrcBladedDLLTypeData%StCCmdDamp,1) + i2_l = LBOUND(SrcBladedDLLTypeData%StCCmdDamp,2) + i2_u = UBOUND(SrcBladedDLLTypeData%StCCmdDamp,2) + IF (.NOT. ALLOCATED(DstBladedDLLTypeData%StCCmdDamp)) THEN + ALLOCATE(DstBladedDLLTypeData%StCCmdDamp(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstBladedDLLTypeData%StCCmdDamp.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DstBladedDLLTypeData%StCCmdDamp = SrcBladedDLLTypeData%StCCmdDamp +ENDIF +IF (ALLOCATED(SrcBladedDLLTypeData%StCCmdBrake)) THEN + i1_l = LBOUND(SrcBladedDLLTypeData%StCCmdBrake,1) + i1_u = UBOUND(SrcBladedDLLTypeData%StCCmdBrake,1) + i2_l = LBOUND(SrcBladedDLLTypeData%StCCmdBrake,2) + i2_u = UBOUND(SrcBladedDLLTypeData%StCCmdBrake,2) + IF (.NOT. ALLOCATED(DstBladedDLLTypeData%StCCmdBrake)) THEN + ALLOCATE(DstBladedDLLTypeData%StCCmdBrake(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstBladedDLLTypeData%StCCmdBrake.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DstBladedDLLTypeData%StCCmdBrake = SrcBladedDLLTypeData%StCCmdBrake +ENDIF +IF (ALLOCATED(SrcBladedDLLTypeData%StCCmdForce)) THEN + i1_l = LBOUND(SrcBladedDLLTypeData%StCCmdForce,1) + i1_u = UBOUND(SrcBladedDLLTypeData%StCCmdForce,1) + i2_l = LBOUND(SrcBladedDLLTypeData%StCCmdForce,2) + i2_u = UBOUND(SrcBladedDLLTypeData%StCCmdForce,2) + IF (.NOT. ALLOCATED(DstBladedDLLTypeData%StCCmdForce)) THEN + ALLOCATE(DstBladedDLLTypeData%StCCmdForce(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstBladedDLLTypeData%StCCmdForce.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DstBladedDLLTypeData%StCCmdForce = SrcBladedDLLTypeData%StCCmdForce +ENDIF +IF (ALLOCATED(SrcBladedDLLTypeData%StCMeasDisp)) THEN + i1_l = LBOUND(SrcBladedDLLTypeData%StCMeasDisp,1) + i1_u = UBOUND(SrcBladedDLLTypeData%StCMeasDisp,1) + i2_l = LBOUND(SrcBladedDLLTypeData%StCMeasDisp,2) + i2_u = UBOUND(SrcBladedDLLTypeData%StCMeasDisp,2) + IF (.NOT. ALLOCATED(DstBladedDLLTypeData%StCMeasDisp)) THEN + ALLOCATE(DstBladedDLLTypeData%StCMeasDisp(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstBladedDLLTypeData%StCMeasDisp.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DstBladedDLLTypeData%StCMeasDisp = SrcBladedDLLTypeData%StCMeasDisp +ENDIF +IF (ALLOCATED(SrcBladedDLLTypeData%StCMeasVel)) THEN + i1_l = LBOUND(SrcBladedDLLTypeData%StCMeasVel,1) + i1_u = UBOUND(SrcBladedDLLTypeData%StCMeasVel,1) + i2_l = LBOUND(SrcBladedDLLTypeData%StCMeasVel,2) + i2_u = UBOUND(SrcBladedDLLTypeData%StCMeasVel,2) + IF (.NOT. ALLOCATED(DstBladedDLLTypeData%StCMeasVel)) THEN + ALLOCATE(DstBladedDLLTypeData%StCMeasVel(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstBladedDLLTypeData%StCMeasVel.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DstBladedDLLTypeData%StCMeasVel = SrcBladedDLLTypeData%StCMeasVel +ENDIF END SUBROUTINE SrvD_CopyBladedDLLType SUBROUTINE SrvD_DestroyBladedDLLType( BladedDLLTypeData, ErrStat, ErrMsg ) @@ -2959,6 +3557,48 @@ SUBROUTINE SrvD_DestroyBladedDLLType( BladedDLLTypeData, ErrStat, ErrMsg ) ENDIF IF (ALLOCATED(BladedDLLTypeData%GenTrq_TLU)) THEN DEALLOCATE(BladedDLLTypeData%GenTrq_TLU) +ENDIF +IF (ALLOCATED(BladedDLLTypeData%PrevCableDeltaL)) THEN + DEALLOCATE(BladedDLLTypeData%PrevCableDeltaL) +ENDIF +IF (ALLOCATED(BladedDLLTypeData%PrevCableDeltaLdot)) THEN + DEALLOCATE(BladedDLLTypeData%PrevCableDeltaLdot) +ENDIF +IF (ALLOCATED(BladedDLLTypeData%CableDeltaL)) THEN + DEALLOCATE(BladedDLLTypeData%CableDeltaL) +ENDIF +IF (ALLOCATED(BladedDLLTypeData%CableDeltaLdot)) THEN + DEALLOCATE(BladedDLLTypeData%CableDeltaLdot) +ENDIF +IF (ALLOCATED(BladedDLLTypeData%PrevStCCmdStiff)) THEN + DEALLOCATE(BladedDLLTypeData%PrevStCCmdStiff) +ENDIF +IF (ALLOCATED(BladedDLLTypeData%PrevStCCmdDamp)) THEN + DEALLOCATE(BladedDLLTypeData%PrevStCCmdDamp) +ENDIF +IF (ALLOCATED(BladedDLLTypeData%PrevStCCmdBrake)) THEN + DEALLOCATE(BladedDLLTypeData%PrevStCCmdBrake) +ENDIF +IF (ALLOCATED(BladedDLLTypeData%PrevStCCmdForce)) THEN + DEALLOCATE(BladedDLLTypeData%PrevStCCmdForce) +ENDIF +IF (ALLOCATED(BladedDLLTypeData%StCCmdStiff)) THEN + DEALLOCATE(BladedDLLTypeData%StCCmdStiff) +ENDIF +IF (ALLOCATED(BladedDLLTypeData%StCCmdDamp)) THEN + DEALLOCATE(BladedDLLTypeData%StCCmdDamp) +ENDIF +IF (ALLOCATED(BladedDLLTypeData%StCCmdBrake)) THEN + DEALLOCATE(BladedDLLTypeData%StCCmdBrake) +ENDIF +IF (ALLOCATED(BladedDLLTypeData%StCCmdForce)) THEN + DEALLOCATE(BladedDLLTypeData%StCCmdForce) +ENDIF +IF (ALLOCATED(BladedDLLTypeData%StCMeasDisp)) THEN + DEALLOCATE(BladedDLLTypeData%StCMeasDisp) +ENDIF +IF (ALLOCATED(BladedDLLTypeData%StCMeasVel)) THEN + DEALLOCATE(BladedDLLTypeData%StCMeasVel) ENDIF END SUBROUTINE SrvD_DestroyBladedDLLType @@ -3009,6 +3649,7 @@ SUBROUTINE SrvD_PackBladedDLLType( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, Re_BufSz = Re_BufSz + SIZE(InData%BlPitchCom) ! BlPitchCom Re_BufSz = Re_BufSz + SIZE(InData%PrevBlPitch) ! PrevBlPitch Re_BufSz = Re_BufSz + SIZE(InData%BlAirfoilCom) ! BlAirfoilCom + Re_BufSz = Re_BufSz + SIZE(InData%PrevBlAirfoilCom) ! PrevBlAirfoilCom Re_BufSz = Re_BufSz + 1 ! ElecPwr_prev Re_BufSz = Re_BufSz + 1 ! GenTrq_prev Int_BufSz = Int_BufSz + 1 ! toSC allocated yes/no @@ -3112,6 +3753,76 @@ SUBROUTINE SrvD_PackBladedDLLType( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, Re_BufSz = Re_BufSz + SIZE(InData%GenTrq_TLU) ! GenTrq_TLU END IF Int_BufSz = Int_BufSz + 1 ! Yaw_Cntrl + Int_BufSz = Int_BufSz + 1 ! PrevCableDeltaL allocated yes/no + IF ( ALLOCATED(InData%PrevCableDeltaL) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! PrevCableDeltaL upper/lower bounds for each dimension + Re_BufSz = Re_BufSz + SIZE(InData%PrevCableDeltaL) ! PrevCableDeltaL + END IF + Int_BufSz = Int_BufSz + 1 ! PrevCableDeltaLdot allocated yes/no + IF ( ALLOCATED(InData%PrevCableDeltaLdot) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! PrevCableDeltaLdot upper/lower bounds for each dimension + Re_BufSz = Re_BufSz + SIZE(InData%PrevCableDeltaLdot) ! PrevCableDeltaLdot + END IF + Int_BufSz = Int_BufSz + 1 ! CableDeltaL allocated yes/no + IF ( ALLOCATED(InData%CableDeltaL) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! CableDeltaL upper/lower bounds for each dimension + Re_BufSz = Re_BufSz + SIZE(InData%CableDeltaL) ! CableDeltaL + END IF + Int_BufSz = Int_BufSz + 1 ! CableDeltaLdot allocated yes/no + IF ( ALLOCATED(InData%CableDeltaLdot) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! CableDeltaLdot upper/lower bounds for each dimension + Re_BufSz = Re_BufSz + SIZE(InData%CableDeltaLdot) ! CableDeltaLdot + END IF + Int_BufSz = Int_BufSz + 1 ! PrevStCCmdStiff allocated yes/no + IF ( ALLOCATED(InData%PrevStCCmdStiff) ) THEN + Int_BufSz = Int_BufSz + 2*2 ! PrevStCCmdStiff upper/lower bounds for each dimension + Re_BufSz = Re_BufSz + SIZE(InData%PrevStCCmdStiff) ! PrevStCCmdStiff + END IF + Int_BufSz = Int_BufSz + 1 ! PrevStCCmdDamp allocated yes/no + IF ( ALLOCATED(InData%PrevStCCmdDamp) ) THEN + Int_BufSz = Int_BufSz + 2*2 ! PrevStCCmdDamp upper/lower bounds for each dimension + Re_BufSz = Re_BufSz + SIZE(InData%PrevStCCmdDamp) ! PrevStCCmdDamp + END IF + Int_BufSz = Int_BufSz + 1 ! PrevStCCmdBrake allocated yes/no + IF ( ALLOCATED(InData%PrevStCCmdBrake) ) THEN + Int_BufSz = Int_BufSz + 2*2 ! PrevStCCmdBrake upper/lower bounds for each dimension + Re_BufSz = Re_BufSz + SIZE(InData%PrevStCCmdBrake) ! PrevStCCmdBrake + END IF + Int_BufSz = Int_BufSz + 1 ! PrevStCCmdForce allocated yes/no + IF ( ALLOCATED(InData%PrevStCCmdForce) ) THEN + Int_BufSz = Int_BufSz + 2*2 ! PrevStCCmdForce upper/lower bounds for each dimension + Re_BufSz = Re_BufSz + SIZE(InData%PrevStCCmdForce) ! PrevStCCmdForce + END IF + Int_BufSz = Int_BufSz + 1 ! StCCmdStiff allocated yes/no + IF ( ALLOCATED(InData%StCCmdStiff) ) THEN + Int_BufSz = Int_BufSz + 2*2 ! StCCmdStiff upper/lower bounds for each dimension + Re_BufSz = Re_BufSz + SIZE(InData%StCCmdStiff) ! StCCmdStiff + END IF + Int_BufSz = Int_BufSz + 1 ! StCCmdDamp allocated yes/no + IF ( ALLOCATED(InData%StCCmdDamp) ) THEN + Int_BufSz = Int_BufSz + 2*2 ! StCCmdDamp upper/lower bounds for each dimension + Re_BufSz = Re_BufSz + SIZE(InData%StCCmdDamp) ! StCCmdDamp + END IF + Int_BufSz = Int_BufSz + 1 ! StCCmdBrake allocated yes/no + IF ( ALLOCATED(InData%StCCmdBrake) ) THEN + Int_BufSz = Int_BufSz + 2*2 ! StCCmdBrake upper/lower bounds for each dimension + Re_BufSz = Re_BufSz + SIZE(InData%StCCmdBrake) ! StCCmdBrake + END IF + Int_BufSz = Int_BufSz + 1 ! StCCmdForce allocated yes/no + IF ( ALLOCATED(InData%StCCmdForce) ) THEN + Int_BufSz = Int_BufSz + 2*2 ! StCCmdForce upper/lower bounds for each dimension + Re_BufSz = Re_BufSz + SIZE(InData%StCCmdForce) ! StCCmdForce + END IF + Int_BufSz = Int_BufSz + 1 ! StCMeasDisp allocated yes/no + IF ( ALLOCATED(InData%StCMeasDisp) ) THEN + Int_BufSz = Int_BufSz + 2*2 ! StCMeasDisp upper/lower bounds for each dimension + Re_BufSz = Re_BufSz + SIZE(InData%StCMeasDisp) ! StCMeasDisp + END IF + Int_BufSz = Int_BufSz + 1 ! StCMeasVel allocated yes/no + IF ( ALLOCATED(InData%StCMeasVel) ) THEN + Int_BufSz = Int_BufSz + 2*2 ! StCMeasVel upper/lower bounds for each dimension + Re_BufSz = Re_BufSz + SIZE(InData%StCMeasVel) ! StCMeasVel + END IF IF ( Re_BufSz .GT. 0 ) THEN ALLOCATE( ReKiBuf( Re_BufSz ), STAT=ErrStat2 ) IF (ErrStat2 /= 0) THEN @@ -3174,6 +3885,10 @@ SUBROUTINE SrvD_PackBladedDLLType( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ReKiBuf(Re_Xferred) = InData%BlAirfoilCom(i1) Re_Xferred = Re_Xferred + 1 END DO + DO i1 = LBOUND(InData%PrevBlAirfoilCom,1), UBOUND(InData%PrevBlAirfoilCom,1) + ReKiBuf(Re_Xferred) = InData%PrevBlAirfoilCom(i1) + Re_Xferred = Re_Xferred + 1 + END DO ReKiBuf(Re_Xferred) = InData%ElecPwr_prev Re_Xferred = Re_Xferred + 1 ReKiBuf(Re_Xferred) = InData%GenTrq_prev @@ -3408,15 +4123,275 @@ SUBROUTINE SrvD_PackBladedDLLType( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, END IF IntKiBuf(Int_Xferred) = InData%Yaw_Cntrl Int_Xferred = Int_Xferred + 1 - END SUBROUTINE SrvD_PackBladedDLLType + IF ( .NOT. ALLOCATED(InData%PrevCableDeltaL) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%PrevCableDeltaL,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%PrevCableDeltaL,1) + Int_Xferred = Int_Xferred + 2 - SUBROUTINE SrvD_UnPackBladedDLLType( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrMsg ) - REAL(ReKi), ALLOCATABLE, INTENT(IN ) :: ReKiBuf(:) - REAL(DbKi), ALLOCATABLE, INTENT(IN ) :: DbKiBuf(:) - INTEGER(IntKi), ALLOCATABLE, INTENT(IN ) :: IntKiBuf(:) - TYPE(BladedDLLType), INTENT(INOUT) :: OutData - INTEGER(IntKi), INTENT( OUT) :: ErrStat - CHARACTER(*), INTENT( OUT) :: ErrMsg + DO i1 = LBOUND(InData%PrevCableDeltaL,1), UBOUND(InData%PrevCableDeltaL,1) + ReKiBuf(Re_Xferred) = InData%PrevCableDeltaL(i1) + Re_Xferred = Re_Xferred + 1 + END DO + END IF + IF ( .NOT. ALLOCATED(InData%PrevCableDeltaLdot) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%PrevCableDeltaLdot,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%PrevCableDeltaLdot,1) + Int_Xferred = Int_Xferred + 2 + + DO i1 = LBOUND(InData%PrevCableDeltaLdot,1), UBOUND(InData%PrevCableDeltaLdot,1) + ReKiBuf(Re_Xferred) = InData%PrevCableDeltaLdot(i1) + Re_Xferred = Re_Xferred + 1 + END DO + END IF + IF ( .NOT. ALLOCATED(InData%CableDeltaL) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%CableDeltaL,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%CableDeltaL,1) + Int_Xferred = Int_Xferred + 2 + + DO i1 = LBOUND(InData%CableDeltaL,1), UBOUND(InData%CableDeltaL,1) + ReKiBuf(Re_Xferred) = InData%CableDeltaL(i1) + Re_Xferred = Re_Xferred + 1 + END DO + END IF + IF ( .NOT. ALLOCATED(InData%CableDeltaLdot) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%CableDeltaLdot,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%CableDeltaLdot,1) + Int_Xferred = Int_Xferred + 2 + + DO i1 = LBOUND(InData%CableDeltaLdot,1), UBOUND(InData%CableDeltaLdot,1) + ReKiBuf(Re_Xferred) = InData%CableDeltaLdot(i1) + Re_Xferred = Re_Xferred + 1 + END DO + END IF + IF ( .NOT. ALLOCATED(InData%PrevStCCmdStiff) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%PrevStCCmdStiff,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%PrevStCCmdStiff,1) + Int_Xferred = Int_Xferred + 2 + IntKiBuf( Int_Xferred ) = LBOUND(InData%PrevStCCmdStiff,2) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%PrevStCCmdStiff,2) + Int_Xferred = Int_Xferred + 2 + + DO i2 = LBOUND(InData%PrevStCCmdStiff,2), UBOUND(InData%PrevStCCmdStiff,2) + DO i1 = LBOUND(InData%PrevStCCmdStiff,1), UBOUND(InData%PrevStCCmdStiff,1) + ReKiBuf(Re_Xferred) = InData%PrevStCCmdStiff(i1,i2) + Re_Xferred = Re_Xferred + 1 + END DO + END DO + END IF + IF ( .NOT. ALLOCATED(InData%PrevStCCmdDamp) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%PrevStCCmdDamp,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%PrevStCCmdDamp,1) + Int_Xferred = Int_Xferred + 2 + IntKiBuf( Int_Xferred ) = LBOUND(InData%PrevStCCmdDamp,2) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%PrevStCCmdDamp,2) + Int_Xferred = Int_Xferred + 2 + + DO i2 = LBOUND(InData%PrevStCCmdDamp,2), UBOUND(InData%PrevStCCmdDamp,2) + DO i1 = LBOUND(InData%PrevStCCmdDamp,1), UBOUND(InData%PrevStCCmdDamp,1) + ReKiBuf(Re_Xferred) = InData%PrevStCCmdDamp(i1,i2) + Re_Xferred = Re_Xferred + 1 + END DO + END DO + END IF + IF ( .NOT. ALLOCATED(InData%PrevStCCmdBrake) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%PrevStCCmdBrake,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%PrevStCCmdBrake,1) + Int_Xferred = Int_Xferred + 2 + IntKiBuf( Int_Xferred ) = LBOUND(InData%PrevStCCmdBrake,2) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%PrevStCCmdBrake,2) + Int_Xferred = Int_Xferred + 2 + + DO i2 = LBOUND(InData%PrevStCCmdBrake,2), UBOUND(InData%PrevStCCmdBrake,2) + DO i1 = LBOUND(InData%PrevStCCmdBrake,1), UBOUND(InData%PrevStCCmdBrake,1) + ReKiBuf(Re_Xferred) = InData%PrevStCCmdBrake(i1,i2) + Re_Xferred = Re_Xferred + 1 + END DO + END DO + END IF + IF ( .NOT. ALLOCATED(InData%PrevStCCmdForce) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%PrevStCCmdForce,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%PrevStCCmdForce,1) + Int_Xferred = Int_Xferred + 2 + IntKiBuf( Int_Xferred ) = LBOUND(InData%PrevStCCmdForce,2) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%PrevStCCmdForce,2) + Int_Xferred = Int_Xferred + 2 + + DO i2 = LBOUND(InData%PrevStCCmdForce,2), UBOUND(InData%PrevStCCmdForce,2) + DO i1 = LBOUND(InData%PrevStCCmdForce,1), UBOUND(InData%PrevStCCmdForce,1) + ReKiBuf(Re_Xferred) = InData%PrevStCCmdForce(i1,i2) + Re_Xferred = Re_Xferred + 1 + END DO + END DO + END IF + IF ( .NOT. ALLOCATED(InData%StCCmdStiff) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%StCCmdStiff,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%StCCmdStiff,1) + Int_Xferred = Int_Xferred + 2 + IntKiBuf( Int_Xferred ) = LBOUND(InData%StCCmdStiff,2) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%StCCmdStiff,2) + Int_Xferred = Int_Xferred + 2 + + DO i2 = LBOUND(InData%StCCmdStiff,2), UBOUND(InData%StCCmdStiff,2) + DO i1 = LBOUND(InData%StCCmdStiff,1), UBOUND(InData%StCCmdStiff,1) + ReKiBuf(Re_Xferred) = InData%StCCmdStiff(i1,i2) + Re_Xferred = Re_Xferred + 1 + END DO + END DO + END IF + IF ( .NOT. ALLOCATED(InData%StCCmdDamp) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%StCCmdDamp,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%StCCmdDamp,1) + Int_Xferred = Int_Xferred + 2 + IntKiBuf( Int_Xferred ) = LBOUND(InData%StCCmdDamp,2) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%StCCmdDamp,2) + Int_Xferred = Int_Xferred + 2 + + DO i2 = LBOUND(InData%StCCmdDamp,2), UBOUND(InData%StCCmdDamp,2) + DO i1 = LBOUND(InData%StCCmdDamp,1), UBOUND(InData%StCCmdDamp,1) + ReKiBuf(Re_Xferred) = InData%StCCmdDamp(i1,i2) + Re_Xferred = Re_Xferred + 1 + END DO + END DO + END IF + IF ( .NOT. ALLOCATED(InData%StCCmdBrake) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%StCCmdBrake,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%StCCmdBrake,1) + Int_Xferred = Int_Xferred + 2 + IntKiBuf( Int_Xferred ) = LBOUND(InData%StCCmdBrake,2) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%StCCmdBrake,2) + Int_Xferred = Int_Xferred + 2 + + DO i2 = LBOUND(InData%StCCmdBrake,2), UBOUND(InData%StCCmdBrake,2) + DO i1 = LBOUND(InData%StCCmdBrake,1), UBOUND(InData%StCCmdBrake,1) + ReKiBuf(Re_Xferred) = InData%StCCmdBrake(i1,i2) + Re_Xferred = Re_Xferred + 1 + END DO + END DO + END IF + IF ( .NOT. ALLOCATED(InData%StCCmdForce) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%StCCmdForce,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%StCCmdForce,1) + Int_Xferred = Int_Xferred + 2 + IntKiBuf( Int_Xferred ) = LBOUND(InData%StCCmdForce,2) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%StCCmdForce,2) + Int_Xferred = Int_Xferred + 2 + + DO i2 = LBOUND(InData%StCCmdForce,2), UBOUND(InData%StCCmdForce,2) + DO i1 = LBOUND(InData%StCCmdForce,1), UBOUND(InData%StCCmdForce,1) + ReKiBuf(Re_Xferred) = InData%StCCmdForce(i1,i2) + Re_Xferred = Re_Xferred + 1 + END DO + END DO + END IF + IF ( .NOT. ALLOCATED(InData%StCMeasDisp) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%StCMeasDisp,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%StCMeasDisp,1) + Int_Xferred = Int_Xferred + 2 + IntKiBuf( Int_Xferred ) = LBOUND(InData%StCMeasDisp,2) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%StCMeasDisp,2) + Int_Xferred = Int_Xferred + 2 + + DO i2 = LBOUND(InData%StCMeasDisp,2), UBOUND(InData%StCMeasDisp,2) + DO i1 = LBOUND(InData%StCMeasDisp,1), UBOUND(InData%StCMeasDisp,1) + ReKiBuf(Re_Xferred) = InData%StCMeasDisp(i1,i2) + Re_Xferred = Re_Xferred + 1 + END DO + END DO + END IF + IF ( .NOT. ALLOCATED(InData%StCMeasVel) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%StCMeasVel,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%StCMeasVel,1) + Int_Xferred = Int_Xferred + 2 + IntKiBuf( Int_Xferred ) = LBOUND(InData%StCMeasVel,2) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%StCMeasVel,2) + Int_Xferred = Int_Xferred + 2 + + DO i2 = LBOUND(InData%StCMeasVel,2), UBOUND(InData%StCMeasVel,2) + DO i1 = LBOUND(InData%StCMeasVel,1), UBOUND(InData%StCMeasVel,1) + ReKiBuf(Re_Xferred) = InData%StCMeasVel(i1,i2) + Re_Xferred = Re_Xferred + 1 + END DO + END DO + END IF + END SUBROUTINE SrvD_PackBladedDLLType + + SUBROUTINE SrvD_UnPackBladedDLLType( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrMsg ) + REAL(ReKi), ALLOCATABLE, INTENT(IN ) :: ReKiBuf(:) + REAL(DbKi), ALLOCATABLE, INTENT(IN ) :: DbKiBuf(:) + INTEGER(IntKi), ALLOCATABLE, INTENT(IN ) :: IntKiBuf(:) + TYPE(BladedDLLType), INTENT(INOUT) :: OutData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg ! Local variables INTEGER(IntKi) :: Buf_size INTEGER(IntKi) :: Re_Xferred @@ -3424,6 +4399,7 @@ SUBROUTINE SrvD_UnPackBladedDLLType( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrSta INTEGER(IntKi) :: Int_Xferred INTEGER(IntKi) :: i INTEGER(IntKi) :: i1, i1_l, i1_u ! bounds (upper/lower) for an array dimension 1 + INTEGER(IntKi) :: i2, i2_l, i2_u ! bounds (upper/lower) for an array dimension 2 INTEGER(IntKi) :: ErrStat2 CHARACTER(ErrMsgLen) :: ErrMsg2 CHARACTER(*), PARAMETER :: RoutineName = 'SrvD_UnPackBladedDLLType' @@ -3481,6 +4457,12 @@ SUBROUTINE SrvD_UnPackBladedDLLType( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrSta OutData%BlAirfoilCom(i1) = ReKiBuf(Re_Xferred) Re_Xferred = Re_Xferred + 1 END DO + i1_l = LBOUND(OutData%PrevBlAirfoilCom,1) + i1_u = UBOUND(OutData%PrevBlAirfoilCom,1) + DO i1 = LBOUND(OutData%PrevBlAirfoilCom,1), UBOUND(OutData%PrevBlAirfoilCom,1) + OutData%PrevBlAirfoilCom(i1) = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + END DO OutData%ElecPwr_prev = ReKiBuf(Re_Xferred) Re_Xferred = Re_Xferred + 1 OutData%GenTrq_prev = ReKiBuf(Re_Xferred) @@ -3749,79 +4731,381 @@ SUBROUTINE SrvD_UnPackBladedDLLType( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrSta END IF OutData%Yaw_Cntrl = IntKiBuf(Int_Xferred) Int_Xferred = Int_Xferred + 1 - END SUBROUTINE SrvD_UnPackBladedDLLType - - SUBROUTINE SrvD_CopyContState( SrcContStateData, DstContStateData, CtrlCode, ErrStat, ErrMsg ) - TYPE(SrvD_ContinuousStateType), INTENT(IN) :: SrcContStateData - TYPE(SrvD_ContinuousStateType), INTENT(INOUT) :: DstContStateData - INTEGER(IntKi), INTENT(IN ) :: CtrlCode - INTEGER(IntKi), INTENT( OUT) :: ErrStat - CHARACTER(*), INTENT( OUT) :: ErrMsg -! Local - INTEGER(IntKi) :: i,j,k - INTEGER(IntKi) :: i1, i1_l, i1_u ! bounds (upper/lower) for an array dimension 1 - INTEGER(IntKi) :: ErrStat2 - CHARACTER(ErrMsgLen) :: ErrMsg2 - CHARACTER(*), PARAMETER :: RoutineName = 'SrvD_CopyContState' -! - ErrStat = ErrID_None - ErrMsg = "" - DstContStateData%DummyContState = SrcContStateData%DummyContState -IF (ALLOCATED(SrcContStateData%BStC)) THEN - i1_l = LBOUND(SrcContStateData%BStC,1) - i1_u = UBOUND(SrcContStateData%BStC,1) - IF (.NOT. ALLOCATED(DstContStateData%BStC)) THEN - ALLOCATE(DstContStateData%BStC(i1_l:i1_u),STAT=ErrStat2) + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! PrevCableDeltaL not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%PrevCableDeltaL)) DEALLOCATE(OutData%PrevCableDeltaL) + ALLOCATE(OutData%PrevCableDeltaL(i1_l:i1_u),STAT=ErrStat2) IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating DstContStateData%BStC.', ErrStat, ErrMsg,RoutineName) - RETURN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%PrevCableDeltaL.', ErrStat, ErrMsg,RoutineName) + RETURN END IF + DO i1 = LBOUND(OutData%PrevCableDeltaL,1), UBOUND(OutData%PrevCableDeltaL,1) + OutData%PrevCableDeltaL(i1) = REAL(ReKiBuf(Re_Xferred), SiKi) + Re_Xferred = Re_Xferred + 1 + END DO END IF - DO i1 = LBOUND(SrcContStateData%BStC,1), UBOUND(SrcContStateData%BStC,1) - CALL StC_CopyContState( SrcContStateData%BStC(i1), DstContStateData%BStC(i1), CtrlCode, ErrStat2, ErrMsg2 ) - CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) - IF (ErrStat>=AbortErrLev) RETURN - ENDDO -ENDIF -IF (ALLOCATED(SrcContStateData%NStC)) THEN - i1_l = LBOUND(SrcContStateData%NStC,1) - i1_u = UBOUND(SrcContStateData%NStC,1) - IF (.NOT. ALLOCATED(DstContStateData%NStC)) THEN - ALLOCATE(DstContStateData%NStC(i1_l:i1_u),STAT=ErrStat2) + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! PrevCableDeltaLdot not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%PrevCableDeltaLdot)) DEALLOCATE(OutData%PrevCableDeltaLdot) + ALLOCATE(OutData%PrevCableDeltaLdot(i1_l:i1_u),STAT=ErrStat2) IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating DstContStateData%NStC.', ErrStat, ErrMsg,RoutineName) - RETURN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%PrevCableDeltaLdot.', ErrStat, ErrMsg,RoutineName) + RETURN END IF + DO i1 = LBOUND(OutData%PrevCableDeltaLdot,1), UBOUND(OutData%PrevCableDeltaLdot,1) + OutData%PrevCableDeltaLdot(i1) = REAL(ReKiBuf(Re_Xferred), SiKi) + Re_Xferred = Re_Xferred + 1 + END DO END IF - DO i1 = LBOUND(SrcContStateData%NStC,1), UBOUND(SrcContStateData%NStC,1) - CALL StC_CopyContState( SrcContStateData%NStC(i1), DstContStateData%NStC(i1), CtrlCode, ErrStat2, ErrMsg2 ) - CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) - IF (ErrStat>=AbortErrLev) RETURN - ENDDO -ENDIF -IF (ALLOCATED(SrcContStateData%TStC)) THEN - i1_l = LBOUND(SrcContStateData%TStC,1) - i1_u = UBOUND(SrcContStateData%TStC,1) - IF (.NOT. ALLOCATED(DstContStateData%TStC)) THEN - ALLOCATE(DstContStateData%TStC(i1_l:i1_u),STAT=ErrStat2) + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! CableDeltaL not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%CableDeltaL)) DEALLOCATE(OutData%CableDeltaL) + ALLOCATE(OutData%CableDeltaL(i1_l:i1_u),STAT=ErrStat2) IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating DstContStateData%TStC.', ErrStat, ErrMsg,RoutineName) - RETURN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%CableDeltaL.', ErrStat, ErrMsg,RoutineName) + RETURN END IF + DO i1 = LBOUND(OutData%CableDeltaL,1), UBOUND(OutData%CableDeltaL,1) + OutData%CableDeltaL(i1) = REAL(ReKiBuf(Re_Xferred), SiKi) + Re_Xferred = Re_Xferred + 1 + END DO END IF - DO i1 = LBOUND(SrcContStateData%TStC,1), UBOUND(SrcContStateData%TStC,1) - CALL StC_CopyContState( SrcContStateData%TStC(i1), DstContStateData%TStC(i1), CtrlCode, ErrStat2, ErrMsg2 ) - CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) - IF (ErrStat>=AbortErrLev) RETURN - ENDDO -ENDIF -IF (ALLOCATED(SrcContStateData%SStC)) THEN - i1_l = LBOUND(SrcContStateData%SStC,1) - i1_u = UBOUND(SrcContStateData%SStC,1) - IF (.NOT. ALLOCATED(DstContStateData%SStC)) THEN - ALLOCATE(DstContStateData%SStC(i1_l:i1_u),STAT=ErrStat2) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating DstContStateData%SStC.', ErrStat, ErrMsg,RoutineName) + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! CableDeltaLdot not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%CableDeltaLdot)) DEALLOCATE(OutData%CableDeltaLdot) + ALLOCATE(OutData%CableDeltaLdot(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%CableDeltaLdot.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i1 = LBOUND(OutData%CableDeltaLdot,1), UBOUND(OutData%CableDeltaLdot,1) + OutData%CableDeltaLdot(i1) = REAL(ReKiBuf(Re_Xferred), SiKi) + Re_Xferred = Re_Xferred + 1 + END DO + END IF + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! PrevStCCmdStiff not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + i2_l = IntKiBuf( Int_Xferred ) + i2_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%PrevStCCmdStiff)) DEALLOCATE(OutData%PrevStCCmdStiff) + ALLOCATE(OutData%PrevStCCmdStiff(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%PrevStCCmdStiff.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i2 = LBOUND(OutData%PrevStCCmdStiff,2), UBOUND(OutData%PrevStCCmdStiff,2) + DO i1 = LBOUND(OutData%PrevStCCmdStiff,1), UBOUND(OutData%PrevStCCmdStiff,1) + OutData%PrevStCCmdStiff(i1,i2) = REAL(ReKiBuf(Re_Xferred), SiKi) + Re_Xferred = Re_Xferred + 1 + END DO + END DO + END IF + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! PrevStCCmdDamp not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + i2_l = IntKiBuf( Int_Xferred ) + i2_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%PrevStCCmdDamp)) DEALLOCATE(OutData%PrevStCCmdDamp) + ALLOCATE(OutData%PrevStCCmdDamp(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%PrevStCCmdDamp.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i2 = LBOUND(OutData%PrevStCCmdDamp,2), UBOUND(OutData%PrevStCCmdDamp,2) + DO i1 = LBOUND(OutData%PrevStCCmdDamp,1), UBOUND(OutData%PrevStCCmdDamp,1) + OutData%PrevStCCmdDamp(i1,i2) = REAL(ReKiBuf(Re_Xferred), SiKi) + Re_Xferred = Re_Xferred + 1 + END DO + END DO + END IF + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! PrevStCCmdBrake not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + i2_l = IntKiBuf( Int_Xferred ) + i2_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%PrevStCCmdBrake)) DEALLOCATE(OutData%PrevStCCmdBrake) + ALLOCATE(OutData%PrevStCCmdBrake(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%PrevStCCmdBrake.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i2 = LBOUND(OutData%PrevStCCmdBrake,2), UBOUND(OutData%PrevStCCmdBrake,2) + DO i1 = LBOUND(OutData%PrevStCCmdBrake,1), UBOUND(OutData%PrevStCCmdBrake,1) + OutData%PrevStCCmdBrake(i1,i2) = REAL(ReKiBuf(Re_Xferred), SiKi) + Re_Xferred = Re_Xferred + 1 + END DO + END DO + END IF + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! PrevStCCmdForce not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + i2_l = IntKiBuf( Int_Xferred ) + i2_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%PrevStCCmdForce)) DEALLOCATE(OutData%PrevStCCmdForce) + ALLOCATE(OutData%PrevStCCmdForce(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%PrevStCCmdForce.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i2 = LBOUND(OutData%PrevStCCmdForce,2), UBOUND(OutData%PrevStCCmdForce,2) + DO i1 = LBOUND(OutData%PrevStCCmdForce,1), UBOUND(OutData%PrevStCCmdForce,1) + OutData%PrevStCCmdForce(i1,i2) = REAL(ReKiBuf(Re_Xferred), SiKi) + Re_Xferred = Re_Xferred + 1 + END DO + END DO + END IF + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! StCCmdStiff not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + i2_l = IntKiBuf( Int_Xferred ) + i2_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%StCCmdStiff)) DEALLOCATE(OutData%StCCmdStiff) + ALLOCATE(OutData%StCCmdStiff(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%StCCmdStiff.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i2 = LBOUND(OutData%StCCmdStiff,2), UBOUND(OutData%StCCmdStiff,2) + DO i1 = LBOUND(OutData%StCCmdStiff,1), UBOUND(OutData%StCCmdStiff,1) + OutData%StCCmdStiff(i1,i2) = REAL(ReKiBuf(Re_Xferred), SiKi) + Re_Xferred = Re_Xferred + 1 + END DO + END DO + END IF + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! StCCmdDamp not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + i2_l = IntKiBuf( Int_Xferred ) + i2_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%StCCmdDamp)) DEALLOCATE(OutData%StCCmdDamp) + ALLOCATE(OutData%StCCmdDamp(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%StCCmdDamp.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i2 = LBOUND(OutData%StCCmdDamp,2), UBOUND(OutData%StCCmdDamp,2) + DO i1 = LBOUND(OutData%StCCmdDamp,1), UBOUND(OutData%StCCmdDamp,1) + OutData%StCCmdDamp(i1,i2) = REAL(ReKiBuf(Re_Xferred), SiKi) + Re_Xferred = Re_Xferred + 1 + END DO + END DO + END IF + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! StCCmdBrake not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + i2_l = IntKiBuf( Int_Xferred ) + i2_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%StCCmdBrake)) DEALLOCATE(OutData%StCCmdBrake) + ALLOCATE(OutData%StCCmdBrake(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%StCCmdBrake.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i2 = LBOUND(OutData%StCCmdBrake,2), UBOUND(OutData%StCCmdBrake,2) + DO i1 = LBOUND(OutData%StCCmdBrake,1), UBOUND(OutData%StCCmdBrake,1) + OutData%StCCmdBrake(i1,i2) = REAL(ReKiBuf(Re_Xferred), SiKi) + Re_Xferred = Re_Xferred + 1 + END DO + END DO + END IF + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! StCCmdForce not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + i2_l = IntKiBuf( Int_Xferred ) + i2_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%StCCmdForce)) DEALLOCATE(OutData%StCCmdForce) + ALLOCATE(OutData%StCCmdForce(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%StCCmdForce.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i2 = LBOUND(OutData%StCCmdForce,2), UBOUND(OutData%StCCmdForce,2) + DO i1 = LBOUND(OutData%StCCmdForce,1), UBOUND(OutData%StCCmdForce,1) + OutData%StCCmdForce(i1,i2) = REAL(ReKiBuf(Re_Xferred), SiKi) + Re_Xferred = Re_Xferred + 1 + END DO + END DO + END IF + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! StCMeasDisp not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + i2_l = IntKiBuf( Int_Xferred ) + i2_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%StCMeasDisp)) DEALLOCATE(OutData%StCMeasDisp) + ALLOCATE(OutData%StCMeasDisp(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%StCMeasDisp.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i2 = LBOUND(OutData%StCMeasDisp,2), UBOUND(OutData%StCMeasDisp,2) + DO i1 = LBOUND(OutData%StCMeasDisp,1), UBOUND(OutData%StCMeasDisp,1) + OutData%StCMeasDisp(i1,i2) = REAL(ReKiBuf(Re_Xferred), SiKi) + Re_Xferred = Re_Xferred + 1 + END DO + END DO + END IF + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! StCMeasVel not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + i2_l = IntKiBuf( Int_Xferred ) + i2_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%StCMeasVel)) DEALLOCATE(OutData%StCMeasVel) + ALLOCATE(OutData%StCMeasVel(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%StCMeasVel.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i2 = LBOUND(OutData%StCMeasVel,2), UBOUND(OutData%StCMeasVel,2) + DO i1 = LBOUND(OutData%StCMeasVel,1), UBOUND(OutData%StCMeasVel,1) + OutData%StCMeasVel(i1,i2) = REAL(ReKiBuf(Re_Xferred), SiKi) + Re_Xferred = Re_Xferred + 1 + END DO + END DO + END IF + END SUBROUTINE SrvD_UnPackBladedDLLType + + SUBROUTINE SrvD_CopyContState( SrcContStateData, DstContStateData, CtrlCode, ErrStat, ErrMsg ) + TYPE(SrvD_ContinuousStateType), INTENT(IN) :: SrcContStateData + TYPE(SrvD_ContinuousStateType), INTENT(INOUT) :: DstContStateData + INTEGER(IntKi), INTENT(IN ) :: CtrlCode + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg +! Local + INTEGER(IntKi) :: i,j,k + INTEGER(IntKi) :: i1, i1_l, i1_u ! bounds (upper/lower) for an array dimension 1 + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'SrvD_CopyContState' +! + ErrStat = ErrID_None + ErrMsg = "" + DstContStateData%DummyContState = SrcContStateData%DummyContState +IF (ALLOCATED(SrcContStateData%BStC)) THEN + i1_l = LBOUND(SrcContStateData%BStC,1) + i1_u = UBOUND(SrcContStateData%BStC,1) + IF (.NOT. ALLOCATED(DstContStateData%BStC)) THEN + ALLOCATE(DstContStateData%BStC(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstContStateData%BStC.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DO i1 = LBOUND(SrcContStateData%BStC,1), UBOUND(SrcContStateData%BStC,1) + CALL StC_CopyContState( SrcContStateData%BStC(i1), DstContStateData%BStC(i1), CtrlCode, ErrStat2, ErrMsg2 ) + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) + IF (ErrStat>=AbortErrLev) RETURN + ENDDO +ENDIF +IF (ALLOCATED(SrcContStateData%NStC)) THEN + i1_l = LBOUND(SrcContStateData%NStC,1) + i1_u = UBOUND(SrcContStateData%NStC,1) + IF (.NOT. ALLOCATED(DstContStateData%NStC)) THEN + ALLOCATE(DstContStateData%NStC(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstContStateData%NStC.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DO i1 = LBOUND(SrcContStateData%NStC,1), UBOUND(SrcContStateData%NStC,1) + CALL StC_CopyContState( SrcContStateData%NStC(i1), DstContStateData%NStC(i1), CtrlCode, ErrStat2, ErrMsg2 ) + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) + IF (ErrStat>=AbortErrLev) RETURN + ENDDO +ENDIF +IF (ALLOCATED(SrcContStateData%TStC)) THEN + i1_l = LBOUND(SrcContStateData%TStC,1) + i1_u = UBOUND(SrcContStateData%TStC,1) + IF (.NOT. ALLOCATED(DstContStateData%TStC)) THEN + ALLOCATE(DstContStateData%TStC(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstContStateData%TStC.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DO i1 = LBOUND(SrcContStateData%TStC,1), UBOUND(SrcContStateData%TStC,1) + CALL StC_CopyContState( SrcContStateData%TStC(i1), DstContStateData%TStC(i1), CtrlCode, ErrStat2, ErrMsg2 ) + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) + IF (ErrStat>=AbortErrLev) RETURN + ENDDO +ENDIF +IF (ALLOCATED(SrcContStateData%SStC)) THEN + i1_l = LBOUND(SrcContStateData%SStC,1) + i1_u = UBOUND(SrcContStateData%SStC,1) + IF (.NOT. ALLOCATED(DstContStateData%SStC)) THEN + ALLOCATE(DstContStateData%SStC(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstContStateData%SStC.', ErrStat, ErrMsg,RoutineName) RETURN END IF END IF @@ -6883,149 +8167,228 @@ SUBROUTINE SrvD_UnPackOtherState( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, END IF END SUBROUTINE SrvD_UnPackOtherState - SUBROUTINE SrvD_CopyMisc( SrcMiscData, DstMiscData, CtrlCode, ErrStat, ErrMsg ) - TYPE(SrvD_MiscVarType), INTENT(IN) :: SrcMiscData - TYPE(SrvD_MiscVarType), INTENT(INOUT) :: DstMiscData + SUBROUTINE SrvD_CopyModuleMapType( SrcModuleMapTypeData, DstModuleMapTypeData, CtrlCode, ErrStat, ErrMsg ) + TYPE(SrvD_ModuleMapType), INTENT(INOUT) :: SrcModuleMapTypeData + TYPE(SrvD_ModuleMapType), INTENT(INOUT) :: DstModuleMapTypeData INTEGER(IntKi), INTENT(IN ) :: CtrlCode INTEGER(IntKi), INTENT( OUT) :: ErrStat CHARACTER(*), INTENT( OUT) :: ErrMsg ! Local INTEGER(IntKi) :: i,j,k INTEGER(IntKi) :: i1, i1_l, i1_u ! bounds (upper/lower) for an array dimension 1 + INTEGER(IntKi) :: i2, i2_l, i2_u ! bounds (upper/lower) for an array dimension 2 INTEGER(IntKi) :: ErrStat2 CHARACTER(ErrMsgLen) :: ErrMsg2 - CHARACTER(*), PARAMETER :: RoutineName = 'SrvD_CopyMisc' + CHARACTER(*), PARAMETER :: RoutineName = 'SrvD_CopyModuleMapType' ! ErrStat = ErrID_None ErrMsg = "" - DstMiscData%LastTimeCalled = SrcMiscData%LastTimeCalled - CALL SrvD_Copybladeddlltype( SrcMiscData%dll_data, DstMiscData%dll_data, CtrlCode, ErrStat2, ErrMsg2 ) +IF (ALLOCATED(SrcModuleMapTypeData%u_BStC_Mot2_BStC)) THEN + i1_l = LBOUND(SrcModuleMapTypeData%u_BStC_Mot2_BStC,1) + i1_u = UBOUND(SrcModuleMapTypeData%u_BStC_Mot2_BStC,1) + i2_l = LBOUND(SrcModuleMapTypeData%u_BStC_Mot2_BStC,2) + i2_u = UBOUND(SrcModuleMapTypeData%u_BStC_Mot2_BStC,2) + IF (.NOT. ALLOCATED(DstModuleMapTypeData%u_BStC_Mot2_BStC)) THEN + ALLOCATE(DstModuleMapTypeData%u_BStC_Mot2_BStC(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstModuleMapTypeData%u_BStC_Mot2_BStC.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DO i2 = LBOUND(SrcModuleMapTypeData%u_BStC_Mot2_BStC,2), UBOUND(SrcModuleMapTypeData%u_BStC_Mot2_BStC,2) + DO i1 = LBOUND(SrcModuleMapTypeData%u_BStC_Mot2_BStC,1), UBOUND(SrcModuleMapTypeData%u_BStC_Mot2_BStC,1) + CALL NWTC_Library_Copymeshmaptype( SrcModuleMapTypeData%u_BStC_Mot2_BStC(i1,i2), DstModuleMapTypeData%u_BStC_Mot2_BStC(i1,i2), CtrlCode, ErrStat2, ErrMsg2 ) CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) IF (ErrStat>=AbortErrLev) RETURN - DstMiscData%FirstWarn = SrcMiscData%FirstWarn - DstMiscData%LastTimeFiltered = SrcMiscData%LastTimeFiltered -IF (ALLOCATED(SrcMiscData%xd_BlPitchFilter)) THEN - i1_l = LBOUND(SrcMiscData%xd_BlPitchFilter,1) - i1_u = UBOUND(SrcMiscData%xd_BlPitchFilter,1) - IF (.NOT. ALLOCATED(DstMiscData%xd_BlPitchFilter)) THEN - ALLOCATE(DstMiscData%xd_BlPitchFilter(i1_l:i1_u),STAT=ErrStat2) + ENDDO + ENDDO +ENDIF +IF (ALLOCATED(SrcModuleMapTypeData%u_NStC_Mot2_NStC)) THEN + i1_l = LBOUND(SrcModuleMapTypeData%u_NStC_Mot2_NStC,1) + i1_u = UBOUND(SrcModuleMapTypeData%u_NStC_Mot2_NStC,1) + IF (.NOT. ALLOCATED(DstModuleMapTypeData%u_NStC_Mot2_NStC)) THEN + ALLOCATE(DstModuleMapTypeData%u_NStC_Mot2_NStC(i1_l:i1_u),STAT=ErrStat2) IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating DstMiscData%xd_BlPitchFilter.', ErrStat, ErrMsg,RoutineName) + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstModuleMapTypeData%u_NStC_Mot2_NStC.', ErrStat, ErrMsg,RoutineName) RETURN END IF END IF - DstMiscData%xd_BlPitchFilter = SrcMiscData%xd_BlPitchFilter + DO i1 = LBOUND(SrcModuleMapTypeData%u_NStC_Mot2_NStC,1), UBOUND(SrcModuleMapTypeData%u_NStC_Mot2_NStC,1) + CALL NWTC_Library_Copymeshmaptype( SrcModuleMapTypeData%u_NStC_Mot2_NStC(i1), DstModuleMapTypeData%u_NStC_Mot2_NStC(i1), CtrlCode, ErrStat2, ErrMsg2 ) + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) + IF (ErrStat>=AbortErrLev) RETURN + ENDDO ENDIF -IF (ALLOCATED(SrcMiscData%BStC)) THEN - i1_l = LBOUND(SrcMiscData%BStC,1) - i1_u = UBOUND(SrcMiscData%BStC,1) - IF (.NOT. ALLOCATED(DstMiscData%BStC)) THEN - ALLOCATE(DstMiscData%BStC(i1_l:i1_u),STAT=ErrStat2) +IF (ALLOCATED(SrcModuleMapTypeData%u_TStC_Mot2_TStC)) THEN + i1_l = LBOUND(SrcModuleMapTypeData%u_TStC_Mot2_TStC,1) + i1_u = UBOUND(SrcModuleMapTypeData%u_TStC_Mot2_TStC,1) + IF (.NOT. ALLOCATED(DstModuleMapTypeData%u_TStC_Mot2_TStC)) THEN + ALLOCATE(DstModuleMapTypeData%u_TStC_Mot2_TStC(i1_l:i1_u),STAT=ErrStat2) IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating DstMiscData%BStC.', ErrStat, ErrMsg,RoutineName) + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstModuleMapTypeData%u_TStC_Mot2_TStC.', ErrStat, ErrMsg,RoutineName) RETURN END IF END IF - DO i1 = LBOUND(SrcMiscData%BStC,1), UBOUND(SrcMiscData%BStC,1) - CALL StC_CopyMisc( SrcMiscData%BStC(i1), DstMiscData%BStC(i1), CtrlCode, ErrStat2, ErrMsg2 ) + DO i1 = LBOUND(SrcModuleMapTypeData%u_TStC_Mot2_TStC,1), UBOUND(SrcModuleMapTypeData%u_TStC_Mot2_TStC,1) + CALL NWTC_Library_Copymeshmaptype( SrcModuleMapTypeData%u_TStC_Mot2_TStC(i1), DstModuleMapTypeData%u_TStC_Mot2_TStC(i1), CtrlCode, ErrStat2, ErrMsg2 ) CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) IF (ErrStat>=AbortErrLev) RETURN ENDDO ENDIF -IF (ALLOCATED(SrcMiscData%NStC)) THEN - i1_l = LBOUND(SrcMiscData%NStC,1) - i1_u = UBOUND(SrcMiscData%NStC,1) - IF (.NOT. ALLOCATED(DstMiscData%NStC)) THEN - ALLOCATE(DstMiscData%NStC(i1_l:i1_u),STAT=ErrStat2) +IF (ALLOCATED(SrcModuleMapTypeData%u_SStC_Mot2_SStC)) THEN + i1_l = LBOUND(SrcModuleMapTypeData%u_SStC_Mot2_SStC,1) + i1_u = UBOUND(SrcModuleMapTypeData%u_SStC_Mot2_SStC,1) + IF (.NOT. ALLOCATED(DstModuleMapTypeData%u_SStC_Mot2_SStC)) THEN + ALLOCATE(DstModuleMapTypeData%u_SStC_Mot2_SStC(i1_l:i1_u),STAT=ErrStat2) IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating DstMiscData%NStC.', ErrStat, ErrMsg,RoutineName) + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstModuleMapTypeData%u_SStC_Mot2_SStC.', ErrStat, ErrMsg,RoutineName) RETURN END IF END IF - DO i1 = LBOUND(SrcMiscData%NStC,1), UBOUND(SrcMiscData%NStC,1) - CALL StC_CopyMisc( SrcMiscData%NStC(i1), DstMiscData%NStC(i1), CtrlCode, ErrStat2, ErrMsg2 ) + DO i1 = LBOUND(SrcModuleMapTypeData%u_SStC_Mot2_SStC,1), UBOUND(SrcModuleMapTypeData%u_SStC_Mot2_SStC,1) + CALL NWTC_Library_Copymeshmaptype( SrcModuleMapTypeData%u_SStC_Mot2_SStC(i1), DstModuleMapTypeData%u_SStC_Mot2_SStC(i1), CtrlCode, ErrStat2, ErrMsg2 ) CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) IF (ErrStat>=AbortErrLev) RETURN ENDDO ENDIF -IF (ALLOCATED(SrcMiscData%TStC)) THEN - i1_l = LBOUND(SrcMiscData%TStC,1) - i1_u = UBOUND(SrcMiscData%TStC,1) - IF (.NOT. ALLOCATED(DstMiscData%TStC)) THEN - ALLOCATE(DstMiscData%TStC(i1_l:i1_u),STAT=ErrStat2) +IF (ALLOCATED(SrcModuleMapTypeData%BStC_Frc2_y_BStC)) THEN + i1_l = LBOUND(SrcModuleMapTypeData%BStC_Frc2_y_BStC,1) + i1_u = UBOUND(SrcModuleMapTypeData%BStC_Frc2_y_BStC,1) + i2_l = LBOUND(SrcModuleMapTypeData%BStC_Frc2_y_BStC,2) + i2_u = UBOUND(SrcModuleMapTypeData%BStC_Frc2_y_BStC,2) + IF (.NOT. ALLOCATED(DstModuleMapTypeData%BStC_Frc2_y_BStC)) THEN + ALLOCATE(DstModuleMapTypeData%BStC_Frc2_y_BStC(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating DstMiscData%TStC.', ErrStat, ErrMsg,RoutineName) + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstModuleMapTypeData%BStC_Frc2_y_BStC.', ErrStat, ErrMsg,RoutineName) RETURN END IF END IF - DO i1 = LBOUND(SrcMiscData%TStC,1), UBOUND(SrcMiscData%TStC,1) - CALL StC_CopyMisc( SrcMiscData%TStC(i1), DstMiscData%TStC(i1), CtrlCode, ErrStat2, ErrMsg2 ) + DO i2 = LBOUND(SrcModuleMapTypeData%BStC_Frc2_y_BStC,2), UBOUND(SrcModuleMapTypeData%BStC_Frc2_y_BStC,2) + DO i1 = LBOUND(SrcModuleMapTypeData%BStC_Frc2_y_BStC,1), UBOUND(SrcModuleMapTypeData%BStC_Frc2_y_BStC,1) + CALL NWTC_Library_Copymeshmaptype( SrcModuleMapTypeData%BStC_Frc2_y_BStC(i1,i2), DstModuleMapTypeData%BStC_Frc2_y_BStC(i1,i2), CtrlCode, ErrStat2, ErrMsg2 ) CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) IF (ErrStat>=AbortErrLev) RETURN ENDDO + ENDDO ENDIF -IF (ALLOCATED(SrcMiscData%SStC)) THEN - i1_l = LBOUND(SrcMiscData%SStC,1) - i1_u = UBOUND(SrcMiscData%SStC,1) - IF (.NOT. ALLOCATED(DstMiscData%SStC)) THEN - ALLOCATE(DstMiscData%SStC(i1_l:i1_u),STAT=ErrStat2) +IF (ALLOCATED(SrcModuleMapTypeData%NStC_Frc2_y_NStC)) THEN + i1_l = LBOUND(SrcModuleMapTypeData%NStC_Frc2_y_NStC,1) + i1_u = UBOUND(SrcModuleMapTypeData%NStC_Frc2_y_NStC,1) + IF (.NOT. ALLOCATED(DstModuleMapTypeData%NStC_Frc2_y_NStC)) THEN + ALLOCATE(DstModuleMapTypeData%NStC_Frc2_y_NStC(i1_l:i1_u),STAT=ErrStat2) IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating DstMiscData%SStC.', ErrStat, ErrMsg,RoutineName) + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstModuleMapTypeData%NStC_Frc2_y_NStC.', ErrStat, ErrMsg,RoutineName) RETURN END IF END IF - DO i1 = LBOUND(SrcMiscData%SStC,1), UBOUND(SrcMiscData%SStC,1) - CALL StC_CopyMisc( SrcMiscData%SStC(i1), DstMiscData%SStC(i1), CtrlCode, ErrStat2, ErrMsg2 ) + DO i1 = LBOUND(SrcModuleMapTypeData%NStC_Frc2_y_NStC,1), UBOUND(SrcModuleMapTypeData%NStC_Frc2_y_NStC,1) + CALL NWTC_Library_Copymeshmaptype( SrcModuleMapTypeData%NStC_Frc2_y_NStC(i1), DstModuleMapTypeData%NStC_Frc2_y_NStC(i1), CtrlCode, ErrStat2, ErrMsg2 ) CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) IF (ErrStat>=AbortErrLev) RETURN ENDDO ENDIF - END SUBROUTINE SrvD_CopyMisc +IF (ALLOCATED(SrcModuleMapTypeData%TStC_Frc2_y_TStC)) THEN + i1_l = LBOUND(SrcModuleMapTypeData%TStC_Frc2_y_TStC,1) + i1_u = UBOUND(SrcModuleMapTypeData%TStC_Frc2_y_TStC,1) + IF (.NOT. ALLOCATED(DstModuleMapTypeData%TStC_Frc2_y_TStC)) THEN + ALLOCATE(DstModuleMapTypeData%TStC_Frc2_y_TStC(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstModuleMapTypeData%TStC_Frc2_y_TStC.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DO i1 = LBOUND(SrcModuleMapTypeData%TStC_Frc2_y_TStC,1), UBOUND(SrcModuleMapTypeData%TStC_Frc2_y_TStC,1) + CALL NWTC_Library_Copymeshmaptype( SrcModuleMapTypeData%TStC_Frc2_y_TStC(i1), DstModuleMapTypeData%TStC_Frc2_y_TStC(i1), CtrlCode, ErrStat2, ErrMsg2 ) + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) + IF (ErrStat>=AbortErrLev) RETURN + ENDDO +ENDIF +IF (ALLOCATED(SrcModuleMapTypeData%SStC_Frc2_y_SStC)) THEN + i1_l = LBOUND(SrcModuleMapTypeData%SStC_Frc2_y_SStC,1) + i1_u = UBOUND(SrcModuleMapTypeData%SStC_Frc2_y_SStC,1) + IF (.NOT. ALLOCATED(DstModuleMapTypeData%SStC_Frc2_y_SStC)) THEN + ALLOCATE(DstModuleMapTypeData%SStC_Frc2_y_SStC(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstModuleMapTypeData%SStC_Frc2_y_SStC.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DO i1 = LBOUND(SrcModuleMapTypeData%SStC_Frc2_y_SStC,1), UBOUND(SrcModuleMapTypeData%SStC_Frc2_y_SStC,1) + CALL NWTC_Library_Copymeshmaptype( SrcModuleMapTypeData%SStC_Frc2_y_SStC(i1), DstModuleMapTypeData%SStC_Frc2_y_SStC(i1), CtrlCode, ErrStat2, ErrMsg2 ) + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) + IF (ErrStat>=AbortErrLev) RETURN + ENDDO +ENDIF + END SUBROUTINE SrvD_CopyModuleMapType - SUBROUTINE SrvD_DestroyMisc( MiscData, ErrStat, ErrMsg ) - TYPE(SrvD_MiscVarType), INTENT(INOUT) :: MiscData + SUBROUTINE SrvD_DestroyModuleMapType( ModuleMapTypeData, ErrStat, ErrMsg ) + TYPE(SrvD_ModuleMapType), INTENT(INOUT) :: ModuleMapTypeData INTEGER(IntKi), INTENT( OUT) :: ErrStat CHARACTER(*), INTENT( OUT) :: ErrMsg - CHARACTER(*), PARAMETER :: RoutineName = 'SrvD_DestroyMisc' + CHARACTER(*), PARAMETER :: RoutineName = 'SrvD_DestroyModuleMapType' INTEGER(IntKi) :: i, i1, i2, i3, i4, i5 ! ErrStat = ErrID_None ErrMsg = "" - CALL SrvD_Destroybladeddlltype( MiscData%dll_data, ErrStat, ErrMsg ) -IF (ALLOCATED(MiscData%xd_BlPitchFilter)) THEN - DEALLOCATE(MiscData%xd_BlPitchFilter) +IF (ALLOCATED(ModuleMapTypeData%u_BStC_Mot2_BStC)) THEN +DO i2 = LBOUND(ModuleMapTypeData%u_BStC_Mot2_BStC,2), UBOUND(ModuleMapTypeData%u_BStC_Mot2_BStC,2) +DO i1 = LBOUND(ModuleMapTypeData%u_BStC_Mot2_BStC,1), UBOUND(ModuleMapTypeData%u_BStC_Mot2_BStC,1) + CALL NWTC_Library_Destroymeshmaptype( ModuleMapTypeData%u_BStC_Mot2_BStC(i1,i2), ErrStat, ErrMsg ) +ENDDO +ENDDO + DEALLOCATE(ModuleMapTypeData%u_BStC_Mot2_BStC) ENDIF -IF (ALLOCATED(MiscData%BStC)) THEN -DO i1 = LBOUND(MiscData%BStC,1), UBOUND(MiscData%BStC,1) - CALL StC_DestroyMisc( MiscData%BStC(i1), ErrStat, ErrMsg ) +IF (ALLOCATED(ModuleMapTypeData%u_NStC_Mot2_NStC)) THEN +DO i1 = LBOUND(ModuleMapTypeData%u_NStC_Mot2_NStC,1), UBOUND(ModuleMapTypeData%u_NStC_Mot2_NStC,1) + CALL NWTC_Library_Destroymeshmaptype( ModuleMapTypeData%u_NStC_Mot2_NStC(i1), ErrStat, ErrMsg ) ENDDO - DEALLOCATE(MiscData%BStC) + DEALLOCATE(ModuleMapTypeData%u_NStC_Mot2_NStC) ENDIF -IF (ALLOCATED(MiscData%NStC)) THEN -DO i1 = LBOUND(MiscData%NStC,1), UBOUND(MiscData%NStC,1) - CALL StC_DestroyMisc( MiscData%NStC(i1), ErrStat, ErrMsg ) +IF (ALLOCATED(ModuleMapTypeData%u_TStC_Mot2_TStC)) THEN +DO i1 = LBOUND(ModuleMapTypeData%u_TStC_Mot2_TStC,1), UBOUND(ModuleMapTypeData%u_TStC_Mot2_TStC,1) + CALL NWTC_Library_Destroymeshmaptype( ModuleMapTypeData%u_TStC_Mot2_TStC(i1), ErrStat, ErrMsg ) ENDDO - DEALLOCATE(MiscData%NStC) + DEALLOCATE(ModuleMapTypeData%u_TStC_Mot2_TStC) ENDIF -IF (ALLOCATED(MiscData%TStC)) THEN -DO i1 = LBOUND(MiscData%TStC,1), UBOUND(MiscData%TStC,1) - CALL StC_DestroyMisc( MiscData%TStC(i1), ErrStat, ErrMsg ) +IF (ALLOCATED(ModuleMapTypeData%u_SStC_Mot2_SStC)) THEN +DO i1 = LBOUND(ModuleMapTypeData%u_SStC_Mot2_SStC,1), UBOUND(ModuleMapTypeData%u_SStC_Mot2_SStC,1) + CALL NWTC_Library_Destroymeshmaptype( ModuleMapTypeData%u_SStC_Mot2_SStC(i1), ErrStat, ErrMsg ) ENDDO - DEALLOCATE(MiscData%TStC) + DEALLOCATE(ModuleMapTypeData%u_SStC_Mot2_SStC) ENDIF -IF (ALLOCATED(MiscData%SStC)) THEN -DO i1 = LBOUND(MiscData%SStC,1), UBOUND(MiscData%SStC,1) - CALL StC_DestroyMisc( MiscData%SStC(i1), ErrStat, ErrMsg ) +IF (ALLOCATED(ModuleMapTypeData%BStC_Frc2_y_BStC)) THEN +DO i2 = LBOUND(ModuleMapTypeData%BStC_Frc2_y_BStC,2), UBOUND(ModuleMapTypeData%BStC_Frc2_y_BStC,2) +DO i1 = LBOUND(ModuleMapTypeData%BStC_Frc2_y_BStC,1), UBOUND(ModuleMapTypeData%BStC_Frc2_y_BStC,1) + CALL NWTC_Library_Destroymeshmaptype( ModuleMapTypeData%BStC_Frc2_y_BStC(i1,i2), ErrStat, ErrMsg ) ENDDO - DEALLOCATE(MiscData%SStC) +ENDDO + DEALLOCATE(ModuleMapTypeData%BStC_Frc2_y_BStC) ENDIF - END SUBROUTINE SrvD_DestroyMisc +IF (ALLOCATED(ModuleMapTypeData%NStC_Frc2_y_NStC)) THEN +DO i1 = LBOUND(ModuleMapTypeData%NStC_Frc2_y_NStC,1), UBOUND(ModuleMapTypeData%NStC_Frc2_y_NStC,1) + CALL NWTC_Library_Destroymeshmaptype( ModuleMapTypeData%NStC_Frc2_y_NStC(i1), ErrStat, ErrMsg ) +ENDDO + DEALLOCATE(ModuleMapTypeData%NStC_Frc2_y_NStC) +ENDIF +IF (ALLOCATED(ModuleMapTypeData%TStC_Frc2_y_TStC)) THEN +DO i1 = LBOUND(ModuleMapTypeData%TStC_Frc2_y_TStC,1), UBOUND(ModuleMapTypeData%TStC_Frc2_y_TStC,1) + CALL NWTC_Library_Destroymeshmaptype( ModuleMapTypeData%TStC_Frc2_y_TStC(i1), ErrStat, ErrMsg ) +ENDDO + DEALLOCATE(ModuleMapTypeData%TStC_Frc2_y_TStC) +ENDIF +IF (ALLOCATED(ModuleMapTypeData%SStC_Frc2_y_SStC)) THEN +DO i1 = LBOUND(ModuleMapTypeData%SStC_Frc2_y_SStC,1), UBOUND(ModuleMapTypeData%SStC_Frc2_y_SStC,1) + CALL NWTC_Library_Destroymeshmaptype( ModuleMapTypeData%SStC_Frc2_y_SStC(i1), ErrStat, ErrMsg ) +ENDDO + DEALLOCATE(ModuleMapTypeData%SStC_Frc2_y_SStC) +ENDIF + END SUBROUTINE SrvD_DestroyModuleMapType - SUBROUTINE SrvD_PackMisc( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg, SizeOnly ) + SUBROUTINE SrvD_PackModuleMapType( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg, SizeOnly ) REAL(ReKi), ALLOCATABLE, INTENT( OUT) :: ReKiBuf(:) REAL(DbKi), ALLOCATABLE, INTENT( OUT) :: DbKiBuf(:) INTEGER(IntKi), ALLOCATABLE, INTENT( OUT) :: IntKiBuf(:) - TYPE(SrvD_MiscVarType), INTENT(IN) :: InData + TYPE(SrvD_ModuleMapType), INTENT(IN) :: InData INTEGER(IntKi), INTENT( OUT) :: ErrStat CHARACTER(*), INTENT( OUT) :: ErrMsg LOGICAL,OPTIONAL, INTENT(IN ) :: SizeOnly @@ -7040,7 +8403,7 @@ SUBROUTINE SrvD_PackMisc( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg, S LOGICAL :: OnlySize ! if present and true, do not pack, just allocate buffers INTEGER(IntKi) :: ErrStat2 CHARACTER(ErrMsgLen) :: ErrMsg2 - CHARACTER(*), PARAMETER :: RoutineName = 'SrvD_PackMisc' + CHARACTER(*), PARAMETER :: RoutineName = 'SrvD_PackModuleMapType' ! buffers to store subtypes, if any REAL(ReKi), ALLOCATABLE :: Re_Buf(:) REAL(DbKi), ALLOCATABLE :: Db_Buf(:) @@ -7056,119 +8419,190 @@ SUBROUTINE SrvD_PackMisc( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg, S Re_BufSz = 0 Db_BufSz = 0 Int_BufSz = 0 - Db_BufSz = Db_BufSz + 1 ! LastTimeCalled + Int_BufSz = Int_BufSz + 1 ! u_BStC_Mot2_BStC allocated yes/no + IF ( ALLOCATED(InData%u_BStC_Mot2_BStC) ) THEN + Int_BufSz = Int_BufSz + 2*2 ! u_BStC_Mot2_BStC upper/lower bounds for each dimension ! Allocate buffers for subtypes, if any (we'll get sizes from these) - Int_BufSz = Int_BufSz + 3 ! dll_data: size of buffers for each call to pack subtype - CALL SrvD_Packbladeddlltype( Re_Buf, Db_Buf, Int_Buf, InData%dll_data, ErrStat2, ErrMsg2, .TRUE. ) ! dll_data + DO i2 = LBOUND(InData%u_BStC_Mot2_BStC,2), UBOUND(InData%u_BStC_Mot2_BStC,2) + DO i1 = LBOUND(InData%u_BStC_Mot2_BStC,1), UBOUND(InData%u_BStC_Mot2_BStC,1) + Int_BufSz = Int_BufSz + 3 ! u_BStC_Mot2_BStC: size of buffers for each call to pack subtype + CALL NWTC_Library_Packmeshmaptype( Re_Buf, Db_Buf, Int_Buf, InData%u_BStC_Mot2_BStC(i1,i2), ErrStat2, ErrMsg2, .TRUE. ) ! u_BStC_Mot2_BStC CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN - IF(ALLOCATED(Re_Buf)) THEN ! dll_data + IF(ALLOCATED(Re_Buf)) THEN ! u_BStC_Mot2_BStC Re_BufSz = Re_BufSz + SIZE( Re_Buf ) DEALLOCATE(Re_Buf) END IF - IF(ALLOCATED(Db_Buf)) THEN ! dll_data + IF(ALLOCATED(Db_Buf)) THEN ! u_BStC_Mot2_BStC Db_BufSz = Db_BufSz + SIZE( Db_Buf ) DEALLOCATE(Db_Buf) END IF - IF(ALLOCATED(Int_Buf)) THEN ! dll_data + IF(ALLOCATED(Int_Buf)) THEN ! u_BStC_Mot2_BStC Int_BufSz = Int_BufSz + SIZE( Int_Buf ) DEALLOCATE(Int_Buf) END IF - Int_BufSz = Int_BufSz + 1 ! FirstWarn - Db_BufSz = Db_BufSz + 1 ! LastTimeFiltered - Int_BufSz = Int_BufSz + 1 ! xd_BlPitchFilter allocated yes/no - IF ( ALLOCATED(InData%xd_BlPitchFilter) ) THEN - Int_BufSz = Int_BufSz + 2*1 ! xd_BlPitchFilter upper/lower bounds for each dimension - Re_BufSz = Re_BufSz + SIZE(InData%xd_BlPitchFilter) ! xd_BlPitchFilter + END DO + END DO END IF - Int_BufSz = Int_BufSz + 1 ! BStC allocated yes/no - IF ( ALLOCATED(InData%BStC) ) THEN - Int_BufSz = Int_BufSz + 2*1 ! BStC upper/lower bounds for each dimension - DO i1 = LBOUND(InData%BStC,1), UBOUND(InData%BStC,1) - Int_BufSz = Int_BufSz + 3 ! BStC: size of buffers for each call to pack subtype - CALL StC_PackMisc( Re_Buf, Db_Buf, Int_Buf, InData%BStC(i1), ErrStat2, ErrMsg2, .TRUE. ) ! BStC + Int_BufSz = Int_BufSz + 1 ! u_NStC_Mot2_NStC allocated yes/no + IF ( ALLOCATED(InData%u_NStC_Mot2_NStC) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! u_NStC_Mot2_NStC upper/lower bounds for each dimension + DO i1 = LBOUND(InData%u_NStC_Mot2_NStC,1), UBOUND(InData%u_NStC_Mot2_NStC,1) + Int_BufSz = Int_BufSz + 3 ! u_NStC_Mot2_NStC: size of buffers for each call to pack subtype + CALL NWTC_Library_Packmeshmaptype( Re_Buf, Db_Buf, Int_Buf, InData%u_NStC_Mot2_NStC(i1), ErrStat2, ErrMsg2, .TRUE. ) ! u_NStC_Mot2_NStC CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN - IF(ALLOCATED(Re_Buf)) THEN ! BStC + IF(ALLOCATED(Re_Buf)) THEN ! u_NStC_Mot2_NStC Re_BufSz = Re_BufSz + SIZE( Re_Buf ) DEALLOCATE(Re_Buf) END IF - IF(ALLOCATED(Db_Buf)) THEN ! BStC + IF(ALLOCATED(Db_Buf)) THEN ! u_NStC_Mot2_NStC Db_BufSz = Db_BufSz + SIZE( Db_Buf ) DEALLOCATE(Db_Buf) END IF - IF(ALLOCATED(Int_Buf)) THEN ! BStC + IF(ALLOCATED(Int_Buf)) THEN ! u_NStC_Mot2_NStC Int_BufSz = Int_BufSz + SIZE( Int_Buf ) DEALLOCATE(Int_Buf) END IF END DO END IF - Int_BufSz = Int_BufSz + 1 ! NStC allocated yes/no - IF ( ALLOCATED(InData%NStC) ) THEN - Int_BufSz = Int_BufSz + 2*1 ! NStC upper/lower bounds for each dimension - DO i1 = LBOUND(InData%NStC,1), UBOUND(InData%NStC,1) - Int_BufSz = Int_BufSz + 3 ! NStC: size of buffers for each call to pack subtype - CALL StC_PackMisc( Re_Buf, Db_Buf, Int_Buf, InData%NStC(i1), ErrStat2, ErrMsg2, .TRUE. ) ! NStC + Int_BufSz = Int_BufSz + 1 ! u_TStC_Mot2_TStC allocated yes/no + IF ( ALLOCATED(InData%u_TStC_Mot2_TStC) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! u_TStC_Mot2_TStC upper/lower bounds for each dimension + DO i1 = LBOUND(InData%u_TStC_Mot2_TStC,1), UBOUND(InData%u_TStC_Mot2_TStC,1) + Int_BufSz = Int_BufSz + 3 ! u_TStC_Mot2_TStC: size of buffers for each call to pack subtype + CALL NWTC_Library_Packmeshmaptype( Re_Buf, Db_Buf, Int_Buf, InData%u_TStC_Mot2_TStC(i1), ErrStat2, ErrMsg2, .TRUE. ) ! u_TStC_Mot2_TStC CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN - IF(ALLOCATED(Re_Buf)) THEN ! NStC + IF(ALLOCATED(Re_Buf)) THEN ! u_TStC_Mot2_TStC Re_BufSz = Re_BufSz + SIZE( Re_Buf ) DEALLOCATE(Re_Buf) END IF - IF(ALLOCATED(Db_Buf)) THEN ! NStC + IF(ALLOCATED(Db_Buf)) THEN ! u_TStC_Mot2_TStC Db_BufSz = Db_BufSz + SIZE( Db_Buf ) DEALLOCATE(Db_Buf) END IF - IF(ALLOCATED(Int_Buf)) THEN ! NStC + IF(ALLOCATED(Int_Buf)) THEN ! u_TStC_Mot2_TStC Int_BufSz = Int_BufSz + SIZE( Int_Buf ) DEALLOCATE(Int_Buf) END IF END DO END IF - Int_BufSz = Int_BufSz + 1 ! TStC allocated yes/no - IF ( ALLOCATED(InData%TStC) ) THEN - Int_BufSz = Int_BufSz + 2*1 ! TStC upper/lower bounds for each dimension - DO i1 = LBOUND(InData%TStC,1), UBOUND(InData%TStC,1) - Int_BufSz = Int_BufSz + 3 ! TStC: size of buffers for each call to pack subtype - CALL StC_PackMisc( Re_Buf, Db_Buf, Int_Buf, InData%TStC(i1), ErrStat2, ErrMsg2, .TRUE. ) ! TStC + Int_BufSz = Int_BufSz + 1 ! u_SStC_Mot2_SStC allocated yes/no + IF ( ALLOCATED(InData%u_SStC_Mot2_SStC) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! u_SStC_Mot2_SStC upper/lower bounds for each dimension + DO i1 = LBOUND(InData%u_SStC_Mot2_SStC,1), UBOUND(InData%u_SStC_Mot2_SStC,1) + Int_BufSz = Int_BufSz + 3 ! u_SStC_Mot2_SStC: size of buffers for each call to pack subtype + CALL NWTC_Library_Packmeshmaptype( Re_Buf, Db_Buf, Int_Buf, InData%u_SStC_Mot2_SStC(i1), ErrStat2, ErrMsg2, .TRUE. ) ! u_SStC_Mot2_SStC CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN - IF(ALLOCATED(Re_Buf)) THEN ! TStC + IF(ALLOCATED(Re_Buf)) THEN ! u_SStC_Mot2_SStC Re_BufSz = Re_BufSz + SIZE( Re_Buf ) DEALLOCATE(Re_Buf) END IF - IF(ALLOCATED(Db_Buf)) THEN ! TStC + IF(ALLOCATED(Db_Buf)) THEN ! u_SStC_Mot2_SStC Db_BufSz = Db_BufSz + SIZE( Db_Buf ) DEALLOCATE(Db_Buf) END IF - IF(ALLOCATED(Int_Buf)) THEN ! TStC + IF(ALLOCATED(Int_Buf)) THEN ! u_SStC_Mot2_SStC Int_BufSz = Int_BufSz + SIZE( Int_Buf ) DEALLOCATE(Int_Buf) END IF END DO END IF - Int_BufSz = Int_BufSz + 1 ! SStC allocated yes/no - IF ( ALLOCATED(InData%SStC) ) THEN - Int_BufSz = Int_BufSz + 2*1 ! SStC upper/lower bounds for each dimension - DO i1 = LBOUND(InData%SStC,1), UBOUND(InData%SStC,1) - Int_BufSz = Int_BufSz + 3 ! SStC: size of buffers for each call to pack subtype - CALL StC_PackMisc( Re_Buf, Db_Buf, Int_Buf, InData%SStC(i1), ErrStat2, ErrMsg2, .TRUE. ) ! SStC + Int_BufSz = Int_BufSz + 1 ! BStC_Frc2_y_BStC allocated yes/no + IF ( ALLOCATED(InData%BStC_Frc2_y_BStC) ) THEN + Int_BufSz = Int_BufSz + 2*2 ! BStC_Frc2_y_BStC upper/lower bounds for each dimension + DO i2 = LBOUND(InData%BStC_Frc2_y_BStC,2), UBOUND(InData%BStC_Frc2_y_BStC,2) + DO i1 = LBOUND(InData%BStC_Frc2_y_BStC,1), UBOUND(InData%BStC_Frc2_y_BStC,1) + Int_BufSz = Int_BufSz + 3 ! BStC_Frc2_y_BStC: size of buffers for each call to pack subtype + CALL NWTC_Library_Packmeshmaptype( Re_Buf, Db_Buf, Int_Buf, InData%BStC_Frc2_y_BStC(i1,i2), ErrStat2, ErrMsg2, .TRUE. ) ! BStC_Frc2_y_BStC CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN - IF(ALLOCATED(Re_Buf)) THEN ! SStC + IF(ALLOCATED(Re_Buf)) THEN ! BStC_Frc2_y_BStC Re_BufSz = Re_BufSz + SIZE( Re_Buf ) DEALLOCATE(Re_Buf) END IF - IF(ALLOCATED(Db_Buf)) THEN ! SStC + IF(ALLOCATED(Db_Buf)) THEN ! BStC_Frc2_y_BStC Db_BufSz = Db_BufSz + SIZE( Db_Buf ) DEALLOCATE(Db_Buf) END IF - IF(ALLOCATED(Int_Buf)) THEN ! SStC + IF(ALLOCATED(Int_Buf)) THEN ! BStC_Frc2_y_BStC + Int_BufSz = Int_BufSz + SIZE( Int_Buf ) + DEALLOCATE(Int_Buf) + END IF + END DO + END DO + END IF + Int_BufSz = Int_BufSz + 1 ! NStC_Frc2_y_NStC allocated yes/no + IF ( ALLOCATED(InData%NStC_Frc2_y_NStC) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! NStC_Frc2_y_NStC upper/lower bounds for each dimension + DO i1 = LBOUND(InData%NStC_Frc2_y_NStC,1), UBOUND(InData%NStC_Frc2_y_NStC,1) + Int_BufSz = Int_BufSz + 3 ! NStC_Frc2_y_NStC: size of buffers for each call to pack subtype + CALL NWTC_Library_Packmeshmaptype( Re_Buf, Db_Buf, Int_Buf, InData%NStC_Frc2_y_NStC(i1), ErrStat2, ErrMsg2, .TRUE. ) ! NStC_Frc2_y_NStC + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN ! NStC_Frc2_y_NStC + Re_BufSz = Re_BufSz + SIZE( Re_Buf ) + DEALLOCATE(Re_Buf) + END IF + IF(ALLOCATED(Db_Buf)) THEN ! NStC_Frc2_y_NStC + Db_BufSz = Db_BufSz + SIZE( Db_Buf ) + DEALLOCATE(Db_Buf) + END IF + IF(ALLOCATED(Int_Buf)) THEN ! NStC_Frc2_y_NStC + Int_BufSz = Int_BufSz + SIZE( Int_Buf ) + DEALLOCATE(Int_Buf) + END IF + END DO + END IF + Int_BufSz = Int_BufSz + 1 ! TStC_Frc2_y_TStC allocated yes/no + IF ( ALLOCATED(InData%TStC_Frc2_y_TStC) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! TStC_Frc2_y_TStC upper/lower bounds for each dimension + DO i1 = LBOUND(InData%TStC_Frc2_y_TStC,1), UBOUND(InData%TStC_Frc2_y_TStC,1) + Int_BufSz = Int_BufSz + 3 ! TStC_Frc2_y_TStC: size of buffers for each call to pack subtype + CALL NWTC_Library_Packmeshmaptype( Re_Buf, Db_Buf, Int_Buf, InData%TStC_Frc2_y_TStC(i1), ErrStat2, ErrMsg2, .TRUE. ) ! TStC_Frc2_y_TStC + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN ! TStC_Frc2_y_TStC + Re_BufSz = Re_BufSz + SIZE( Re_Buf ) + DEALLOCATE(Re_Buf) + END IF + IF(ALLOCATED(Db_Buf)) THEN ! TStC_Frc2_y_TStC + Db_BufSz = Db_BufSz + SIZE( Db_Buf ) + DEALLOCATE(Db_Buf) + END IF + IF(ALLOCATED(Int_Buf)) THEN ! TStC_Frc2_y_TStC + Int_BufSz = Int_BufSz + SIZE( Int_Buf ) + DEALLOCATE(Int_Buf) + END IF + END DO + END IF + Int_BufSz = Int_BufSz + 1 ! SStC_Frc2_y_SStC allocated yes/no + IF ( ALLOCATED(InData%SStC_Frc2_y_SStC) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! SStC_Frc2_y_SStC upper/lower bounds for each dimension + DO i1 = LBOUND(InData%SStC_Frc2_y_SStC,1), UBOUND(InData%SStC_Frc2_y_SStC,1) + Int_BufSz = Int_BufSz + 3 ! SStC_Frc2_y_SStC: size of buffers for each call to pack subtype + CALL NWTC_Library_Packmeshmaptype( Re_Buf, Db_Buf, Int_Buf, InData%SStC_Frc2_y_SStC(i1), ErrStat2, ErrMsg2, .TRUE. ) ! SStC_Frc2_y_SStC + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN ! SStC_Frc2_y_SStC + Re_BufSz = Re_BufSz + SIZE( Re_Buf ) + DEALLOCATE(Re_Buf) + END IF + IF(ALLOCATED(Db_Buf)) THEN ! SStC_Frc2_y_SStC + Db_BufSz = Db_BufSz + SIZE( Db_Buf ) + DEALLOCATE(Db_Buf) + END IF + IF(ALLOCATED(Int_Buf)) THEN ! SStC_Frc2_y_SStC Int_BufSz = Int_BufSz + SIZE( Int_Buf ) DEALLOCATE(Int_Buf) END IF @@ -7201,9 +8635,22 @@ SUBROUTINE SrvD_PackMisc( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg, S Db_Xferred = 1 Int_Xferred = 1 - DbKiBuf(Db_Xferred) = InData%LastTimeCalled - Db_Xferred = Db_Xferred + 1 - CALL SrvD_Packbladeddlltype( Re_Buf, Db_Buf, Int_Buf, InData%dll_data, ErrStat2, ErrMsg2, OnlySize ) ! dll_data + IF ( .NOT. ALLOCATED(InData%u_BStC_Mot2_BStC) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%u_BStC_Mot2_BStC,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%u_BStC_Mot2_BStC,1) + Int_Xferred = Int_Xferred + 2 + IntKiBuf( Int_Xferred ) = LBOUND(InData%u_BStC_Mot2_BStC,2) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%u_BStC_Mot2_BStC,2) + Int_Xferred = Int_Xferred + 2 + + DO i2 = LBOUND(InData%u_BStC_Mot2_BStC,2), UBOUND(InData%u_BStC_Mot2_BStC,2) + DO i1 = LBOUND(InData%u_BStC_Mot2_BStC,1), UBOUND(InData%u_BStC_Mot2_BStC,1) + CALL NWTC_Library_Packmeshmaptype( Re_Buf, Db_Buf, Int_Buf, InData%u_BStC_Mot2_BStC(i1,i2), ErrStat2, ErrMsg2, OnlySize ) ! u_BStC_Mot2_BStC CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN @@ -7231,37 +8678,21 @@ SUBROUTINE SrvD_PackMisc( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg, S ELSE IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 ENDIF - IntKiBuf(Int_Xferred) = TRANSFER(InData%FirstWarn, IntKiBuf(1)) - Int_Xferred = Int_Xferred + 1 - DbKiBuf(Db_Xferred) = InData%LastTimeFiltered - Db_Xferred = Db_Xferred + 1 - IF ( .NOT. ALLOCATED(InData%xd_BlPitchFilter) ) THEN - IntKiBuf( Int_Xferred ) = 0 - Int_Xferred = Int_Xferred + 1 - ELSE - IntKiBuf( Int_Xferred ) = 1 - Int_Xferred = Int_Xferred + 1 - IntKiBuf( Int_Xferred ) = LBOUND(InData%xd_BlPitchFilter,1) - IntKiBuf( Int_Xferred + 1) = UBOUND(InData%xd_BlPitchFilter,1) - Int_Xferred = Int_Xferred + 2 - - DO i1 = LBOUND(InData%xd_BlPitchFilter,1), UBOUND(InData%xd_BlPitchFilter,1) - ReKiBuf(Re_Xferred) = InData%xd_BlPitchFilter(i1) - Re_Xferred = Re_Xferred + 1 - END DO + END DO + END DO END IF - IF ( .NOT. ALLOCATED(InData%BStC) ) THEN + IF ( .NOT. ALLOCATED(InData%u_NStC_Mot2_NStC) ) THEN IntKiBuf( Int_Xferred ) = 0 Int_Xferred = Int_Xferred + 1 ELSE IntKiBuf( Int_Xferred ) = 1 Int_Xferred = Int_Xferred + 1 - IntKiBuf( Int_Xferred ) = LBOUND(InData%BStC,1) - IntKiBuf( Int_Xferred + 1) = UBOUND(InData%BStC,1) + IntKiBuf( Int_Xferred ) = LBOUND(InData%u_NStC_Mot2_NStC,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%u_NStC_Mot2_NStC,1) Int_Xferred = Int_Xferred + 2 - DO i1 = LBOUND(InData%BStC,1), UBOUND(InData%BStC,1) - CALL StC_PackMisc( Re_Buf, Db_Buf, Int_Buf, InData%BStC(i1), ErrStat2, ErrMsg2, OnlySize ) ! BStC + DO i1 = LBOUND(InData%u_NStC_Mot2_NStC,1), UBOUND(InData%u_NStC_Mot2_NStC,1) + CALL NWTC_Library_Packmeshmaptype( Re_Buf, Db_Buf, Int_Buf, InData%u_NStC_Mot2_NStC(i1), ErrStat2, ErrMsg2, OnlySize ) ! u_NStC_Mot2_NStC CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN @@ -7291,18 +8722,18 @@ SUBROUTINE SrvD_PackMisc( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg, S ENDIF END DO END IF - IF ( .NOT. ALLOCATED(InData%NStC) ) THEN + IF ( .NOT. ALLOCATED(InData%u_TStC_Mot2_TStC) ) THEN IntKiBuf( Int_Xferred ) = 0 Int_Xferred = Int_Xferred + 1 ELSE IntKiBuf( Int_Xferred ) = 1 Int_Xferred = Int_Xferred + 1 - IntKiBuf( Int_Xferred ) = LBOUND(InData%NStC,1) - IntKiBuf( Int_Xferred + 1) = UBOUND(InData%NStC,1) + IntKiBuf( Int_Xferred ) = LBOUND(InData%u_TStC_Mot2_TStC,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%u_TStC_Mot2_TStC,1) Int_Xferred = Int_Xferred + 2 - DO i1 = LBOUND(InData%NStC,1), UBOUND(InData%NStC,1) - CALL StC_PackMisc( Re_Buf, Db_Buf, Int_Buf, InData%NStC(i1), ErrStat2, ErrMsg2, OnlySize ) ! NStC + DO i1 = LBOUND(InData%u_TStC_Mot2_TStC,1), UBOUND(InData%u_TStC_Mot2_TStC,1) + CALL NWTC_Library_Packmeshmaptype( Re_Buf, Db_Buf, Int_Buf, InData%u_TStC_Mot2_TStC(i1), ErrStat2, ErrMsg2, OnlySize ) ! u_TStC_Mot2_TStC CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN @@ -7332,18 +8763,18 @@ SUBROUTINE SrvD_PackMisc( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg, S ENDIF END DO END IF - IF ( .NOT. ALLOCATED(InData%TStC) ) THEN + IF ( .NOT. ALLOCATED(InData%u_SStC_Mot2_SStC) ) THEN IntKiBuf( Int_Xferred ) = 0 Int_Xferred = Int_Xferred + 1 ELSE IntKiBuf( Int_Xferred ) = 1 Int_Xferred = Int_Xferred + 1 - IntKiBuf( Int_Xferred ) = LBOUND(InData%TStC,1) - IntKiBuf( Int_Xferred + 1) = UBOUND(InData%TStC,1) + IntKiBuf( Int_Xferred ) = LBOUND(InData%u_SStC_Mot2_SStC,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%u_SStC_Mot2_SStC,1) Int_Xferred = Int_Xferred + 2 - DO i1 = LBOUND(InData%TStC,1), UBOUND(InData%TStC,1) - CALL StC_PackMisc( Re_Buf, Db_Buf, Int_Buf, InData%TStC(i1), ErrStat2, ErrMsg2, OnlySize ) ! TStC + DO i1 = LBOUND(InData%u_SStC_Mot2_SStC,1), UBOUND(InData%u_SStC_Mot2_SStC,1) + CALL NWTC_Library_Packmeshmaptype( Re_Buf, Db_Buf, Int_Buf, InData%u_SStC_Mot2_SStC(i1), ErrStat2, ErrMsg2, OnlySize ) ! u_SStC_Mot2_SStC CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN @@ -7373,18 +8804,22 @@ SUBROUTINE SrvD_PackMisc( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg, S ENDIF END DO END IF - IF ( .NOT. ALLOCATED(InData%SStC) ) THEN + IF ( .NOT. ALLOCATED(InData%BStC_Frc2_y_BStC) ) THEN IntKiBuf( Int_Xferred ) = 0 Int_Xferred = Int_Xferred + 1 ELSE IntKiBuf( Int_Xferred ) = 1 Int_Xferred = Int_Xferred + 1 - IntKiBuf( Int_Xferred ) = LBOUND(InData%SStC,1) - IntKiBuf( Int_Xferred + 1) = UBOUND(InData%SStC,1) + IntKiBuf( Int_Xferred ) = LBOUND(InData%BStC_Frc2_y_BStC,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%BStC_Frc2_y_BStC,1) + Int_Xferred = Int_Xferred + 2 + IntKiBuf( Int_Xferred ) = LBOUND(InData%BStC_Frc2_y_BStC,2) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%BStC_Frc2_y_BStC,2) Int_Xferred = Int_Xferred + 2 - DO i1 = LBOUND(InData%SStC,1), UBOUND(InData%SStC,1) - CALL StC_PackMisc( Re_Buf, Db_Buf, Int_Buf, InData%SStC(i1), ErrStat2, ErrMsg2, OnlySize ) ! SStC + DO i2 = LBOUND(InData%BStC_Frc2_y_BStC,2), UBOUND(InData%BStC_Frc2_y_BStC,2) + DO i1 = LBOUND(InData%BStC_Frc2_y_BStC,1), UBOUND(InData%BStC_Frc2_y_BStC,1) + CALL NWTC_Library_Packmeshmaptype( Re_Buf, Db_Buf, Int_Buf, InData%BStC_Frc2_y_BStC(i1,i2), ErrStat2, ErrMsg2, OnlySize ) ! BStC_Frc2_y_BStC CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN @@ -7413,14 +8848,138 @@ SUBROUTINE SrvD_PackMisc( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg, S IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 ENDIF END DO + END DO END IF - END SUBROUTINE SrvD_PackMisc + IF ( .NOT. ALLOCATED(InData%NStC_Frc2_y_NStC) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%NStC_Frc2_y_NStC,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%NStC_Frc2_y_NStC,1) + Int_Xferred = Int_Xferred + 2 - SUBROUTINE SrvD_UnPackMisc( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrMsg ) - REAL(ReKi), ALLOCATABLE, INTENT(IN ) :: ReKiBuf(:) - REAL(DbKi), ALLOCATABLE, INTENT(IN ) :: DbKiBuf(:) - INTEGER(IntKi), ALLOCATABLE, INTENT(IN ) :: IntKiBuf(:) - TYPE(SrvD_MiscVarType), INTENT(INOUT) :: OutData + DO i1 = LBOUND(InData%NStC_Frc2_y_NStC,1), UBOUND(InData%NStC_Frc2_y_NStC,1) + CALL NWTC_Library_Packmeshmaptype( Re_Buf, Db_Buf, Int_Buf, InData%NStC_Frc2_y_NStC(i1), ErrStat2, ErrMsg2, OnlySize ) ! NStC_Frc2_y_NStC + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Re_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Re_Buf) > 0) ReKiBuf( Re_Xferred:Re_Xferred+SIZE(Re_Buf)-1 ) = Re_Buf + Re_Xferred = Re_Xferred + SIZE(Re_Buf) + DEALLOCATE(Re_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Db_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Db_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Db_Buf) > 0) DbKiBuf( Db_Xferred:Db_Xferred+SIZE(Db_Buf)-1 ) = Db_Buf + Db_Xferred = Db_Xferred + SIZE(Db_Buf) + DEALLOCATE(Db_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Int_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Int_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Int_Buf) > 0) IntKiBuf( Int_Xferred:Int_Xferred+SIZE(Int_Buf)-1 ) = Int_Buf + Int_Xferred = Int_Xferred + SIZE(Int_Buf) + DEALLOCATE(Int_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + END DO + END IF + IF ( .NOT. ALLOCATED(InData%TStC_Frc2_y_TStC) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%TStC_Frc2_y_TStC,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%TStC_Frc2_y_TStC,1) + Int_Xferred = Int_Xferred + 2 + + DO i1 = LBOUND(InData%TStC_Frc2_y_TStC,1), UBOUND(InData%TStC_Frc2_y_TStC,1) + CALL NWTC_Library_Packmeshmaptype( Re_Buf, Db_Buf, Int_Buf, InData%TStC_Frc2_y_TStC(i1), ErrStat2, ErrMsg2, OnlySize ) ! TStC_Frc2_y_TStC + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Re_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Re_Buf) > 0) ReKiBuf( Re_Xferred:Re_Xferred+SIZE(Re_Buf)-1 ) = Re_Buf + Re_Xferred = Re_Xferred + SIZE(Re_Buf) + DEALLOCATE(Re_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Db_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Db_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Db_Buf) > 0) DbKiBuf( Db_Xferred:Db_Xferred+SIZE(Db_Buf)-1 ) = Db_Buf + Db_Xferred = Db_Xferred + SIZE(Db_Buf) + DEALLOCATE(Db_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Int_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Int_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Int_Buf) > 0) IntKiBuf( Int_Xferred:Int_Xferred+SIZE(Int_Buf)-1 ) = Int_Buf + Int_Xferred = Int_Xferred + SIZE(Int_Buf) + DEALLOCATE(Int_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + END DO + END IF + IF ( .NOT. ALLOCATED(InData%SStC_Frc2_y_SStC) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%SStC_Frc2_y_SStC,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%SStC_Frc2_y_SStC,1) + Int_Xferred = Int_Xferred + 2 + + DO i1 = LBOUND(InData%SStC_Frc2_y_SStC,1), UBOUND(InData%SStC_Frc2_y_SStC,1) + CALL NWTC_Library_Packmeshmaptype( Re_Buf, Db_Buf, Int_Buf, InData%SStC_Frc2_y_SStC(i1), ErrStat2, ErrMsg2, OnlySize ) ! SStC_Frc2_y_SStC + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Re_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Re_Buf) > 0) ReKiBuf( Re_Xferred:Re_Xferred+SIZE(Re_Buf)-1 ) = Re_Buf + Re_Xferred = Re_Xferred + SIZE(Re_Buf) + DEALLOCATE(Re_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Db_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Db_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Db_Buf) > 0) DbKiBuf( Db_Xferred:Db_Xferred+SIZE(Db_Buf)-1 ) = Db_Buf + Db_Xferred = Db_Xferred + SIZE(Db_Buf) + DEALLOCATE(Db_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Int_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Int_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Int_Buf) > 0) IntKiBuf( Int_Xferred:Int_Xferred+SIZE(Int_Buf)-1 ) = Int_Buf + Int_Xferred = Int_Xferred + SIZE(Int_Buf) + DEALLOCATE(Int_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + END DO + END IF + END SUBROUTINE SrvD_PackModuleMapType + + SUBROUTINE SrvD_UnPackModuleMapType( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrMsg ) + REAL(ReKi), ALLOCATABLE, INTENT(IN ) :: ReKiBuf(:) + REAL(DbKi), ALLOCATABLE, INTENT(IN ) :: DbKiBuf(:) + INTEGER(IntKi), ALLOCATABLE, INTENT(IN ) :: IntKiBuf(:) + TYPE(SrvD_ModuleMapType), INTENT(INOUT) :: OutData INTEGER(IntKi), INTENT( OUT) :: ErrStat CHARACTER(*), INTENT( OUT) :: ErrMsg ! Local variables @@ -7430,9 +8989,10 @@ SUBROUTINE SrvD_UnPackMisc( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrMsg INTEGER(IntKi) :: Int_Xferred INTEGER(IntKi) :: i INTEGER(IntKi) :: i1, i1_l, i1_u ! bounds (upper/lower) for an array dimension 1 + INTEGER(IntKi) :: i2, i2_l, i2_u ! bounds (upper/lower) for an array dimension 2 INTEGER(IntKi) :: ErrStat2 CHARACTER(ErrMsgLen) :: ErrMsg2 - CHARACTER(*), PARAMETER :: RoutineName = 'SrvD_UnPackMisc' + CHARACTER(*), PARAMETER :: RoutineName = 'SrvD_UnPackModuleMapType' ! buffers to store meshes, if any REAL(ReKi), ALLOCATABLE :: Re_Buf(:) REAL(DbKi), ALLOCATABLE :: Db_Buf(:) @@ -7443,8 +9003,2310 @@ SUBROUTINE SrvD_UnPackMisc( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrMsg Re_Xferred = 1 Db_Xferred = 1 Int_Xferred = 1 - OutData%LastTimeCalled = DbKiBuf(Db_Xferred) - Db_Xferred = Db_Xferred + 1 + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! u_BStC_Mot2_BStC not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + i2_l = IntKiBuf( Int_Xferred ) + i2_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%u_BStC_Mot2_BStC)) DEALLOCATE(OutData%u_BStC_Mot2_BStC) + ALLOCATE(OutData%u_BStC_Mot2_BStC(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%u_BStC_Mot2_BStC.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i2 = LBOUND(OutData%u_BStC_Mot2_BStC,2), UBOUND(OutData%u_BStC_Mot2_BStC,2) + DO i1 = LBOUND(OutData%u_BStC_Mot2_BStC,1), UBOUND(OutData%u_BStC_Mot2_BStC,1) + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Re_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Re_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Re_Buf = ReKiBuf( Re_Xferred:Re_Xferred+Buf_size-1 ) + Re_Xferred = Re_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Db_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Db_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Db_Buf = DbKiBuf( Db_Xferred:Db_Xferred+Buf_size-1 ) + Db_Xferred = Db_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Int_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Int_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) + Int_Xferred = Int_Xferred + Buf_size + END IF + CALL NWTC_Library_Unpackmeshmaptype( Re_Buf, Db_Buf, Int_Buf, OutData%u_BStC_Mot2_BStC(i1,i2), ErrStat2, ErrMsg2 ) ! u_BStC_Mot2_BStC + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) + IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) + IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) + END DO + END DO + END IF + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! u_NStC_Mot2_NStC not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%u_NStC_Mot2_NStC)) DEALLOCATE(OutData%u_NStC_Mot2_NStC) + ALLOCATE(OutData%u_NStC_Mot2_NStC(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%u_NStC_Mot2_NStC.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i1 = LBOUND(OutData%u_NStC_Mot2_NStC,1), UBOUND(OutData%u_NStC_Mot2_NStC,1) + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Re_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Re_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Re_Buf = ReKiBuf( Re_Xferred:Re_Xferred+Buf_size-1 ) + Re_Xferred = Re_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Db_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Db_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Db_Buf = DbKiBuf( Db_Xferred:Db_Xferred+Buf_size-1 ) + Db_Xferred = Db_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Int_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Int_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) + Int_Xferred = Int_Xferred + Buf_size + END IF + CALL NWTC_Library_Unpackmeshmaptype( Re_Buf, Db_Buf, Int_Buf, OutData%u_NStC_Mot2_NStC(i1), ErrStat2, ErrMsg2 ) ! u_NStC_Mot2_NStC + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) + IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) + IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) + END DO + END IF + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! u_TStC_Mot2_TStC not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%u_TStC_Mot2_TStC)) DEALLOCATE(OutData%u_TStC_Mot2_TStC) + ALLOCATE(OutData%u_TStC_Mot2_TStC(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%u_TStC_Mot2_TStC.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i1 = LBOUND(OutData%u_TStC_Mot2_TStC,1), UBOUND(OutData%u_TStC_Mot2_TStC,1) + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Re_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Re_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Re_Buf = ReKiBuf( Re_Xferred:Re_Xferred+Buf_size-1 ) + Re_Xferred = Re_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Db_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Db_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Db_Buf = DbKiBuf( Db_Xferred:Db_Xferred+Buf_size-1 ) + Db_Xferred = Db_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Int_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Int_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) + Int_Xferred = Int_Xferred + Buf_size + END IF + CALL NWTC_Library_Unpackmeshmaptype( Re_Buf, Db_Buf, Int_Buf, OutData%u_TStC_Mot2_TStC(i1), ErrStat2, ErrMsg2 ) ! u_TStC_Mot2_TStC + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) + IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) + IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) + END DO + END IF + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! u_SStC_Mot2_SStC not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%u_SStC_Mot2_SStC)) DEALLOCATE(OutData%u_SStC_Mot2_SStC) + ALLOCATE(OutData%u_SStC_Mot2_SStC(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%u_SStC_Mot2_SStC.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i1 = LBOUND(OutData%u_SStC_Mot2_SStC,1), UBOUND(OutData%u_SStC_Mot2_SStC,1) + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Re_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Re_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Re_Buf = ReKiBuf( Re_Xferred:Re_Xferred+Buf_size-1 ) + Re_Xferred = Re_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Db_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Db_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Db_Buf = DbKiBuf( Db_Xferred:Db_Xferred+Buf_size-1 ) + Db_Xferred = Db_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Int_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Int_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) + Int_Xferred = Int_Xferred + Buf_size + END IF + CALL NWTC_Library_Unpackmeshmaptype( Re_Buf, Db_Buf, Int_Buf, OutData%u_SStC_Mot2_SStC(i1), ErrStat2, ErrMsg2 ) ! u_SStC_Mot2_SStC + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) + IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) + IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) + END DO + END IF + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! BStC_Frc2_y_BStC not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + i2_l = IntKiBuf( Int_Xferred ) + i2_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%BStC_Frc2_y_BStC)) DEALLOCATE(OutData%BStC_Frc2_y_BStC) + ALLOCATE(OutData%BStC_Frc2_y_BStC(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%BStC_Frc2_y_BStC.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i2 = LBOUND(OutData%BStC_Frc2_y_BStC,2), UBOUND(OutData%BStC_Frc2_y_BStC,2) + DO i1 = LBOUND(OutData%BStC_Frc2_y_BStC,1), UBOUND(OutData%BStC_Frc2_y_BStC,1) + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Re_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Re_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Re_Buf = ReKiBuf( Re_Xferred:Re_Xferred+Buf_size-1 ) + Re_Xferred = Re_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Db_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Db_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Db_Buf = DbKiBuf( Db_Xferred:Db_Xferred+Buf_size-1 ) + Db_Xferred = Db_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Int_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Int_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) + Int_Xferred = Int_Xferred + Buf_size + END IF + CALL NWTC_Library_Unpackmeshmaptype( Re_Buf, Db_Buf, Int_Buf, OutData%BStC_Frc2_y_BStC(i1,i2), ErrStat2, ErrMsg2 ) ! BStC_Frc2_y_BStC + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) + IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) + IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) + END DO + END DO + END IF + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! NStC_Frc2_y_NStC not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%NStC_Frc2_y_NStC)) DEALLOCATE(OutData%NStC_Frc2_y_NStC) + ALLOCATE(OutData%NStC_Frc2_y_NStC(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%NStC_Frc2_y_NStC.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i1 = LBOUND(OutData%NStC_Frc2_y_NStC,1), UBOUND(OutData%NStC_Frc2_y_NStC,1) + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Re_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Re_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Re_Buf = ReKiBuf( Re_Xferred:Re_Xferred+Buf_size-1 ) + Re_Xferred = Re_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Db_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Db_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Db_Buf = DbKiBuf( Db_Xferred:Db_Xferred+Buf_size-1 ) + Db_Xferred = Db_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Int_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Int_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) + Int_Xferred = Int_Xferred + Buf_size + END IF + CALL NWTC_Library_Unpackmeshmaptype( Re_Buf, Db_Buf, Int_Buf, OutData%NStC_Frc2_y_NStC(i1), ErrStat2, ErrMsg2 ) ! NStC_Frc2_y_NStC + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) + IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) + IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) + END DO + END IF + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! TStC_Frc2_y_TStC not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%TStC_Frc2_y_TStC)) DEALLOCATE(OutData%TStC_Frc2_y_TStC) + ALLOCATE(OutData%TStC_Frc2_y_TStC(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%TStC_Frc2_y_TStC.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i1 = LBOUND(OutData%TStC_Frc2_y_TStC,1), UBOUND(OutData%TStC_Frc2_y_TStC,1) + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Re_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Re_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Re_Buf = ReKiBuf( Re_Xferred:Re_Xferred+Buf_size-1 ) + Re_Xferred = Re_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Db_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Db_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Db_Buf = DbKiBuf( Db_Xferred:Db_Xferred+Buf_size-1 ) + Db_Xferred = Db_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Int_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Int_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) + Int_Xferred = Int_Xferred + Buf_size + END IF + CALL NWTC_Library_Unpackmeshmaptype( Re_Buf, Db_Buf, Int_Buf, OutData%TStC_Frc2_y_TStC(i1), ErrStat2, ErrMsg2 ) ! TStC_Frc2_y_TStC + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) + IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) + IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) + END DO + END IF + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! SStC_Frc2_y_SStC not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%SStC_Frc2_y_SStC)) DEALLOCATE(OutData%SStC_Frc2_y_SStC) + ALLOCATE(OutData%SStC_Frc2_y_SStC(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%SStC_Frc2_y_SStC.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i1 = LBOUND(OutData%SStC_Frc2_y_SStC,1), UBOUND(OutData%SStC_Frc2_y_SStC,1) + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Re_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Re_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Re_Buf = ReKiBuf( Re_Xferred:Re_Xferred+Buf_size-1 ) + Re_Xferred = Re_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Db_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Db_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Db_Buf = DbKiBuf( Db_Xferred:Db_Xferred+Buf_size-1 ) + Db_Xferred = Db_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Int_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Int_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) + Int_Xferred = Int_Xferred + Buf_size + END IF + CALL NWTC_Library_Unpackmeshmaptype( Re_Buf, Db_Buf, Int_Buf, OutData%SStC_Frc2_y_SStC(i1), ErrStat2, ErrMsg2 ) ! SStC_Frc2_y_SStC + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) + IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) + IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) + END DO + END IF + END SUBROUTINE SrvD_UnPackModuleMapType + + SUBROUTINE SrvD_CopyMisc( SrcMiscData, DstMiscData, CtrlCode, ErrStat, ErrMsg ) + TYPE(SrvD_MiscVarType), INTENT(INOUT) :: SrcMiscData + TYPE(SrvD_MiscVarType), INTENT(INOUT) :: DstMiscData + INTEGER(IntKi), INTENT(IN ) :: CtrlCode + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg +! Local + INTEGER(IntKi) :: i,j,k + INTEGER(IntKi) :: i1, i1_l, i1_u ! bounds (upper/lower) for an array dimension 1 + INTEGER(IntKi) :: i2, i2_l, i2_u ! bounds (upper/lower) for an array dimension 2 + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'SrvD_CopyMisc' +! + ErrStat = ErrID_None + ErrMsg = "" + DstMiscData%LastTimeCalled = SrcMiscData%LastTimeCalled + CALL SrvD_Copybladeddlltype( SrcMiscData%dll_data, DstMiscData%dll_data, CtrlCode, ErrStat2, ErrMsg2 ) + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) + IF (ErrStat>=AbortErrLev) RETURN + DstMiscData%FirstWarn = SrcMiscData%FirstWarn + DstMiscData%LastTimeFiltered = SrcMiscData%LastTimeFiltered +IF (ALLOCATED(SrcMiscData%xd_BlPitchFilter)) THEN + i1_l = LBOUND(SrcMiscData%xd_BlPitchFilter,1) + i1_u = UBOUND(SrcMiscData%xd_BlPitchFilter,1) + IF (.NOT. ALLOCATED(DstMiscData%xd_BlPitchFilter)) THEN + ALLOCATE(DstMiscData%xd_BlPitchFilter(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstMiscData%xd_BlPitchFilter.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DstMiscData%xd_BlPitchFilter = SrcMiscData%xd_BlPitchFilter +ENDIF +IF (ALLOCATED(SrcMiscData%BStC)) THEN + i1_l = LBOUND(SrcMiscData%BStC,1) + i1_u = UBOUND(SrcMiscData%BStC,1) + IF (.NOT. ALLOCATED(DstMiscData%BStC)) THEN + ALLOCATE(DstMiscData%BStC(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstMiscData%BStC.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DO i1 = LBOUND(SrcMiscData%BStC,1), UBOUND(SrcMiscData%BStC,1) + CALL StC_CopyMisc( SrcMiscData%BStC(i1), DstMiscData%BStC(i1), CtrlCode, ErrStat2, ErrMsg2 ) + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) + IF (ErrStat>=AbortErrLev) RETURN + ENDDO +ENDIF +IF (ALLOCATED(SrcMiscData%NStC)) THEN + i1_l = LBOUND(SrcMiscData%NStC,1) + i1_u = UBOUND(SrcMiscData%NStC,1) + IF (.NOT. ALLOCATED(DstMiscData%NStC)) THEN + ALLOCATE(DstMiscData%NStC(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstMiscData%NStC.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DO i1 = LBOUND(SrcMiscData%NStC,1), UBOUND(SrcMiscData%NStC,1) + CALL StC_CopyMisc( SrcMiscData%NStC(i1), DstMiscData%NStC(i1), CtrlCode, ErrStat2, ErrMsg2 ) + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) + IF (ErrStat>=AbortErrLev) RETURN + ENDDO +ENDIF +IF (ALLOCATED(SrcMiscData%TStC)) THEN + i1_l = LBOUND(SrcMiscData%TStC,1) + i1_u = UBOUND(SrcMiscData%TStC,1) + IF (.NOT. ALLOCATED(DstMiscData%TStC)) THEN + ALLOCATE(DstMiscData%TStC(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstMiscData%TStC.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DO i1 = LBOUND(SrcMiscData%TStC,1), UBOUND(SrcMiscData%TStC,1) + CALL StC_CopyMisc( SrcMiscData%TStC(i1), DstMiscData%TStC(i1), CtrlCode, ErrStat2, ErrMsg2 ) + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) + IF (ErrStat>=AbortErrLev) RETURN + ENDDO +ENDIF +IF (ALLOCATED(SrcMiscData%SStC)) THEN + i1_l = LBOUND(SrcMiscData%SStC,1) + i1_u = UBOUND(SrcMiscData%SStC,1) + IF (.NOT. ALLOCATED(DstMiscData%SStC)) THEN + ALLOCATE(DstMiscData%SStC(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstMiscData%SStC.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DO i1 = LBOUND(SrcMiscData%SStC,1), UBOUND(SrcMiscData%SStC,1) + CALL StC_CopyMisc( SrcMiscData%SStC(i1), DstMiscData%SStC(i1), CtrlCode, ErrStat2, ErrMsg2 ) + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) + IF (ErrStat>=AbortErrLev) RETURN + ENDDO +ENDIF +IF (ALLOCATED(SrcMiscData%u_BStC)) THEN + i1_l = LBOUND(SrcMiscData%u_BStC,1) + i1_u = UBOUND(SrcMiscData%u_BStC,1) + i2_l = LBOUND(SrcMiscData%u_BStC,2) + i2_u = UBOUND(SrcMiscData%u_BStC,2) + IF (.NOT. ALLOCATED(DstMiscData%u_BStC)) THEN + ALLOCATE(DstMiscData%u_BStC(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstMiscData%u_BStC.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DO i2 = LBOUND(SrcMiscData%u_BStC,2), UBOUND(SrcMiscData%u_BStC,2) + DO i1 = LBOUND(SrcMiscData%u_BStC,1), UBOUND(SrcMiscData%u_BStC,1) + CALL StC_CopyInput( SrcMiscData%u_BStC(i1,i2), DstMiscData%u_BStC(i1,i2), CtrlCode, ErrStat2, ErrMsg2 ) + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) + IF (ErrStat>=AbortErrLev) RETURN + ENDDO + ENDDO +ENDIF +IF (ALLOCATED(SrcMiscData%u_NStC)) THEN + i1_l = LBOUND(SrcMiscData%u_NStC,1) + i1_u = UBOUND(SrcMiscData%u_NStC,1) + i2_l = LBOUND(SrcMiscData%u_NStC,2) + i2_u = UBOUND(SrcMiscData%u_NStC,2) + IF (.NOT. ALLOCATED(DstMiscData%u_NStC)) THEN + ALLOCATE(DstMiscData%u_NStC(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstMiscData%u_NStC.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DO i2 = LBOUND(SrcMiscData%u_NStC,2), UBOUND(SrcMiscData%u_NStC,2) + DO i1 = LBOUND(SrcMiscData%u_NStC,1), UBOUND(SrcMiscData%u_NStC,1) + CALL StC_CopyInput( SrcMiscData%u_NStC(i1,i2), DstMiscData%u_NStC(i1,i2), CtrlCode, ErrStat2, ErrMsg2 ) + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) + IF (ErrStat>=AbortErrLev) RETURN + ENDDO + ENDDO +ENDIF +IF (ALLOCATED(SrcMiscData%u_TStC)) THEN + i1_l = LBOUND(SrcMiscData%u_TStC,1) + i1_u = UBOUND(SrcMiscData%u_TStC,1) + i2_l = LBOUND(SrcMiscData%u_TStC,2) + i2_u = UBOUND(SrcMiscData%u_TStC,2) + IF (.NOT. ALLOCATED(DstMiscData%u_TStC)) THEN + ALLOCATE(DstMiscData%u_TStC(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstMiscData%u_TStC.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DO i2 = LBOUND(SrcMiscData%u_TStC,2), UBOUND(SrcMiscData%u_TStC,2) + DO i1 = LBOUND(SrcMiscData%u_TStC,1), UBOUND(SrcMiscData%u_TStC,1) + CALL StC_CopyInput( SrcMiscData%u_TStC(i1,i2), DstMiscData%u_TStC(i1,i2), CtrlCode, ErrStat2, ErrMsg2 ) + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) + IF (ErrStat>=AbortErrLev) RETURN + ENDDO + ENDDO +ENDIF +IF (ALLOCATED(SrcMiscData%u_SStC)) THEN + i1_l = LBOUND(SrcMiscData%u_SStC,1) + i1_u = UBOUND(SrcMiscData%u_SStC,1) + i2_l = LBOUND(SrcMiscData%u_SStC,2) + i2_u = UBOUND(SrcMiscData%u_SStC,2) + IF (.NOT. ALLOCATED(DstMiscData%u_SStC)) THEN + ALLOCATE(DstMiscData%u_SStC(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstMiscData%u_SStC.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DO i2 = LBOUND(SrcMiscData%u_SStC,2), UBOUND(SrcMiscData%u_SStC,2) + DO i1 = LBOUND(SrcMiscData%u_SStC,1), UBOUND(SrcMiscData%u_SStC,1) + CALL StC_CopyInput( SrcMiscData%u_SStC(i1,i2), DstMiscData%u_SStC(i1,i2), CtrlCode, ErrStat2, ErrMsg2 ) + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) + IF (ErrStat>=AbortErrLev) RETURN + ENDDO + ENDDO +ENDIF +IF (ALLOCATED(SrcMiscData%y_BStC)) THEN + i1_l = LBOUND(SrcMiscData%y_BStC,1) + i1_u = UBOUND(SrcMiscData%y_BStC,1) + IF (.NOT. ALLOCATED(DstMiscData%y_BStC)) THEN + ALLOCATE(DstMiscData%y_BStC(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstMiscData%y_BStC.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DO i1 = LBOUND(SrcMiscData%y_BStC,1), UBOUND(SrcMiscData%y_BStC,1) + CALL StC_CopyOutput( SrcMiscData%y_BStC(i1), DstMiscData%y_BStC(i1), CtrlCode, ErrStat2, ErrMsg2 ) + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) + IF (ErrStat>=AbortErrLev) RETURN + ENDDO +ENDIF +IF (ALLOCATED(SrcMiscData%y_NStC)) THEN + i1_l = LBOUND(SrcMiscData%y_NStC,1) + i1_u = UBOUND(SrcMiscData%y_NStC,1) + IF (.NOT. ALLOCATED(DstMiscData%y_NStC)) THEN + ALLOCATE(DstMiscData%y_NStC(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstMiscData%y_NStC.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DO i1 = LBOUND(SrcMiscData%y_NStC,1), UBOUND(SrcMiscData%y_NStC,1) + CALL StC_CopyOutput( SrcMiscData%y_NStC(i1), DstMiscData%y_NStC(i1), CtrlCode, ErrStat2, ErrMsg2 ) + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) + IF (ErrStat>=AbortErrLev) RETURN + ENDDO +ENDIF +IF (ALLOCATED(SrcMiscData%y_TStC)) THEN + i1_l = LBOUND(SrcMiscData%y_TStC,1) + i1_u = UBOUND(SrcMiscData%y_TStC,1) + IF (.NOT. ALLOCATED(DstMiscData%y_TStC)) THEN + ALLOCATE(DstMiscData%y_TStC(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstMiscData%y_TStC.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DO i1 = LBOUND(SrcMiscData%y_TStC,1), UBOUND(SrcMiscData%y_TStC,1) + CALL StC_CopyOutput( SrcMiscData%y_TStC(i1), DstMiscData%y_TStC(i1), CtrlCode, ErrStat2, ErrMsg2 ) + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) + IF (ErrStat>=AbortErrLev) RETURN + ENDDO +ENDIF +IF (ALLOCATED(SrcMiscData%y_SStC)) THEN + i1_l = LBOUND(SrcMiscData%y_SStC,1) + i1_u = UBOUND(SrcMiscData%y_SStC,1) + IF (.NOT. ALLOCATED(DstMiscData%y_SStC)) THEN + ALLOCATE(DstMiscData%y_SStC(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstMiscData%y_SStC.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DO i1 = LBOUND(SrcMiscData%y_SStC,1), UBOUND(SrcMiscData%y_SStC,1) + CALL StC_CopyOutput( SrcMiscData%y_SStC(i1), DstMiscData%y_SStC(i1), CtrlCode, ErrStat2, ErrMsg2 ) + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) + IF (ErrStat>=AbortErrLev) RETURN + ENDDO +ENDIF + CALL SrvD_Copymodulemaptype( SrcMiscData%SrvD_MeshMap, DstMiscData%SrvD_MeshMap, CtrlCode, ErrStat2, ErrMsg2 ) + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) + IF (ErrStat>=AbortErrLev) RETURN + DstMiscData%PrevTstepNcall = SrcMiscData%PrevTstepNcall + END SUBROUTINE SrvD_CopyMisc + + SUBROUTINE SrvD_DestroyMisc( MiscData, ErrStat, ErrMsg ) + TYPE(SrvD_MiscVarType), INTENT(INOUT) :: MiscData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + CHARACTER(*), PARAMETER :: RoutineName = 'SrvD_DestroyMisc' + INTEGER(IntKi) :: i, i1, i2, i3, i4, i5 +! + ErrStat = ErrID_None + ErrMsg = "" + CALL SrvD_Destroybladeddlltype( MiscData%dll_data, ErrStat, ErrMsg ) +IF (ALLOCATED(MiscData%xd_BlPitchFilter)) THEN + DEALLOCATE(MiscData%xd_BlPitchFilter) +ENDIF +IF (ALLOCATED(MiscData%BStC)) THEN +DO i1 = LBOUND(MiscData%BStC,1), UBOUND(MiscData%BStC,1) + CALL StC_DestroyMisc( MiscData%BStC(i1), ErrStat, ErrMsg ) +ENDDO + DEALLOCATE(MiscData%BStC) +ENDIF +IF (ALLOCATED(MiscData%NStC)) THEN +DO i1 = LBOUND(MiscData%NStC,1), UBOUND(MiscData%NStC,1) + CALL StC_DestroyMisc( MiscData%NStC(i1), ErrStat, ErrMsg ) +ENDDO + DEALLOCATE(MiscData%NStC) +ENDIF +IF (ALLOCATED(MiscData%TStC)) THEN +DO i1 = LBOUND(MiscData%TStC,1), UBOUND(MiscData%TStC,1) + CALL StC_DestroyMisc( MiscData%TStC(i1), ErrStat, ErrMsg ) +ENDDO + DEALLOCATE(MiscData%TStC) +ENDIF +IF (ALLOCATED(MiscData%SStC)) THEN +DO i1 = LBOUND(MiscData%SStC,1), UBOUND(MiscData%SStC,1) + CALL StC_DestroyMisc( MiscData%SStC(i1), ErrStat, ErrMsg ) +ENDDO + DEALLOCATE(MiscData%SStC) +ENDIF +IF (ALLOCATED(MiscData%u_BStC)) THEN +DO i2 = LBOUND(MiscData%u_BStC,2), UBOUND(MiscData%u_BStC,2) +DO i1 = LBOUND(MiscData%u_BStC,1), UBOUND(MiscData%u_BStC,1) + CALL StC_DestroyInput( MiscData%u_BStC(i1,i2), ErrStat, ErrMsg ) +ENDDO +ENDDO + DEALLOCATE(MiscData%u_BStC) +ENDIF +IF (ALLOCATED(MiscData%u_NStC)) THEN +DO i2 = LBOUND(MiscData%u_NStC,2), UBOUND(MiscData%u_NStC,2) +DO i1 = LBOUND(MiscData%u_NStC,1), UBOUND(MiscData%u_NStC,1) + CALL StC_DestroyInput( MiscData%u_NStC(i1,i2), ErrStat, ErrMsg ) +ENDDO +ENDDO + DEALLOCATE(MiscData%u_NStC) +ENDIF +IF (ALLOCATED(MiscData%u_TStC)) THEN +DO i2 = LBOUND(MiscData%u_TStC,2), UBOUND(MiscData%u_TStC,2) +DO i1 = LBOUND(MiscData%u_TStC,1), UBOUND(MiscData%u_TStC,1) + CALL StC_DestroyInput( MiscData%u_TStC(i1,i2), ErrStat, ErrMsg ) +ENDDO +ENDDO + DEALLOCATE(MiscData%u_TStC) +ENDIF +IF (ALLOCATED(MiscData%u_SStC)) THEN +DO i2 = LBOUND(MiscData%u_SStC,2), UBOUND(MiscData%u_SStC,2) +DO i1 = LBOUND(MiscData%u_SStC,1), UBOUND(MiscData%u_SStC,1) + CALL StC_DestroyInput( MiscData%u_SStC(i1,i2), ErrStat, ErrMsg ) +ENDDO +ENDDO + DEALLOCATE(MiscData%u_SStC) +ENDIF +IF (ALLOCATED(MiscData%y_BStC)) THEN +DO i1 = LBOUND(MiscData%y_BStC,1), UBOUND(MiscData%y_BStC,1) + CALL StC_DestroyOutput( MiscData%y_BStC(i1), ErrStat, ErrMsg ) +ENDDO + DEALLOCATE(MiscData%y_BStC) +ENDIF +IF (ALLOCATED(MiscData%y_NStC)) THEN +DO i1 = LBOUND(MiscData%y_NStC,1), UBOUND(MiscData%y_NStC,1) + CALL StC_DestroyOutput( MiscData%y_NStC(i1), ErrStat, ErrMsg ) +ENDDO + DEALLOCATE(MiscData%y_NStC) +ENDIF +IF (ALLOCATED(MiscData%y_TStC)) THEN +DO i1 = LBOUND(MiscData%y_TStC,1), UBOUND(MiscData%y_TStC,1) + CALL StC_DestroyOutput( MiscData%y_TStC(i1), ErrStat, ErrMsg ) +ENDDO + DEALLOCATE(MiscData%y_TStC) +ENDIF +IF (ALLOCATED(MiscData%y_SStC)) THEN +DO i1 = LBOUND(MiscData%y_SStC,1), UBOUND(MiscData%y_SStC,1) + CALL StC_DestroyOutput( MiscData%y_SStC(i1), ErrStat, ErrMsg ) +ENDDO + DEALLOCATE(MiscData%y_SStC) +ENDIF + CALL SrvD_Destroymodulemaptype( MiscData%SrvD_MeshMap, ErrStat, ErrMsg ) + END SUBROUTINE SrvD_DestroyMisc + + SUBROUTINE SrvD_PackMisc( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg, SizeOnly ) + REAL(ReKi), ALLOCATABLE, INTENT( OUT) :: ReKiBuf(:) + REAL(DbKi), ALLOCATABLE, INTENT( OUT) :: DbKiBuf(:) + INTEGER(IntKi), ALLOCATABLE, INTENT( OUT) :: IntKiBuf(:) + TYPE(SrvD_MiscVarType), INTENT(IN) :: InData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + LOGICAL,OPTIONAL, INTENT(IN ) :: SizeOnly + ! Local variables + INTEGER(IntKi) :: Re_BufSz + INTEGER(IntKi) :: Re_Xferred + INTEGER(IntKi) :: Db_BufSz + INTEGER(IntKi) :: Db_Xferred + INTEGER(IntKi) :: Int_BufSz + INTEGER(IntKi) :: Int_Xferred + INTEGER(IntKi) :: i,i1,i2,i3,i4,i5 + LOGICAL :: OnlySize ! if present and true, do not pack, just allocate buffers + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'SrvD_PackMisc' + ! buffers to store subtypes, if any + REAL(ReKi), ALLOCATABLE :: Re_Buf(:) + REAL(DbKi), ALLOCATABLE :: Db_Buf(:) + INTEGER(IntKi), ALLOCATABLE :: Int_Buf(:) + + OnlySize = .FALSE. + IF ( PRESENT(SizeOnly) ) THEN + OnlySize = SizeOnly + ENDIF + ! + ErrStat = ErrID_None + ErrMsg = "" + Re_BufSz = 0 + Db_BufSz = 0 + Int_BufSz = 0 + Db_BufSz = Db_BufSz + 1 ! LastTimeCalled + ! Allocate buffers for subtypes, if any (we'll get sizes from these) + Int_BufSz = Int_BufSz + 3 ! dll_data: size of buffers for each call to pack subtype + CALL SrvD_Packbladeddlltype( Re_Buf, Db_Buf, Int_Buf, InData%dll_data, ErrStat2, ErrMsg2, .TRUE. ) ! dll_data + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN ! dll_data + Re_BufSz = Re_BufSz + SIZE( Re_Buf ) + DEALLOCATE(Re_Buf) + END IF + IF(ALLOCATED(Db_Buf)) THEN ! dll_data + Db_BufSz = Db_BufSz + SIZE( Db_Buf ) + DEALLOCATE(Db_Buf) + END IF + IF(ALLOCATED(Int_Buf)) THEN ! dll_data + Int_BufSz = Int_BufSz + SIZE( Int_Buf ) + DEALLOCATE(Int_Buf) + END IF + Int_BufSz = Int_BufSz + 1 ! FirstWarn + Db_BufSz = Db_BufSz + 1 ! LastTimeFiltered + Int_BufSz = Int_BufSz + 1 ! xd_BlPitchFilter allocated yes/no + IF ( ALLOCATED(InData%xd_BlPitchFilter) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! xd_BlPitchFilter upper/lower bounds for each dimension + Re_BufSz = Re_BufSz + SIZE(InData%xd_BlPitchFilter) ! xd_BlPitchFilter + END IF + Int_BufSz = Int_BufSz + 1 ! BStC allocated yes/no + IF ( ALLOCATED(InData%BStC) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! BStC upper/lower bounds for each dimension + DO i1 = LBOUND(InData%BStC,1), UBOUND(InData%BStC,1) + Int_BufSz = Int_BufSz + 3 ! BStC: size of buffers for each call to pack subtype + CALL StC_PackMisc( Re_Buf, Db_Buf, Int_Buf, InData%BStC(i1), ErrStat2, ErrMsg2, .TRUE. ) ! BStC + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN ! BStC + Re_BufSz = Re_BufSz + SIZE( Re_Buf ) + DEALLOCATE(Re_Buf) + END IF + IF(ALLOCATED(Db_Buf)) THEN ! BStC + Db_BufSz = Db_BufSz + SIZE( Db_Buf ) + DEALLOCATE(Db_Buf) + END IF + IF(ALLOCATED(Int_Buf)) THEN ! BStC + Int_BufSz = Int_BufSz + SIZE( Int_Buf ) + DEALLOCATE(Int_Buf) + END IF + END DO + END IF + Int_BufSz = Int_BufSz + 1 ! NStC allocated yes/no + IF ( ALLOCATED(InData%NStC) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! NStC upper/lower bounds for each dimension + DO i1 = LBOUND(InData%NStC,1), UBOUND(InData%NStC,1) + Int_BufSz = Int_BufSz + 3 ! NStC: size of buffers for each call to pack subtype + CALL StC_PackMisc( Re_Buf, Db_Buf, Int_Buf, InData%NStC(i1), ErrStat2, ErrMsg2, .TRUE. ) ! NStC + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN ! NStC + Re_BufSz = Re_BufSz + SIZE( Re_Buf ) + DEALLOCATE(Re_Buf) + END IF + IF(ALLOCATED(Db_Buf)) THEN ! NStC + Db_BufSz = Db_BufSz + SIZE( Db_Buf ) + DEALLOCATE(Db_Buf) + END IF + IF(ALLOCATED(Int_Buf)) THEN ! NStC + Int_BufSz = Int_BufSz + SIZE( Int_Buf ) + DEALLOCATE(Int_Buf) + END IF + END DO + END IF + Int_BufSz = Int_BufSz + 1 ! TStC allocated yes/no + IF ( ALLOCATED(InData%TStC) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! TStC upper/lower bounds for each dimension + DO i1 = LBOUND(InData%TStC,1), UBOUND(InData%TStC,1) + Int_BufSz = Int_BufSz + 3 ! TStC: size of buffers for each call to pack subtype + CALL StC_PackMisc( Re_Buf, Db_Buf, Int_Buf, InData%TStC(i1), ErrStat2, ErrMsg2, .TRUE. ) ! TStC + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN ! TStC + Re_BufSz = Re_BufSz + SIZE( Re_Buf ) + DEALLOCATE(Re_Buf) + END IF + IF(ALLOCATED(Db_Buf)) THEN ! TStC + Db_BufSz = Db_BufSz + SIZE( Db_Buf ) + DEALLOCATE(Db_Buf) + END IF + IF(ALLOCATED(Int_Buf)) THEN ! TStC + Int_BufSz = Int_BufSz + SIZE( Int_Buf ) + DEALLOCATE(Int_Buf) + END IF + END DO + END IF + Int_BufSz = Int_BufSz + 1 ! SStC allocated yes/no + IF ( ALLOCATED(InData%SStC) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! SStC upper/lower bounds for each dimension + DO i1 = LBOUND(InData%SStC,1), UBOUND(InData%SStC,1) + Int_BufSz = Int_BufSz + 3 ! SStC: size of buffers for each call to pack subtype + CALL StC_PackMisc( Re_Buf, Db_Buf, Int_Buf, InData%SStC(i1), ErrStat2, ErrMsg2, .TRUE. ) ! SStC + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN ! SStC + Re_BufSz = Re_BufSz + SIZE( Re_Buf ) + DEALLOCATE(Re_Buf) + END IF + IF(ALLOCATED(Db_Buf)) THEN ! SStC + Db_BufSz = Db_BufSz + SIZE( Db_Buf ) + DEALLOCATE(Db_Buf) + END IF + IF(ALLOCATED(Int_Buf)) THEN ! SStC + Int_BufSz = Int_BufSz + SIZE( Int_Buf ) + DEALLOCATE(Int_Buf) + END IF + END DO + END IF + Int_BufSz = Int_BufSz + 1 ! u_BStC allocated yes/no + IF ( ALLOCATED(InData%u_BStC) ) THEN + Int_BufSz = Int_BufSz + 2*2 ! u_BStC upper/lower bounds for each dimension + DO i2 = LBOUND(InData%u_BStC,2), UBOUND(InData%u_BStC,2) + DO i1 = LBOUND(InData%u_BStC,1), UBOUND(InData%u_BStC,1) + Int_BufSz = Int_BufSz + 3 ! u_BStC: size of buffers for each call to pack subtype + CALL StC_PackInput( Re_Buf, Db_Buf, Int_Buf, InData%u_BStC(i1,i2), ErrStat2, ErrMsg2, .TRUE. ) ! u_BStC + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN ! u_BStC + Re_BufSz = Re_BufSz + SIZE( Re_Buf ) + DEALLOCATE(Re_Buf) + END IF + IF(ALLOCATED(Db_Buf)) THEN ! u_BStC + Db_BufSz = Db_BufSz + SIZE( Db_Buf ) + DEALLOCATE(Db_Buf) + END IF + IF(ALLOCATED(Int_Buf)) THEN ! u_BStC + Int_BufSz = Int_BufSz + SIZE( Int_Buf ) + DEALLOCATE(Int_Buf) + END IF + END DO + END DO + END IF + Int_BufSz = Int_BufSz + 1 ! u_NStC allocated yes/no + IF ( ALLOCATED(InData%u_NStC) ) THEN + Int_BufSz = Int_BufSz + 2*2 ! u_NStC upper/lower bounds for each dimension + DO i2 = LBOUND(InData%u_NStC,2), UBOUND(InData%u_NStC,2) + DO i1 = LBOUND(InData%u_NStC,1), UBOUND(InData%u_NStC,1) + Int_BufSz = Int_BufSz + 3 ! u_NStC: size of buffers for each call to pack subtype + CALL StC_PackInput( Re_Buf, Db_Buf, Int_Buf, InData%u_NStC(i1,i2), ErrStat2, ErrMsg2, .TRUE. ) ! u_NStC + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN ! u_NStC + Re_BufSz = Re_BufSz + SIZE( Re_Buf ) + DEALLOCATE(Re_Buf) + END IF + IF(ALLOCATED(Db_Buf)) THEN ! u_NStC + Db_BufSz = Db_BufSz + SIZE( Db_Buf ) + DEALLOCATE(Db_Buf) + END IF + IF(ALLOCATED(Int_Buf)) THEN ! u_NStC + Int_BufSz = Int_BufSz + SIZE( Int_Buf ) + DEALLOCATE(Int_Buf) + END IF + END DO + END DO + END IF + Int_BufSz = Int_BufSz + 1 ! u_TStC allocated yes/no + IF ( ALLOCATED(InData%u_TStC) ) THEN + Int_BufSz = Int_BufSz + 2*2 ! u_TStC upper/lower bounds for each dimension + DO i2 = LBOUND(InData%u_TStC,2), UBOUND(InData%u_TStC,2) + DO i1 = LBOUND(InData%u_TStC,1), UBOUND(InData%u_TStC,1) + Int_BufSz = Int_BufSz + 3 ! u_TStC: size of buffers for each call to pack subtype + CALL StC_PackInput( Re_Buf, Db_Buf, Int_Buf, InData%u_TStC(i1,i2), ErrStat2, ErrMsg2, .TRUE. ) ! u_TStC + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN ! u_TStC + Re_BufSz = Re_BufSz + SIZE( Re_Buf ) + DEALLOCATE(Re_Buf) + END IF + IF(ALLOCATED(Db_Buf)) THEN ! u_TStC + Db_BufSz = Db_BufSz + SIZE( Db_Buf ) + DEALLOCATE(Db_Buf) + END IF + IF(ALLOCATED(Int_Buf)) THEN ! u_TStC + Int_BufSz = Int_BufSz + SIZE( Int_Buf ) + DEALLOCATE(Int_Buf) + END IF + END DO + END DO + END IF + Int_BufSz = Int_BufSz + 1 ! u_SStC allocated yes/no + IF ( ALLOCATED(InData%u_SStC) ) THEN + Int_BufSz = Int_BufSz + 2*2 ! u_SStC upper/lower bounds for each dimension + DO i2 = LBOUND(InData%u_SStC,2), UBOUND(InData%u_SStC,2) + DO i1 = LBOUND(InData%u_SStC,1), UBOUND(InData%u_SStC,1) + Int_BufSz = Int_BufSz + 3 ! u_SStC: size of buffers for each call to pack subtype + CALL StC_PackInput( Re_Buf, Db_Buf, Int_Buf, InData%u_SStC(i1,i2), ErrStat2, ErrMsg2, .TRUE. ) ! u_SStC + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN ! u_SStC + Re_BufSz = Re_BufSz + SIZE( Re_Buf ) + DEALLOCATE(Re_Buf) + END IF + IF(ALLOCATED(Db_Buf)) THEN ! u_SStC + Db_BufSz = Db_BufSz + SIZE( Db_Buf ) + DEALLOCATE(Db_Buf) + END IF + IF(ALLOCATED(Int_Buf)) THEN ! u_SStC + Int_BufSz = Int_BufSz + SIZE( Int_Buf ) + DEALLOCATE(Int_Buf) + END IF + END DO + END DO + END IF + Int_BufSz = Int_BufSz + 1 ! y_BStC allocated yes/no + IF ( ALLOCATED(InData%y_BStC) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! y_BStC upper/lower bounds for each dimension + DO i1 = LBOUND(InData%y_BStC,1), UBOUND(InData%y_BStC,1) + Int_BufSz = Int_BufSz + 3 ! y_BStC: size of buffers for each call to pack subtype + CALL StC_PackOutput( Re_Buf, Db_Buf, Int_Buf, InData%y_BStC(i1), ErrStat2, ErrMsg2, .TRUE. ) ! y_BStC + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN ! y_BStC + Re_BufSz = Re_BufSz + SIZE( Re_Buf ) + DEALLOCATE(Re_Buf) + END IF + IF(ALLOCATED(Db_Buf)) THEN ! y_BStC + Db_BufSz = Db_BufSz + SIZE( Db_Buf ) + DEALLOCATE(Db_Buf) + END IF + IF(ALLOCATED(Int_Buf)) THEN ! y_BStC + Int_BufSz = Int_BufSz + SIZE( Int_Buf ) + DEALLOCATE(Int_Buf) + END IF + END DO + END IF + Int_BufSz = Int_BufSz + 1 ! y_NStC allocated yes/no + IF ( ALLOCATED(InData%y_NStC) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! y_NStC upper/lower bounds for each dimension + DO i1 = LBOUND(InData%y_NStC,1), UBOUND(InData%y_NStC,1) + Int_BufSz = Int_BufSz + 3 ! y_NStC: size of buffers for each call to pack subtype + CALL StC_PackOutput( Re_Buf, Db_Buf, Int_Buf, InData%y_NStC(i1), ErrStat2, ErrMsg2, .TRUE. ) ! y_NStC + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN ! y_NStC + Re_BufSz = Re_BufSz + SIZE( Re_Buf ) + DEALLOCATE(Re_Buf) + END IF + IF(ALLOCATED(Db_Buf)) THEN ! y_NStC + Db_BufSz = Db_BufSz + SIZE( Db_Buf ) + DEALLOCATE(Db_Buf) + END IF + IF(ALLOCATED(Int_Buf)) THEN ! y_NStC + Int_BufSz = Int_BufSz + SIZE( Int_Buf ) + DEALLOCATE(Int_Buf) + END IF + END DO + END IF + Int_BufSz = Int_BufSz + 1 ! y_TStC allocated yes/no + IF ( ALLOCATED(InData%y_TStC) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! y_TStC upper/lower bounds for each dimension + DO i1 = LBOUND(InData%y_TStC,1), UBOUND(InData%y_TStC,1) + Int_BufSz = Int_BufSz + 3 ! y_TStC: size of buffers for each call to pack subtype + CALL StC_PackOutput( Re_Buf, Db_Buf, Int_Buf, InData%y_TStC(i1), ErrStat2, ErrMsg2, .TRUE. ) ! y_TStC + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN ! y_TStC + Re_BufSz = Re_BufSz + SIZE( Re_Buf ) + DEALLOCATE(Re_Buf) + END IF + IF(ALLOCATED(Db_Buf)) THEN ! y_TStC + Db_BufSz = Db_BufSz + SIZE( Db_Buf ) + DEALLOCATE(Db_Buf) + END IF + IF(ALLOCATED(Int_Buf)) THEN ! y_TStC + Int_BufSz = Int_BufSz + SIZE( Int_Buf ) + DEALLOCATE(Int_Buf) + END IF + END DO + END IF + Int_BufSz = Int_BufSz + 1 ! y_SStC allocated yes/no + IF ( ALLOCATED(InData%y_SStC) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! y_SStC upper/lower bounds for each dimension + DO i1 = LBOUND(InData%y_SStC,1), UBOUND(InData%y_SStC,1) + Int_BufSz = Int_BufSz + 3 ! y_SStC: size of buffers for each call to pack subtype + CALL StC_PackOutput( Re_Buf, Db_Buf, Int_Buf, InData%y_SStC(i1), ErrStat2, ErrMsg2, .TRUE. ) ! y_SStC + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN ! y_SStC + Re_BufSz = Re_BufSz + SIZE( Re_Buf ) + DEALLOCATE(Re_Buf) + END IF + IF(ALLOCATED(Db_Buf)) THEN ! y_SStC + Db_BufSz = Db_BufSz + SIZE( Db_Buf ) + DEALLOCATE(Db_Buf) + END IF + IF(ALLOCATED(Int_Buf)) THEN ! y_SStC + Int_BufSz = Int_BufSz + SIZE( Int_Buf ) + DEALLOCATE(Int_Buf) + END IF + END DO + END IF + Int_BufSz = Int_BufSz + 3 ! SrvD_MeshMap: size of buffers for each call to pack subtype + CALL SrvD_Packmodulemaptype( Re_Buf, Db_Buf, Int_Buf, InData%SrvD_MeshMap, ErrStat2, ErrMsg2, .TRUE. ) ! SrvD_MeshMap + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN ! SrvD_MeshMap + Re_BufSz = Re_BufSz + SIZE( Re_Buf ) + DEALLOCATE(Re_Buf) + END IF + IF(ALLOCATED(Db_Buf)) THEN ! SrvD_MeshMap + Db_BufSz = Db_BufSz + SIZE( Db_Buf ) + DEALLOCATE(Db_Buf) + END IF + IF(ALLOCATED(Int_Buf)) THEN ! SrvD_MeshMap + Int_BufSz = Int_BufSz + SIZE( Int_Buf ) + DEALLOCATE(Int_Buf) + END IF + Int_BufSz = Int_BufSz + 1 ! PrevTstepNcall + IF ( Re_BufSz .GT. 0 ) THEN + ALLOCATE( ReKiBuf( Re_BufSz ), STAT=ErrStat2 ) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating ReKiBuf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + IF ( Db_BufSz .GT. 0 ) THEN + ALLOCATE( DbKiBuf( Db_BufSz ), STAT=ErrStat2 ) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DbKiBuf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + IF ( Int_BufSz .GT. 0 ) THEN + ALLOCATE( IntKiBuf( Int_BufSz ), STAT=ErrStat2 ) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating IntKiBuf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + IF(OnlySize) RETURN ! return early if only trying to allocate buffers (not pack them) + + Re_Xferred = 1 + Db_Xferred = 1 + Int_Xferred = 1 + + DbKiBuf(Db_Xferred) = InData%LastTimeCalled + Db_Xferred = Db_Xferred + 1 + CALL SrvD_Packbladeddlltype( Re_Buf, Db_Buf, Int_Buf, InData%dll_data, ErrStat2, ErrMsg2, OnlySize ) ! dll_data + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Re_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Re_Buf) > 0) ReKiBuf( Re_Xferred:Re_Xferred+SIZE(Re_Buf)-1 ) = Re_Buf + Re_Xferred = Re_Xferred + SIZE(Re_Buf) + DEALLOCATE(Re_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Db_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Db_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Db_Buf) > 0) DbKiBuf( Db_Xferred:Db_Xferred+SIZE(Db_Buf)-1 ) = Db_Buf + Db_Xferred = Db_Xferred + SIZE(Db_Buf) + DEALLOCATE(Db_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Int_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Int_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Int_Buf) > 0) IntKiBuf( Int_Xferred:Int_Xferred+SIZE(Int_Buf)-1 ) = Int_Buf + Int_Xferred = Int_Xferred + SIZE(Int_Buf) + DEALLOCATE(Int_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IntKiBuf(Int_Xferred) = TRANSFER(InData%FirstWarn, IntKiBuf(1)) + Int_Xferred = Int_Xferred + 1 + DbKiBuf(Db_Xferred) = InData%LastTimeFiltered + Db_Xferred = Db_Xferred + 1 + IF ( .NOT. ALLOCATED(InData%xd_BlPitchFilter) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%xd_BlPitchFilter,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%xd_BlPitchFilter,1) + Int_Xferred = Int_Xferred + 2 + + DO i1 = LBOUND(InData%xd_BlPitchFilter,1), UBOUND(InData%xd_BlPitchFilter,1) + ReKiBuf(Re_Xferred) = InData%xd_BlPitchFilter(i1) + Re_Xferred = Re_Xferred + 1 + END DO + END IF + IF ( .NOT. ALLOCATED(InData%BStC) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%BStC,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%BStC,1) + Int_Xferred = Int_Xferred + 2 + + DO i1 = LBOUND(InData%BStC,1), UBOUND(InData%BStC,1) + CALL StC_PackMisc( Re_Buf, Db_Buf, Int_Buf, InData%BStC(i1), ErrStat2, ErrMsg2, OnlySize ) ! BStC + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Re_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Re_Buf) > 0) ReKiBuf( Re_Xferred:Re_Xferred+SIZE(Re_Buf)-1 ) = Re_Buf + Re_Xferred = Re_Xferred + SIZE(Re_Buf) + DEALLOCATE(Re_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Db_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Db_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Db_Buf) > 0) DbKiBuf( Db_Xferred:Db_Xferred+SIZE(Db_Buf)-1 ) = Db_Buf + Db_Xferred = Db_Xferred + SIZE(Db_Buf) + DEALLOCATE(Db_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Int_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Int_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Int_Buf) > 0) IntKiBuf( Int_Xferred:Int_Xferred+SIZE(Int_Buf)-1 ) = Int_Buf + Int_Xferred = Int_Xferred + SIZE(Int_Buf) + DEALLOCATE(Int_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + END DO + END IF + IF ( .NOT. ALLOCATED(InData%NStC) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%NStC,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%NStC,1) + Int_Xferred = Int_Xferred + 2 + + DO i1 = LBOUND(InData%NStC,1), UBOUND(InData%NStC,1) + CALL StC_PackMisc( Re_Buf, Db_Buf, Int_Buf, InData%NStC(i1), ErrStat2, ErrMsg2, OnlySize ) ! NStC + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Re_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Re_Buf) > 0) ReKiBuf( Re_Xferred:Re_Xferred+SIZE(Re_Buf)-1 ) = Re_Buf + Re_Xferred = Re_Xferred + SIZE(Re_Buf) + DEALLOCATE(Re_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Db_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Db_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Db_Buf) > 0) DbKiBuf( Db_Xferred:Db_Xferred+SIZE(Db_Buf)-1 ) = Db_Buf + Db_Xferred = Db_Xferred + SIZE(Db_Buf) + DEALLOCATE(Db_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Int_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Int_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Int_Buf) > 0) IntKiBuf( Int_Xferred:Int_Xferred+SIZE(Int_Buf)-1 ) = Int_Buf + Int_Xferred = Int_Xferred + SIZE(Int_Buf) + DEALLOCATE(Int_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + END DO + END IF + IF ( .NOT. ALLOCATED(InData%TStC) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%TStC,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%TStC,1) + Int_Xferred = Int_Xferred + 2 + + DO i1 = LBOUND(InData%TStC,1), UBOUND(InData%TStC,1) + CALL StC_PackMisc( Re_Buf, Db_Buf, Int_Buf, InData%TStC(i1), ErrStat2, ErrMsg2, OnlySize ) ! TStC + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Re_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Re_Buf) > 0) ReKiBuf( Re_Xferred:Re_Xferred+SIZE(Re_Buf)-1 ) = Re_Buf + Re_Xferred = Re_Xferred + SIZE(Re_Buf) + DEALLOCATE(Re_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Db_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Db_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Db_Buf) > 0) DbKiBuf( Db_Xferred:Db_Xferred+SIZE(Db_Buf)-1 ) = Db_Buf + Db_Xferred = Db_Xferred + SIZE(Db_Buf) + DEALLOCATE(Db_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Int_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Int_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Int_Buf) > 0) IntKiBuf( Int_Xferred:Int_Xferred+SIZE(Int_Buf)-1 ) = Int_Buf + Int_Xferred = Int_Xferred + SIZE(Int_Buf) + DEALLOCATE(Int_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + END DO + END IF + IF ( .NOT. ALLOCATED(InData%SStC) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%SStC,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%SStC,1) + Int_Xferred = Int_Xferred + 2 + + DO i1 = LBOUND(InData%SStC,1), UBOUND(InData%SStC,1) + CALL StC_PackMisc( Re_Buf, Db_Buf, Int_Buf, InData%SStC(i1), ErrStat2, ErrMsg2, OnlySize ) ! SStC + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Re_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Re_Buf) > 0) ReKiBuf( Re_Xferred:Re_Xferred+SIZE(Re_Buf)-1 ) = Re_Buf + Re_Xferred = Re_Xferred + SIZE(Re_Buf) + DEALLOCATE(Re_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Db_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Db_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Db_Buf) > 0) DbKiBuf( Db_Xferred:Db_Xferred+SIZE(Db_Buf)-1 ) = Db_Buf + Db_Xferred = Db_Xferred + SIZE(Db_Buf) + DEALLOCATE(Db_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Int_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Int_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Int_Buf) > 0) IntKiBuf( Int_Xferred:Int_Xferred+SIZE(Int_Buf)-1 ) = Int_Buf + Int_Xferred = Int_Xferred + SIZE(Int_Buf) + DEALLOCATE(Int_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + END DO + END IF + IF ( .NOT. ALLOCATED(InData%u_BStC) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%u_BStC,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%u_BStC,1) + Int_Xferred = Int_Xferred + 2 + IntKiBuf( Int_Xferred ) = LBOUND(InData%u_BStC,2) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%u_BStC,2) + Int_Xferred = Int_Xferred + 2 + + DO i2 = LBOUND(InData%u_BStC,2), UBOUND(InData%u_BStC,2) + DO i1 = LBOUND(InData%u_BStC,1), UBOUND(InData%u_BStC,1) + CALL StC_PackInput( Re_Buf, Db_Buf, Int_Buf, InData%u_BStC(i1,i2), ErrStat2, ErrMsg2, OnlySize ) ! u_BStC + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Re_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Re_Buf) > 0) ReKiBuf( Re_Xferred:Re_Xferred+SIZE(Re_Buf)-1 ) = Re_Buf + Re_Xferred = Re_Xferred + SIZE(Re_Buf) + DEALLOCATE(Re_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Db_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Db_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Db_Buf) > 0) DbKiBuf( Db_Xferred:Db_Xferred+SIZE(Db_Buf)-1 ) = Db_Buf + Db_Xferred = Db_Xferred + SIZE(Db_Buf) + DEALLOCATE(Db_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Int_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Int_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Int_Buf) > 0) IntKiBuf( Int_Xferred:Int_Xferred+SIZE(Int_Buf)-1 ) = Int_Buf + Int_Xferred = Int_Xferred + SIZE(Int_Buf) + DEALLOCATE(Int_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + END DO + END DO + END IF + IF ( .NOT. ALLOCATED(InData%u_NStC) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%u_NStC,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%u_NStC,1) + Int_Xferred = Int_Xferred + 2 + IntKiBuf( Int_Xferred ) = LBOUND(InData%u_NStC,2) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%u_NStC,2) + Int_Xferred = Int_Xferred + 2 + + DO i2 = LBOUND(InData%u_NStC,2), UBOUND(InData%u_NStC,2) + DO i1 = LBOUND(InData%u_NStC,1), UBOUND(InData%u_NStC,1) + CALL StC_PackInput( Re_Buf, Db_Buf, Int_Buf, InData%u_NStC(i1,i2), ErrStat2, ErrMsg2, OnlySize ) ! u_NStC + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Re_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Re_Buf) > 0) ReKiBuf( Re_Xferred:Re_Xferred+SIZE(Re_Buf)-1 ) = Re_Buf + Re_Xferred = Re_Xferred + SIZE(Re_Buf) + DEALLOCATE(Re_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Db_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Db_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Db_Buf) > 0) DbKiBuf( Db_Xferred:Db_Xferred+SIZE(Db_Buf)-1 ) = Db_Buf + Db_Xferred = Db_Xferred + SIZE(Db_Buf) + DEALLOCATE(Db_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Int_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Int_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Int_Buf) > 0) IntKiBuf( Int_Xferred:Int_Xferred+SIZE(Int_Buf)-1 ) = Int_Buf + Int_Xferred = Int_Xferred + SIZE(Int_Buf) + DEALLOCATE(Int_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + END DO + END DO + END IF + IF ( .NOT. ALLOCATED(InData%u_TStC) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%u_TStC,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%u_TStC,1) + Int_Xferred = Int_Xferred + 2 + IntKiBuf( Int_Xferred ) = LBOUND(InData%u_TStC,2) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%u_TStC,2) + Int_Xferred = Int_Xferred + 2 + + DO i2 = LBOUND(InData%u_TStC,2), UBOUND(InData%u_TStC,2) + DO i1 = LBOUND(InData%u_TStC,1), UBOUND(InData%u_TStC,1) + CALL StC_PackInput( Re_Buf, Db_Buf, Int_Buf, InData%u_TStC(i1,i2), ErrStat2, ErrMsg2, OnlySize ) ! u_TStC + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Re_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Re_Buf) > 0) ReKiBuf( Re_Xferred:Re_Xferred+SIZE(Re_Buf)-1 ) = Re_Buf + Re_Xferred = Re_Xferred + SIZE(Re_Buf) + DEALLOCATE(Re_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Db_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Db_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Db_Buf) > 0) DbKiBuf( Db_Xferred:Db_Xferred+SIZE(Db_Buf)-1 ) = Db_Buf + Db_Xferred = Db_Xferred + SIZE(Db_Buf) + DEALLOCATE(Db_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Int_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Int_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Int_Buf) > 0) IntKiBuf( Int_Xferred:Int_Xferred+SIZE(Int_Buf)-1 ) = Int_Buf + Int_Xferred = Int_Xferred + SIZE(Int_Buf) + DEALLOCATE(Int_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + END DO + END DO + END IF + IF ( .NOT. ALLOCATED(InData%u_SStC) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%u_SStC,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%u_SStC,1) + Int_Xferred = Int_Xferred + 2 + IntKiBuf( Int_Xferred ) = LBOUND(InData%u_SStC,2) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%u_SStC,2) + Int_Xferred = Int_Xferred + 2 + + DO i2 = LBOUND(InData%u_SStC,2), UBOUND(InData%u_SStC,2) + DO i1 = LBOUND(InData%u_SStC,1), UBOUND(InData%u_SStC,1) + CALL StC_PackInput( Re_Buf, Db_Buf, Int_Buf, InData%u_SStC(i1,i2), ErrStat2, ErrMsg2, OnlySize ) ! u_SStC + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Re_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Re_Buf) > 0) ReKiBuf( Re_Xferred:Re_Xferred+SIZE(Re_Buf)-1 ) = Re_Buf + Re_Xferred = Re_Xferred + SIZE(Re_Buf) + DEALLOCATE(Re_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Db_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Db_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Db_Buf) > 0) DbKiBuf( Db_Xferred:Db_Xferred+SIZE(Db_Buf)-1 ) = Db_Buf + Db_Xferred = Db_Xferred + SIZE(Db_Buf) + DEALLOCATE(Db_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Int_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Int_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Int_Buf) > 0) IntKiBuf( Int_Xferred:Int_Xferred+SIZE(Int_Buf)-1 ) = Int_Buf + Int_Xferred = Int_Xferred + SIZE(Int_Buf) + DEALLOCATE(Int_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + END DO + END DO + END IF + IF ( .NOT. ALLOCATED(InData%y_BStC) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%y_BStC,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%y_BStC,1) + Int_Xferred = Int_Xferred + 2 + + DO i1 = LBOUND(InData%y_BStC,1), UBOUND(InData%y_BStC,1) + CALL StC_PackOutput( Re_Buf, Db_Buf, Int_Buf, InData%y_BStC(i1), ErrStat2, ErrMsg2, OnlySize ) ! y_BStC + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Re_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Re_Buf) > 0) ReKiBuf( Re_Xferred:Re_Xferred+SIZE(Re_Buf)-1 ) = Re_Buf + Re_Xferred = Re_Xferred + SIZE(Re_Buf) + DEALLOCATE(Re_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Db_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Db_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Db_Buf) > 0) DbKiBuf( Db_Xferred:Db_Xferred+SIZE(Db_Buf)-1 ) = Db_Buf + Db_Xferred = Db_Xferred + SIZE(Db_Buf) + DEALLOCATE(Db_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Int_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Int_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Int_Buf) > 0) IntKiBuf( Int_Xferred:Int_Xferred+SIZE(Int_Buf)-1 ) = Int_Buf + Int_Xferred = Int_Xferred + SIZE(Int_Buf) + DEALLOCATE(Int_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + END DO + END IF + IF ( .NOT. ALLOCATED(InData%y_NStC) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%y_NStC,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%y_NStC,1) + Int_Xferred = Int_Xferred + 2 + + DO i1 = LBOUND(InData%y_NStC,1), UBOUND(InData%y_NStC,1) + CALL StC_PackOutput( Re_Buf, Db_Buf, Int_Buf, InData%y_NStC(i1), ErrStat2, ErrMsg2, OnlySize ) ! y_NStC + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Re_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Re_Buf) > 0) ReKiBuf( Re_Xferred:Re_Xferred+SIZE(Re_Buf)-1 ) = Re_Buf + Re_Xferred = Re_Xferred + SIZE(Re_Buf) + DEALLOCATE(Re_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Db_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Db_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Db_Buf) > 0) DbKiBuf( Db_Xferred:Db_Xferred+SIZE(Db_Buf)-1 ) = Db_Buf + Db_Xferred = Db_Xferred + SIZE(Db_Buf) + DEALLOCATE(Db_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Int_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Int_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Int_Buf) > 0) IntKiBuf( Int_Xferred:Int_Xferred+SIZE(Int_Buf)-1 ) = Int_Buf + Int_Xferred = Int_Xferred + SIZE(Int_Buf) + DEALLOCATE(Int_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + END DO + END IF + IF ( .NOT. ALLOCATED(InData%y_TStC) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%y_TStC,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%y_TStC,1) + Int_Xferred = Int_Xferred + 2 + + DO i1 = LBOUND(InData%y_TStC,1), UBOUND(InData%y_TStC,1) + CALL StC_PackOutput( Re_Buf, Db_Buf, Int_Buf, InData%y_TStC(i1), ErrStat2, ErrMsg2, OnlySize ) ! y_TStC + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Re_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Re_Buf) > 0) ReKiBuf( Re_Xferred:Re_Xferred+SIZE(Re_Buf)-1 ) = Re_Buf + Re_Xferred = Re_Xferred + SIZE(Re_Buf) + DEALLOCATE(Re_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Db_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Db_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Db_Buf) > 0) DbKiBuf( Db_Xferred:Db_Xferred+SIZE(Db_Buf)-1 ) = Db_Buf + Db_Xferred = Db_Xferred + SIZE(Db_Buf) + DEALLOCATE(Db_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Int_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Int_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Int_Buf) > 0) IntKiBuf( Int_Xferred:Int_Xferred+SIZE(Int_Buf)-1 ) = Int_Buf + Int_Xferred = Int_Xferred + SIZE(Int_Buf) + DEALLOCATE(Int_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + END DO + END IF + IF ( .NOT. ALLOCATED(InData%y_SStC) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%y_SStC,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%y_SStC,1) + Int_Xferred = Int_Xferred + 2 + + DO i1 = LBOUND(InData%y_SStC,1), UBOUND(InData%y_SStC,1) + CALL StC_PackOutput( Re_Buf, Db_Buf, Int_Buf, InData%y_SStC(i1), ErrStat2, ErrMsg2, OnlySize ) ! y_SStC + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Re_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Re_Buf) > 0) ReKiBuf( Re_Xferred:Re_Xferred+SIZE(Re_Buf)-1 ) = Re_Buf + Re_Xferred = Re_Xferred + SIZE(Re_Buf) + DEALLOCATE(Re_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Db_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Db_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Db_Buf) > 0) DbKiBuf( Db_Xferred:Db_Xferred+SIZE(Db_Buf)-1 ) = Db_Buf + Db_Xferred = Db_Xferred + SIZE(Db_Buf) + DEALLOCATE(Db_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Int_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Int_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Int_Buf) > 0) IntKiBuf( Int_Xferred:Int_Xferred+SIZE(Int_Buf)-1 ) = Int_Buf + Int_Xferred = Int_Xferred + SIZE(Int_Buf) + DEALLOCATE(Int_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + END DO + END IF + CALL SrvD_Packmodulemaptype( Re_Buf, Db_Buf, Int_Buf, InData%SrvD_MeshMap, ErrStat2, ErrMsg2, OnlySize ) ! SrvD_MeshMap + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Re_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Re_Buf) > 0) ReKiBuf( Re_Xferred:Re_Xferred+SIZE(Re_Buf)-1 ) = Re_Buf + Re_Xferred = Re_Xferred + SIZE(Re_Buf) + DEALLOCATE(Re_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Db_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Db_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Db_Buf) > 0) DbKiBuf( Db_Xferred:Db_Xferred+SIZE(Db_Buf)-1 ) = Db_Buf + Db_Xferred = Db_Xferred + SIZE(Db_Buf) + DEALLOCATE(Db_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Int_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Int_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Int_Buf) > 0) IntKiBuf( Int_Xferred:Int_Xferred+SIZE(Int_Buf)-1 ) = Int_Buf + Int_Xferred = Int_Xferred + SIZE(Int_Buf) + DEALLOCATE(Int_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IntKiBuf(Int_Xferred) = InData%PrevTstepNcall + Int_Xferred = Int_Xferred + 1 + END SUBROUTINE SrvD_PackMisc + + SUBROUTINE SrvD_UnPackMisc( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrMsg ) + REAL(ReKi), ALLOCATABLE, INTENT(IN ) :: ReKiBuf(:) + REAL(DbKi), ALLOCATABLE, INTENT(IN ) :: DbKiBuf(:) + INTEGER(IntKi), ALLOCATABLE, INTENT(IN ) :: IntKiBuf(:) + TYPE(SrvD_MiscVarType), INTENT(INOUT) :: OutData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + ! Local variables + INTEGER(IntKi) :: Buf_size + INTEGER(IntKi) :: Re_Xferred + INTEGER(IntKi) :: Db_Xferred + INTEGER(IntKi) :: Int_Xferred + INTEGER(IntKi) :: i + INTEGER(IntKi) :: i1, i1_l, i1_u ! bounds (upper/lower) for an array dimension 1 + INTEGER(IntKi) :: i2, i2_l, i2_u ! bounds (upper/lower) for an array dimension 2 + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'SrvD_UnPackMisc' + ! buffers to store meshes, if any + REAL(ReKi), ALLOCATABLE :: Re_Buf(:) + REAL(DbKi), ALLOCATABLE :: Db_Buf(:) + INTEGER(IntKi), ALLOCATABLE :: Int_Buf(:) + ! + ErrStat = ErrID_None + ErrMsg = "" + Re_Xferred = 1 + Db_Xferred = 1 + Int_Xferred = 1 + OutData%LastTimeCalled = DbKiBuf(Db_Xferred) + Db_Xferred = Db_Xferred + 1 + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Re_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Re_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Re_Buf = ReKiBuf( Re_Xferred:Re_Xferred+Buf_size-1 ) + Re_Xferred = Re_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Db_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Db_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Db_Buf = DbKiBuf( Db_Xferred:Db_Xferred+Buf_size-1 ) + Db_Xferred = Db_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Int_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Int_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) + Int_Xferred = Int_Xferred + Buf_size + END IF + CALL SrvD_Unpackbladeddlltype( Re_Buf, Db_Buf, Int_Buf, OutData%dll_data, ErrStat2, ErrMsg2 ) ! dll_data + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) + IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) + IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) + OutData%FirstWarn = TRANSFER(IntKiBuf(Int_Xferred), OutData%FirstWarn) + Int_Xferred = Int_Xferred + 1 + OutData%LastTimeFiltered = DbKiBuf(Db_Xferred) + Db_Xferred = Db_Xferred + 1 + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! xd_BlPitchFilter not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%xd_BlPitchFilter)) DEALLOCATE(OutData%xd_BlPitchFilter) + ALLOCATE(OutData%xd_BlPitchFilter(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%xd_BlPitchFilter.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i1 = LBOUND(OutData%xd_BlPitchFilter,1), UBOUND(OutData%xd_BlPitchFilter,1) + OutData%xd_BlPitchFilter(i1) = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + END DO + END IF + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! BStC not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%BStC)) DEALLOCATE(OutData%BStC) + ALLOCATE(OutData%BStC(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%BStC.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i1 = LBOUND(OutData%BStC,1), UBOUND(OutData%BStC,1) + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Re_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Re_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Re_Buf = ReKiBuf( Re_Xferred:Re_Xferred+Buf_size-1 ) + Re_Xferred = Re_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Db_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Db_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Db_Buf = DbKiBuf( Db_Xferred:Db_Xferred+Buf_size-1 ) + Db_Xferred = Db_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Int_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Int_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) + Int_Xferred = Int_Xferred + Buf_size + END IF + CALL StC_UnpackMisc( Re_Buf, Db_Buf, Int_Buf, OutData%BStC(i1), ErrStat2, ErrMsg2 ) ! BStC + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) + IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) + IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) + END DO + END IF + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! NStC not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%NStC)) DEALLOCATE(OutData%NStC) + ALLOCATE(OutData%NStC(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%NStC.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i1 = LBOUND(OutData%NStC,1), UBOUND(OutData%NStC,1) + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Re_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Re_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Re_Buf = ReKiBuf( Re_Xferred:Re_Xferred+Buf_size-1 ) + Re_Xferred = Re_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Db_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Db_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Db_Buf = DbKiBuf( Db_Xferred:Db_Xferred+Buf_size-1 ) + Db_Xferred = Db_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Int_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Int_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) + Int_Xferred = Int_Xferred + Buf_size + END IF + CALL StC_UnpackMisc( Re_Buf, Db_Buf, Int_Buf, OutData%NStC(i1), ErrStat2, ErrMsg2 ) ! NStC + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) + IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) + IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) + END DO + END IF + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! TStC not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%TStC)) DEALLOCATE(OutData%TStC) + ALLOCATE(OutData%TStC(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%TStC.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i1 = LBOUND(OutData%TStC,1), UBOUND(OutData%TStC,1) + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Re_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Re_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Re_Buf = ReKiBuf( Re_Xferred:Re_Xferred+Buf_size-1 ) + Re_Xferred = Re_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Db_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Db_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Db_Buf = DbKiBuf( Db_Xferred:Db_Xferred+Buf_size-1 ) + Db_Xferred = Db_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Int_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Int_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) + Int_Xferred = Int_Xferred + Buf_size + END IF + CALL StC_UnpackMisc( Re_Buf, Db_Buf, Int_Buf, OutData%TStC(i1), ErrStat2, ErrMsg2 ) ! TStC + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) + IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) + IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) + END DO + END IF + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! SStC not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%SStC)) DEALLOCATE(OutData%SStC) + ALLOCATE(OutData%SStC(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%SStC.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i1 = LBOUND(OutData%SStC,1), UBOUND(OutData%SStC,1) + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Re_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Re_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Re_Buf = ReKiBuf( Re_Xferred:Re_Xferred+Buf_size-1 ) + Re_Xferred = Re_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Db_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Db_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Db_Buf = DbKiBuf( Db_Xferred:Db_Xferred+Buf_size-1 ) + Db_Xferred = Db_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Int_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Int_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) + Int_Xferred = Int_Xferred + Buf_size + END IF + CALL StC_UnpackMisc( Re_Buf, Db_Buf, Int_Buf, OutData%SStC(i1), ErrStat2, ErrMsg2 ) ! SStC + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) + IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) + IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) + END DO + END IF + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! u_BStC not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + i2_l = IntKiBuf( Int_Xferred ) + i2_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%u_BStC)) DEALLOCATE(OutData%u_BStC) + ALLOCATE(OutData%u_BStC(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%u_BStC.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i2 = LBOUND(OutData%u_BStC,2), UBOUND(OutData%u_BStC,2) + DO i1 = LBOUND(OutData%u_BStC,1), UBOUND(OutData%u_BStC,1) + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Re_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Re_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Re_Buf = ReKiBuf( Re_Xferred:Re_Xferred+Buf_size-1 ) + Re_Xferred = Re_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Db_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Db_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Db_Buf = DbKiBuf( Db_Xferred:Db_Xferred+Buf_size-1 ) + Db_Xferred = Db_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Int_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Int_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) + Int_Xferred = Int_Xferred + Buf_size + END IF + CALL StC_UnpackInput( Re_Buf, Db_Buf, Int_Buf, OutData%u_BStC(i1,i2), ErrStat2, ErrMsg2 ) ! u_BStC + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) + IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) + IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) + END DO + END DO + END IF + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! u_NStC not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + i2_l = IntKiBuf( Int_Xferred ) + i2_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%u_NStC)) DEALLOCATE(OutData%u_NStC) + ALLOCATE(OutData%u_NStC(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%u_NStC.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i2 = LBOUND(OutData%u_NStC,2), UBOUND(OutData%u_NStC,2) + DO i1 = LBOUND(OutData%u_NStC,1), UBOUND(OutData%u_NStC,1) + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Re_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Re_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Re_Buf = ReKiBuf( Re_Xferred:Re_Xferred+Buf_size-1 ) + Re_Xferred = Re_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Db_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Db_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Db_Buf = DbKiBuf( Db_Xferred:Db_Xferred+Buf_size-1 ) + Db_Xferred = Db_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Int_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Int_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) + Int_Xferred = Int_Xferred + Buf_size + END IF + CALL StC_UnpackInput( Re_Buf, Db_Buf, Int_Buf, OutData%u_NStC(i1,i2), ErrStat2, ErrMsg2 ) ! u_NStC + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) + IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) + IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) + END DO + END DO + END IF + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! u_TStC not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + i2_l = IntKiBuf( Int_Xferred ) + i2_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%u_TStC)) DEALLOCATE(OutData%u_TStC) + ALLOCATE(OutData%u_TStC(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%u_TStC.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i2 = LBOUND(OutData%u_TStC,2), UBOUND(OutData%u_TStC,2) + DO i1 = LBOUND(OutData%u_TStC,1), UBOUND(OutData%u_TStC,1) + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Re_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Re_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Re_Buf = ReKiBuf( Re_Xferred:Re_Xferred+Buf_size-1 ) + Re_Xferred = Re_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Db_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Db_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Db_Buf = DbKiBuf( Db_Xferred:Db_Xferred+Buf_size-1 ) + Db_Xferred = Db_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Int_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Int_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) + Int_Xferred = Int_Xferred + Buf_size + END IF + CALL StC_UnpackInput( Re_Buf, Db_Buf, Int_Buf, OutData%u_TStC(i1,i2), ErrStat2, ErrMsg2 ) ! u_TStC + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) + IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) + IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) + END DO + END DO + END IF + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! u_SStC not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + i2_l = IntKiBuf( Int_Xferred ) + i2_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%u_SStC)) DEALLOCATE(OutData%u_SStC) + ALLOCATE(OutData%u_SStC(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%u_SStC.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i2 = LBOUND(OutData%u_SStC,2), UBOUND(OutData%u_SStC,2) + DO i1 = LBOUND(OutData%u_SStC,1), UBOUND(OutData%u_SStC,1) Buf_size=IntKiBuf( Int_Xferred ) Int_Xferred = Int_Xferred + 1 IF(Buf_size > 0) THEN @@ -7478,49 +11340,30 @@ SUBROUTINE SrvD_UnPackMisc( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrMsg Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) Int_Xferred = Int_Xferred + Buf_size END IF - CALL SrvD_Unpackbladeddlltype( Re_Buf, Db_Buf, Int_Buf, OutData%dll_data, ErrStat2, ErrMsg2 ) ! dll_data + CALL StC_UnpackInput( Re_Buf, Db_Buf, Int_Buf, OutData%u_SStC(i1,i2), ErrStat2, ErrMsg2 ) ! u_SStC CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) - OutData%FirstWarn = TRANSFER(IntKiBuf(Int_Xferred), OutData%FirstWarn) - Int_Xferred = Int_Xferred + 1 - OutData%LastTimeFiltered = DbKiBuf(Db_Xferred) - Db_Xferred = Db_Xferred + 1 - IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! xd_BlPitchFilter not allocated - Int_Xferred = Int_Xferred + 1 - ELSE - Int_Xferred = Int_Xferred + 1 - i1_l = IntKiBuf( Int_Xferred ) - i1_u = IntKiBuf( Int_Xferred + 1) - Int_Xferred = Int_Xferred + 2 - IF (ALLOCATED(OutData%xd_BlPitchFilter)) DEALLOCATE(OutData%xd_BlPitchFilter) - ALLOCATE(OutData%xd_BlPitchFilter(i1_l:i1_u),STAT=ErrStat2) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%xd_BlPitchFilter.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - DO i1 = LBOUND(OutData%xd_BlPitchFilter,1), UBOUND(OutData%xd_BlPitchFilter,1) - OutData%xd_BlPitchFilter(i1) = ReKiBuf(Re_Xferred) - Re_Xferred = Re_Xferred + 1 - END DO + END DO + END DO END IF - IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! BStC not allocated + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! y_BStC not allocated Int_Xferred = Int_Xferred + 1 ELSE Int_Xferred = Int_Xferred + 1 i1_l = IntKiBuf( Int_Xferred ) i1_u = IntKiBuf( Int_Xferred + 1) Int_Xferred = Int_Xferred + 2 - IF (ALLOCATED(OutData%BStC)) DEALLOCATE(OutData%BStC) - ALLOCATE(OutData%BStC(i1_l:i1_u),STAT=ErrStat2) + IF (ALLOCATED(OutData%y_BStC)) DEALLOCATE(OutData%y_BStC) + ALLOCATE(OutData%y_BStC(i1_l:i1_u),STAT=ErrStat2) IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%BStC.', ErrStat, ErrMsg,RoutineName) + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%y_BStC.', ErrStat, ErrMsg,RoutineName) RETURN END IF - DO i1 = LBOUND(OutData%BStC,1), UBOUND(OutData%BStC,1) + DO i1 = LBOUND(OutData%y_BStC,1), UBOUND(OutData%y_BStC,1) Buf_size=IntKiBuf( Int_Xferred ) Int_Xferred = Int_Xferred + 1 IF(Buf_size > 0) THEN @@ -7554,7 +11397,7 @@ SUBROUTINE SrvD_UnPackMisc( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrMsg Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) Int_Xferred = Int_Xferred + Buf_size END IF - CALL StC_UnpackMisc( Re_Buf, Db_Buf, Int_Buf, OutData%BStC(i1), ErrStat2, ErrMsg2 ) ! BStC + CALL StC_UnpackOutput( Re_Buf, Db_Buf, Int_Buf, OutData%y_BStC(i1), ErrStat2, ErrMsg2 ) ! y_BStC CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN @@ -7563,20 +11406,20 @@ SUBROUTINE SrvD_UnPackMisc( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrMsg IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) END DO END IF - IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! NStC not allocated + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! y_NStC not allocated Int_Xferred = Int_Xferred + 1 ELSE Int_Xferred = Int_Xferred + 1 i1_l = IntKiBuf( Int_Xferred ) i1_u = IntKiBuf( Int_Xferred + 1) Int_Xferred = Int_Xferred + 2 - IF (ALLOCATED(OutData%NStC)) DEALLOCATE(OutData%NStC) - ALLOCATE(OutData%NStC(i1_l:i1_u),STAT=ErrStat2) + IF (ALLOCATED(OutData%y_NStC)) DEALLOCATE(OutData%y_NStC) + ALLOCATE(OutData%y_NStC(i1_l:i1_u),STAT=ErrStat2) IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%NStC.', ErrStat, ErrMsg,RoutineName) + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%y_NStC.', ErrStat, ErrMsg,RoutineName) RETURN END IF - DO i1 = LBOUND(OutData%NStC,1), UBOUND(OutData%NStC,1) + DO i1 = LBOUND(OutData%y_NStC,1), UBOUND(OutData%y_NStC,1) Buf_size=IntKiBuf( Int_Xferred ) Int_Xferred = Int_Xferred + 1 IF(Buf_size > 0) THEN @@ -7610,7 +11453,7 @@ SUBROUTINE SrvD_UnPackMisc( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrMsg Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) Int_Xferred = Int_Xferred + Buf_size END IF - CALL StC_UnpackMisc( Re_Buf, Db_Buf, Int_Buf, OutData%NStC(i1), ErrStat2, ErrMsg2 ) ! NStC + CALL StC_UnpackOutput( Re_Buf, Db_Buf, Int_Buf, OutData%y_NStC(i1), ErrStat2, ErrMsg2 ) ! y_NStC CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN @@ -7619,20 +11462,20 @@ SUBROUTINE SrvD_UnPackMisc( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrMsg IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) END DO END IF - IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! TStC not allocated + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! y_TStC not allocated Int_Xferred = Int_Xferred + 1 ELSE Int_Xferred = Int_Xferred + 1 i1_l = IntKiBuf( Int_Xferred ) i1_u = IntKiBuf( Int_Xferred + 1) Int_Xferred = Int_Xferred + 2 - IF (ALLOCATED(OutData%TStC)) DEALLOCATE(OutData%TStC) - ALLOCATE(OutData%TStC(i1_l:i1_u),STAT=ErrStat2) + IF (ALLOCATED(OutData%y_TStC)) DEALLOCATE(OutData%y_TStC) + ALLOCATE(OutData%y_TStC(i1_l:i1_u),STAT=ErrStat2) IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%TStC.', ErrStat, ErrMsg,RoutineName) + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%y_TStC.', ErrStat, ErrMsg,RoutineName) RETURN END IF - DO i1 = LBOUND(OutData%TStC,1), UBOUND(OutData%TStC,1) + DO i1 = LBOUND(OutData%y_TStC,1), UBOUND(OutData%y_TStC,1) Buf_size=IntKiBuf( Int_Xferred ) Int_Xferred = Int_Xferred + 1 IF(Buf_size > 0) THEN @@ -7666,7 +11509,7 @@ SUBROUTINE SrvD_UnPackMisc( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrMsg Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) Int_Xferred = Int_Xferred + Buf_size END IF - CALL StC_UnpackMisc( Re_Buf, Db_Buf, Int_Buf, OutData%TStC(i1), ErrStat2, ErrMsg2 ) ! TStC + CALL StC_UnpackOutput( Re_Buf, Db_Buf, Int_Buf, OutData%y_TStC(i1), ErrStat2, ErrMsg2 ) ! y_TStC CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN @@ -7675,20 +11518,20 @@ SUBROUTINE SrvD_UnPackMisc( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrMsg IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) END DO END IF - IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! SStC not allocated + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! y_SStC not allocated Int_Xferred = Int_Xferred + 1 ELSE Int_Xferred = Int_Xferred + 1 i1_l = IntKiBuf( Int_Xferred ) i1_u = IntKiBuf( Int_Xferred + 1) Int_Xferred = Int_Xferred + 2 - IF (ALLOCATED(OutData%SStC)) DEALLOCATE(OutData%SStC) - ALLOCATE(OutData%SStC(i1_l:i1_u),STAT=ErrStat2) + IF (ALLOCATED(OutData%y_SStC)) DEALLOCATE(OutData%y_SStC) + ALLOCATE(OutData%y_SStC(i1_l:i1_u),STAT=ErrStat2) IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%SStC.', ErrStat, ErrMsg,RoutineName) + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%y_SStC.', ErrStat, ErrMsg,RoutineName) RETURN END IF - DO i1 = LBOUND(OutData%SStC,1), UBOUND(OutData%SStC,1) + DO i1 = LBOUND(OutData%y_SStC,1), UBOUND(OutData%y_SStC,1) Buf_size=IntKiBuf( Int_Xferred ) Int_Xferred = Int_Xferred + 1 IF(Buf_size > 0) THEN @@ -7722,7 +11565,7 @@ SUBROUTINE SrvD_UnPackMisc( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrMsg Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) Int_Xferred = Int_Xferred + Buf_size END IF - CALL StC_UnpackMisc( Re_Buf, Db_Buf, Int_Buf, OutData%SStC(i1), ErrStat2, ErrMsg2 ) ! SStC + CALL StC_UnpackOutput( Re_Buf, Db_Buf, Int_Buf, OutData%y_SStC(i1), ErrStat2, ErrMsg2 ) ! y_SStC CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN @@ -7731,6 +11574,48 @@ SUBROUTINE SrvD_UnPackMisc( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrMsg IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) END DO END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Re_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Re_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Re_Buf = ReKiBuf( Re_Xferred:Re_Xferred+Buf_size-1 ) + Re_Xferred = Re_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Db_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Db_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Db_Buf = DbKiBuf( Db_Xferred:Db_Xferred+Buf_size-1 ) + Db_Xferred = Db_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Int_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Int_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) + Int_Xferred = Int_Xferred + Buf_size + END IF + CALL SrvD_Unpackmodulemaptype( Re_Buf, Db_Buf, Int_Buf, OutData%SrvD_MeshMap, ErrStat2, ErrMsg2 ) ! SrvD_MeshMap + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) + IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) + IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) + OutData%PrevTstepNcall = IntKiBuf(Int_Xferred) + Int_Xferred = Int_Xferred + 1 END SUBROUTINE SrvD_UnPackMisc SUBROUTINE SrvD_CopyParam( SrcParamData, DstParamData, CtrlCode, ErrStat, ErrMsg ) @@ -7868,6 +11753,12 @@ SUBROUTINE SrvD_CopyParam( SrcParamData, DstParamData, CtrlCode, ErrStat, ErrMsg DstParamData%NumNStC = SrcParamData%NumNStC DstParamData%NumTStC = SrcParamData%NumTStC DstParamData%NumSStC = SrcParamData%NumSStC + DstParamData%AfCmode = SrcParamData%AfCmode + DstParamData%AfC_Mean = SrcParamData%AfC_Mean + DstParamData%AfC_Amp = SrcParamData%AfC_Amp + DstParamData%AfC_Phase = SrcParamData%AfC_Phase + DstParamData%CCmode = SrcParamData%CCmode + DstParamData%StCCmode = SrcParamData%StCCmode DstParamData%NumOuts = SrcParamData%NumOuts DstParamData%NumOuts_DLL = SrcParamData%NumOuts_DLL DstParamData%RootName = SrcParamData%RootName @@ -7964,6 +11855,22 @@ SUBROUTINE SrvD_CopyParam( SrcParamData, DstParamData, CtrlCode, ErrStat, ErrMsg CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) IF (ErrStat>=AbortErrLev) RETURN ENDDO +ENDIF + DstParamData%InterpOrder = SrcParamData%InterpOrder + DstParamData%EXavrSWAP = SrcParamData%EXavrSWAP + DstParamData%NumCableControl = SrcParamData%NumCableControl + DstParamData%NumStC_Control = SrcParamData%NumStC_Control +IF (ALLOCATED(SrcParamData%StCMeasNumPerChan)) THEN + i1_l = LBOUND(SrcParamData%StCMeasNumPerChan,1) + i1_u = UBOUND(SrcParamData%StCMeasNumPerChan,1) + IF (.NOT. ALLOCATED(DstParamData%StCMeasNumPerChan)) THEN + ALLOCATE(DstParamData%StCMeasNumPerChan(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstParamData%StCMeasNumPerChan.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DstParamData%StCMeasNumPerChan = SrcParamData%StCMeasNumPerChan ENDIF DstParamData%UseSC = SrcParamData%UseSC END SUBROUTINE SrvD_CopyParam @@ -8022,6 +11929,9 @@ SUBROUTINE SrvD_DestroyParam( ParamData, ErrStat, ErrMsg ) CALL StC_DestroyParam( ParamData%SStC(i1), ErrStat, ErrMsg ) ENDDO DEALLOCATE(ParamData%SStC) +ENDIF +IF (ALLOCATED(ParamData%StCMeasNumPerChan)) THEN + DEALLOCATE(ParamData%StCMeasNumPerChan) ENDIF END SUBROUTINE SrvD_DestroyParam @@ -8145,6 +12055,12 @@ SUBROUTINE SrvD_PackParam( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg, Int_BufSz = Int_BufSz + 1 ! NumNStC Int_BufSz = Int_BufSz + 1 ! NumTStC Int_BufSz = Int_BufSz + 1 ! NumSStC + Int_BufSz = Int_BufSz + 1 ! AfCmode + Re_BufSz = Re_BufSz + 1 ! AfC_Mean + Re_BufSz = Re_BufSz + 1 ! AfC_Amp + Re_BufSz = Re_BufSz + 1 ! AfC_Phase + Int_BufSz = Int_BufSz + 1 ! CCmode + Int_BufSz = Int_BufSz + 1 ! StCCmode Int_BufSz = Int_BufSz + 1 ! NumOuts Int_BufSz = Int_BufSz + 1 ! NumOuts_DLL Int_BufSz = Int_BufSz + 1*LEN(InData%RootName) ! RootName @@ -8293,6 +12209,15 @@ SUBROUTINE SrvD_PackParam( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg, DEALLOCATE(Int_Buf) END IF END DO + END IF + Int_BufSz = Int_BufSz + 1 ! InterpOrder + Int_BufSz = Int_BufSz + 1 ! EXavrSWAP + Int_BufSz = Int_BufSz + 1 ! NumCableControl + Int_BufSz = Int_BufSz + 1 ! NumStC_Control + Int_BufSz = Int_BufSz + 1 ! StCMeasNumPerChan allocated yes/no + IF ( ALLOCATED(InData%StCMeasNumPerChan) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! StCMeasNumPerChan upper/lower bounds for each dimension + Int_BufSz = Int_BufSz + SIZE(InData%StCMeasNumPerChan) ! StCMeasNumPerChan END IF Int_BufSz = Int_BufSz + 1 ! UseSC IF ( Re_BufSz .GT. 0 ) THEN @@ -8517,6 +12442,18 @@ SUBROUTINE SrvD_PackParam( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg, Int_Xferred = Int_Xferred + 1 IntKiBuf(Int_Xferred) = InData%NumSStC Int_Xferred = Int_Xferred + 1 + IntKiBuf(Int_Xferred) = InData%AfCmode + Int_Xferred = Int_Xferred + 1 + ReKiBuf(Re_Xferred) = InData%AfC_Mean + Re_Xferred = Re_Xferred + 1 + ReKiBuf(Re_Xferred) = InData%AfC_Amp + Re_Xferred = Re_Xferred + 1 + ReKiBuf(Re_Xferred) = InData%AfC_Phase + Re_Xferred = Re_Xferred + 1 + IntKiBuf(Int_Xferred) = InData%CCmode + Int_Xferred = Int_Xferred + 1 + IntKiBuf(Int_Xferred) = InData%StCCmode + Int_Xferred = Int_Xferred + 1 IntKiBuf(Int_Xferred) = InData%NumOuts Int_Xferred = Int_Xferred + 1 IntKiBuf(Int_Xferred) = InData%NumOuts_DLL @@ -8785,6 +12722,29 @@ SUBROUTINE SrvD_PackParam( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg, IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 ENDIF END DO + END IF + IntKiBuf(Int_Xferred) = InData%InterpOrder + Int_Xferred = Int_Xferred + 1 + IntKiBuf(Int_Xferred) = TRANSFER(InData%EXavrSWAP, IntKiBuf(1)) + Int_Xferred = Int_Xferred + 1 + IntKiBuf(Int_Xferred) = InData%NumCableControl + Int_Xferred = Int_Xferred + 1 + IntKiBuf(Int_Xferred) = InData%NumStC_Control + Int_Xferred = Int_Xferred + 1 + IF ( .NOT. ALLOCATED(InData%StCMeasNumPerChan) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%StCMeasNumPerChan,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%StCMeasNumPerChan,1) + Int_Xferred = Int_Xferred + 2 + + DO i1 = LBOUND(InData%StCMeasNumPerChan,1), UBOUND(InData%StCMeasNumPerChan,1) + IntKiBuf(Int_Xferred) = InData%StCMeasNumPerChan(i1) + Int_Xferred = Int_Xferred + 1 + END DO END IF IntKiBuf(Int_Xferred) = TRANSFER(InData%UseSC, IntKiBuf(1)) Int_Xferred = Int_Xferred + 1 @@ -9027,6 +12987,18 @@ SUBROUTINE SrvD_UnPackParam( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrMs Int_Xferred = Int_Xferred + 1 OutData%NumSStC = IntKiBuf(Int_Xferred) Int_Xferred = Int_Xferred + 1 + OutData%AfCmode = IntKiBuf(Int_Xferred) + Int_Xferred = Int_Xferred + 1 + OutData%AfC_Mean = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + OutData%AfC_Amp = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + OutData%AfC_Phase = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + OutData%CCmode = IntKiBuf(Int_Xferred) + Int_Xferred = Int_Xferred + 1 + OutData%StCCmode = IntKiBuf(Int_Xferred) + Int_Xferred = Int_Xferred + 1 OutData%NumOuts = IntKiBuf(Int_Xferred) Int_Xferred = Int_Xferred + 1 OutData%NumOuts_DLL = IntKiBuf(Int_Xferred) @@ -9382,6 +13354,32 @@ SUBROUTINE SrvD_UnPackParam( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrMs IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) END DO + END IF + OutData%InterpOrder = IntKiBuf(Int_Xferred) + Int_Xferred = Int_Xferred + 1 + OutData%EXavrSWAP = TRANSFER(IntKiBuf(Int_Xferred), OutData%EXavrSWAP) + Int_Xferred = Int_Xferred + 1 + OutData%NumCableControl = IntKiBuf(Int_Xferred) + Int_Xferred = Int_Xferred + 1 + OutData%NumStC_Control = IntKiBuf(Int_Xferred) + Int_Xferred = Int_Xferred + 1 + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! StCMeasNumPerChan not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%StCMeasNumPerChan)) DEALLOCATE(OutData%StCMeasNumPerChan) + ALLOCATE(OutData%StCMeasNumPerChan(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%StCMeasNumPerChan.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i1 = LBOUND(OutData%StCMeasNumPerChan,1), UBOUND(OutData%StCMeasNumPerChan,1) + OutData%StCMeasNumPerChan(i1) = IntKiBuf(Int_Xferred) + Int_Xferred = Int_Xferred + 1 + END DO END IF OutData%UseSC = TRANSFER(IntKiBuf(Int_Xferred), OutData%UseSC) Int_Xferred = Int_Xferred + 1 @@ -9396,6 +13394,7 @@ SUBROUTINE SrvD_CopyInput( SrcInputData, DstInputData, CtrlCode, ErrStat, ErrMsg ! Local INTEGER(IntKi) :: i,j,k INTEGER(IntKi) :: i1, i1_l, i1_u ! bounds (upper/lower) for an array dimension 1 + INTEGER(IntKi) :: i2, i2_l, i2_u ! bounds (upper/lower) for an array dimension 2 INTEGER(IntKi) :: ErrStat2 CHARACTER(ErrMsgLen) :: ErrMsg2 CHARACTER(*), PARAMETER :: RoutineName = 'SrvD_CopyInput' @@ -9436,6 +13435,42 @@ SUBROUTINE SrvD_CopyInput( SrcInputData, DstInputData, CtrlCode, ErrStat, ErrMsg DstInputData%ExternalGenTrq = SrcInputData%ExternalGenTrq DstInputData%ExternalElecPwr = SrcInputData%ExternalElecPwr DstInputData%ExternalHSSBrFrac = SrcInputData%ExternalHSSBrFrac +IF (ALLOCATED(SrcInputData%ExternalBlAirfoilCom)) THEN + i1_l = LBOUND(SrcInputData%ExternalBlAirfoilCom,1) + i1_u = UBOUND(SrcInputData%ExternalBlAirfoilCom,1) + IF (.NOT. ALLOCATED(DstInputData%ExternalBlAirfoilCom)) THEN + ALLOCATE(DstInputData%ExternalBlAirfoilCom(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstInputData%ExternalBlAirfoilCom.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DstInputData%ExternalBlAirfoilCom = SrcInputData%ExternalBlAirfoilCom +ENDIF +IF (ALLOCATED(SrcInputData%ExternalCableDeltaL)) THEN + i1_l = LBOUND(SrcInputData%ExternalCableDeltaL,1) + i1_u = UBOUND(SrcInputData%ExternalCableDeltaL,1) + IF (.NOT. ALLOCATED(DstInputData%ExternalCableDeltaL)) THEN + ALLOCATE(DstInputData%ExternalCableDeltaL(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstInputData%ExternalCableDeltaL.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DstInputData%ExternalCableDeltaL = SrcInputData%ExternalCableDeltaL +ENDIF +IF (ALLOCATED(SrcInputData%ExternalCableDeltaLdot)) THEN + i1_l = LBOUND(SrcInputData%ExternalCableDeltaLdot,1) + i1_u = UBOUND(SrcInputData%ExternalCableDeltaLdot,1) + IF (.NOT. ALLOCATED(DstInputData%ExternalCableDeltaLdot)) THEN + ALLOCATE(DstInputData%ExternalCableDeltaLdot(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstInputData%ExternalCableDeltaLdot.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DstInputData%ExternalCableDeltaLdot = SrcInputData%ExternalCableDeltaLdot +ENDIF DstInputData%TwrAccel = SrcInputData%TwrAccel DstInputData%YawErr = SrcInputData%YawErr DstInputData%WindDir = SrcInputData%WindDir @@ -9457,105 +13492,112 @@ SUBROUTINE SrvD_CopyInput( SrcInputData, DstInputData, CtrlCode, ErrStat, ErrMsg DstInputData%RotPwr = SrcInputData%RotPwr DstInputData%HorWindV = SrcInputData%HorWindV DstInputData%YawAngle = SrcInputData%YawAngle -IF (ALLOCATED(SrcInputData%BStC)) THEN - i1_l = LBOUND(SrcInputData%BStC,1) - i1_u = UBOUND(SrcInputData%BStC,1) - IF (.NOT. ALLOCATED(DstInputData%BStC)) THEN - ALLOCATE(DstInputData%BStC(i1_l:i1_u),STAT=ErrStat2) +IF (ALLOCATED(SrcInputData%fromSC)) THEN + i1_l = LBOUND(SrcInputData%fromSC,1) + i1_u = UBOUND(SrcInputData%fromSC,1) + IF (.NOT. ALLOCATED(DstInputData%fromSC)) THEN + ALLOCATE(DstInputData%fromSC(i1_l:i1_u),STAT=ErrStat2) IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating DstInputData%BStC.', ErrStat, ErrMsg,RoutineName) + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstInputData%fromSC.', ErrStat, ErrMsg,RoutineName) RETURN END IF END IF - DO i1 = LBOUND(SrcInputData%BStC,1), UBOUND(SrcInputData%BStC,1) - CALL StC_CopyInput( SrcInputData%BStC(i1), DstInputData%BStC(i1), CtrlCode, ErrStat2, ErrMsg2 ) - CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) - IF (ErrStat>=AbortErrLev) RETURN - ENDDO + DstInputData%fromSC = SrcInputData%fromSC ENDIF -IF (ALLOCATED(SrcInputData%NStC)) THEN - i1_l = LBOUND(SrcInputData%NStC,1) - i1_u = UBOUND(SrcInputData%NStC,1) - IF (.NOT. ALLOCATED(DstInputData%NStC)) THEN - ALLOCATE(DstInputData%NStC(i1_l:i1_u),STAT=ErrStat2) +IF (ALLOCATED(SrcInputData%fromSCglob)) THEN + i1_l = LBOUND(SrcInputData%fromSCglob,1) + i1_u = UBOUND(SrcInputData%fromSCglob,1) + IF (.NOT. ALLOCATED(DstInputData%fromSCglob)) THEN + ALLOCATE(DstInputData%fromSCglob(i1_l:i1_u),STAT=ErrStat2) IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating DstInputData%NStC.', ErrStat, ErrMsg,RoutineName) + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstInputData%fromSCglob.', ErrStat, ErrMsg,RoutineName) RETURN END IF END IF - DO i1 = LBOUND(SrcInputData%NStC,1), UBOUND(SrcInputData%NStC,1) - CALL StC_CopyInput( SrcInputData%NStC(i1), DstInputData%NStC(i1), CtrlCode, ErrStat2, ErrMsg2 ) - CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) - IF (ErrStat>=AbortErrLev) RETURN - ENDDO + DstInputData%fromSCglob = SrcInputData%fromSCglob ENDIF -IF (ALLOCATED(SrcInputData%TStC)) THEN - i1_l = LBOUND(SrcInputData%TStC,1) - i1_u = UBOUND(SrcInputData%TStC,1) - IF (.NOT. ALLOCATED(DstInputData%TStC)) THEN - ALLOCATE(DstInputData%TStC(i1_l:i1_u),STAT=ErrStat2) +IF (ALLOCATED(SrcInputData%Lidar)) THEN + i1_l = LBOUND(SrcInputData%Lidar,1) + i1_u = UBOUND(SrcInputData%Lidar,1) + IF (.NOT. ALLOCATED(DstInputData%Lidar)) THEN + ALLOCATE(DstInputData%Lidar(i1_l:i1_u),STAT=ErrStat2) IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating DstInputData%TStC.', ErrStat, ErrMsg,RoutineName) + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstInputData%Lidar.', ErrStat, ErrMsg,RoutineName) RETURN END IF END IF - DO i1 = LBOUND(SrcInputData%TStC,1), UBOUND(SrcInputData%TStC,1) - CALL StC_CopyInput( SrcInputData%TStC(i1), DstInputData%TStC(i1), CtrlCode, ErrStat2, ErrMsg2 ) - CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) - IF (ErrStat>=AbortErrLev) RETURN - ENDDO + DstInputData%Lidar = SrcInputData%Lidar ENDIF -IF (ALLOCATED(SrcInputData%SStC)) THEN - i1_l = LBOUND(SrcInputData%SStC,1) - i1_u = UBOUND(SrcInputData%SStC,1) - IF (.NOT. ALLOCATED(DstInputData%SStC)) THEN - ALLOCATE(DstInputData%SStC(i1_l:i1_u),STAT=ErrStat2) + CALL MeshCopy( SrcInputData%PtfmMotionMesh, DstInputData%PtfmMotionMesh, CtrlCode, ErrStat2, ErrMsg2 ) + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat>=AbortErrLev) RETURN +IF (ALLOCATED(SrcInputData%BStCMotionMesh)) THEN + i1_l = LBOUND(SrcInputData%BStCMotionMesh,1) + i1_u = UBOUND(SrcInputData%BStCMotionMesh,1) + i2_l = LBOUND(SrcInputData%BStCMotionMesh,2) + i2_u = UBOUND(SrcInputData%BStCMotionMesh,2) + IF (.NOT. ALLOCATED(DstInputData%BStCMotionMesh)) THEN + ALLOCATE(DstInputData%BStCMotionMesh(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating DstInputData%SStC.', ErrStat, ErrMsg,RoutineName) + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstInputData%BStCMotionMesh.', ErrStat, ErrMsg,RoutineName) RETURN END IF END IF - DO i1 = LBOUND(SrcInputData%SStC,1), UBOUND(SrcInputData%SStC,1) - CALL StC_CopyInput( SrcInputData%SStC(i1), DstInputData%SStC(i1), CtrlCode, ErrStat2, ErrMsg2 ) - CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) + DO i2 = LBOUND(SrcInputData%BStCMotionMesh,2), UBOUND(SrcInputData%BStCMotionMesh,2) + DO i1 = LBOUND(SrcInputData%BStCMotionMesh,1), UBOUND(SrcInputData%BStCMotionMesh,1) + CALL MeshCopy( SrcInputData%BStCMotionMesh(i1,i2), DstInputData%BStCMotionMesh(i1,i2), CtrlCode, ErrStat2, ErrMsg2 ) + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat>=AbortErrLev) RETURN ENDDO + ENDDO ENDIF -IF (ALLOCATED(SrcInputData%fromSC)) THEN - i1_l = LBOUND(SrcInputData%fromSC,1) - i1_u = UBOUND(SrcInputData%fromSC,1) - IF (.NOT. ALLOCATED(DstInputData%fromSC)) THEN - ALLOCATE(DstInputData%fromSC(i1_l:i1_u),STAT=ErrStat2) +IF (ALLOCATED(SrcInputData%NStCMotionMesh)) THEN + i1_l = LBOUND(SrcInputData%NStCMotionMesh,1) + i1_u = UBOUND(SrcInputData%NStCMotionMesh,1) + IF (.NOT. ALLOCATED(DstInputData%NStCMotionMesh)) THEN + ALLOCATE(DstInputData%NStCMotionMesh(i1_l:i1_u),STAT=ErrStat2) IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating DstInputData%fromSC.', ErrStat, ErrMsg,RoutineName) + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstInputData%NStCMotionMesh.', ErrStat, ErrMsg,RoutineName) RETURN END IF END IF - DstInputData%fromSC = SrcInputData%fromSC + DO i1 = LBOUND(SrcInputData%NStCMotionMesh,1), UBOUND(SrcInputData%NStCMotionMesh,1) + CALL MeshCopy( SrcInputData%NStCMotionMesh(i1), DstInputData%NStCMotionMesh(i1), CtrlCode, ErrStat2, ErrMsg2 ) + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat>=AbortErrLev) RETURN + ENDDO ENDIF -IF (ALLOCATED(SrcInputData%fromSCglob)) THEN - i1_l = LBOUND(SrcInputData%fromSCglob,1) - i1_u = UBOUND(SrcInputData%fromSCglob,1) - IF (.NOT. ALLOCATED(DstInputData%fromSCglob)) THEN - ALLOCATE(DstInputData%fromSCglob(i1_l:i1_u),STAT=ErrStat2) +IF (ALLOCATED(SrcInputData%TStCMotionMesh)) THEN + i1_l = LBOUND(SrcInputData%TStCMotionMesh,1) + i1_u = UBOUND(SrcInputData%TStCMotionMesh,1) + IF (.NOT. ALLOCATED(DstInputData%TStCMotionMesh)) THEN + ALLOCATE(DstInputData%TStCMotionMesh(i1_l:i1_u),STAT=ErrStat2) IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating DstInputData%fromSCglob.', ErrStat, ErrMsg,RoutineName) + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstInputData%TStCMotionMesh.', ErrStat, ErrMsg,RoutineName) RETURN END IF END IF - DstInputData%fromSCglob = SrcInputData%fromSCglob + DO i1 = LBOUND(SrcInputData%TStCMotionMesh,1), UBOUND(SrcInputData%TStCMotionMesh,1) + CALL MeshCopy( SrcInputData%TStCMotionMesh(i1), DstInputData%TStCMotionMesh(i1), CtrlCode, ErrStat2, ErrMsg2 ) + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat>=AbortErrLev) RETURN + ENDDO ENDIF -IF (ALLOCATED(SrcInputData%Lidar)) THEN - i1_l = LBOUND(SrcInputData%Lidar,1) - i1_u = UBOUND(SrcInputData%Lidar,1) - IF (.NOT. ALLOCATED(DstInputData%Lidar)) THEN - ALLOCATE(DstInputData%Lidar(i1_l:i1_u),STAT=ErrStat2) +IF (ALLOCATED(SrcInputData%SStCMotionMesh)) THEN + i1_l = LBOUND(SrcInputData%SStCMotionMesh,1) + i1_u = UBOUND(SrcInputData%SStCMotionMesh,1) + IF (.NOT. ALLOCATED(DstInputData%SStCMotionMesh)) THEN + ALLOCATE(DstInputData%SStCMotionMesh(i1_l:i1_u),STAT=ErrStat2) IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating DstInputData%Lidar.', ErrStat, ErrMsg,RoutineName) + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstInputData%SStCMotionMesh.', ErrStat, ErrMsg,RoutineName) RETURN END IF END IF - DstInputData%Lidar = SrcInputData%Lidar + DO i1 = LBOUND(SrcInputData%SStCMotionMesh,1), UBOUND(SrcInputData%SStCMotionMesh,1) + CALL MeshCopy( SrcInputData%SStCMotionMesh(i1), DstInputData%SStCMotionMesh(i1), CtrlCode, ErrStat2, ErrMsg2 ) + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat>=AbortErrLev) RETURN + ENDDO ENDIF END SUBROUTINE SrvD_CopyInput @@ -9574,29 +13616,14 @@ SUBROUTINE SrvD_DestroyInput( InputData, ErrStat, ErrMsg ) IF (ALLOCATED(InputData%ExternalBlPitchCom)) THEN DEALLOCATE(InputData%ExternalBlPitchCom) ENDIF -IF (ALLOCATED(InputData%BStC)) THEN -DO i1 = LBOUND(InputData%BStC,1), UBOUND(InputData%BStC,1) - CALL StC_DestroyInput( InputData%BStC(i1), ErrStat, ErrMsg ) -ENDDO - DEALLOCATE(InputData%BStC) -ENDIF -IF (ALLOCATED(InputData%NStC)) THEN -DO i1 = LBOUND(InputData%NStC,1), UBOUND(InputData%NStC,1) - CALL StC_DestroyInput( InputData%NStC(i1), ErrStat, ErrMsg ) -ENDDO - DEALLOCATE(InputData%NStC) +IF (ALLOCATED(InputData%ExternalBlAirfoilCom)) THEN + DEALLOCATE(InputData%ExternalBlAirfoilCom) ENDIF -IF (ALLOCATED(InputData%TStC)) THEN -DO i1 = LBOUND(InputData%TStC,1), UBOUND(InputData%TStC,1) - CALL StC_DestroyInput( InputData%TStC(i1), ErrStat, ErrMsg ) -ENDDO - DEALLOCATE(InputData%TStC) +IF (ALLOCATED(InputData%ExternalCableDeltaL)) THEN + DEALLOCATE(InputData%ExternalCableDeltaL) ENDIF -IF (ALLOCATED(InputData%SStC)) THEN -DO i1 = LBOUND(InputData%SStC,1), UBOUND(InputData%SStC,1) - CALL StC_DestroyInput( InputData%SStC(i1), ErrStat, ErrMsg ) -ENDDO - DEALLOCATE(InputData%SStC) +IF (ALLOCATED(InputData%ExternalCableDeltaLdot)) THEN + DEALLOCATE(InputData%ExternalCableDeltaLdot) ENDIF IF (ALLOCATED(InputData%fromSC)) THEN DEALLOCATE(InputData%fromSC) @@ -9606,6 +13633,33 @@ SUBROUTINE SrvD_DestroyInput( InputData, ErrStat, ErrMsg ) ENDIF IF (ALLOCATED(InputData%Lidar)) THEN DEALLOCATE(InputData%Lidar) +ENDIF + CALL MeshDestroy( InputData%PtfmMotionMesh, ErrStat, ErrMsg ) +IF (ALLOCATED(InputData%BStCMotionMesh)) THEN +DO i2 = LBOUND(InputData%BStCMotionMesh,2), UBOUND(InputData%BStCMotionMesh,2) +DO i1 = LBOUND(InputData%BStCMotionMesh,1), UBOUND(InputData%BStCMotionMesh,1) + CALL MeshDestroy( InputData%BStCMotionMesh(i1,i2), ErrStat, ErrMsg ) +ENDDO +ENDDO + DEALLOCATE(InputData%BStCMotionMesh) +ENDIF +IF (ALLOCATED(InputData%NStCMotionMesh)) THEN +DO i1 = LBOUND(InputData%NStCMotionMesh,1), UBOUND(InputData%NStCMotionMesh,1) + CALL MeshDestroy( InputData%NStCMotionMesh(i1), ErrStat, ErrMsg ) +ENDDO + DEALLOCATE(InputData%NStCMotionMesh) +ENDIF +IF (ALLOCATED(InputData%TStCMotionMesh)) THEN +DO i1 = LBOUND(InputData%TStCMotionMesh,1), UBOUND(InputData%TStCMotionMesh,1) + CALL MeshDestroy( InputData%TStCMotionMesh(i1), ErrStat, ErrMsg ) +ENDDO + DEALLOCATE(InputData%TStCMotionMesh) +ENDIF +IF (ALLOCATED(InputData%SStCMotionMesh)) THEN +DO i1 = LBOUND(InputData%SStCMotionMesh,1), UBOUND(InputData%SStCMotionMesh,1) + CALL MeshDestroy( InputData%SStCMotionMesh(i1), ErrStat, ErrMsg ) +ENDDO + DEALLOCATE(InputData%SStCMotionMesh) ENDIF END SUBROUTINE SrvD_DestroyInput @@ -9664,6 +13718,21 @@ SUBROUTINE SrvD_PackInput( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg, Re_BufSz = Re_BufSz + 1 ! ExternalGenTrq Re_BufSz = Re_BufSz + 1 ! ExternalElecPwr Re_BufSz = Re_BufSz + 1 ! ExternalHSSBrFrac + Int_BufSz = Int_BufSz + 1 ! ExternalBlAirfoilCom allocated yes/no + IF ( ALLOCATED(InData%ExternalBlAirfoilCom) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! ExternalBlAirfoilCom upper/lower bounds for each dimension + Re_BufSz = Re_BufSz + SIZE(InData%ExternalBlAirfoilCom) ! ExternalBlAirfoilCom + END IF + Int_BufSz = Int_BufSz + 1 ! ExternalCableDeltaL allocated yes/no + IF ( ALLOCATED(InData%ExternalCableDeltaL) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! ExternalCableDeltaL upper/lower bounds for each dimension + Re_BufSz = Re_BufSz + SIZE(InData%ExternalCableDeltaL) ! ExternalCableDeltaL + END IF + Int_BufSz = Int_BufSz + 1 ! ExternalCableDeltaLdot allocated yes/no + IF ( ALLOCATED(InData%ExternalCableDeltaLdot) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! ExternalCableDeltaLdot upper/lower bounds for each dimension + Re_BufSz = Re_BufSz + SIZE(InData%ExternalCableDeltaLdot) ! ExternalCableDeltaLdot + END IF Re_BufSz = Re_BufSz + 1 ! TwrAccel Re_BufSz = Re_BufSz + 1 ! YawErr Re_BufSz = Re_BufSz + 1 ! WindDir @@ -9685,114 +13754,133 @@ SUBROUTINE SrvD_PackInput( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg, Re_BufSz = Re_BufSz + 1 ! RotPwr Re_BufSz = Re_BufSz + 1 ! HorWindV Re_BufSz = Re_BufSz + 1 ! YawAngle - Int_BufSz = Int_BufSz + 1 ! BStC allocated yes/no - IF ( ALLOCATED(InData%BStC) ) THEN - Int_BufSz = Int_BufSz + 2*1 ! BStC upper/lower bounds for each dimension + Int_BufSz = Int_BufSz + 1 ! fromSC allocated yes/no + IF ( ALLOCATED(InData%fromSC) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! fromSC upper/lower bounds for each dimension + Re_BufSz = Re_BufSz + SIZE(InData%fromSC) ! fromSC + END IF + Int_BufSz = Int_BufSz + 1 ! fromSCglob allocated yes/no + IF ( ALLOCATED(InData%fromSCglob) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! fromSCglob upper/lower bounds for each dimension + Re_BufSz = Re_BufSz + SIZE(InData%fromSCglob) ! fromSCglob + END IF + Int_BufSz = Int_BufSz + 1 ! Lidar allocated yes/no + IF ( ALLOCATED(InData%Lidar) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! Lidar upper/lower bounds for each dimension + Re_BufSz = Re_BufSz + SIZE(InData%Lidar) ! Lidar + END IF ! Allocate buffers for subtypes, if any (we'll get sizes from these) - DO i1 = LBOUND(InData%BStC,1), UBOUND(InData%BStC,1) - Int_BufSz = Int_BufSz + 3 ! BStC: size of buffers for each call to pack subtype - CALL StC_PackInput( Re_Buf, Db_Buf, Int_Buf, InData%BStC(i1), ErrStat2, ErrMsg2, .TRUE. ) ! BStC + Int_BufSz = Int_BufSz + 3 ! PtfmMotionMesh: size of buffers for each call to pack subtype + CALL MeshPack( InData%PtfmMotionMesh, Re_Buf, Db_Buf, Int_Buf, ErrStat2, ErrMsg2, .TRUE. ) ! PtfmMotionMesh CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN - IF(ALLOCATED(Re_Buf)) THEN ! BStC + IF(ALLOCATED(Re_Buf)) THEN ! PtfmMotionMesh Re_BufSz = Re_BufSz + SIZE( Re_Buf ) DEALLOCATE(Re_Buf) END IF - IF(ALLOCATED(Db_Buf)) THEN ! BStC + IF(ALLOCATED(Db_Buf)) THEN ! PtfmMotionMesh Db_BufSz = Db_BufSz + SIZE( Db_Buf ) DEALLOCATE(Db_Buf) END IF - IF(ALLOCATED(Int_Buf)) THEN ! BStC + IF(ALLOCATED(Int_Buf)) THEN ! PtfmMotionMesh + Int_BufSz = Int_BufSz + SIZE( Int_Buf ) + DEALLOCATE(Int_Buf) + END IF + Int_BufSz = Int_BufSz + 1 ! BStCMotionMesh allocated yes/no + IF ( ALLOCATED(InData%BStCMotionMesh) ) THEN + Int_BufSz = Int_BufSz + 2*2 ! BStCMotionMesh upper/lower bounds for each dimension + DO i2 = LBOUND(InData%BStCMotionMesh,2), UBOUND(InData%BStCMotionMesh,2) + DO i1 = LBOUND(InData%BStCMotionMesh,1), UBOUND(InData%BStCMotionMesh,1) + Int_BufSz = Int_BufSz + 3 ! BStCMotionMesh: size of buffers for each call to pack subtype + CALL MeshPack( InData%BStCMotionMesh(i1,i2), Re_Buf, Db_Buf, Int_Buf, ErrStat2, ErrMsg2, .TRUE. ) ! BStCMotionMesh + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf)) THEN ! BStCMotionMesh + Re_BufSz = Re_BufSz + SIZE( Re_Buf ) + DEALLOCATE(Re_Buf) + END IF + IF(ALLOCATED(Db_Buf)) THEN ! BStCMotionMesh + Db_BufSz = Db_BufSz + SIZE( Db_Buf ) + DEALLOCATE(Db_Buf) + END IF + IF(ALLOCATED(Int_Buf)) THEN ! BStCMotionMesh Int_BufSz = Int_BufSz + SIZE( Int_Buf ) DEALLOCATE(Int_Buf) END IF END DO + END DO END IF - Int_BufSz = Int_BufSz + 1 ! NStC allocated yes/no - IF ( ALLOCATED(InData%NStC) ) THEN - Int_BufSz = Int_BufSz + 2*1 ! NStC upper/lower bounds for each dimension - DO i1 = LBOUND(InData%NStC,1), UBOUND(InData%NStC,1) - Int_BufSz = Int_BufSz + 3 ! NStC: size of buffers for each call to pack subtype - CALL StC_PackInput( Re_Buf, Db_Buf, Int_Buf, InData%NStC(i1), ErrStat2, ErrMsg2, .TRUE. ) ! NStC + Int_BufSz = Int_BufSz + 1 ! NStCMotionMesh allocated yes/no + IF ( ALLOCATED(InData%NStCMotionMesh) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! NStCMotionMesh upper/lower bounds for each dimension + DO i1 = LBOUND(InData%NStCMotionMesh,1), UBOUND(InData%NStCMotionMesh,1) + Int_BufSz = Int_BufSz + 3 ! NStCMotionMesh: size of buffers for each call to pack subtype + CALL MeshPack( InData%NStCMotionMesh(i1), Re_Buf, Db_Buf, Int_Buf, ErrStat2, ErrMsg2, .TRUE. ) ! NStCMotionMesh CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN - IF(ALLOCATED(Re_Buf)) THEN ! NStC + IF(ALLOCATED(Re_Buf)) THEN ! NStCMotionMesh Re_BufSz = Re_BufSz + SIZE( Re_Buf ) DEALLOCATE(Re_Buf) END IF - IF(ALLOCATED(Db_Buf)) THEN ! NStC + IF(ALLOCATED(Db_Buf)) THEN ! NStCMotionMesh Db_BufSz = Db_BufSz + SIZE( Db_Buf ) DEALLOCATE(Db_Buf) END IF - IF(ALLOCATED(Int_Buf)) THEN ! NStC + IF(ALLOCATED(Int_Buf)) THEN ! NStCMotionMesh Int_BufSz = Int_BufSz + SIZE( Int_Buf ) DEALLOCATE(Int_Buf) END IF END DO END IF - Int_BufSz = Int_BufSz + 1 ! TStC allocated yes/no - IF ( ALLOCATED(InData%TStC) ) THEN - Int_BufSz = Int_BufSz + 2*1 ! TStC upper/lower bounds for each dimension - DO i1 = LBOUND(InData%TStC,1), UBOUND(InData%TStC,1) - Int_BufSz = Int_BufSz + 3 ! TStC: size of buffers for each call to pack subtype - CALL StC_PackInput( Re_Buf, Db_Buf, Int_Buf, InData%TStC(i1), ErrStat2, ErrMsg2, .TRUE. ) ! TStC + Int_BufSz = Int_BufSz + 1 ! TStCMotionMesh allocated yes/no + IF ( ALLOCATED(InData%TStCMotionMesh) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! TStCMotionMesh upper/lower bounds for each dimension + DO i1 = LBOUND(InData%TStCMotionMesh,1), UBOUND(InData%TStCMotionMesh,1) + Int_BufSz = Int_BufSz + 3 ! TStCMotionMesh: size of buffers for each call to pack subtype + CALL MeshPack( InData%TStCMotionMesh(i1), Re_Buf, Db_Buf, Int_Buf, ErrStat2, ErrMsg2, .TRUE. ) ! TStCMotionMesh CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN - IF(ALLOCATED(Re_Buf)) THEN ! TStC + IF(ALLOCATED(Re_Buf)) THEN ! TStCMotionMesh Re_BufSz = Re_BufSz + SIZE( Re_Buf ) DEALLOCATE(Re_Buf) END IF - IF(ALLOCATED(Db_Buf)) THEN ! TStC + IF(ALLOCATED(Db_Buf)) THEN ! TStCMotionMesh Db_BufSz = Db_BufSz + SIZE( Db_Buf ) DEALLOCATE(Db_Buf) END IF - IF(ALLOCATED(Int_Buf)) THEN ! TStC + IF(ALLOCATED(Int_Buf)) THEN ! TStCMotionMesh Int_BufSz = Int_BufSz + SIZE( Int_Buf ) DEALLOCATE(Int_Buf) END IF END DO END IF - Int_BufSz = Int_BufSz + 1 ! SStC allocated yes/no - IF ( ALLOCATED(InData%SStC) ) THEN - Int_BufSz = Int_BufSz + 2*1 ! SStC upper/lower bounds for each dimension - DO i1 = LBOUND(InData%SStC,1), UBOUND(InData%SStC,1) - Int_BufSz = Int_BufSz + 3 ! SStC: size of buffers for each call to pack subtype - CALL StC_PackInput( Re_Buf, Db_Buf, Int_Buf, InData%SStC(i1), ErrStat2, ErrMsg2, .TRUE. ) ! SStC + Int_BufSz = Int_BufSz + 1 ! SStCMotionMesh allocated yes/no + IF ( ALLOCATED(InData%SStCMotionMesh) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! SStCMotionMesh upper/lower bounds for each dimension + DO i1 = LBOUND(InData%SStCMotionMesh,1), UBOUND(InData%SStCMotionMesh,1) + Int_BufSz = Int_BufSz + 3 ! SStCMotionMesh: size of buffers for each call to pack subtype + CALL MeshPack( InData%SStCMotionMesh(i1), Re_Buf, Db_Buf, Int_Buf, ErrStat2, ErrMsg2, .TRUE. ) ! SStCMotionMesh CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN - IF(ALLOCATED(Re_Buf)) THEN ! SStC + IF(ALLOCATED(Re_Buf)) THEN ! SStCMotionMesh Re_BufSz = Re_BufSz + SIZE( Re_Buf ) DEALLOCATE(Re_Buf) END IF - IF(ALLOCATED(Db_Buf)) THEN ! SStC + IF(ALLOCATED(Db_Buf)) THEN ! SStCMotionMesh Db_BufSz = Db_BufSz + SIZE( Db_Buf ) DEALLOCATE(Db_Buf) END IF - IF(ALLOCATED(Int_Buf)) THEN ! SStC + IF(ALLOCATED(Int_Buf)) THEN ! SStCMotionMesh Int_BufSz = Int_BufSz + SIZE( Int_Buf ) DEALLOCATE(Int_Buf) END IF END DO END IF - Int_BufSz = Int_BufSz + 1 ! fromSC allocated yes/no - IF ( ALLOCATED(InData%fromSC) ) THEN - Int_BufSz = Int_BufSz + 2*1 ! fromSC upper/lower bounds for each dimension - Re_BufSz = Re_BufSz + SIZE(InData%fromSC) ! fromSC - END IF - Int_BufSz = Int_BufSz + 1 ! fromSCglob allocated yes/no - IF ( ALLOCATED(InData%fromSCglob) ) THEN - Int_BufSz = Int_BufSz + 2*1 ! fromSCglob upper/lower bounds for each dimension - Re_BufSz = Re_BufSz + SIZE(InData%fromSCglob) ! fromSCglob - END IF - Int_BufSz = Int_BufSz + 1 ! Lidar allocated yes/no - IF ( ALLOCATED(InData%Lidar) ) THEN - Int_BufSz = Int_BufSz + 2*1 ! Lidar upper/lower bounds for each dimension - Re_BufSz = Re_BufSz + SIZE(InData%Lidar) ! Lidar - END IF IF ( Re_BufSz .GT. 0 ) THEN ALLOCATE( ReKiBuf( Re_BufSz ), STAT=ErrStat2 ) IF (ErrStat2 /= 0) THEN @@ -9870,6 +13958,51 @@ SUBROUTINE SrvD_PackInput( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg, Re_Xferred = Re_Xferred + 1 ReKiBuf(Re_Xferred) = InData%ExternalHSSBrFrac Re_Xferred = Re_Xferred + 1 + IF ( .NOT. ALLOCATED(InData%ExternalBlAirfoilCom) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%ExternalBlAirfoilCom,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%ExternalBlAirfoilCom,1) + Int_Xferred = Int_Xferred + 2 + + DO i1 = LBOUND(InData%ExternalBlAirfoilCom,1), UBOUND(InData%ExternalBlAirfoilCom,1) + ReKiBuf(Re_Xferred) = InData%ExternalBlAirfoilCom(i1) + Re_Xferred = Re_Xferred + 1 + END DO + END IF + IF ( .NOT. ALLOCATED(InData%ExternalCableDeltaL) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%ExternalCableDeltaL,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%ExternalCableDeltaL,1) + Int_Xferred = Int_Xferred + 2 + + DO i1 = LBOUND(InData%ExternalCableDeltaL,1), UBOUND(InData%ExternalCableDeltaL,1) + ReKiBuf(Re_Xferred) = InData%ExternalCableDeltaL(i1) + Re_Xferred = Re_Xferred + 1 + END DO + END IF + IF ( .NOT. ALLOCATED(InData%ExternalCableDeltaLdot) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%ExternalCableDeltaLdot,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%ExternalCableDeltaLdot,1) + Int_Xferred = Int_Xferred + 2 + + DO i1 = LBOUND(InData%ExternalCableDeltaLdot,1), UBOUND(InData%ExternalCableDeltaLdot,1) + ReKiBuf(Re_Xferred) = InData%ExternalCableDeltaLdot(i1) + Re_Xferred = Re_Xferred + 1 + END DO + END IF ReKiBuf(Re_Xferred) = InData%TwrAccel Re_Xferred = Re_Xferred + 1 ReKiBuf(Re_Xferred) = InData%YawErr @@ -9916,18 +14049,52 @@ SUBROUTINE SrvD_PackInput( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg, Re_Xferred = Re_Xferred + 1 ReKiBuf(Re_Xferred) = InData%YawAngle Re_Xferred = Re_Xferred + 1 - IF ( .NOT. ALLOCATED(InData%BStC) ) THEN + IF ( .NOT. ALLOCATED(InData%fromSC) ) THEN IntKiBuf( Int_Xferred ) = 0 Int_Xferred = Int_Xferred + 1 ELSE IntKiBuf( Int_Xferred ) = 1 Int_Xferred = Int_Xferred + 1 - IntKiBuf( Int_Xferred ) = LBOUND(InData%BStC,1) - IntKiBuf( Int_Xferred + 1) = UBOUND(InData%BStC,1) + IntKiBuf( Int_Xferred ) = LBOUND(InData%fromSC,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%fromSC,1) Int_Xferred = Int_Xferred + 2 - DO i1 = LBOUND(InData%BStC,1), UBOUND(InData%BStC,1) - CALL StC_PackInput( Re_Buf, Db_Buf, Int_Buf, InData%BStC(i1), ErrStat2, ErrMsg2, OnlySize ) ! BStC + DO i1 = LBOUND(InData%fromSC,1), UBOUND(InData%fromSC,1) + ReKiBuf(Re_Xferred) = InData%fromSC(i1) + Re_Xferred = Re_Xferred + 1 + END DO + END IF + IF ( .NOT. ALLOCATED(InData%fromSCglob) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%fromSCglob,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%fromSCglob,1) + Int_Xferred = Int_Xferred + 2 + + DO i1 = LBOUND(InData%fromSCglob,1), UBOUND(InData%fromSCglob,1) + ReKiBuf(Re_Xferred) = InData%fromSCglob(i1) + Re_Xferred = Re_Xferred + 1 + END DO + END IF + IF ( .NOT. ALLOCATED(InData%Lidar) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%Lidar,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%Lidar,1) + Int_Xferred = Int_Xferred + 2 + + DO i1 = LBOUND(InData%Lidar,1), UBOUND(InData%Lidar,1) + ReKiBuf(Re_Xferred) = InData%Lidar(i1) + Re_Xferred = Re_Xferred + 1 + END DO + END IF + CALL MeshPack( InData%PtfmMotionMesh, Re_Buf, Db_Buf, Int_Buf, ErrStat2, ErrMsg2, OnlySize ) ! PtfmMotionMesh CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN @@ -9955,20 +14122,22 @@ SUBROUTINE SrvD_PackInput( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg, ELSE IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 ENDIF - END DO - END IF - IF ( .NOT. ALLOCATED(InData%NStC) ) THEN + IF ( .NOT. ALLOCATED(InData%BStCMotionMesh) ) THEN IntKiBuf( Int_Xferred ) = 0 Int_Xferred = Int_Xferred + 1 ELSE IntKiBuf( Int_Xferred ) = 1 Int_Xferred = Int_Xferred + 1 - IntKiBuf( Int_Xferred ) = LBOUND(InData%NStC,1) - IntKiBuf( Int_Xferred + 1) = UBOUND(InData%NStC,1) + IntKiBuf( Int_Xferred ) = LBOUND(InData%BStCMotionMesh,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%BStCMotionMesh,1) + Int_Xferred = Int_Xferred + 2 + IntKiBuf( Int_Xferred ) = LBOUND(InData%BStCMotionMesh,2) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%BStCMotionMesh,2) Int_Xferred = Int_Xferred + 2 - DO i1 = LBOUND(InData%NStC,1), UBOUND(InData%NStC,1) - CALL StC_PackInput( Re_Buf, Db_Buf, Int_Buf, InData%NStC(i1), ErrStat2, ErrMsg2, OnlySize ) ! NStC + DO i2 = LBOUND(InData%BStCMotionMesh,2), UBOUND(InData%BStCMotionMesh,2) + DO i1 = LBOUND(InData%BStCMotionMesh,1), UBOUND(InData%BStCMotionMesh,1) + CALL MeshPack( InData%BStCMotionMesh(i1,i2), Re_Buf, Db_Buf, Int_Buf, ErrStat2, ErrMsg2, OnlySize ) ! BStCMotionMesh CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN @@ -9997,19 +14166,20 @@ SUBROUTINE SrvD_PackInput( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg, IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 ENDIF END DO + END DO END IF - IF ( .NOT. ALLOCATED(InData%TStC) ) THEN + IF ( .NOT. ALLOCATED(InData%NStCMotionMesh) ) THEN IntKiBuf( Int_Xferred ) = 0 Int_Xferred = Int_Xferred + 1 ELSE IntKiBuf( Int_Xferred ) = 1 Int_Xferred = Int_Xferred + 1 - IntKiBuf( Int_Xferred ) = LBOUND(InData%TStC,1) - IntKiBuf( Int_Xferred + 1) = UBOUND(InData%TStC,1) + IntKiBuf( Int_Xferred ) = LBOUND(InData%NStCMotionMesh,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%NStCMotionMesh,1) Int_Xferred = Int_Xferred + 2 - DO i1 = LBOUND(InData%TStC,1), UBOUND(InData%TStC,1) - CALL StC_PackInput( Re_Buf, Db_Buf, Int_Buf, InData%TStC(i1), ErrStat2, ErrMsg2, OnlySize ) ! TStC + DO i1 = LBOUND(InData%NStCMotionMesh,1), UBOUND(InData%NStCMotionMesh,1) + CALL MeshPack( InData%NStCMotionMesh(i1), Re_Buf, Db_Buf, Int_Buf, ErrStat2, ErrMsg2, OnlySize ) ! NStCMotionMesh CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN @@ -10039,18 +14209,18 @@ SUBROUTINE SrvD_PackInput( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg, ENDIF END DO END IF - IF ( .NOT. ALLOCATED(InData%SStC) ) THEN + IF ( .NOT. ALLOCATED(InData%TStCMotionMesh) ) THEN IntKiBuf( Int_Xferred ) = 0 Int_Xferred = Int_Xferred + 1 ELSE IntKiBuf( Int_Xferred ) = 1 Int_Xferred = Int_Xferred + 1 - IntKiBuf( Int_Xferred ) = LBOUND(InData%SStC,1) - IntKiBuf( Int_Xferred + 1) = UBOUND(InData%SStC,1) + IntKiBuf( Int_Xferred ) = LBOUND(InData%TStCMotionMesh,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%TStCMotionMesh,1) Int_Xferred = Int_Xferred + 2 - DO i1 = LBOUND(InData%SStC,1), UBOUND(InData%SStC,1) - CALL StC_PackInput( Re_Buf, Db_Buf, Int_Buf, InData%SStC(i1), ErrStat2, ErrMsg2, OnlySize ) ! SStC + DO i1 = LBOUND(InData%TStCMotionMesh,1), UBOUND(InData%TStCMotionMesh,1) + CALL MeshPack( InData%TStCMotionMesh(i1), Re_Buf, Db_Buf, Int_Buf, ErrStat2, ErrMsg2, OnlySize ) ! TStCMotionMesh CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN @@ -10080,50 +14250,46 @@ SUBROUTINE SrvD_PackInput( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg, ENDIF END DO END IF - IF ( .NOT. ALLOCATED(InData%fromSC) ) THEN - IntKiBuf( Int_Xferred ) = 0 - Int_Xferred = Int_Xferred + 1 - ELSE - IntKiBuf( Int_Xferred ) = 1 - Int_Xferred = Int_Xferred + 1 - IntKiBuf( Int_Xferred ) = LBOUND(InData%fromSC,1) - IntKiBuf( Int_Xferred + 1) = UBOUND(InData%fromSC,1) - Int_Xferred = Int_Xferred + 2 - - DO i1 = LBOUND(InData%fromSC,1), UBOUND(InData%fromSC,1) - ReKiBuf(Re_Xferred) = InData%fromSC(i1) - Re_Xferred = Re_Xferred + 1 - END DO - END IF - IF ( .NOT. ALLOCATED(InData%fromSCglob) ) THEN + IF ( .NOT. ALLOCATED(InData%SStCMotionMesh) ) THEN IntKiBuf( Int_Xferred ) = 0 Int_Xferred = Int_Xferred + 1 ELSE IntKiBuf( Int_Xferred ) = 1 Int_Xferred = Int_Xferred + 1 - IntKiBuf( Int_Xferred ) = LBOUND(InData%fromSCglob,1) - IntKiBuf( Int_Xferred + 1) = UBOUND(InData%fromSCglob,1) + IntKiBuf( Int_Xferred ) = LBOUND(InData%SStCMotionMesh,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%SStCMotionMesh,1) Int_Xferred = Int_Xferred + 2 - DO i1 = LBOUND(InData%fromSCglob,1), UBOUND(InData%fromSCglob,1) - ReKiBuf(Re_Xferred) = InData%fromSCglob(i1) - Re_Xferred = Re_Xferred + 1 - END DO - END IF - IF ( .NOT. ALLOCATED(InData%Lidar) ) THEN - IntKiBuf( Int_Xferred ) = 0 - Int_Xferred = Int_Xferred + 1 - ELSE - IntKiBuf( Int_Xferred ) = 1 - Int_Xferred = Int_Xferred + 1 - IntKiBuf( Int_Xferred ) = LBOUND(InData%Lidar,1) - IntKiBuf( Int_Xferred + 1) = UBOUND(InData%Lidar,1) - Int_Xferred = Int_Xferred + 2 + DO i1 = LBOUND(InData%SStCMotionMesh,1), UBOUND(InData%SStCMotionMesh,1) + CALL MeshPack( InData%SStCMotionMesh(i1), Re_Buf, Db_Buf, Int_Buf, ErrStat2, ErrMsg2, OnlySize ) ! SStCMotionMesh + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN - DO i1 = LBOUND(InData%Lidar,1), UBOUND(InData%Lidar,1) - ReKiBuf(Re_Xferred) = InData%Lidar(i1) - Re_Xferred = Re_Xferred + 1 - END DO + IF(ALLOCATED(Re_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Re_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Re_Buf) > 0) ReKiBuf( Re_Xferred:Re_Xferred+SIZE(Re_Buf)-1 ) = Re_Buf + Re_Xferred = Re_Xferred + SIZE(Re_Buf) + DEALLOCATE(Re_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Db_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Db_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Db_Buf) > 0) DbKiBuf( Db_Xferred:Db_Xferred+SIZE(Db_Buf)-1 ) = Db_Buf + Db_Xferred = Db_Xferred + SIZE(Db_Buf) + DEALLOCATE(Db_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + IF(ALLOCATED(Int_Buf)) THEN + IntKiBuf( Int_Xferred ) = SIZE(Int_Buf); Int_Xferred = Int_Xferred + 1 + IF (SIZE(Int_Buf) > 0) IntKiBuf( Int_Xferred:Int_Xferred+SIZE(Int_Buf)-1 ) = Int_Buf + Int_Xferred = Int_Xferred + SIZE(Int_Buf) + DEALLOCATE(Int_Buf) + ELSE + IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 + ENDIF + END DO END IF END SUBROUTINE SrvD_PackInput @@ -10141,6 +14307,7 @@ SUBROUTINE SrvD_UnPackInput( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrMs INTEGER(IntKi) :: Int_Xferred INTEGER(IntKi) :: i INTEGER(IntKi) :: i1, i1_l, i1_u ! bounds (upper/lower) for an array dimension 1 + INTEGER(IntKi) :: i2, i2_l, i2_u ! bounds (upper/lower) for an array dimension 2 INTEGER(IntKi) :: ErrStat2 CHARACTER(ErrMsgLen) :: ErrMsg2 CHARACTER(*), PARAMETER :: RoutineName = 'SrvD_UnPackInput' @@ -10210,6 +14377,60 @@ SUBROUTINE SrvD_UnPackInput( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrMs Re_Xferred = Re_Xferred + 1 OutData%ExternalHSSBrFrac = ReKiBuf(Re_Xferred) Re_Xferred = Re_Xferred + 1 + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! ExternalBlAirfoilCom not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%ExternalBlAirfoilCom)) DEALLOCATE(OutData%ExternalBlAirfoilCom) + ALLOCATE(OutData%ExternalBlAirfoilCom(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%ExternalBlAirfoilCom.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i1 = LBOUND(OutData%ExternalBlAirfoilCom,1), UBOUND(OutData%ExternalBlAirfoilCom,1) + OutData%ExternalBlAirfoilCom(i1) = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + END DO + END IF + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! ExternalCableDeltaL not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%ExternalCableDeltaL)) DEALLOCATE(OutData%ExternalCableDeltaL) + ALLOCATE(OutData%ExternalCableDeltaL(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%ExternalCableDeltaL.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i1 = LBOUND(OutData%ExternalCableDeltaL,1), UBOUND(OutData%ExternalCableDeltaL,1) + OutData%ExternalCableDeltaL(i1) = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + END DO + END IF + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! ExternalCableDeltaLdot not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%ExternalCableDeltaLdot)) DEALLOCATE(OutData%ExternalCableDeltaLdot) + ALLOCATE(OutData%ExternalCableDeltaLdot(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%ExternalCableDeltaLdot.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i1 = LBOUND(OutData%ExternalCableDeltaLdot,1), UBOUND(OutData%ExternalCableDeltaLdot,1) + OutData%ExternalCableDeltaLdot(i1) = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + END DO + END IF OutData%TwrAccel = ReKiBuf(Re_Xferred) Re_Xferred = Re_Xferred + 1 OutData%YawErr = ReKiBuf(Re_Xferred) @@ -10260,20 +14481,60 @@ SUBROUTINE SrvD_UnPackInput( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrMs Re_Xferred = Re_Xferred + 1 OutData%YawAngle = ReKiBuf(Re_Xferred) Re_Xferred = Re_Xferred + 1 - IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! BStC not allocated + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! fromSC not allocated Int_Xferred = Int_Xferred + 1 ELSE Int_Xferred = Int_Xferred + 1 i1_l = IntKiBuf( Int_Xferred ) i1_u = IntKiBuf( Int_Xferred + 1) Int_Xferred = Int_Xferred + 2 - IF (ALLOCATED(OutData%BStC)) DEALLOCATE(OutData%BStC) - ALLOCATE(OutData%BStC(i1_l:i1_u),STAT=ErrStat2) + IF (ALLOCATED(OutData%fromSC)) DEALLOCATE(OutData%fromSC) + ALLOCATE(OutData%fromSC(i1_l:i1_u),STAT=ErrStat2) IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%BStC.', ErrStat, ErrMsg,RoutineName) + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%fromSC.', ErrStat, ErrMsg,RoutineName) RETURN END IF - DO i1 = LBOUND(OutData%BStC,1), UBOUND(OutData%BStC,1) + DO i1 = LBOUND(OutData%fromSC,1), UBOUND(OutData%fromSC,1) + OutData%fromSC(i1) = REAL(ReKiBuf(Re_Xferred), SiKi) + Re_Xferred = Re_Xferred + 1 + END DO + END IF + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! fromSCglob not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%fromSCglob)) DEALLOCATE(OutData%fromSCglob) + ALLOCATE(OutData%fromSCglob(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%fromSCglob.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i1 = LBOUND(OutData%fromSCglob,1), UBOUND(OutData%fromSCglob,1) + OutData%fromSCglob(i1) = REAL(ReKiBuf(Re_Xferred), SiKi) + Re_Xferred = Re_Xferred + 1 + END DO + END IF + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! Lidar not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%Lidar)) DEALLOCATE(OutData%Lidar) + ALLOCATE(OutData%Lidar(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%Lidar.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i1 = LBOUND(OutData%Lidar,1), UBOUND(OutData%Lidar,1) + OutData%Lidar(i1) = REAL(ReKiBuf(Re_Xferred), SiKi) + Re_Xferred = Re_Xferred + 1 + END DO + END IF Buf_size=IntKiBuf( Int_Xferred ) Int_Xferred = Int_Xferred + 1 IF(Buf_size > 0) THEN @@ -10307,29 +14568,31 @@ SUBROUTINE SrvD_UnPackInput( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrMs Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) Int_Xferred = Int_Xferred + Buf_size END IF - CALL StC_UnpackInput( Re_Buf, Db_Buf, Int_Buf, OutData%BStC(i1), ErrStat2, ErrMsg2 ) ! BStC + CALL MeshUnpack( OutData%PtfmMotionMesh, Re_Buf, Db_Buf, Int_Buf, ErrStat2, ErrMsg2 ) ! PtfmMotionMesh CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) - END DO - END IF - IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! NStC not allocated + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! BStCMotionMesh not allocated Int_Xferred = Int_Xferred + 1 ELSE Int_Xferred = Int_Xferred + 1 i1_l = IntKiBuf( Int_Xferred ) i1_u = IntKiBuf( Int_Xferred + 1) Int_Xferred = Int_Xferred + 2 - IF (ALLOCATED(OutData%NStC)) DEALLOCATE(OutData%NStC) - ALLOCATE(OutData%NStC(i1_l:i1_u),STAT=ErrStat2) + i2_l = IntKiBuf( Int_Xferred ) + i2_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%BStCMotionMesh)) DEALLOCATE(OutData%BStCMotionMesh) + ALLOCATE(OutData%BStCMotionMesh(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%NStC.', ErrStat, ErrMsg,RoutineName) + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%BStCMotionMesh.', ErrStat, ErrMsg,RoutineName) RETURN END IF - DO i1 = LBOUND(OutData%NStC,1), UBOUND(OutData%NStC,1) + DO i2 = LBOUND(OutData%BStCMotionMesh,2), UBOUND(OutData%BStCMotionMesh,2) + DO i1 = LBOUND(OutData%BStCMotionMesh,1), UBOUND(OutData%BStCMotionMesh,1) Buf_size=IntKiBuf( Int_Xferred ) Int_Xferred = Int_Xferred + 1 IF(Buf_size > 0) THEN @@ -10363,7 +14626,7 @@ SUBROUTINE SrvD_UnPackInput( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrMs Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) Int_Xferred = Int_Xferred + Buf_size END IF - CALL StC_UnpackInput( Re_Buf, Db_Buf, Int_Buf, OutData%NStC(i1), ErrStat2, ErrMsg2 ) ! NStC + CALL MeshUnpack( OutData%BStCMotionMesh(i1,i2), Re_Buf, Db_Buf, Int_Buf, ErrStat2, ErrMsg2 ) ! BStCMotionMesh CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN @@ -10371,21 +14634,22 @@ SUBROUTINE SrvD_UnPackInput( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrMs IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) END DO + END DO END IF - IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! TStC not allocated + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! NStCMotionMesh not allocated Int_Xferred = Int_Xferred + 1 ELSE Int_Xferred = Int_Xferred + 1 i1_l = IntKiBuf( Int_Xferred ) i1_u = IntKiBuf( Int_Xferred + 1) Int_Xferred = Int_Xferred + 2 - IF (ALLOCATED(OutData%TStC)) DEALLOCATE(OutData%TStC) - ALLOCATE(OutData%TStC(i1_l:i1_u),STAT=ErrStat2) + IF (ALLOCATED(OutData%NStCMotionMesh)) DEALLOCATE(OutData%NStCMotionMesh) + ALLOCATE(OutData%NStCMotionMesh(i1_l:i1_u),STAT=ErrStat2) IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%TStC.', ErrStat, ErrMsg,RoutineName) + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%NStCMotionMesh.', ErrStat, ErrMsg,RoutineName) RETURN END IF - DO i1 = LBOUND(OutData%TStC,1), UBOUND(OutData%TStC,1) + DO i1 = LBOUND(OutData%NStCMotionMesh,1), UBOUND(OutData%NStCMotionMesh,1) Buf_size=IntKiBuf( Int_Xferred ) Int_Xferred = Int_Xferred + 1 IF(Buf_size > 0) THEN @@ -10419,7 +14683,7 @@ SUBROUTINE SrvD_UnPackInput( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrMs Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) Int_Xferred = Int_Xferred + Buf_size END IF - CALL StC_UnpackInput( Re_Buf, Db_Buf, Int_Buf, OutData%TStC(i1), ErrStat2, ErrMsg2 ) ! TStC + CALL MeshUnpack( OutData%NStCMotionMesh(i1), Re_Buf, Db_Buf, Int_Buf, ErrStat2, ErrMsg2 ) ! NStCMotionMesh CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN @@ -10428,20 +14692,20 @@ SUBROUTINE SrvD_UnPackInput( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrMs IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) END DO END IF - IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! SStC not allocated + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! TStCMotionMesh not allocated Int_Xferred = Int_Xferred + 1 ELSE Int_Xferred = Int_Xferred + 1 i1_l = IntKiBuf( Int_Xferred ) i1_u = IntKiBuf( Int_Xferred + 1) Int_Xferred = Int_Xferred + 2 - IF (ALLOCATED(OutData%SStC)) DEALLOCATE(OutData%SStC) - ALLOCATE(OutData%SStC(i1_l:i1_u),STAT=ErrStat2) + IF (ALLOCATED(OutData%TStCMotionMesh)) DEALLOCATE(OutData%TStCMotionMesh) + ALLOCATE(OutData%TStCMotionMesh(i1_l:i1_u),STAT=ErrStat2) IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%SStC.', ErrStat, ErrMsg,RoutineName) + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%TStCMotionMesh.', ErrStat, ErrMsg,RoutineName) RETURN END IF - DO i1 = LBOUND(OutData%SStC,1), UBOUND(OutData%SStC,1) + DO i1 = LBOUND(OutData%TStCMotionMesh,1), UBOUND(OutData%TStCMotionMesh,1) Buf_size=IntKiBuf( Int_Xferred ) Int_Xferred = Int_Xferred + 1 IF(Buf_size > 0) THEN @@ -10475,7 +14739,7 @@ SUBROUTINE SrvD_UnPackInput( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrMs Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) Int_Xferred = Int_Xferred + Buf_size END IF - CALL StC_UnpackInput( Re_Buf, Db_Buf, Int_Buf, OutData%SStC(i1), ErrStat2, ErrMsg2 ) ! SStC + CALL MeshUnpack( OutData%TStCMotionMesh(i1), Re_Buf, Db_Buf, Int_Buf, ErrStat2, ErrMsg2 ) ! TStCMotionMesh CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN @@ -10484,59 +14748,61 @@ SUBROUTINE SrvD_UnPackInput( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrMs IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) END DO END IF - IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! fromSC not allocated - Int_Xferred = Int_Xferred + 1 - ELSE - Int_Xferred = Int_Xferred + 1 - i1_l = IntKiBuf( Int_Xferred ) - i1_u = IntKiBuf( Int_Xferred + 1) - Int_Xferred = Int_Xferred + 2 - IF (ALLOCATED(OutData%fromSC)) DEALLOCATE(OutData%fromSC) - ALLOCATE(OutData%fromSC(i1_l:i1_u),STAT=ErrStat2) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%fromSC.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - DO i1 = LBOUND(OutData%fromSC,1), UBOUND(OutData%fromSC,1) - OutData%fromSC(i1) = REAL(ReKiBuf(Re_Xferred), SiKi) - Re_Xferred = Re_Xferred + 1 - END DO - END IF - IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! fromSCglob not allocated - Int_Xferred = Int_Xferred + 1 - ELSE - Int_Xferred = Int_Xferred + 1 - i1_l = IntKiBuf( Int_Xferred ) - i1_u = IntKiBuf( Int_Xferred + 1) - Int_Xferred = Int_Xferred + 2 - IF (ALLOCATED(OutData%fromSCglob)) DEALLOCATE(OutData%fromSCglob) - ALLOCATE(OutData%fromSCglob(i1_l:i1_u),STAT=ErrStat2) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%fromSCglob.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - DO i1 = LBOUND(OutData%fromSCglob,1), UBOUND(OutData%fromSCglob,1) - OutData%fromSCglob(i1) = REAL(ReKiBuf(Re_Xferred), SiKi) - Re_Xferred = Re_Xferred + 1 - END DO - END IF - IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! Lidar not allocated + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! SStCMotionMesh not allocated Int_Xferred = Int_Xferred + 1 ELSE Int_Xferred = Int_Xferred + 1 i1_l = IntKiBuf( Int_Xferred ) i1_u = IntKiBuf( Int_Xferred + 1) Int_Xferred = Int_Xferred + 2 - IF (ALLOCATED(OutData%Lidar)) DEALLOCATE(OutData%Lidar) - ALLOCATE(OutData%Lidar(i1_l:i1_u),STAT=ErrStat2) + IF (ALLOCATED(OutData%SStCMotionMesh)) DEALLOCATE(OutData%SStCMotionMesh) + ALLOCATE(OutData%SStCMotionMesh(i1_l:i1_u),STAT=ErrStat2) IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%Lidar.', ErrStat, ErrMsg,RoutineName) + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%SStCMotionMesh.', ErrStat, ErrMsg,RoutineName) RETURN END IF - DO i1 = LBOUND(OutData%Lidar,1), UBOUND(OutData%Lidar,1) - OutData%Lidar(i1) = REAL(ReKiBuf(Re_Xferred), SiKi) - Re_Xferred = Re_Xferred + 1 - END DO + DO i1 = LBOUND(OutData%SStCMotionMesh,1), UBOUND(OutData%SStCMotionMesh,1) + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Re_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Re_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Re_Buf = ReKiBuf( Re_Xferred:Re_Xferred+Buf_size-1 ) + Re_Xferred = Re_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Db_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Db_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Db_Buf = DbKiBuf( Db_Xferred:Db_Xferred+Buf_size-1 ) + Db_Xferred = Db_Xferred + Buf_size + END IF + Buf_size=IntKiBuf( Int_Xferred ) + Int_Xferred = Int_Xferred + 1 + IF(Buf_size > 0) THEN + ALLOCATE(Int_Buf(Buf_size),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating Int_Buf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) + Int_Xferred = Int_Xferred + Buf_size + END IF + CALL MeshUnpack( OutData%SStCMotionMesh(i1), Re_Buf, Db_Buf, Int_Buf, ErrStat2, ErrMsg2 ) ! SStCMotionMesh + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) + IF (ErrStat >= AbortErrLev) RETURN + + IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf ) + IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) + IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) + END DO END IF END SUBROUTINE SrvD_UnPackInput @@ -10549,6 +14815,7 @@ SUBROUTINE SrvD_CopyOutput( SrcOutputData, DstOutputData, CtrlCode, ErrStat, Err ! Local INTEGER(IntKi) :: i,j,k INTEGER(IntKi) :: i1, i1_l, i1_u ! bounds (upper/lower) for an array dimension 1 + INTEGER(IntKi) :: i2, i2_l, i2_u ! bounds (upper/lower) for an array dimension 2 INTEGER(IntKi) :: ErrStat2 CHARACTER(ErrMsgLen) :: ErrMsg2 CHARACTER(*), PARAMETER :: RoutineName = 'SrvD_CopyOutput' @@ -10607,67 +14874,107 @@ SUBROUTINE SrvD_CopyOutput( SrcOutputData, DstOutputData, CtrlCode, ErrStat, Err END IF DstOutputData%TBDrCon = SrcOutputData%TBDrCon ENDIF -IF (ALLOCATED(SrcOutputData%BStC)) THEN - i1_l = LBOUND(SrcOutputData%BStC,1) - i1_u = UBOUND(SrcOutputData%BStC,1) - IF (.NOT. ALLOCATED(DstOutputData%BStC)) THEN - ALLOCATE(DstOutputData%BStC(i1_l:i1_u),STAT=ErrStat2) +IF (ALLOCATED(SrcOutputData%Lidar)) THEN + i1_l = LBOUND(SrcOutputData%Lidar,1) + i1_u = UBOUND(SrcOutputData%Lidar,1) + IF (.NOT. ALLOCATED(DstOutputData%Lidar)) THEN + ALLOCATE(DstOutputData%Lidar(i1_l:i1_u),STAT=ErrStat2) IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating DstOutputData%BStC.', ErrStat, ErrMsg,RoutineName) + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstOutputData%Lidar.', ErrStat, ErrMsg,RoutineName) RETURN END IF END IF - DO i1 = LBOUND(SrcOutputData%BStC,1), UBOUND(SrcOutputData%BStC,1) - CALL StC_CopyOutput( SrcOutputData%BStC(i1), DstOutputData%BStC(i1), CtrlCode, ErrStat2, ErrMsg2 ) - CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) + DstOutputData%Lidar = SrcOutputData%Lidar +ENDIF +IF (ALLOCATED(SrcOutputData%CableDeltaL)) THEN + i1_l = LBOUND(SrcOutputData%CableDeltaL,1) + i1_u = UBOUND(SrcOutputData%CableDeltaL,1) + IF (.NOT. ALLOCATED(DstOutputData%CableDeltaL)) THEN + ALLOCATE(DstOutputData%CableDeltaL(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstOutputData%CableDeltaL.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DstOutputData%CableDeltaL = SrcOutputData%CableDeltaL +ENDIF +IF (ALLOCATED(SrcOutputData%CableDeltaLdot)) THEN + i1_l = LBOUND(SrcOutputData%CableDeltaLdot,1) + i1_u = UBOUND(SrcOutputData%CableDeltaLdot,1) + IF (.NOT. ALLOCATED(DstOutputData%CableDeltaLdot)) THEN + ALLOCATE(DstOutputData%CableDeltaLdot(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstOutputData%CableDeltaLdot.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DstOutputData%CableDeltaLdot = SrcOutputData%CableDeltaLdot +ENDIF +IF (ALLOCATED(SrcOutputData%BStCLoadMesh)) THEN + i1_l = LBOUND(SrcOutputData%BStCLoadMesh,1) + i1_u = UBOUND(SrcOutputData%BStCLoadMesh,1) + i2_l = LBOUND(SrcOutputData%BStCLoadMesh,2) + i2_u = UBOUND(SrcOutputData%BStCLoadMesh,2) + IF (.NOT. ALLOCATED(DstOutputData%BStCLoadMesh)) THEN + ALLOCATE(DstOutputData%BStCLoadMesh(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstOutputData%BStCLoadMesh.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DO i2 = LBOUND(SrcOutputData%BStCLoadMesh,2), UBOUND(SrcOutputData%BStCLoadMesh,2) + DO i1 = LBOUND(SrcOutputData%BStCLoadMesh,1), UBOUND(SrcOutputData%BStCLoadMesh,1) + CALL MeshCopy( SrcOutputData%BStCLoadMesh(i1,i2), DstOutputData%BStCLoadMesh(i1,i2), CtrlCode, ErrStat2, ErrMsg2 ) + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat>=AbortErrLev) RETURN ENDDO + ENDDO ENDIF -IF (ALLOCATED(SrcOutputData%NStC)) THEN - i1_l = LBOUND(SrcOutputData%NStC,1) - i1_u = UBOUND(SrcOutputData%NStC,1) - IF (.NOT. ALLOCATED(DstOutputData%NStC)) THEN - ALLOCATE(DstOutputData%NStC(i1_l:i1_u),STAT=ErrStat2) +IF (ALLOCATED(SrcOutputData%NStCLoadMesh)) THEN + i1_l = LBOUND(SrcOutputData%NStCLoadMesh,1) + i1_u = UBOUND(SrcOutputData%NStCLoadMesh,1) + IF (.NOT. ALLOCATED(DstOutputData%NStCLoadMesh)) THEN + ALLOCATE(DstOutputData%NStCLoadMesh(i1_l:i1_u),STAT=ErrStat2) IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating DstOutputData%NStC.', ErrStat, ErrMsg,RoutineName) + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstOutputData%NStCLoadMesh.', ErrStat, ErrMsg,RoutineName) RETURN END IF END IF - DO i1 = LBOUND(SrcOutputData%NStC,1), UBOUND(SrcOutputData%NStC,1) - CALL StC_CopyOutput( SrcOutputData%NStC(i1), DstOutputData%NStC(i1), CtrlCode, ErrStat2, ErrMsg2 ) - CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) + DO i1 = LBOUND(SrcOutputData%NStCLoadMesh,1), UBOUND(SrcOutputData%NStCLoadMesh,1) + CALL MeshCopy( SrcOutputData%NStCLoadMesh(i1), DstOutputData%NStCLoadMesh(i1), CtrlCode, ErrStat2, ErrMsg2 ) + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat>=AbortErrLev) RETURN ENDDO ENDIF -IF (ALLOCATED(SrcOutputData%TStC)) THEN - i1_l = LBOUND(SrcOutputData%TStC,1) - i1_u = UBOUND(SrcOutputData%TStC,1) - IF (.NOT. ALLOCATED(DstOutputData%TStC)) THEN - ALLOCATE(DstOutputData%TStC(i1_l:i1_u),STAT=ErrStat2) +IF (ALLOCATED(SrcOutputData%TStCLoadMesh)) THEN + i1_l = LBOUND(SrcOutputData%TStCLoadMesh,1) + i1_u = UBOUND(SrcOutputData%TStCLoadMesh,1) + IF (.NOT. ALLOCATED(DstOutputData%TStCLoadMesh)) THEN + ALLOCATE(DstOutputData%TStCLoadMesh(i1_l:i1_u),STAT=ErrStat2) IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating DstOutputData%TStC.', ErrStat, ErrMsg,RoutineName) + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstOutputData%TStCLoadMesh.', ErrStat, ErrMsg,RoutineName) RETURN END IF END IF - DO i1 = LBOUND(SrcOutputData%TStC,1), UBOUND(SrcOutputData%TStC,1) - CALL StC_CopyOutput( SrcOutputData%TStC(i1), DstOutputData%TStC(i1), CtrlCode, ErrStat2, ErrMsg2 ) - CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) + DO i1 = LBOUND(SrcOutputData%TStCLoadMesh,1), UBOUND(SrcOutputData%TStCLoadMesh,1) + CALL MeshCopy( SrcOutputData%TStCLoadMesh(i1), DstOutputData%TStCLoadMesh(i1), CtrlCode, ErrStat2, ErrMsg2 ) + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat>=AbortErrLev) RETURN ENDDO ENDIF -IF (ALLOCATED(SrcOutputData%SStC)) THEN - i1_l = LBOUND(SrcOutputData%SStC,1) - i1_u = UBOUND(SrcOutputData%SStC,1) - IF (.NOT. ALLOCATED(DstOutputData%SStC)) THEN - ALLOCATE(DstOutputData%SStC(i1_l:i1_u),STAT=ErrStat2) +IF (ALLOCATED(SrcOutputData%SStCLoadMesh)) THEN + i1_l = LBOUND(SrcOutputData%SStCLoadMesh,1) + i1_u = UBOUND(SrcOutputData%SStCLoadMesh,1) + IF (.NOT. ALLOCATED(DstOutputData%SStCLoadMesh)) THEN + ALLOCATE(DstOutputData%SStCLoadMesh(i1_l:i1_u),STAT=ErrStat2) IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating DstOutputData%SStC.', ErrStat, ErrMsg,RoutineName) + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstOutputData%SStCLoadMesh.', ErrStat, ErrMsg,RoutineName) RETURN END IF END IF - DO i1 = LBOUND(SrcOutputData%SStC,1), UBOUND(SrcOutputData%SStC,1) - CALL StC_CopyOutput( SrcOutputData%SStC(i1), DstOutputData%SStC(i1), CtrlCode, ErrStat2, ErrMsg2 ) - CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) + DO i1 = LBOUND(SrcOutputData%SStCLoadMesh,1), UBOUND(SrcOutputData%SStCLoadMesh,1) + CALL MeshCopy( SrcOutputData%SStCLoadMesh(i1), DstOutputData%SStCLoadMesh(i1), CtrlCode, ErrStat2, ErrMsg2 ) + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat>=AbortErrLev) RETURN ENDDO ENDIF @@ -10682,18 +14989,6 @@ SUBROUTINE SrvD_CopyOutput( SrcOutputData, DstOutputData, CtrlCode, ErrStat, Err END IF END IF DstOutputData%toSC = SrcOutputData%toSC -ENDIF -IF (ALLOCATED(SrcOutputData%Lidar)) THEN - i1_l = LBOUND(SrcOutputData%Lidar,1) - i1_u = UBOUND(SrcOutputData%Lidar,1) - IF (.NOT. ALLOCATED(DstOutputData%Lidar)) THEN - ALLOCATE(DstOutputData%Lidar(i1_l:i1_u),STAT=ErrStat2) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating DstOutputData%Lidar.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - END IF - DstOutputData%Lidar = SrcOutputData%Lidar ENDIF END SUBROUTINE SrvD_CopyOutput @@ -10718,35 +15013,43 @@ SUBROUTINE SrvD_DestroyOutput( OutputData, ErrStat, ErrMsg ) IF (ALLOCATED(OutputData%TBDrCon)) THEN DEALLOCATE(OutputData%TBDrCon) ENDIF -IF (ALLOCATED(OutputData%BStC)) THEN -DO i1 = LBOUND(OutputData%BStC,1), UBOUND(OutputData%BStC,1) - CALL StC_DestroyOutput( OutputData%BStC(i1), ErrStat, ErrMsg ) +IF (ALLOCATED(OutputData%Lidar)) THEN + DEALLOCATE(OutputData%Lidar) +ENDIF +IF (ALLOCATED(OutputData%CableDeltaL)) THEN + DEALLOCATE(OutputData%CableDeltaL) +ENDIF +IF (ALLOCATED(OutputData%CableDeltaLdot)) THEN + DEALLOCATE(OutputData%CableDeltaLdot) +ENDIF +IF (ALLOCATED(OutputData%BStCLoadMesh)) THEN +DO i2 = LBOUND(OutputData%BStCLoadMesh,2), UBOUND(OutputData%BStCLoadMesh,2) +DO i1 = LBOUND(OutputData%BStCLoadMesh,1), UBOUND(OutputData%BStCLoadMesh,1) + CALL MeshDestroy( OutputData%BStCLoadMesh(i1,i2), ErrStat, ErrMsg ) ENDDO - DEALLOCATE(OutputData%BStC) +ENDDO + DEALLOCATE(OutputData%BStCLoadMesh) ENDIF -IF (ALLOCATED(OutputData%NStC)) THEN -DO i1 = LBOUND(OutputData%NStC,1), UBOUND(OutputData%NStC,1) - CALL StC_DestroyOutput( OutputData%NStC(i1), ErrStat, ErrMsg ) +IF (ALLOCATED(OutputData%NStCLoadMesh)) THEN +DO i1 = LBOUND(OutputData%NStCLoadMesh,1), UBOUND(OutputData%NStCLoadMesh,1) + CALL MeshDestroy( OutputData%NStCLoadMesh(i1), ErrStat, ErrMsg ) ENDDO - DEALLOCATE(OutputData%NStC) + DEALLOCATE(OutputData%NStCLoadMesh) ENDIF -IF (ALLOCATED(OutputData%TStC)) THEN -DO i1 = LBOUND(OutputData%TStC,1), UBOUND(OutputData%TStC,1) - CALL StC_DestroyOutput( OutputData%TStC(i1), ErrStat, ErrMsg ) +IF (ALLOCATED(OutputData%TStCLoadMesh)) THEN +DO i1 = LBOUND(OutputData%TStCLoadMesh,1), UBOUND(OutputData%TStCLoadMesh,1) + CALL MeshDestroy( OutputData%TStCLoadMesh(i1), ErrStat, ErrMsg ) ENDDO - DEALLOCATE(OutputData%TStC) + DEALLOCATE(OutputData%TStCLoadMesh) ENDIF -IF (ALLOCATED(OutputData%SStC)) THEN -DO i1 = LBOUND(OutputData%SStC,1), UBOUND(OutputData%SStC,1) - CALL StC_DestroyOutput( OutputData%SStC(i1), ErrStat, ErrMsg ) +IF (ALLOCATED(OutputData%SStCLoadMesh)) THEN +DO i1 = LBOUND(OutputData%SStCLoadMesh,1), UBOUND(OutputData%SStCLoadMesh,1) + CALL MeshDestroy( OutputData%SStCLoadMesh(i1), ErrStat, ErrMsg ) ENDDO - DEALLOCATE(OutputData%SStC) + DEALLOCATE(OutputData%SStCLoadMesh) ENDIF IF (ALLOCATED(OutputData%toSC)) THEN DEALLOCATE(OutputData%toSC) -ENDIF -IF (ALLOCATED(OutputData%Lidar)) THEN - DEALLOCATE(OutputData%Lidar) ENDIF END SUBROUTINE SrvD_DestroyOutput @@ -10809,108 +15112,120 @@ SUBROUTINE SrvD_PackOutput( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg, Int_BufSz = Int_BufSz + 2*1 ! TBDrCon upper/lower bounds for each dimension Re_BufSz = Re_BufSz + SIZE(InData%TBDrCon) ! TBDrCon END IF - Int_BufSz = Int_BufSz + 1 ! BStC allocated yes/no - IF ( ALLOCATED(InData%BStC) ) THEN - Int_BufSz = Int_BufSz + 2*1 ! BStC upper/lower bounds for each dimension + Int_BufSz = Int_BufSz + 1 ! Lidar allocated yes/no + IF ( ALLOCATED(InData%Lidar) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! Lidar upper/lower bounds for each dimension + Re_BufSz = Re_BufSz + SIZE(InData%Lidar) ! Lidar + END IF + Int_BufSz = Int_BufSz + 1 ! CableDeltaL allocated yes/no + IF ( ALLOCATED(InData%CableDeltaL) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! CableDeltaL upper/lower bounds for each dimension + Re_BufSz = Re_BufSz + SIZE(InData%CableDeltaL) ! CableDeltaL + END IF + Int_BufSz = Int_BufSz + 1 ! CableDeltaLdot allocated yes/no + IF ( ALLOCATED(InData%CableDeltaLdot) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! CableDeltaLdot upper/lower bounds for each dimension + Re_BufSz = Re_BufSz + SIZE(InData%CableDeltaLdot) ! CableDeltaLdot + END IF + Int_BufSz = Int_BufSz + 1 ! BStCLoadMesh allocated yes/no + IF ( ALLOCATED(InData%BStCLoadMesh) ) THEN + Int_BufSz = Int_BufSz + 2*2 ! BStCLoadMesh upper/lower bounds for each dimension ! Allocate buffers for subtypes, if any (we'll get sizes from these) - DO i1 = LBOUND(InData%BStC,1), UBOUND(InData%BStC,1) - Int_BufSz = Int_BufSz + 3 ! BStC: size of buffers for each call to pack subtype - CALL StC_PackOutput( Re_Buf, Db_Buf, Int_Buf, InData%BStC(i1), ErrStat2, ErrMsg2, .TRUE. ) ! BStC + DO i2 = LBOUND(InData%BStCLoadMesh,2), UBOUND(InData%BStCLoadMesh,2) + DO i1 = LBOUND(InData%BStCLoadMesh,1), UBOUND(InData%BStCLoadMesh,1) + Int_BufSz = Int_BufSz + 3 ! BStCLoadMesh: size of buffers for each call to pack subtype + CALL MeshPack( InData%BStCLoadMesh(i1,i2), Re_Buf, Db_Buf, Int_Buf, ErrStat2, ErrMsg2, .TRUE. ) ! BStCLoadMesh CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN - IF(ALLOCATED(Re_Buf)) THEN ! BStC + IF(ALLOCATED(Re_Buf)) THEN ! BStCLoadMesh Re_BufSz = Re_BufSz + SIZE( Re_Buf ) DEALLOCATE(Re_Buf) END IF - IF(ALLOCATED(Db_Buf)) THEN ! BStC + IF(ALLOCATED(Db_Buf)) THEN ! BStCLoadMesh Db_BufSz = Db_BufSz + SIZE( Db_Buf ) DEALLOCATE(Db_Buf) END IF - IF(ALLOCATED(Int_Buf)) THEN ! BStC + IF(ALLOCATED(Int_Buf)) THEN ! BStCLoadMesh Int_BufSz = Int_BufSz + SIZE( Int_Buf ) DEALLOCATE(Int_Buf) END IF END DO + END DO END IF - Int_BufSz = Int_BufSz + 1 ! NStC allocated yes/no - IF ( ALLOCATED(InData%NStC) ) THEN - Int_BufSz = Int_BufSz + 2*1 ! NStC upper/lower bounds for each dimension - DO i1 = LBOUND(InData%NStC,1), UBOUND(InData%NStC,1) - Int_BufSz = Int_BufSz + 3 ! NStC: size of buffers for each call to pack subtype - CALL StC_PackOutput( Re_Buf, Db_Buf, Int_Buf, InData%NStC(i1), ErrStat2, ErrMsg2, .TRUE. ) ! NStC + Int_BufSz = Int_BufSz + 1 ! NStCLoadMesh allocated yes/no + IF ( ALLOCATED(InData%NStCLoadMesh) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! NStCLoadMesh upper/lower bounds for each dimension + DO i1 = LBOUND(InData%NStCLoadMesh,1), UBOUND(InData%NStCLoadMesh,1) + Int_BufSz = Int_BufSz + 3 ! NStCLoadMesh: size of buffers for each call to pack subtype + CALL MeshPack( InData%NStCLoadMesh(i1), Re_Buf, Db_Buf, Int_Buf, ErrStat2, ErrMsg2, .TRUE. ) ! NStCLoadMesh CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN - IF(ALLOCATED(Re_Buf)) THEN ! NStC + IF(ALLOCATED(Re_Buf)) THEN ! NStCLoadMesh Re_BufSz = Re_BufSz + SIZE( Re_Buf ) DEALLOCATE(Re_Buf) END IF - IF(ALLOCATED(Db_Buf)) THEN ! NStC + IF(ALLOCATED(Db_Buf)) THEN ! NStCLoadMesh Db_BufSz = Db_BufSz + SIZE( Db_Buf ) DEALLOCATE(Db_Buf) END IF - IF(ALLOCATED(Int_Buf)) THEN ! NStC + IF(ALLOCATED(Int_Buf)) THEN ! NStCLoadMesh Int_BufSz = Int_BufSz + SIZE( Int_Buf ) DEALLOCATE(Int_Buf) END IF END DO END IF - Int_BufSz = Int_BufSz + 1 ! TStC allocated yes/no - IF ( ALLOCATED(InData%TStC) ) THEN - Int_BufSz = Int_BufSz + 2*1 ! TStC upper/lower bounds for each dimension - DO i1 = LBOUND(InData%TStC,1), UBOUND(InData%TStC,1) - Int_BufSz = Int_BufSz + 3 ! TStC: size of buffers for each call to pack subtype - CALL StC_PackOutput( Re_Buf, Db_Buf, Int_Buf, InData%TStC(i1), ErrStat2, ErrMsg2, .TRUE. ) ! TStC + Int_BufSz = Int_BufSz + 1 ! TStCLoadMesh allocated yes/no + IF ( ALLOCATED(InData%TStCLoadMesh) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! TStCLoadMesh upper/lower bounds for each dimension + DO i1 = LBOUND(InData%TStCLoadMesh,1), UBOUND(InData%TStCLoadMesh,1) + Int_BufSz = Int_BufSz + 3 ! TStCLoadMesh: size of buffers for each call to pack subtype + CALL MeshPack( InData%TStCLoadMesh(i1), Re_Buf, Db_Buf, Int_Buf, ErrStat2, ErrMsg2, .TRUE. ) ! TStCLoadMesh CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN - IF(ALLOCATED(Re_Buf)) THEN ! TStC + IF(ALLOCATED(Re_Buf)) THEN ! TStCLoadMesh Re_BufSz = Re_BufSz + SIZE( Re_Buf ) DEALLOCATE(Re_Buf) END IF - IF(ALLOCATED(Db_Buf)) THEN ! TStC + IF(ALLOCATED(Db_Buf)) THEN ! TStCLoadMesh Db_BufSz = Db_BufSz + SIZE( Db_Buf ) DEALLOCATE(Db_Buf) END IF - IF(ALLOCATED(Int_Buf)) THEN ! TStC + IF(ALLOCATED(Int_Buf)) THEN ! TStCLoadMesh Int_BufSz = Int_BufSz + SIZE( Int_Buf ) DEALLOCATE(Int_Buf) END IF END DO END IF - Int_BufSz = Int_BufSz + 1 ! SStC allocated yes/no - IF ( ALLOCATED(InData%SStC) ) THEN - Int_BufSz = Int_BufSz + 2*1 ! SStC upper/lower bounds for each dimension - DO i1 = LBOUND(InData%SStC,1), UBOUND(InData%SStC,1) - Int_BufSz = Int_BufSz + 3 ! SStC: size of buffers for each call to pack subtype - CALL StC_PackOutput( Re_Buf, Db_Buf, Int_Buf, InData%SStC(i1), ErrStat2, ErrMsg2, .TRUE. ) ! SStC + Int_BufSz = Int_BufSz + 1 ! SStCLoadMesh allocated yes/no + IF ( ALLOCATED(InData%SStCLoadMesh) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! SStCLoadMesh upper/lower bounds for each dimension + DO i1 = LBOUND(InData%SStCLoadMesh,1), UBOUND(InData%SStCLoadMesh,1) + Int_BufSz = Int_BufSz + 3 ! SStCLoadMesh: size of buffers for each call to pack subtype + CALL MeshPack( InData%SStCLoadMesh(i1), Re_Buf, Db_Buf, Int_Buf, ErrStat2, ErrMsg2, .TRUE. ) ! SStCLoadMesh CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN - IF(ALLOCATED(Re_Buf)) THEN ! SStC + IF(ALLOCATED(Re_Buf)) THEN ! SStCLoadMesh Re_BufSz = Re_BufSz + SIZE( Re_Buf ) DEALLOCATE(Re_Buf) END IF - IF(ALLOCATED(Db_Buf)) THEN ! SStC + IF(ALLOCATED(Db_Buf)) THEN ! SStCLoadMesh Db_BufSz = Db_BufSz + SIZE( Db_Buf ) DEALLOCATE(Db_Buf) END IF - IF(ALLOCATED(Int_Buf)) THEN ! SStC + IF(ALLOCATED(Int_Buf)) THEN ! SStCLoadMesh Int_BufSz = Int_BufSz + SIZE( Int_Buf ) DEALLOCATE(Int_Buf) END IF END DO END IF Int_BufSz = Int_BufSz + 1 ! toSC allocated yes/no - IF ( ALLOCATED(InData%toSC) ) THEN - Int_BufSz = Int_BufSz + 2*1 ! toSC upper/lower bounds for each dimension - Re_BufSz = Re_BufSz + SIZE(InData%toSC) ! toSC - END IF - Int_BufSz = Int_BufSz + 1 ! Lidar allocated yes/no - IF ( ALLOCATED(InData%Lidar) ) THEN - Int_BufSz = Int_BufSz + 2*1 ! Lidar upper/lower bounds for each dimension - Re_BufSz = Re_BufSz + SIZE(InData%Lidar) ! Lidar + IF ( ALLOCATED(InData%toSC) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! toSC upper/lower bounds for each dimension + Re_BufSz = Re_BufSz + SIZE(InData%toSC) ! toSC END IF IF ( Re_BufSz .GT. 0 ) THEN ALLOCATE( ReKiBuf( Re_BufSz ), STAT=ErrStat2 ) @@ -11007,18 +15322,67 @@ SUBROUTINE SrvD_PackOutput( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg, Re_Xferred = Re_Xferred + 1 END DO END IF - IF ( .NOT. ALLOCATED(InData%BStC) ) THEN + IF ( .NOT. ALLOCATED(InData%Lidar) ) THEN IntKiBuf( Int_Xferred ) = 0 Int_Xferred = Int_Xferred + 1 ELSE IntKiBuf( Int_Xferred ) = 1 Int_Xferred = Int_Xferred + 1 - IntKiBuf( Int_Xferred ) = LBOUND(InData%BStC,1) - IntKiBuf( Int_Xferred + 1) = UBOUND(InData%BStC,1) + IntKiBuf( Int_Xferred ) = LBOUND(InData%Lidar,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%Lidar,1) Int_Xferred = Int_Xferred + 2 - DO i1 = LBOUND(InData%BStC,1), UBOUND(InData%BStC,1) - CALL StC_PackOutput( Re_Buf, Db_Buf, Int_Buf, InData%BStC(i1), ErrStat2, ErrMsg2, OnlySize ) ! BStC + DO i1 = LBOUND(InData%Lidar,1), UBOUND(InData%Lidar,1) + ReKiBuf(Re_Xferred) = InData%Lidar(i1) + Re_Xferred = Re_Xferred + 1 + END DO + END IF + IF ( .NOT. ALLOCATED(InData%CableDeltaL) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%CableDeltaL,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%CableDeltaL,1) + Int_Xferred = Int_Xferred + 2 + + DO i1 = LBOUND(InData%CableDeltaL,1), UBOUND(InData%CableDeltaL,1) + ReKiBuf(Re_Xferred) = InData%CableDeltaL(i1) + Re_Xferred = Re_Xferred + 1 + END DO + END IF + IF ( .NOT. ALLOCATED(InData%CableDeltaLdot) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%CableDeltaLdot,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%CableDeltaLdot,1) + Int_Xferred = Int_Xferred + 2 + + DO i1 = LBOUND(InData%CableDeltaLdot,1), UBOUND(InData%CableDeltaLdot,1) + ReKiBuf(Re_Xferred) = InData%CableDeltaLdot(i1) + Re_Xferred = Re_Xferred + 1 + END DO + END IF + IF ( .NOT. ALLOCATED(InData%BStCLoadMesh) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%BStCLoadMesh,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%BStCLoadMesh,1) + Int_Xferred = Int_Xferred + 2 + IntKiBuf( Int_Xferred ) = LBOUND(InData%BStCLoadMesh,2) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%BStCLoadMesh,2) + Int_Xferred = Int_Xferred + 2 + + DO i2 = LBOUND(InData%BStCLoadMesh,2), UBOUND(InData%BStCLoadMesh,2) + DO i1 = LBOUND(InData%BStCLoadMesh,1), UBOUND(InData%BStCLoadMesh,1) + CALL MeshPack( InData%BStCLoadMesh(i1,i2), Re_Buf, Db_Buf, Int_Buf, ErrStat2, ErrMsg2, OnlySize ) ! BStCLoadMesh CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN @@ -11047,19 +15411,20 @@ SUBROUTINE SrvD_PackOutput( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg, IntKiBuf( Int_Xferred ) = 0; Int_Xferred = Int_Xferred + 1 ENDIF END DO + END DO END IF - IF ( .NOT. ALLOCATED(InData%NStC) ) THEN + IF ( .NOT. ALLOCATED(InData%NStCLoadMesh) ) THEN IntKiBuf( Int_Xferred ) = 0 Int_Xferred = Int_Xferred + 1 ELSE IntKiBuf( Int_Xferred ) = 1 Int_Xferred = Int_Xferred + 1 - IntKiBuf( Int_Xferred ) = LBOUND(InData%NStC,1) - IntKiBuf( Int_Xferred + 1) = UBOUND(InData%NStC,1) + IntKiBuf( Int_Xferred ) = LBOUND(InData%NStCLoadMesh,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%NStCLoadMesh,1) Int_Xferred = Int_Xferred + 2 - DO i1 = LBOUND(InData%NStC,1), UBOUND(InData%NStC,1) - CALL StC_PackOutput( Re_Buf, Db_Buf, Int_Buf, InData%NStC(i1), ErrStat2, ErrMsg2, OnlySize ) ! NStC + DO i1 = LBOUND(InData%NStCLoadMesh,1), UBOUND(InData%NStCLoadMesh,1) + CALL MeshPack( InData%NStCLoadMesh(i1), Re_Buf, Db_Buf, Int_Buf, ErrStat2, ErrMsg2, OnlySize ) ! NStCLoadMesh CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN @@ -11089,18 +15454,18 @@ SUBROUTINE SrvD_PackOutput( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg, ENDIF END DO END IF - IF ( .NOT. ALLOCATED(InData%TStC) ) THEN + IF ( .NOT. ALLOCATED(InData%TStCLoadMesh) ) THEN IntKiBuf( Int_Xferred ) = 0 Int_Xferred = Int_Xferred + 1 ELSE IntKiBuf( Int_Xferred ) = 1 Int_Xferred = Int_Xferred + 1 - IntKiBuf( Int_Xferred ) = LBOUND(InData%TStC,1) - IntKiBuf( Int_Xferred + 1) = UBOUND(InData%TStC,1) + IntKiBuf( Int_Xferred ) = LBOUND(InData%TStCLoadMesh,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%TStCLoadMesh,1) Int_Xferred = Int_Xferred + 2 - DO i1 = LBOUND(InData%TStC,1), UBOUND(InData%TStC,1) - CALL StC_PackOutput( Re_Buf, Db_Buf, Int_Buf, InData%TStC(i1), ErrStat2, ErrMsg2, OnlySize ) ! TStC + DO i1 = LBOUND(InData%TStCLoadMesh,1), UBOUND(InData%TStCLoadMesh,1) + CALL MeshPack( InData%TStCLoadMesh(i1), Re_Buf, Db_Buf, Int_Buf, ErrStat2, ErrMsg2, OnlySize ) ! TStCLoadMesh CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN @@ -11130,18 +15495,18 @@ SUBROUTINE SrvD_PackOutput( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg, ENDIF END DO END IF - IF ( .NOT. ALLOCATED(InData%SStC) ) THEN + IF ( .NOT. ALLOCATED(InData%SStCLoadMesh) ) THEN IntKiBuf( Int_Xferred ) = 0 Int_Xferred = Int_Xferred + 1 ELSE IntKiBuf( Int_Xferred ) = 1 Int_Xferred = Int_Xferred + 1 - IntKiBuf( Int_Xferred ) = LBOUND(InData%SStC,1) - IntKiBuf( Int_Xferred + 1) = UBOUND(InData%SStC,1) + IntKiBuf( Int_Xferred ) = LBOUND(InData%SStCLoadMesh,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%SStCLoadMesh,1) Int_Xferred = Int_Xferred + 2 - DO i1 = LBOUND(InData%SStC,1), UBOUND(InData%SStC,1) - CALL StC_PackOutput( Re_Buf, Db_Buf, Int_Buf, InData%SStC(i1), ErrStat2, ErrMsg2, OnlySize ) ! SStC + DO i1 = LBOUND(InData%SStCLoadMesh,1), UBOUND(InData%SStCLoadMesh,1) + CALL MeshPack( InData%SStCLoadMesh(i1), Re_Buf, Db_Buf, Int_Buf, ErrStat2, ErrMsg2, OnlySize ) ! SStCLoadMesh CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN @@ -11186,21 +15551,6 @@ SUBROUTINE SrvD_PackOutput( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg, Re_Xferred = Re_Xferred + 1 END DO END IF - IF ( .NOT. ALLOCATED(InData%Lidar) ) THEN - IntKiBuf( Int_Xferred ) = 0 - Int_Xferred = Int_Xferred + 1 - ELSE - IntKiBuf( Int_Xferred ) = 1 - Int_Xferred = Int_Xferred + 1 - IntKiBuf( Int_Xferred ) = LBOUND(InData%Lidar,1) - IntKiBuf( Int_Xferred + 1) = UBOUND(InData%Lidar,1) - Int_Xferred = Int_Xferred + 2 - - DO i1 = LBOUND(InData%Lidar,1), UBOUND(InData%Lidar,1) - ReKiBuf(Re_Xferred) = InData%Lidar(i1) - Re_Xferred = Re_Xferred + 1 - END DO - END IF END SUBROUTINE SrvD_PackOutput SUBROUTINE SrvD_UnPackOutput( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrMsg ) @@ -11217,6 +15567,7 @@ SUBROUTINE SrvD_UnPackOutput( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrM INTEGER(IntKi) :: Int_Xferred INTEGER(IntKi) :: i INTEGER(IntKi) :: i1, i1_l, i1_u ! bounds (upper/lower) for an array dimension 1 + INTEGER(IntKi) :: i2, i2_l, i2_u ! bounds (upper/lower) for an array dimension 2 INTEGER(IntKi) :: ErrStat2 CHARACTER(ErrMsgLen) :: ErrMsg2 CHARACTER(*), PARAMETER :: RoutineName = 'SrvD_UnPackOutput' @@ -11310,20 +15661,78 @@ SUBROUTINE SrvD_UnPackOutput( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrM Re_Xferred = Re_Xferred + 1 END DO END IF - IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! BStC not allocated + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! Lidar not allocated Int_Xferred = Int_Xferred + 1 ELSE Int_Xferred = Int_Xferred + 1 i1_l = IntKiBuf( Int_Xferred ) i1_u = IntKiBuf( Int_Xferred + 1) Int_Xferred = Int_Xferred + 2 - IF (ALLOCATED(OutData%BStC)) DEALLOCATE(OutData%BStC) - ALLOCATE(OutData%BStC(i1_l:i1_u),STAT=ErrStat2) + IF (ALLOCATED(OutData%Lidar)) DEALLOCATE(OutData%Lidar) + ALLOCATE(OutData%Lidar(i1_l:i1_u),STAT=ErrStat2) IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%BStC.', ErrStat, ErrMsg,RoutineName) + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%Lidar.', ErrStat, ErrMsg,RoutineName) RETURN END IF - DO i1 = LBOUND(OutData%BStC,1), UBOUND(OutData%BStC,1) + DO i1 = LBOUND(OutData%Lidar,1), UBOUND(OutData%Lidar,1) + OutData%Lidar(i1) = REAL(ReKiBuf(Re_Xferred), SiKi) + Re_Xferred = Re_Xferred + 1 + END DO + END IF + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! CableDeltaL not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%CableDeltaL)) DEALLOCATE(OutData%CableDeltaL) + ALLOCATE(OutData%CableDeltaL(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%CableDeltaL.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i1 = LBOUND(OutData%CableDeltaL,1), UBOUND(OutData%CableDeltaL,1) + OutData%CableDeltaL(i1) = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + END DO + END IF + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! CableDeltaLdot not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%CableDeltaLdot)) DEALLOCATE(OutData%CableDeltaLdot) + ALLOCATE(OutData%CableDeltaLdot(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%CableDeltaLdot.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i1 = LBOUND(OutData%CableDeltaLdot,1), UBOUND(OutData%CableDeltaLdot,1) + OutData%CableDeltaLdot(i1) = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + END DO + END IF + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! BStCLoadMesh not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + i2_l = IntKiBuf( Int_Xferred ) + i2_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%BStCLoadMesh)) DEALLOCATE(OutData%BStCLoadMesh) + ALLOCATE(OutData%BStCLoadMesh(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%BStCLoadMesh.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i2 = LBOUND(OutData%BStCLoadMesh,2), UBOUND(OutData%BStCLoadMesh,2) + DO i1 = LBOUND(OutData%BStCLoadMesh,1), UBOUND(OutData%BStCLoadMesh,1) Buf_size=IntKiBuf( Int_Xferred ) Int_Xferred = Int_Xferred + 1 IF(Buf_size > 0) THEN @@ -11357,7 +15766,7 @@ SUBROUTINE SrvD_UnPackOutput( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrM Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) Int_Xferred = Int_Xferred + Buf_size END IF - CALL StC_UnpackOutput( Re_Buf, Db_Buf, Int_Buf, OutData%BStC(i1), ErrStat2, ErrMsg2 ) ! BStC + CALL MeshUnpack( OutData%BStCLoadMesh(i1,i2), Re_Buf, Db_Buf, Int_Buf, ErrStat2, ErrMsg2 ) ! BStCLoadMesh CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN @@ -11365,21 +15774,22 @@ SUBROUTINE SrvD_UnPackOutput( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrM IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf ) IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) END DO + END DO END IF - IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! NStC not allocated + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! NStCLoadMesh not allocated Int_Xferred = Int_Xferred + 1 ELSE Int_Xferred = Int_Xferred + 1 i1_l = IntKiBuf( Int_Xferred ) i1_u = IntKiBuf( Int_Xferred + 1) Int_Xferred = Int_Xferred + 2 - IF (ALLOCATED(OutData%NStC)) DEALLOCATE(OutData%NStC) - ALLOCATE(OutData%NStC(i1_l:i1_u),STAT=ErrStat2) + IF (ALLOCATED(OutData%NStCLoadMesh)) DEALLOCATE(OutData%NStCLoadMesh) + ALLOCATE(OutData%NStCLoadMesh(i1_l:i1_u),STAT=ErrStat2) IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%NStC.', ErrStat, ErrMsg,RoutineName) + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%NStCLoadMesh.', ErrStat, ErrMsg,RoutineName) RETURN END IF - DO i1 = LBOUND(OutData%NStC,1), UBOUND(OutData%NStC,1) + DO i1 = LBOUND(OutData%NStCLoadMesh,1), UBOUND(OutData%NStCLoadMesh,1) Buf_size=IntKiBuf( Int_Xferred ) Int_Xferred = Int_Xferred + 1 IF(Buf_size > 0) THEN @@ -11413,7 +15823,7 @@ SUBROUTINE SrvD_UnPackOutput( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrM Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) Int_Xferred = Int_Xferred + Buf_size END IF - CALL StC_UnpackOutput( Re_Buf, Db_Buf, Int_Buf, OutData%NStC(i1), ErrStat2, ErrMsg2 ) ! NStC + CALL MeshUnpack( OutData%NStCLoadMesh(i1), Re_Buf, Db_Buf, Int_Buf, ErrStat2, ErrMsg2 ) ! NStCLoadMesh CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN @@ -11422,20 +15832,20 @@ SUBROUTINE SrvD_UnPackOutput( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrM IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) END DO END IF - IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! TStC not allocated + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! TStCLoadMesh not allocated Int_Xferred = Int_Xferred + 1 ELSE Int_Xferred = Int_Xferred + 1 i1_l = IntKiBuf( Int_Xferred ) i1_u = IntKiBuf( Int_Xferred + 1) Int_Xferred = Int_Xferred + 2 - IF (ALLOCATED(OutData%TStC)) DEALLOCATE(OutData%TStC) - ALLOCATE(OutData%TStC(i1_l:i1_u),STAT=ErrStat2) + IF (ALLOCATED(OutData%TStCLoadMesh)) DEALLOCATE(OutData%TStCLoadMesh) + ALLOCATE(OutData%TStCLoadMesh(i1_l:i1_u),STAT=ErrStat2) IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%TStC.', ErrStat, ErrMsg,RoutineName) + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%TStCLoadMesh.', ErrStat, ErrMsg,RoutineName) RETURN END IF - DO i1 = LBOUND(OutData%TStC,1), UBOUND(OutData%TStC,1) + DO i1 = LBOUND(OutData%TStCLoadMesh,1), UBOUND(OutData%TStCLoadMesh,1) Buf_size=IntKiBuf( Int_Xferred ) Int_Xferred = Int_Xferred + 1 IF(Buf_size > 0) THEN @@ -11469,7 +15879,7 @@ SUBROUTINE SrvD_UnPackOutput( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrM Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) Int_Xferred = Int_Xferred + Buf_size END IF - CALL StC_UnpackOutput( Re_Buf, Db_Buf, Int_Buf, OutData%TStC(i1), ErrStat2, ErrMsg2 ) ! TStC + CALL MeshUnpack( OutData%TStCLoadMesh(i1), Re_Buf, Db_Buf, Int_Buf, ErrStat2, ErrMsg2 ) ! TStCLoadMesh CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN @@ -11478,20 +15888,20 @@ SUBROUTINE SrvD_UnPackOutput( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrM IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) END DO END IF - IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! SStC not allocated + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! SStCLoadMesh not allocated Int_Xferred = Int_Xferred + 1 ELSE Int_Xferred = Int_Xferred + 1 i1_l = IntKiBuf( Int_Xferred ) i1_u = IntKiBuf( Int_Xferred + 1) Int_Xferred = Int_Xferred + 2 - IF (ALLOCATED(OutData%SStC)) DEALLOCATE(OutData%SStC) - ALLOCATE(OutData%SStC(i1_l:i1_u),STAT=ErrStat2) + IF (ALLOCATED(OutData%SStCLoadMesh)) DEALLOCATE(OutData%SStCLoadMesh) + ALLOCATE(OutData%SStCLoadMesh(i1_l:i1_u),STAT=ErrStat2) IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%SStC.', ErrStat, ErrMsg,RoutineName) + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%SStCLoadMesh.', ErrStat, ErrMsg,RoutineName) RETURN END IF - DO i1 = LBOUND(OutData%SStC,1), UBOUND(OutData%SStC,1) + DO i1 = LBOUND(OutData%SStCLoadMesh,1), UBOUND(OutData%SStCLoadMesh,1) Buf_size=IntKiBuf( Int_Xferred ) Int_Xferred = Int_Xferred + 1 IF(Buf_size > 0) THEN @@ -11525,7 +15935,7 @@ SUBROUTINE SrvD_UnPackOutput( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrM Int_Buf = IntKiBuf( Int_Xferred:Int_Xferred+Buf_size-1 ) Int_Xferred = Int_Xferred + Buf_size END IF - CALL StC_UnpackOutput( Re_Buf, Db_Buf, Int_Buf, OutData%SStC(i1), ErrStat2, ErrMsg2 ) ! SStC + CALL MeshUnpack( OutData%SStCLoadMesh(i1), Re_Buf, Db_Buf, Int_Buf, ErrStat2, ErrMsg2 ) ! SStCLoadMesh CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat >= AbortErrLev) RETURN @@ -11552,24 +15962,6 @@ SUBROUTINE SrvD_UnPackOutput( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrM Re_Xferred = Re_Xferred + 1 END DO END IF - IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! Lidar not allocated - Int_Xferred = Int_Xferred + 1 - ELSE - Int_Xferred = Int_Xferred + 1 - i1_l = IntKiBuf( Int_Xferred ) - i1_u = IntKiBuf( Int_Xferred + 1) - Int_Xferred = Int_Xferred + 2 - IF (ALLOCATED(OutData%Lidar)) DEALLOCATE(OutData%Lidar) - ALLOCATE(OutData%Lidar(i1_l:i1_u),STAT=ErrStat2) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%Lidar.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - DO i1 = LBOUND(OutData%Lidar,1), UBOUND(OutData%Lidar,1) - OutData%Lidar(i1) = REAL(ReKiBuf(Re_Xferred), SiKi) - Re_Xferred = Re_Xferred + 1 - END DO - END IF END SUBROUTINE SrvD_UnPackOutput @@ -11652,7 +16044,9 @@ SUBROUTINE SrvD_Input_ExtrapInterp1(u1, u2, tin, u_out, tin_out, ErrStat, ErrMsg INTEGER(IntKi) :: ErrStat2 ! local errors CHARACTER(ErrMsgLen) :: ErrMsg2 ! local errors INTEGER :: i01 ! dim1 level 0 counter variable for arrays of ddts + INTEGER :: i02 ! dim2 level 0 counter variable for arrays of ddts INTEGER :: i1 ! dim1 counter variable for arrays + INTEGER :: i2 ! dim2 counter variable for arrays ! Initialize ErrStat ErrStat = ErrID_None ErrMsg = "" @@ -11695,6 +16089,24 @@ SUBROUTINE SrvD_Input_ExtrapInterp1(u1, u2, tin, u_out, tin_out, ErrStat, ErrMsg u_out%ExternalElecPwr = u1%ExternalElecPwr + b * ScaleFactor b = -(u1%ExternalHSSBrFrac - u2%ExternalHSSBrFrac) u_out%ExternalHSSBrFrac = u1%ExternalHSSBrFrac + b * ScaleFactor +IF (ALLOCATED(u_out%ExternalBlAirfoilCom) .AND. ALLOCATED(u1%ExternalBlAirfoilCom)) THEN + DO i1 = LBOUND(u_out%ExternalBlAirfoilCom,1),UBOUND(u_out%ExternalBlAirfoilCom,1) + b = -(u1%ExternalBlAirfoilCom(i1) - u2%ExternalBlAirfoilCom(i1)) + u_out%ExternalBlAirfoilCom(i1) = u1%ExternalBlAirfoilCom(i1) + b * ScaleFactor + END DO +END IF ! check if allocated +IF (ALLOCATED(u_out%ExternalCableDeltaL) .AND. ALLOCATED(u1%ExternalCableDeltaL)) THEN + DO i1 = LBOUND(u_out%ExternalCableDeltaL,1),UBOUND(u_out%ExternalCableDeltaL,1) + b = -(u1%ExternalCableDeltaL(i1) - u2%ExternalCableDeltaL(i1)) + u_out%ExternalCableDeltaL(i1) = u1%ExternalCableDeltaL(i1) + b * ScaleFactor + END DO +END IF ! check if allocated +IF (ALLOCATED(u_out%ExternalCableDeltaLdot) .AND. ALLOCATED(u1%ExternalCableDeltaLdot)) THEN + DO i1 = LBOUND(u_out%ExternalCableDeltaLdot,1),UBOUND(u_out%ExternalCableDeltaLdot,1) + b = -(u1%ExternalCableDeltaLdot(i1) - u2%ExternalCableDeltaLdot(i1)) + u_out%ExternalCableDeltaLdot(i1) = u1%ExternalCableDeltaLdot(i1) + b * ScaleFactor + END DO +END IF ! check if allocated b = -(u1%TwrAccel - u2%TwrAccel) u_out%TwrAccel = u1%TwrAccel + b * ScaleFactor CALL Angles_ExtrapInterp( u1%YawErr, u2%YawErr, tin, u_out%YawErr, tin_out ) @@ -11738,30 +16150,6 @@ SUBROUTINE SrvD_Input_ExtrapInterp1(u1, u2, tin, u_out, tin_out, ErrStat, ErrMsg b = -(u1%HorWindV - u2%HorWindV) u_out%HorWindV = u1%HorWindV + b * ScaleFactor CALL Angles_ExtrapInterp( u1%YawAngle, u2%YawAngle, tin, u_out%YawAngle, tin_out ) -IF (ALLOCATED(u_out%BStC) .AND. ALLOCATED(u1%BStC)) THEN - DO i1 = LBOUND(u_out%BStC,1),UBOUND(u_out%BStC,1) - CALL StC_Input_ExtrapInterp1( u1%BStC(i1), u2%BStC(i1), tin, u_out%BStC(i1), tin_out, ErrStat2, ErrMsg2 ) - CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) - ENDDO -END IF ! check if allocated -IF (ALLOCATED(u_out%NStC) .AND. ALLOCATED(u1%NStC)) THEN - DO i1 = LBOUND(u_out%NStC,1),UBOUND(u_out%NStC,1) - CALL StC_Input_ExtrapInterp1( u1%NStC(i1), u2%NStC(i1), tin, u_out%NStC(i1), tin_out, ErrStat2, ErrMsg2 ) - CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) - ENDDO -END IF ! check if allocated -IF (ALLOCATED(u_out%TStC) .AND. ALLOCATED(u1%TStC)) THEN - DO i1 = LBOUND(u_out%TStC,1),UBOUND(u_out%TStC,1) - CALL StC_Input_ExtrapInterp1( u1%TStC(i1), u2%TStC(i1), tin, u_out%TStC(i1), tin_out, ErrStat2, ErrMsg2 ) - CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) - ENDDO -END IF ! check if allocated -IF (ALLOCATED(u_out%SStC) .AND. ALLOCATED(u1%SStC)) THEN - DO i1 = LBOUND(u_out%SStC,1),UBOUND(u_out%SStC,1) - CALL StC_Input_ExtrapInterp1( u1%SStC(i1), u2%SStC(i1), tin, u_out%SStC(i1), tin_out, ErrStat2, ErrMsg2 ) - CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) - ENDDO -END IF ! check if allocated IF (ALLOCATED(u_out%fromSC) .AND. ALLOCATED(u1%fromSC)) THEN DO i1 = LBOUND(u_out%fromSC,1),UBOUND(u_out%fromSC,1) b = -(u1%fromSC(i1) - u2%fromSC(i1)) @@ -11779,6 +16167,34 @@ SUBROUTINE SrvD_Input_ExtrapInterp1(u1, u2, tin, u_out, tin_out, ErrStat, ErrMsg b = -(u1%Lidar(i1) - u2%Lidar(i1)) u_out%Lidar(i1) = u1%Lidar(i1) + b * ScaleFactor END DO +END IF ! check if allocated + CALL MeshExtrapInterp1(u1%PtfmMotionMesh, u2%PtfmMotionMesh, tin, u_out%PtfmMotionMesh, tin_out, ErrStat2, ErrMsg2 ) + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) +IF (ALLOCATED(u_out%BStCMotionMesh) .AND. ALLOCATED(u1%BStCMotionMesh)) THEN + DO i2 = LBOUND(u_out%BStCMotionMesh,2),UBOUND(u_out%BStCMotionMesh,2) + DO i1 = LBOUND(u_out%BStCMotionMesh,1),UBOUND(u_out%BStCMotionMesh,1) + CALL MeshExtrapInterp1(u1%BStCMotionMesh(i1,i2), u2%BStCMotionMesh(i1,i2), tin, u_out%BStCMotionMesh(i1,i2), tin_out, ErrStat2, ErrMsg2 ) + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) + ENDDO + ENDDO +END IF ! check if allocated +IF (ALLOCATED(u_out%NStCMotionMesh) .AND. ALLOCATED(u1%NStCMotionMesh)) THEN + DO i1 = LBOUND(u_out%NStCMotionMesh,1),UBOUND(u_out%NStCMotionMesh,1) + CALL MeshExtrapInterp1(u1%NStCMotionMesh(i1), u2%NStCMotionMesh(i1), tin, u_out%NStCMotionMesh(i1), tin_out, ErrStat2, ErrMsg2 ) + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) + ENDDO +END IF ! check if allocated +IF (ALLOCATED(u_out%TStCMotionMesh) .AND. ALLOCATED(u1%TStCMotionMesh)) THEN + DO i1 = LBOUND(u_out%TStCMotionMesh,1),UBOUND(u_out%TStCMotionMesh,1) + CALL MeshExtrapInterp1(u1%TStCMotionMesh(i1), u2%TStCMotionMesh(i1), tin, u_out%TStCMotionMesh(i1), tin_out, ErrStat2, ErrMsg2 ) + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) + ENDDO +END IF ! check if allocated +IF (ALLOCATED(u_out%SStCMotionMesh) .AND. ALLOCATED(u1%SStCMotionMesh)) THEN + DO i1 = LBOUND(u_out%SStCMotionMesh,1),UBOUND(u_out%SStCMotionMesh,1) + CALL MeshExtrapInterp1(u1%SStCMotionMesh(i1), u2%SStCMotionMesh(i1), tin, u_out%SStCMotionMesh(i1), tin_out, ErrStat2, ErrMsg2 ) + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) + ENDDO END IF ! check if allocated END SUBROUTINE SrvD_Input_ExtrapInterp1 @@ -11816,7 +16232,9 @@ SUBROUTINE SrvD_Input_ExtrapInterp2(u1, u2, u3, tin, u_out, tin_out, ErrStat, Er CHARACTER(ErrMsgLen) :: ErrMsg2 ! local errors CHARACTER(*), PARAMETER :: RoutineName = 'SrvD_Input_ExtrapInterp2' INTEGER :: i01 ! dim1 level 0 counter variable for arrays of ddts + INTEGER :: i02 ! dim2 level 0 counter variable for arrays of ddts INTEGER :: i1 ! dim1 counter variable for arrays + INTEGER :: i2 ! dim2 counter variable for arrays ! Initialize ErrStat ErrStat = ErrID_None ErrMsg = "" @@ -11873,6 +16291,27 @@ SUBROUTINE SrvD_Input_ExtrapInterp2(u1, u2, u3, tin, u_out, tin_out, ErrStat, Er b = (t(3)**2*(u1%ExternalHSSBrFrac - u2%ExternalHSSBrFrac) + t(2)**2*(-u1%ExternalHSSBrFrac + u3%ExternalHSSBrFrac))* scaleFactor c = ( (t(2)-t(3))*u1%ExternalHSSBrFrac + t(3)*u2%ExternalHSSBrFrac - t(2)*u3%ExternalHSSBrFrac ) * scaleFactor u_out%ExternalHSSBrFrac = u1%ExternalHSSBrFrac + b + c * t_out +IF (ALLOCATED(u_out%ExternalBlAirfoilCom) .AND. ALLOCATED(u1%ExternalBlAirfoilCom)) THEN + DO i1 = LBOUND(u_out%ExternalBlAirfoilCom,1),UBOUND(u_out%ExternalBlAirfoilCom,1) + b = (t(3)**2*(u1%ExternalBlAirfoilCom(i1) - u2%ExternalBlAirfoilCom(i1)) + t(2)**2*(-u1%ExternalBlAirfoilCom(i1) + u3%ExternalBlAirfoilCom(i1)))* scaleFactor + c = ( (t(2)-t(3))*u1%ExternalBlAirfoilCom(i1) + t(3)*u2%ExternalBlAirfoilCom(i1) - t(2)*u3%ExternalBlAirfoilCom(i1) ) * scaleFactor + u_out%ExternalBlAirfoilCom(i1) = u1%ExternalBlAirfoilCom(i1) + b + c * t_out + END DO +END IF ! check if allocated +IF (ALLOCATED(u_out%ExternalCableDeltaL) .AND. ALLOCATED(u1%ExternalCableDeltaL)) THEN + DO i1 = LBOUND(u_out%ExternalCableDeltaL,1),UBOUND(u_out%ExternalCableDeltaL,1) + b = (t(3)**2*(u1%ExternalCableDeltaL(i1) - u2%ExternalCableDeltaL(i1)) + t(2)**2*(-u1%ExternalCableDeltaL(i1) + u3%ExternalCableDeltaL(i1)))* scaleFactor + c = ( (t(2)-t(3))*u1%ExternalCableDeltaL(i1) + t(3)*u2%ExternalCableDeltaL(i1) - t(2)*u3%ExternalCableDeltaL(i1) ) * scaleFactor + u_out%ExternalCableDeltaL(i1) = u1%ExternalCableDeltaL(i1) + b + c * t_out + END DO +END IF ! check if allocated +IF (ALLOCATED(u_out%ExternalCableDeltaLdot) .AND. ALLOCATED(u1%ExternalCableDeltaLdot)) THEN + DO i1 = LBOUND(u_out%ExternalCableDeltaLdot,1),UBOUND(u_out%ExternalCableDeltaLdot,1) + b = (t(3)**2*(u1%ExternalCableDeltaLdot(i1) - u2%ExternalCableDeltaLdot(i1)) + t(2)**2*(-u1%ExternalCableDeltaLdot(i1) + u3%ExternalCableDeltaLdot(i1)))* scaleFactor + c = ( (t(2)-t(3))*u1%ExternalCableDeltaLdot(i1) + t(3)*u2%ExternalCableDeltaLdot(i1) - t(2)*u3%ExternalCableDeltaLdot(i1) ) * scaleFactor + u_out%ExternalCableDeltaLdot(i1) = u1%ExternalCableDeltaLdot(i1) + b + c * t_out + END DO +END IF ! check if allocated b = (t(3)**2*(u1%TwrAccel - u2%TwrAccel) + t(2)**2*(-u1%TwrAccel + u3%TwrAccel))* scaleFactor c = ( (t(2)-t(3))*u1%TwrAccel + t(3)*u2%TwrAccel - t(2)*u3%TwrAccel ) * scaleFactor u_out%TwrAccel = u1%TwrAccel + b + c * t_out @@ -11934,30 +16373,6 @@ SUBROUTINE SrvD_Input_ExtrapInterp2(u1, u2, u3, tin, u_out, tin_out, ErrStat, Er c = ( (t(2)-t(3))*u1%HorWindV + t(3)*u2%HorWindV - t(2)*u3%HorWindV ) * scaleFactor u_out%HorWindV = u1%HorWindV + b + c * t_out CALL Angles_ExtrapInterp( u1%YawAngle, u2%YawAngle, u3%YawAngle, tin, u_out%YawAngle, tin_out ) -IF (ALLOCATED(u_out%BStC) .AND. ALLOCATED(u1%BStC)) THEN - DO i1 = LBOUND(u_out%BStC,1),UBOUND(u_out%BStC,1) - CALL StC_Input_ExtrapInterp2( u1%BStC(i1), u2%BStC(i1), u3%BStC(i1), tin, u_out%BStC(i1), tin_out, ErrStat2, ErrMsg2 ) - CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) - ENDDO -END IF ! check if allocated -IF (ALLOCATED(u_out%NStC) .AND. ALLOCATED(u1%NStC)) THEN - DO i1 = LBOUND(u_out%NStC,1),UBOUND(u_out%NStC,1) - CALL StC_Input_ExtrapInterp2( u1%NStC(i1), u2%NStC(i1), u3%NStC(i1), tin, u_out%NStC(i1), tin_out, ErrStat2, ErrMsg2 ) - CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) - ENDDO -END IF ! check if allocated -IF (ALLOCATED(u_out%TStC) .AND. ALLOCATED(u1%TStC)) THEN - DO i1 = LBOUND(u_out%TStC,1),UBOUND(u_out%TStC,1) - CALL StC_Input_ExtrapInterp2( u1%TStC(i1), u2%TStC(i1), u3%TStC(i1), tin, u_out%TStC(i1), tin_out, ErrStat2, ErrMsg2 ) - CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) - ENDDO -END IF ! check if allocated -IF (ALLOCATED(u_out%SStC) .AND. ALLOCATED(u1%SStC)) THEN - DO i1 = LBOUND(u_out%SStC,1),UBOUND(u_out%SStC,1) - CALL StC_Input_ExtrapInterp2( u1%SStC(i1), u2%SStC(i1), u3%SStC(i1), tin, u_out%SStC(i1), tin_out, ErrStat2, ErrMsg2 ) - CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) - ENDDO -END IF ! check if allocated IF (ALLOCATED(u_out%fromSC) .AND. ALLOCATED(u1%fromSC)) THEN DO i1 = LBOUND(u_out%fromSC,1),UBOUND(u_out%fromSC,1) b = (t(3)**2*(u1%fromSC(i1) - u2%fromSC(i1)) + t(2)**2*(-u1%fromSC(i1) + u3%fromSC(i1)))* scaleFactor @@ -11978,6 +16393,34 @@ SUBROUTINE SrvD_Input_ExtrapInterp2(u1, u2, u3, tin, u_out, tin_out, ErrStat, Er c = ( (t(2)-t(3))*u1%Lidar(i1) + t(3)*u2%Lidar(i1) - t(2)*u3%Lidar(i1) ) * scaleFactor u_out%Lidar(i1) = u1%Lidar(i1) + b + c * t_out END DO +END IF ! check if allocated + CALL MeshExtrapInterp2(u1%PtfmMotionMesh, u2%PtfmMotionMesh, u3%PtfmMotionMesh, tin, u_out%PtfmMotionMesh, tin_out, ErrStat2, ErrMsg2 ) + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) +IF (ALLOCATED(u_out%BStCMotionMesh) .AND. ALLOCATED(u1%BStCMotionMesh)) THEN + DO i2 = LBOUND(u_out%BStCMotionMesh,2),UBOUND(u_out%BStCMotionMesh,2) + DO i1 = LBOUND(u_out%BStCMotionMesh,1),UBOUND(u_out%BStCMotionMesh,1) + CALL MeshExtrapInterp2(u1%BStCMotionMesh(i1,i2), u2%BStCMotionMesh(i1,i2), u3%BStCMotionMesh(i1,i2), tin, u_out%BStCMotionMesh(i1,i2), tin_out, ErrStat2, ErrMsg2 ) + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) + ENDDO + ENDDO +END IF ! check if allocated +IF (ALLOCATED(u_out%NStCMotionMesh) .AND. ALLOCATED(u1%NStCMotionMesh)) THEN + DO i1 = LBOUND(u_out%NStCMotionMesh,1),UBOUND(u_out%NStCMotionMesh,1) + CALL MeshExtrapInterp2(u1%NStCMotionMesh(i1), u2%NStCMotionMesh(i1), u3%NStCMotionMesh(i1), tin, u_out%NStCMotionMesh(i1), tin_out, ErrStat2, ErrMsg2 ) + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) + ENDDO +END IF ! check if allocated +IF (ALLOCATED(u_out%TStCMotionMesh) .AND. ALLOCATED(u1%TStCMotionMesh)) THEN + DO i1 = LBOUND(u_out%TStCMotionMesh,1),UBOUND(u_out%TStCMotionMesh,1) + CALL MeshExtrapInterp2(u1%TStCMotionMesh(i1), u2%TStCMotionMesh(i1), u3%TStCMotionMesh(i1), tin, u_out%TStCMotionMesh(i1), tin_out, ErrStat2, ErrMsg2 ) + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) + ENDDO +END IF ! check if allocated +IF (ALLOCATED(u_out%SStCMotionMesh) .AND. ALLOCATED(u1%SStCMotionMesh)) THEN + DO i1 = LBOUND(u_out%SStCMotionMesh,1),UBOUND(u_out%SStCMotionMesh,1) + CALL MeshExtrapInterp2(u1%SStCMotionMesh(i1), u2%SStCMotionMesh(i1), u3%SStCMotionMesh(i1), tin, u_out%SStCMotionMesh(i1), tin_out, ErrStat2, ErrMsg2 ) + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) + ENDDO END IF ! check if allocated END SUBROUTINE SrvD_Input_ExtrapInterp2 @@ -12061,7 +16504,9 @@ SUBROUTINE SrvD_Output_ExtrapInterp1(y1, y2, tin, y_out, tin_out, ErrStat, ErrMs INTEGER(IntKi) :: ErrStat2 ! local errors CHARACTER(ErrMsgLen) :: ErrMsg2 ! local errors INTEGER :: i01 ! dim1 level 0 counter variable for arrays of ddts + INTEGER :: i02 ! dim2 level 0 counter variable for arrays of ddts INTEGER :: i1 ! dim1 counter variable for arrays + INTEGER :: i2 ! dim2 counter variable for arrays ! Initialize ErrStat ErrStat = ErrID_None ErrMsg = "" @@ -12107,27 +16552,47 @@ SUBROUTINE SrvD_Output_ExtrapInterp1(y1, y2, tin, y_out, tin_out, ErrStat, ErrMs y_out%TBDrCon(i1) = y1%TBDrCon(i1) + b * ScaleFactor END DO END IF ! check if allocated -IF (ALLOCATED(y_out%BStC) .AND. ALLOCATED(y1%BStC)) THEN - DO i1 = LBOUND(y_out%BStC,1),UBOUND(y_out%BStC,1) - CALL StC_Output_ExtrapInterp1( y1%BStC(i1), y2%BStC(i1), tin, y_out%BStC(i1), tin_out, ErrStat2, ErrMsg2 ) +IF (ALLOCATED(y_out%Lidar) .AND. ALLOCATED(y1%Lidar)) THEN + DO i1 = LBOUND(y_out%Lidar,1),UBOUND(y_out%Lidar,1) + b = -(y1%Lidar(i1) - y2%Lidar(i1)) + y_out%Lidar(i1) = y1%Lidar(i1) + b * ScaleFactor + END DO +END IF ! check if allocated +IF (ALLOCATED(y_out%CableDeltaL) .AND. ALLOCATED(y1%CableDeltaL)) THEN + DO i1 = LBOUND(y_out%CableDeltaL,1),UBOUND(y_out%CableDeltaL,1) + b = -(y1%CableDeltaL(i1) - y2%CableDeltaL(i1)) + y_out%CableDeltaL(i1) = y1%CableDeltaL(i1) + b * ScaleFactor + END DO +END IF ! check if allocated +IF (ALLOCATED(y_out%CableDeltaLdot) .AND. ALLOCATED(y1%CableDeltaLdot)) THEN + DO i1 = LBOUND(y_out%CableDeltaLdot,1),UBOUND(y_out%CableDeltaLdot,1) + b = -(y1%CableDeltaLdot(i1) - y2%CableDeltaLdot(i1)) + y_out%CableDeltaLdot(i1) = y1%CableDeltaLdot(i1) + b * ScaleFactor + END DO +END IF ! check if allocated +IF (ALLOCATED(y_out%BStCLoadMesh) .AND. ALLOCATED(y1%BStCLoadMesh)) THEN + DO i2 = LBOUND(y_out%BStCLoadMesh,2),UBOUND(y_out%BStCLoadMesh,2) + DO i1 = LBOUND(y_out%BStCLoadMesh,1),UBOUND(y_out%BStCLoadMesh,1) + CALL MeshExtrapInterp1(y1%BStCLoadMesh(i1,i2), y2%BStCLoadMesh(i1,i2), tin, y_out%BStCLoadMesh(i1,i2), tin_out, ErrStat2, ErrMsg2 ) CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) ENDDO + ENDDO END IF ! check if allocated -IF (ALLOCATED(y_out%NStC) .AND. ALLOCATED(y1%NStC)) THEN - DO i1 = LBOUND(y_out%NStC,1),UBOUND(y_out%NStC,1) - CALL StC_Output_ExtrapInterp1( y1%NStC(i1), y2%NStC(i1), tin, y_out%NStC(i1), tin_out, ErrStat2, ErrMsg2 ) +IF (ALLOCATED(y_out%NStCLoadMesh) .AND. ALLOCATED(y1%NStCLoadMesh)) THEN + DO i1 = LBOUND(y_out%NStCLoadMesh,1),UBOUND(y_out%NStCLoadMesh,1) + CALL MeshExtrapInterp1(y1%NStCLoadMesh(i1), y2%NStCLoadMesh(i1), tin, y_out%NStCLoadMesh(i1), tin_out, ErrStat2, ErrMsg2 ) CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) ENDDO END IF ! check if allocated -IF (ALLOCATED(y_out%TStC) .AND. ALLOCATED(y1%TStC)) THEN - DO i1 = LBOUND(y_out%TStC,1),UBOUND(y_out%TStC,1) - CALL StC_Output_ExtrapInterp1( y1%TStC(i1), y2%TStC(i1), tin, y_out%TStC(i1), tin_out, ErrStat2, ErrMsg2 ) +IF (ALLOCATED(y_out%TStCLoadMesh) .AND. ALLOCATED(y1%TStCLoadMesh)) THEN + DO i1 = LBOUND(y_out%TStCLoadMesh,1),UBOUND(y_out%TStCLoadMesh,1) + CALL MeshExtrapInterp1(y1%TStCLoadMesh(i1), y2%TStCLoadMesh(i1), tin, y_out%TStCLoadMesh(i1), tin_out, ErrStat2, ErrMsg2 ) CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) ENDDO END IF ! check if allocated -IF (ALLOCATED(y_out%SStC) .AND. ALLOCATED(y1%SStC)) THEN - DO i1 = LBOUND(y_out%SStC,1),UBOUND(y_out%SStC,1) - CALL StC_Output_ExtrapInterp1( y1%SStC(i1), y2%SStC(i1), tin, y_out%SStC(i1), tin_out, ErrStat2, ErrMsg2 ) +IF (ALLOCATED(y_out%SStCLoadMesh) .AND. ALLOCATED(y1%SStCLoadMesh)) THEN + DO i1 = LBOUND(y_out%SStCLoadMesh,1),UBOUND(y_out%SStCLoadMesh,1) + CALL MeshExtrapInterp1(y1%SStCLoadMesh(i1), y2%SStCLoadMesh(i1), tin, y_out%SStCLoadMesh(i1), tin_out, ErrStat2, ErrMsg2 ) CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) ENDDO END IF ! check if allocated @@ -12136,12 +16601,6 @@ SUBROUTINE SrvD_Output_ExtrapInterp1(y1, y2, tin, y_out, tin_out, ErrStat, ErrMs b = -(y1%toSC(i1) - y2%toSC(i1)) y_out%toSC(i1) = y1%toSC(i1) + b * ScaleFactor END DO -END IF ! check if allocated -IF (ALLOCATED(y_out%Lidar) .AND. ALLOCATED(y1%Lidar)) THEN - DO i1 = LBOUND(y_out%Lidar,1),UBOUND(y_out%Lidar,1) - b = -(y1%Lidar(i1) - y2%Lidar(i1)) - y_out%Lidar(i1) = y1%Lidar(i1) + b * ScaleFactor - END DO END IF ! check if allocated END SUBROUTINE SrvD_Output_ExtrapInterp1 @@ -12179,7 +16638,9 @@ SUBROUTINE SrvD_Output_ExtrapInterp2(y1, y2, y3, tin, y_out, tin_out, ErrStat, E CHARACTER(ErrMsgLen) :: ErrMsg2 ! local errors CHARACTER(*), PARAMETER :: RoutineName = 'SrvD_Output_ExtrapInterp2' INTEGER :: i01 ! dim1 level 0 counter variable for arrays of ddts + INTEGER :: i02 ! dim2 level 0 counter variable for arrays of ddts INTEGER :: i1 ! dim1 counter variable for arrays + INTEGER :: i2 ! dim2 counter variable for arrays ! Initialize ErrStat ErrStat = ErrID_None ErrMsg = "" @@ -12238,27 +16699,50 @@ SUBROUTINE SrvD_Output_ExtrapInterp2(y1, y2, y3, tin, y_out, tin_out, ErrStat, E y_out%TBDrCon(i1) = y1%TBDrCon(i1) + b + c * t_out END DO END IF ! check if allocated -IF (ALLOCATED(y_out%BStC) .AND. ALLOCATED(y1%BStC)) THEN - DO i1 = LBOUND(y_out%BStC,1),UBOUND(y_out%BStC,1) - CALL StC_Output_ExtrapInterp2( y1%BStC(i1), y2%BStC(i1), y3%BStC(i1), tin, y_out%BStC(i1), tin_out, ErrStat2, ErrMsg2 ) +IF (ALLOCATED(y_out%Lidar) .AND. ALLOCATED(y1%Lidar)) THEN + DO i1 = LBOUND(y_out%Lidar,1),UBOUND(y_out%Lidar,1) + b = (t(3)**2*(y1%Lidar(i1) - y2%Lidar(i1)) + t(2)**2*(-y1%Lidar(i1) + y3%Lidar(i1)))* scaleFactor + c = ( (t(2)-t(3))*y1%Lidar(i1) + t(3)*y2%Lidar(i1) - t(2)*y3%Lidar(i1) ) * scaleFactor + y_out%Lidar(i1) = y1%Lidar(i1) + b + c * t_out + END DO +END IF ! check if allocated +IF (ALLOCATED(y_out%CableDeltaL) .AND. ALLOCATED(y1%CableDeltaL)) THEN + DO i1 = LBOUND(y_out%CableDeltaL,1),UBOUND(y_out%CableDeltaL,1) + b = (t(3)**2*(y1%CableDeltaL(i1) - y2%CableDeltaL(i1)) + t(2)**2*(-y1%CableDeltaL(i1) + y3%CableDeltaL(i1)))* scaleFactor + c = ( (t(2)-t(3))*y1%CableDeltaL(i1) + t(3)*y2%CableDeltaL(i1) - t(2)*y3%CableDeltaL(i1) ) * scaleFactor + y_out%CableDeltaL(i1) = y1%CableDeltaL(i1) + b + c * t_out + END DO +END IF ! check if allocated +IF (ALLOCATED(y_out%CableDeltaLdot) .AND. ALLOCATED(y1%CableDeltaLdot)) THEN + DO i1 = LBOUND(y_out%CableDeltaLdot,1),UBOUND(y_out%CableDeltaLdot,1) + b = (t(3)**2*(y1%CableDeltaLdot(i1) - y2%CableDeltaLdot(i1)) + t(2)**2*(-y1%CableDeltaLdot(i1) + y3%CableDeltaLdot(i1)))* scaleFactor + c = ( (t(2)-t(3))*y1%CableDeltaLdot(i1) + t(3)*y2%CableDeltaLdot(i1) - t(2)*y3%CableDeltaLdot(i1) ) * scaleFactor + y_out%CableDeltaLdot(i1) = y1%CableDeltaLdot(i1) + b + c * t_out + END DO +END IF ! check if allocated +IF (ALLOCATED(y_out%BStCLoadMesh) .AND. ALLOCATED(y1%BStCLoadMesh)) THEN + DO i2 = LBOUND(y_out%BStCLoadMesh,2),UBOUND(y_out%BStCLoadMesh,2) + DO i1 = LBOUND(y_out%BStCLoadMesh,1),UBOUND(y_out%BStCLoadMesh,1) + CALL MeshExtrapInterp2(y1%BStCLoadMesh(i1,i2), y2%BStCLoadMesh(i1,i2), y3%BStCLoadMesh(i1,i2), tin, y_out%BStCLoadMesh(i1,i2), tin_out, ErrStat2, ErrMsg2 ) CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) ENDDO + ENDDO END IF ! check if allocated -IF (ALLOCATED(y_out%NStC) .AND. ALLOCATED(y1%NStC)) THEN - DO i1 = LBOUND(y_out%NStC,1),UBOUND(y_out%NStC,1) - CALL StC_Output_ExtrapInterp2( y1%NStC(i1), y2%NStC(i1), y3%NStC(i1), tin, y_out%NStC(i1), tin_out, ErrStat2, ErrMsg2 ) +IF (ALLOCATED(y_out%NStCLoadMesh) .AND. ALLOCATED(y1%NStCLoadMesh)) THEN + DO i1 = LBOUND(y_out%NStCLoadMesh,1),UBOUND(y_out%NStCLoadMesh,1) + CALL MeshExtrapInterp2(y1%NStCLoadMesh(i1), y2%NStCLoadMesh(i1), y3%NStCLoadMesh(i1), tin, y_out%NStCLoadMesh(i1), tin_out, ErrStat2, ErrMsg2 ) CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) ENDDO END IF ! check if allocated -IF (ALLOCATED(y_out%TStC) .AND. ALLOCATED(y1%TStC)) THEN - DO i1 = LBOUND(y_out%TStC,1),UBOUND(y_out%TStC,1) - CALL StC_Output_ExtrapInterp2( y1%TStC(i1), y2%TStC(i1), y3%TStC(i1), tin, y_out%TStC(i1), tin_out, ErrStat2, ErrMsg2 ) +IF (ALLOCATED(y_out%TStCLoadMesh) .AND. ALLOCATED(y1%TStCLoadMesh)) THEN + DO i1 = LBOUND(y_out%TStCLoadMesh,1),UBOUND(y_out%TStCLoadMesh,1) + CALL MeshExtrapInterp2(y1%TStCLoadMesh(i1), y2%TStCLoadMesh(i1), y3%TStCLoadMesh(i1), tin, y_out%TStCLoadMesh(i1), tin_out, ErrStat2, ErrMsg2 ) CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) ENDDO END IF ! check if allocated -IF (ALLOCATED(y_out%SStC) .AND. ALLOCATED(y1%SStC)) THEN - DO i1 = LBOUND(y_out%SStC,1),UBOUND(y_out%SStC,1) - CALL StC_Output_ExtrapInterp2( y1%SStC(i1), y2%SStC(i1), y3%SStC(i1), tin, y_out%SStC(i1), tin_out, ErrStat2, ErrMsg2 ) +IF (ALLOCATED(y_out%SStCLoadMesh) .AND. ALLOCATED(y1%SStCLoadMesh)) THEN + DO i1 = LBOUND(y_out%SStCLoadMesh,1),UBOUND(y_out%SStCLoadMesh,1) + CALL MeshExtrapInterp2(y1%SStCLoadMesh(i1), y2%SStCLoadMesh(i1), y3%SStCLoadMesh(i1), tin, y_out%SStCLoadMesh(i1), tin_out, ErrStat2, ErrMsg2 ) CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) ENDDO END IF ! check if allocated @@ -12268,13 +16752,6 @@ SUBROUTINE SrvD_Output_ExtrapInterp2(y1, y2, y3, tin, y_out, tin_out, ErrStat, E c = ( (t(2)-t(3))*y1%toSC(i1) + t(3)*y2%toSC(i1) - t(2)*y3%toSC(i1) ) * scaleFactor y_out%toSC(i1) = y1%toSC(i1) + b + c * t_out END DO -END IF ! check if allocated -IF (ALLOCATED(y_out%Lidar) .AND. ALLOCATED(y1%Lidar)) THEN - DO i1 = LBOUND(y_out%Lidar,1),UBOUND(y_out%Lidar,1) - b = (t(3)**2*(y1%Lidar(i1) - y2%Lidar(i1)) + t(2)**2*(-y1%Lidar(i1) + y3%Lidar(i1)))* scaleFactor - c = ( (t(2)-t(3))*y1%Lidar(i1) + t(3)*y2%Lidar(i1) - t(2)*y3%Lidar(i1) ) * scaleFactor - y_out%Lidar(i1) = y1%Lidar(i1) + b + c * t_out - END DO END IF ! check if allocated END SUBROUTINE SrvD_Output_ExtrapInterp2 diff --git a/modules/servodyn/src/StrucCtrl.f90 b/modules/servodyn/src/StrucCtrl.f90 index cbcc7d4722..c769c61652 100644 --- a/modules/servodyn/src/StrucCtrl.f90 +++ b/modules/servodyn/src/StrucCtrl.f90 @@ -52,7 +52,8 @@ MODULE StrucCtrl INTEGER(IntKi), PRIVATE, PARAMETER :: DOFMode_Prescribed = 4 !< prescribed force series INTEGER(IntKi), PRIVATE, PARAMETER :: CMODE_Semi = 1 !< semi-active control - INTEGER(IntKi), PRIVATE, PARAMETER :: CMODE_Active = 2 !< active control + INTEGER(IntKi), PRIVATE, PARAMETER :: CMODE_ActiveEXTERN = 4 !< active control + INTEGER(IntKi), PRIVATE, PARAMETER :: CMODE_ActiveDLL = 5 !< active control INTEGER(IntKi), PRIVATE, PARAMETER :: SA_CMODE_GH_vel = 1 !< 1: velocity-based ground hook control; INTEGER(IntKi), PRIVATE, PARAMETER :: SA_CMODE_GH_invVel = 2 !< 2: Inverse velocity-based ground hook control @@ -96,9 +97,8 @@ SUBROUTINE StC_Init( InitInp, u, p, x, xd, z, OtherState, y, m, Interval, InitOu INTEGER(IntKi) :: NumOuts TYPE(StC_InputFile) :: InputFileData ! Data stored in the module's input file INTEGER(IntKi) :: i_pt ! Generic counter for mesh point - REAL(ReKi), allocatable, dimension(:,:) :: PositionP - REAL(ReKi), allocatable, dimension(:,:) :: PositionGlobal - REAL(R8Ki), allocatable, dimension(:,:,:) :: OrientationP + INTEGER(IntKi) :: i ! Generic counter for mesh point + REAL(ReKi), allocatable, dimension(:,:) :: RefPosGlobal type(FileInfoType) :: FileInfo_In !< The derived type for holding the full input file for parsing -- we may pass this in the future type(FileInfoType) :: FileInfo_In_PrescribeFrc !< The derived type for holding the prescribed forces input file for parsing -- we may pass this in the future @@ -116,8 +116,6 @@ SUBROUTINE StC_Init( InitInp, u, p, x, xd, z, OtherState, y, m, Interval, InitOu NumOuts = 0 UnEcho = -1 ! will be > 0 if echo file is opened - InitOut%dummyInitOut = 0.0_SiKi ! initialize this so compiler doesn't warn about un-set intent(out) variables - ! Initialize the NWTC Subroutine Library CALL NWTC_Init( EchoLibVer=.FALSE. ) @@ -141,10 +139,10 @@ SUBROUTINE StC_Init( InitInp, u, p, x, xd, z, OtherState, y, m, Interval, InitOu ! For diagnostic purposes, the following can be used to display the contents ! of the FileInfo_In data structure. - !call Print_FileInfo_Struct( CU, FileInfo_In ) ! CU is the screen -- different number on different systems. + ! call Print_FileInfo_Struct( CU, FileInfo_In ) ! CU is the screen -- different number on different systems. ! Parse the FileInfo_In structure of data from the inputfile into the InitInp%InputFile structure - CALL StC_ParseInputFileInfo( PriPath, InitInp%InputFile, TRIM(InitInp%RootName), FileInfo_In, InputFileData, UnEcho, ErrStat2, ErrMsg2 ) + CALL StC_ParseInputFileInfo( PriPath, InitInp%InputFile, TRIM(InitInp%RootName), InitInp%NumMeshPts, FileInfo_In, InputFileData, UnEcho, ErrStat2, ErrMsg2 ) if (Failed()) return; ! Using the InputFileData structure, check that it makes sense @@ -189,7 +187,6 @@ SUBROUTINE StC_Init( InitInp, u, p, x, xd, z, OtherState, y, m, Interval, InitOu call Init_Misc( p, m, ErrStat2, ErrMsg2 ) if (Failed()) return; - ! Allocate continuous states (x) call AllocAry(x%StC_x, 6, p%NumMeshPts, 'x%StC_x', ErrStat2,ErrMsg2) if (Failed()) return; @@ -206,15 +203,13 @@ SUBROUTINE StC_Init( InitInp, u, p, x, xd, z, OtherState, y, m, Interval, InitOu ! set positions and orientations for tuned mass dampers's - call AllocAry(PositionP, 3, p%NumMeshPts, 'PositionP', ErrStat2,ErrMsg2); if (Failed()) return; - call AllocAry(PositionGlobal, 3, p%NumMeshPts, 'PositionGlobal', ErrStat2,ErrMsg2); if (Failed()) return; - call AllocAry(OrientationP, 3, 3, p%NumMeshPts, 'OrientationP', ErrStat2,ErrMsg2); if (Failed()) return; + call AllocAry(InitOut%RelPosition, 3, p%NumMeshPts, 'RelPosition', ErrStat2,ErrMsg2); if (Failed()) return; + call AllocAry(RefPosGlobal, 3, p%NumMeshPts, 'RefPosGlobal', ErrStat2,ErrMsg2); if (Failed()) return; - ! Set the initial positions and orietantions for each point + ! Set the initial positions and orientations for each point (Ref coords) do i_pt = 1,p%NumMeshPts - PositionP(:,i_pt) = (/ InputFileData%StC_P_X, InputFileData%StC_P_Y, InputFileData%StC_P_Z /) - OrientationP(:,:,i_pt) = InitInp%InitOrientation(:,:,i_pt) - PositionGlobal(:,i_pt) = InitInp%InitPosition(:,i_pt) + real( matmul(PositionP(:,i_pt),OrientationP(:,:,i_pt)), ReKi) + InitOut%RelPosition(:,i_pt) = (/ InputFileData%StC_P_X, InputFileData%StC_P_Y, InputFileData%StC_P_Z /) + RefPosGlobal(:,i_pt) = InitInp%InitRefPos(:,i_pt) + real( matmul(InitOut%RelPosition(:,i_pt),InitInp%InitRefOrient(:,:,i_pt)), ReKi) enddo ! Define system output initializations (set up mesh) here: @@ -251,8 +246,7 @@ SUBROUTINE StC_Init( InitInp, u, p, x, xd, z, OtherState, y, m, Interval, InitOu ! Create the node on the mesh - ! make position node at point P (rest position of tuned mass dampers, somewhere above the yaw bearing) - CALL MeshPositionNode ( u%Mesh(i_pt),1, PositionGlobal(:,i_pt), ErrStat2, ErrMsg2, OrientationP(:,:,i_pt) ) + CALL MeshPositionNode ( u%Mesh(i_pt),1, RefPosGlobal(:,i_pt), ErrStat2, ErrMsg2, InitInp%InitRefOrient(:,:,i_pt) ) CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) ! Create the mesh element @@ -280,6 +274,10 @@ SUBROUTINE StC_Init( InitInp, u, p, x, xd, z, OtherState, y, m, Interval, InitOu u%Mesh(i_pt)%RemapFlag = .TRUE. y%Mesh(i_pt)%RemapFlag = .TRUE. + + ! Set initial displacements + u%Mesh(i_pt)%Orientation(1:3,1:3,1) = InitInp%InitOrient(:,:,i_pt) + u%Mesh(i_pt)%TranslationDisp(1:3,1) = InitInp%InitTransDisp(:,i_pt) enddo @@ -313,6 +311,49 @@ SUBROUTINE StC_Init( InitInp, u, p, x, xd, z, OtherState, y, m, Interval, InitOu ! Set the interval value to tell ServoDyn we are using (we don't actually change this in StC) Interval = p%DT + + ! Initialize the input and output arrays for control channels + ! NOTE: these will get resized later in ServoDyn!!!! + if (maxval(p%StC_CChan) > 0) then + call AllocAry( u%CmdStiff, 3, maxval(p%StC_CChan), 'u%CmdStiff', ErrStat2, ErrMsg2 ) + if (Failed()) return; + call AllocAry( u%CmdDamp, 3, maxval(p%StC_CChan), 'u%CmdDamp', ErrStat2, ErrMsg2 ) + if (Failed()) return; + call AllocAry( u%CmdBrake, 3, maxval(p%StC_CChan), 'u%CmdBrake', ErrStat2, ErrMsg2 ) + if (Failed()) return; + call AllocAry( u%CmdForce, 3, maxval(p%StC_CChan), 'u%CmdForce', ErrStat2, ErrMsg2 ) + if (Failed()) return; + call AllocAry( y%MeasDisp, 3, maxval(p%StC_CChan), 'y%MeasDisp', ErrStat2, ErrMsg2 ) + if (Failed()) return; + call AllocAry( y%MeasVel, 3, maxval(p%StC_CChan), 'y%MeasVel', ErrStat2, ErrMsg2 ) + if (Failed()) return; + ! Initialize to zero (if we asked for channel 9, the first 8 channel entries are zero) + u%CmdStiff = 0.0_ReKi + u%CmdDamp = 0.0_ReKi + u%CmdBrake = 0.0_ReKi + u%CmdForce = 0.0_ReKi + y%MeasDisp = 0.0_ReKi + y%MeasVel = 0.0_ReKi + ! Check that dimensions of x are what we expect + if (size(p%StC_CChan) /= size(x%StC_x,2)) then + ErrStat2 = ErrID_Fatal + ErrMsg2 = "Error in setup of StC_Chan array -- does not match expected dimensionality of x%StC_x" + if (Failed()) return; + endif + ! Set actual values for channels requested + do i=1,size(p%StC_CChan) + if (p%StC_CChan(i) > 0) then + u%CmdStiff(1:3,p%StC_CChan(i)) = (/ p%K_X, p%K_Y, p%K_Z /) + u%CmdDamp( 1:3,p%StC_CChan(i)) = (/ p%C_X, p%C_Y, p%C_Z /) + !u%CmdBrake and u%CmdForce--- leave these at zero for now (no input file method to set it) + ! The states are sized by (6,NumMeshPts). NumMeshPts is then used to set + ! size of StC_CChan as well. For safety, we will check it here. + y%MeasDisp(1:3,p%StC_CChan(i)) = (/ x%StC_x(1,i), x%StC_x(3,i), x%StC_x(5,i) /) + y%MeasVel( 1:3,p%StC_CChan(i)) = (/ x%StC_x(2,i), x%StC_x(4,i), x%StC_x(6,i) /) + endif + enddo + endif + call cleanup() !................................ CONTAINS @@ -348,6 +389,14 @@ subroutine Init_Misc( p, m, ErrStat, ErrMsg ) call AllocAry(m%F_table, 3, p%NumMeshPts, 'F_table', ErrStat, ErrMsg); if (ErrStat >= AbortErrLev) return; m%F_table = 0.0_ReKi call AllocAry(m%F_k , 3, p%NumMeshPts, 'F_k' , ErrStat, ErrMsg); if (ErrStat >= AbortErrLev) return; m%F_k = 0.0_ReKi + ! Set spring constants to value from input file + call AllocAry(m%K , 3, p%NumMeshPts, 'K' , ErrStat, ErrMsg); if (ErrStat >= AbortErrLev) return + do i_pt=1,p%NumMeshPts + m%K(1,i_pt) = p%K_X + m%K(2,i_pt) = p%K_Y + m%K(3,i_pt) = p%K_Z + enddo + ! indexing m%PrescribedInterpIdx = 0_IntKi ! index tracker for PrescribedForce option @@ -360,10 +409,8 @@ logical function Failed() end function Failed !......................................... SUBROUTINE cleanup() - if (UnEcho > 0) close(UnEcho) ! Close echo file - if (allocated(PositionP )) deallocate(PositionP ) - if (allocated(PositionGlobal)) deallocate(PositionGlobal) - if (allocated(OrientationP )) deallocate(OrientationP ) + if (UnEcho > 0) close(UnEcho) ! Close echo file + if (allocated(RefPosGlobal )) deallocate(RefPosGlobal ) CALL StC_DestroyInputFile( InputFileData, ErrStat2, ErrMsg2) ! Ignore warnings here. END SUBROUTINE cleanup !......................................... @@ -746,9 +793,9 @@ SUBROUTINE StC_CalcOutput( Time, u, p, x, xd, z, OtherState, y, m, ErrStat, ErrM ! inertial contributions from mass of tuned mass dampers and acceleration of point ! forces and moments in local coordinates - m%F_P(1,i_pt) = p%K_X * x%StC_x(1,i_pt) + m%C_ctrl(1,i_pt) * x%StC_x(2,i_pt) + m%C_Brake(1,i_pt) * x%StC_x(2,i_pt) - m%F_stop(1,i_pt) - m%F_ext(1,i_pt) - m%F_fr(1,i_pt) - F_Y_P(1) - F_Z_P(1) + m%F_table(1,i_pt) - m%F_P(2,i_pt) = p%K_Y * x%StC_x(3,i_pt) + m%C_ctrl(2,i_pt) * x%StC_x(4,i_pt) + m%C_Brake(2,i_pt) * x%StC_x(4,i_pt) - m%F_stop(2,i_pt) - m%F_ext(2,i_pt) - m%F_fr(2,i_pt) - F_X_P(2) - F_Z_P(2) + m%F_table(2,i_pt) - m%F_P(3,i_pt) = p%K_Z * x%StC_x(5,i_pt) + m%C_ctrl(3,i_pt) * x%StC_x(6,i_pt) + m%C_Brake(3,i_pt) * x%StC_x(6,i_pt) - m%F_stop(3,i_pt) - m%F_ext(3,i_pt) - m%F_fr(3,i_pt) - F_X_P(3) - F_Y_P(3) + m%F_table(3,i_pt) + m%F_P(1,i_pt) = m%K(1,i_pt) * x%StC_x(1,i_pt) + m%C_ctrl(1,i_pt) * x%StC_x(2,i_pt) + m%C_Brake(1,i_pt) * x%StC_x(2,i_pt) - m%F_stop(1,i_pt) - m%F_ext(1,i_pt) - m%F_fr(1,i_pt) - F_Y_P(1) - F_Z_P(1) + m%F_table(1,i_pt) + m%F_P(2,i_pt) = m%K(2,i_pt) * x%StC_x(3,i_pt) + m%C_ctrl(2,i_pt) * x%StC_x(4,i_pt) + m%C_Brake(2,i_pt) * x%StC_x(4,i_pt) - m%F_stop(2,i_pt) - m%F_ext(2,i_pt) - m%F_fr(2,i_pt) - F_X_P(2) - F_Z_P(2) + m%F_table(2,i_pt) + m%F_P(3,i_pt) = m%K(3,i_pt) * x%StC_x(5,i_pt) + m%C_ctrl(3,i_pt) * x%StC_x(6,i_pt) + m%C_Brake(3,i_pt) * x%StC_x(6,i_pt) - m%F_stop(3,i_pt) - m%F_ext(3,i_pt) - m%F_fr(3,i_pt) - F_X_P(3) - F_Y_P(3) + m%F_table(3,i_pt) - p%StC_Z_PreLd m%M_P(1,i_pt) = - F_Y_P(3) * x%StC_x(3,i_pt) + F_Z_P(2) * x%StC_x(5,i_pt) m%M_P(2,i_pt) = F_X_P(3) * x%StC_x(1,i_pt) - F_Z_P(1) * x%StC_x(5,i_pt) @@ -775,8 +822,8 @@ SUBROUTINE StC_CalcOutput( Time, u, p, x, xd, z, OtherState, y, m, ErrStat, ErrM ! inertial contributions from mass of tuned mass dampers and acceleration of point ! forces and moments in local coordinates - m%F_P(1,i_pt) = p%K_X * x%StC_x(1,i_pt) + m%C_ctrl(1,i_pt) * x%StC_x(2,i_pt) + m%C_Brake(1,i_pt) * x%StC_x(2,i_pt) - m%F_stop(1,i_pt) - m%F_ext(1,i_pt) - m%F_fr(1,i_pt) - F_XY_P(1) + m%F_table(1,i_pt)*(m%F_k(1,i_pt)) - m%F_P(2,i_pt) = p%K_Y * x%StC_x(3,i_pt) + m%C_ctrl(2,i_pt) * x%StC_x(4,i_pt) + m%C_Brake(2,i_pt) * x%StC_x(4,i_pt) - m%F_stop(2,i_pt) - m%F_ext(2,i_pt) - m%F_fr(2,i_pt) - F_XY_P(2) + m%F_table(2,i_pt)*(m%F_k(2,i_pt)) + m%F_P(1,i_pt) = m%K(1,i_pt) * x%StC_x(1,i_pt) + m%C_ctrl(1,i_pt) * x%StC_x(2,i_pt) + m%C_Brake(1,i_pt) * x%StC_x(2,i_pt) - m%F_stop(1,i_pt) - m%F_ext(1,i_pt) - m%F_fr(1,i_pt) - F_XY_P(1) + m%F_table(1,i_pt)*(m%F_k(1,i_pt)) + m%F_P(2,i_pt) = m%K(2,i_pt) * x%StC_x(3,i_pt) + m%C_ctrl(2,i_pt) * x%StC_x(4,i_pt) + m%C_Brake(2,i_pt) * x%StC_x(4,i_pt) - m%F_stop(2,i_pt) - m%F_ext(2,i_pt) - m%F_fr(2,i_pt) - F_XY_P(2) + m%F_table(2,i_pt)*(m%F_k(2,i_pt)) m%F_P(3,i_pt) = - F_XY_P(3) m%M_P(1,i_pt) = - F_XY_P(3) * x%StC_x(3,i_pt) @@ -911,6 +958,21 @@ SUBROUTINE StC_CalcOutput( Time, u, p, x, xd, z, OtherState, y, m, ErrStat, ErrM endif END IF + ! Set output values for the measured displacements for + do i=1,size(p%StC_CChan) + if (p%StC_CChan(i) > 0) then + if (p%StC_DOF_MODE == DOFMode_Indept .or. p%StC_DOF_MODE == DOFMode_Omni) then + ! The states are sized by (6,NumMeshPts). NumMeshPts is then used to set + ! size of StC_CChan as well. For safety, we will check it here. + y%MeasDisp(1:3,p%StC_CChan(i)) = (/ x%StC_x(1,i), x%StC_x(3,i), x%StC_x(5,i) /) + y%MeasVel( 1:3,p%StC_CChan(i)) = (/ x%StC_x(2,i), x%StC_x(4,i), x%StC_x(6,i) /) + else + y%MeasDisp(1:3,p%StC_CChan(i)) = 0.0_ReKi + y%MeasVel( 1:3,p%StC_CChan(i)) = 0.0_ReKi + endif + endif + enddo + call CleanUp() CONTAINS @@ -941,7 +1003,7 @@ SUBROUTINE StC_CalcContStateDeriv( Time, u, p, x, xd, z, OtherState, m, dxdt, Er INTEGER(IntKi), INTENT( OUT) :: ErrStat !< Error status of the operation CHARACTER(*), INTENT( OUT) :: ErrMsg !< Error message if ErrStat /= ErrID_None - REAL(ReKi), dimension(3) :: K ! tuned mass damper stiffness + REAL(ReKi), dimension(3,p%NumMeshPts) :: K ! tuned mass damper stiffness Real(ReKi) :: denom ! denominator for omni-direction factors integer(IntKi) :: i_pt ! Generic counter for mesh point @@ -963,14 +1025,14 @@ SUBROUTINE StC_CalcContStateDeriv( Time, u, p, x, xd, z, OtherState, m, dxdt, Er CALL StC_CalcStopForce(x,p,m%F_stop) END IF - ! Compute stiffness + ! Compute stiffness -- Note that this value may be overwritten by controller IF (p%Use_F_TBL) THEN ! use stiffness table CALL SpringForceExtrapInterp(x,p,m%F_table,ErrStat2,ErrMsg2); if (Failed()) return; K = 0.0_ReKi ELSE ! use preset values - K(1) = p%K_X - K(2) = p%K_Y - K(3) = p%K_Z + K(1,:) = p%K_X + K(2,:) = p%K_Y + K(3,:) = p%K_Z END IF @@ -997,7 +1059,7 @@ SUBROUTINE StC_CalcContStateDeriv( Time, u, p, x, xd, z, OtherState, m, dxdt, Er ! Aggregate acceleration terms m%Acc(1,i_pt) = - m%rddot_P(1,i_pt) + m%a_G(1,i_pt) + 1 / p%M_X * ( m%F_ext(1,i_pt) + m%F_stop(1,i_pt) - m%F_table(1,i_pt) ) m%Acc(2,i_pt) = - m%rddot_P(2,i_pt) + m%a_G(2,i_pt) + 1 / p%M_Y * ( m%F_ext(2,i_pt) + m%F_stop(2,i_pt) - m%F_table(2,i_pt) ) - m%Acc(3,i_pt) = - m%rddot_P(3,i_pt) + m%a_G(3,i_pt) + 1 / p%M_Z * ( m%F_ext(3,i_pt) + m%F_stop(3,i_pt) - m%F_table(3,i_pt) ) + m%Acc(3,i_pt) = - m%rddot_P(3,i_pt) + m%a_G(3,i_pt) + 1 / p%M_Z * ( m%F_ext(3,i_pt) + m%F_stop(3,i_pt) - m%F_table(3,i_pt) + p%StC_Z_PreLd ) enddo ELSE IF (p%StC_DOF_MODE == DOFMode_Omni) THEN @@ -1068,11 +1130,25 @@ SUBROUTINE StC_CalcContStateDeriv( Time, u, p, x, xd, z, OtherState, m, dxdt, Er m%C_ctrl(1,:) = p%C_X m%C_ctrl(2,:) = p%C_Y m%C_ctrl(3,:) = p%C_Z - m%C_Brake = 0.0_ReKi m%F_fr = 0.0_ReKi ELSE IF (p%StC_CMODE == CMODE_Semi) THEN ! ground hook control CALL StC_GroundHookDamp(dxdt,x,u,p,m%rdisp_P,m%rdot_P,m%C_ctrl,m%C_Brake,m%F_fr) + ELSE IF (p%StC_CMODE == CMODE_ActiveDLL) THEN ! Active control from DLL + call StC_ActiveCtrl_StiffDamp(u,p,m%K,m%C_ctrl,m%C_Brake,m%F_ext) + m%F_fr = 0.0_ReKi + if (.not. p%Use_F_TBL) then + K(1:3,:) = m%K(1:3,:) +!FIXME: for the derivative, I don't know how this should be handled. +!!! Defaulting to how the stiffness table operates for now, but leaving +!!! this next code chunk in case it shuold be handed this way instead + !else + ! ! Make commanded stiffness a perturbation about the table value (to avoid double counting the table) + ! ! NOTE: This has not been verified and may have unintended consequences. + ! do i_pt=1,p%NumMeshPts + ! K(1:3,i_pt) = m%F_table(1:3,i_pt) - m%K(1:3,i_pt) + ! enddo + endif END IF @@ -1081,7 +1157,7 @@ SUBROUTINE StC_CalcContStateDeriv( Time, u, p, x, xd, z, OtherState, m, dxdt, Er IF (p%StC_X_DOF) THEN do i_pt=1,p%NumMeshPts - dxdt%StC_x(2,i_pt) = ( m%omega_P(2,i_pt)**2 + m%omega_P(3,i_pt)**2 - K(1) / p%M_X) * x%StC_x(1,i_pt) & + dxdt%StC_x(2,i_pt) = ( m%omega_P(2,i_pt)**2 + m%omega_P(3,i_pt)**2 - K(1,i_pt) / p%M_X) * x%StC_x(1,i_pt) & - ( m%C_ctrl( 1,i_pt)/p%M_X ) * x%StC_x(2,i_pt) & - ( m%C_Brake(1,i_pt)/p%M_X ) * x%StC_x(2,i_pt) & + m%Acc(1,i_pt) + m%F_fr(1,i_pt) / p%M_X @@ -1093,7 +1169,7 @@ SUBROUTINE StC_CalcContStateDeriv( Time, u, p, x, xd, z, OtherState, m, dxdt, Er END IF IF (p%StC_Y_DOF) THEN do i_pt=1,p%NumMeshPts - dxdt%StC_x(4,i_pt) = ( m%omega_P(1,i_pt)**2 + m%omega_P(3,i_pt)**2 - K(2) / p%M_Y) * x%StC_x(3,i_pt) & + dxdt%StC_x(4,i_pt) = ( m%omega_P(1,i_pt)**2 + m%omega_P(3,i_pt)**2 - K(2,i_pt) / p%M_Y) * x%StC_x(3,i_pt) & - ( m%C_ctrl( 2,i_pt)/p%M_Y ) * x%StC_x(4,i_pt) & - ( m%C_Brake(2,i_pt)/p%M_Y ) * x%StC_x(4,i_pt) & + m%Acc(2,i_pt) + m%F_fr(2,i_pt) / p%M_Y @@ -1105,7 +1181,7 @@ SUBROUTINE StC_CalcContStateDeriv( Time, u, p, x, xd, z, OtherState, m, dxdt, Er END IF IF (p%StC_Z_DOF) THEN do i_pt=1,p%NumMeshPts - dxdt%StC_x(6,i_pt) = ( m%omega_P(1,i_pt)**2 + m%omega_P(2,i_pt)**2 - K(3) / p%M_Z) * x%StC_x(5,i_pt) & + dxdt%StC_x(6,i_pt) = ( m%omega_P(1,i_pt)**2 + m%omega_P(2,i_pt)**2 - K(3,i_pt) / p%M_Z) * x%StC_x(5,i_pt) & - ( m%C_ctrl( 3,i_pt)/p%M_Z ) * x%StC_x(6,i_pt) & - ( m%C_Brake(3,i_pt)/p%M_Z ) * x%StC_x(6,i_pt) & + m%Acc(3,i_pt) + m%F_fr(3,i_pt) / p%M_Z @@ -1119,13 +1195,13 @@ SUBROUTINE StC_CalcContStateDeriv( Time, u, p, x, xd, z, OtherState, m, dxdt, Er ELSE IF (p%StC_DOF_MODE == DOFMode_Omni) THEN ! Only includes X and Y ! Compute the first time derivatives of the continuous states of Omnidirectional tuned masse damper mode by sm 2015-0904 do i_pt=1,p%NumMeshPts - dxdt%StC_x(2,i_pt) = ( m%omega_P(2,i_pt)**2 + m%omega_P(3,i_pt)**2 - K(1) / p%M_XY) * x%StC_x(1,i_pt) & + dxdt%StC_x(2,i_pt) = ( m%omega_P(2,i_pt)**2 + m%omega_P(3,i_pt)**2 - K(1,i_pt) / p%M_XY) * x%StC_x(1,i_pt) & - ( m%C_ctrl( 1,i_pt)/p%M_XY ) * x%StC_x(2,i_pt) & - ( m%C_Brake(1,i_pt)/p%M_XY ) * x%StC_x(2,i_pt) & + m%Acc(1,i_pt) + 1/p%M_XY * ( m%F_fr(1,i_pt) ) & - ( m%omega_P(1,i_pt)*m%omega_P(2,i_pt) - m%alpha_P(3,i_pt) ) * x%StC_x(3,i_pt) & +2 * m%omega_P(3,i_pt) * x%StC_x(4,i_pt) - dxdt%StC_x(4,i_pt) = ( m%omega_P(1,i_pt)**2 + m%omega_P(3,i_pt)**2 - K(2) / p%M_XY) * x%StC_x(3,i_pt) & + dxdt%StC_x(4,i_pt) = ( m%omega_P(1,i_pt)**2 + m%omega_P(3,i_pt)**2 - K(2,i_pt) / p%M_XY) * x%StC_x(3,i_pt) & - ( m%C_ctrl( 2,i_pt)/p%M_XY ) * x%StC_x(4,i_pt) & - ( m%C_Brake(2,i_pt)/p%M_XY ) * x%StC_x(4,i_pt) & + m%Acc(2,i_pt) + 1/p%M_XY * ( m%F_fr(2,i_pt) ) & @@ -1214,7 +1290,7 @@ SUBROUTINE StC_GroundHookDamp(dxdt,x,u,p,rdisp_P,rdot_P,C_ctrl,C_Brake,F_fr) REAL(ReKi), dimension(:,:), INTENT(IN ) :: rdisp_P !< translational displacement in local coordinates REAL(ReKi), dimension(:,:), INTENT(IN ) :: rdot_P !< translational velocity in local coordinates REAL(ReKi), dimension(:,:), INTENT(INOUT) :: C_ctrl !< extrapolated/interpolated stiffness values - REAL(ReKi), dimension(:,:), INTENT(INOUT) :: C_Brake !< extrapolated/interpolated stiffness values + REAL(ReKi), dimension(:,:), INTENT(INOUT) :: C_Brake !< extrapolated/interpolated braking values REAL(ReKi), dimension(:,:), INTENT(INOUT) :: F_fr !< Friction forces INTEGER(IntKi) :: i_pt !< generic counter for mesh points @@ -1526,10 +1602,32 @@ SUBROUTINE StC_GroundHookDamp(dxdt,x,u,p,rdisp_P,rdot_P,C_ctrl,C_Brake,F_fr) END IF enddo - - END SUBROUTINE StC_GroundHookDamp !---------------------------------------------------------------------------------------------------------------------------------- +SUBROUTINE StC_ActiveCtrl_StiffDamp(u,p,K_ctrl,C_ctrl,C_Brake,F_ctrl) + TYPE(StC_InputType), INTENT(IN ) :: u !< Inputs at Time + TYPE(StC_ParameterType), INTENT(IN ) :: p !< The module's parameter data + real(ReKi), intent(inout) :: K_ctrl(:,:) !< stiffness commanded by dll -- leave alone if no ctrl + real(ReKi), intent(inout) :: C_ctrl(:,:) !< damping commanded by dll + real(ReKi), intent(inout) :: C_Brake(:,:) !< brake commanded by dll + real(ReKi), intent(inout) :: F_ctrl(:,:) !< brake commanded by dll + integer(IntKi) :: i_pt ! counter for mesh points + do i_pt=1,p%NumMeshPts + if (p%StC_CChan(i_pt) > 0) then ! This index should have been checked at init, so won't check bounds here + K_ctrl( 1:3,i_pt) = u%CmdStiff(1:3,p%StC_CChan(i_pt)) + C_ctrl( 1:3,i_pt) = u%CmdDamp( 1:3,p%StC_CChan(i_pt)) + C_Brake(1:3,i_pt) = u%CmdBrake(1:3,p%StC_CChan(i_pt)) + F_ctrl(1:3,i_pt) = u%CmdForce(1:3,p%StC_CChan(i_pt)) + else ! Use parameters from file (as if no control) -- leave K value as that may be set by table prior + C_ctrl(1,:) = p%C_X + C_ctrl(2,:) = p%C_Y + C_ctrl(3,:) = p%C_Z + C_Brake = 0.0_ReKi + F_ctrl = 0.0_ReKi + endif + enddo +END SUBROUTINE StC_ActiveCtrl_StiffDamp +!---------------------------------------------------------------------------------------------------------------------------------- !> Extrapolate or interpolate stiffness value based on stiffness table. SUBROUTINE SpringForceExtrapInterp(x, p, F_table,ErrStat,ErrMsg) TYPE(StC_ContinuousStateType), INTENT(IN ) :: x !< Continuous states at Time @@ -1604,7 +1702,7 @@ SUBROUTINE SpringForceExtrapInterp(x, p, F_table,ErrStat,ErrMsg) END SUBROUTINE SpringForceExtrapInterp !---------------------------------------------------------------------------------------------------------------------------------- !> Parse the inputfile info stored in FileInfo_In. -SUBROUTINE StC_ParseInputFileInfo( PriPath, InputFile, RootName, FileInfo_In, InputFileData, UnEcho, ErrStat, ErrMsg ) +SUBROUTINE StC_ParseInputFileInfo( PriPath, InputFile, RootName, NumMeshPts, FileInfo_In, InputFileData, UnEcho, ErrStat, ErrMsg ) implicit none @@ -1612,6 +1710,7 @@ SUBROUTINE StC_ParseInputFileInfo( PriPath, InputFile, RootName, FileInfo_In, In character(*), intent(in ) :: PriPath !< primary path CHARACTER(*), intent(in ) :: InputFile !< Name of the file containing the primary input data CHARACTER(*), intent(in ) :: RootName !< The rootname of the echo file, possibly opened in this routine + integer(IntKi), intent(in ) :: NumMeshPts !< The number of mesh points passed in type(StC_InputFile), intent(inout) :: InputFileData !< All the data in the StrucCtrl input file type(FileInfoType), intent(in ) :: FileInfo_In !< The derived type for holding the file information. integer(IntKi), intent( out) :: UnEcho !< The local unit number for this module's echo file @@ -1715,6 +1814,9 @@ SUBROUTINE StC_ParseInputFileInfo( PriPath, InputFile, RootName, FileInfo_In, In ! StC Z initial displacement (m) [relative to at rest position; used only when StC_DOF_MODE=1 and StC_Z_DOF=TRUE] call ParseVar( FileInfo_In, Curline, 'StC_Z_DSP', InputFileData%StC_Z_DSP, ErrStat2, ErrMsg2, UnEcho ) If (Failed()) return; + ! StC Z pre-load (N) {"gravity" to offset for gravity load; "none" or 0 to turn off} [used only when StC_DOF_MODE=1 and StC_Z_DOF=TRUE] + call ParseVar( FileInfo_In, Curline, 'StC_Z_PreLd', InputFileData%StC_Z_PreLdC, ErrStat2, ErrMsg2, UnEcho ) + If (Failed()) return; !------------------------------------------------------------------------------------------------- ! StC CONFIGURATION [used only when StC_DOF_MODE=1 or 2] @@ -1849,9 +1951,26 @@ SUBROUTINE StC_ParseInputFileInfo( PriPath, InputFile, RootName, FileInfo_In, In if ( InputFileData%Echo ) WRITE(UnEcho, '(A)') FileInfo_In%Lines(CurLine) ! Write section break to echo CurLine = CurLine + 1 - ! Control mode (switch) {0:none; 1: Semi-Active Control Mode; 2: Active Control Mode} + ! Control mode (switch) { + ! 0:none; + ! 1: Semi-Active Control Mode; + ! 4: Active Control Mode through Simulink (not available); + ! 5: Active Control Mode through Bladed interface} (-) call ParseVar( FileInfo_In, Curline, 'StC_CMODE', InputFileData%StC_CMODE, ErrStat2, ErrMsg2 ) If (Failed()) return; + ! Control channels -- there may be multiple if there are multiple StC mesh points (blade TMD case), but we also allow a single + ! StC_CChan - Control channel group for stiffness and damping (StC_[XYZ]_K, StC_[XYZ]_C, and StC_[XYZ]_Brake) [used only when StC_CMODE=4 or StC_CMODE=5] + allocate( InputFileData%StC_CChan(NumMeshPts), STAT=ErrStat2 ) ! Blade TMD will possibly have independent TMD's for each instance + if (ErrStat2 /= ErrID_None) ErrMsg2="Error allocating InputFileData%StC_CChan(NumMeshPts)" + If (Failed()) return; + call ParseAry( FileInfo_In, CurLine, 'StC_CChan', InputFileData%StC_CChan, NumMeshPts, ErrStat2, ErrMsg2 ) + if ( ErrStat2 /= ErrID_None) then ! If we didn't read a full array, then try reading just one input + ! If there was an error, CurLine didn't advance, so no resetting of it needed + call ParseVar( FileInfo_In, CurLine, 'StC_CChan', InputFileData%StC_CChan(1), ErrStat2, ErrMsg2 ) + InputFileData%StC_CChan(:) = InputFileData%StC_CChan(1) ! Assign all the same, will check in validation + endif + If (Failed()) return; + ! Semi-Active control mode { ! 1: velocity-based ground hook control; ! 2: Inverse velocity-based ground hook control; @@ -1972,6 +2091,10 @@ subroutine StC_ValidatePrimaryData( InputFileData, InitInp, ErrStat, ErrMsg ) INTEGER(IntKi), INTENT( OUT) :: ErrStat !< The error status code CHARACTER(ErrMsgLen), INTENT( OUT) :: ErrMsg !< The error message, if an error occurred + integer(IntKi) :: i !< generic loop counter + real(ReKi) :: TmpRe + character(10) :: TmpCh + integer(IntKi) :: ErrStat2 CHARACTER(*), PARAMETER :: RoutineName = 'StC_ValidatePrimaryData' ! Initialize variables @@ -1984,13 +2107,38 @@ subroutine StC_ValidatePrimaryData( InputFileData, InitInp, ErrStat, ErrMsg ) InputFileData%StC_DOF_MODE /= DOFMode_Omni .and. & InputFileData%StC_DOF_MODE /= DOFMode_TLCD .and. & InputFileData%StC_DOF_MODE /= DOFMode_Prescribed) & - CALL SetErrStat( ErrID_Fatal, 'DOF mode (StC_DOF_MODE) must be 0 (no DOF), 1 (two independent DOFs), or 2 (omni-directional), or 3 (TLCD), or 4 (prescribed force time-series).', ErrStat, ErrMsg, RoutineName ) + CALL SetErrStat( ErrID_Fatal, 'DOF mode (StC_DOF_MODE) must be 0 (no DOF), 1 (two independent DOFs), '// & + 'or 2 (omni-directional), or 3 (TLCD), or 4 (prescribed force time-series).', ErrStat, ErrMsg, RoutineName ) ! Check control modes - IF ( InputFileData%StC_CMODE /= ControlMode_None .and. InputFileData%StC_CMODE /= CMODE_Semi ) & - CALL SetErrStat( ErrID_Fatal, 'Control mode (StC_CMode) must be 0 (none) or 1 (semi-active) in this version of StrucCtrl.', ErrStat, ErrMsg, RoutineName ) -! IF ( InputFileData%StC_CMODE /= ControlMode_None .and. InputFileData%StC_CMODE /= CMODE_Semi .and. InputFileData%StC_CMODE /= CMODE_Active) & -! CALL SetErrStat( ErrID_Fatal, 'Control mode (StC_CMode) must be 0 (none), 1 (semi-active), or 2 (active).', ErrStat, ErrMsg, RoutineName ) + IF ( InputFileData%StC_CMODE /= ControlMode_None .and. & + InputFileData%StC_CMODE /= CMODE_Semi .and. & + InputFileData%StC_CMODE /= CMODE_ActiveDLL ) & + !InputFileData%StC_CMode /= CMODE_ActiveEXTERN .and. & ! Not an option at the moment --> 4 (active with Simulink control), + CALL SetErrStat( ErrID_Fatal, 'Control mode (StC_CMode) must be 0 (none), 1 (semi-active),'// & + ' or 5 (active with DLL control) in this version of StrucCtrl.', ErrStat, ErrMsg, RoutineName ) + + ! Check control channel + if ( InputFileData%StC_CMode == CMODE_ActiveDLL ) then + if ( InputFileData%StC_DOF_MODE /= DOFMode_Indept .and. InputFileData%StC_DOF_MODE /= DOFMode_Omni ) then + call SetErrStat( ErrID_Fatal, 'Control mode 4 (active with Simulink control), or 5 (active with DLL control) '// & + 'can only be used with independent or omni DOF (StC_DOF_Mode=1 or 2) in this version of StrucCtrl.', ErrStat, ErrMsg, RoutineName ) + endif + if (InitInp%NumMeshPts > 1) then + do i=2,InitInp%NumMeshPts ! Warn if controlling multiple mesh points with single instance (blade TMD) + if ( InputFileData%StC_CChan(i) == InputFileData%StC_CChan(1) ) then + call SetErrStat( ErrID_Warn, 'Same control channel is used for multiple StC instances within input file '// & + trim(InitInp%InputFile)//'. This may not be desired in some cases such as blade TMD active controls.', & + ErrStat, ErrMsg, RoutineName ) + endif + enddo + endif + do i=1,InitInp%NumMeshPts ! Check we are in range of number of control channel groups + if ( InputFileData%StC_CChan(i) < 0 .or. InputFileData%StC_CChan(i) > 10 ) then + call SetErrStat( ErrID_Fatal, 'Control channel (StC_CChan) must be between 0 (off) and 10 when StC_CMode=5.', ErrStat, ErrMsg, RoutineName ) + endif + enddo + endif IF ( InputFileData%StC_SA_MODE /= SA_CMODE_GH_vel .and. & InputFileData%StC_SA_MODE /= SA_CMODE_GH_invVel .and. & @@ -2022,6 +2170,11 @@ subroutine StC_ValidatePrimaryData( InputFileData, InitInp, ErrStat, ErrMsg ) if (InputFileData%StC_DOF_MODE == DOFMode_Indept .and. InputFileData%StC_Y_DOF .and. (InputFileData%StC_Y_K <= 0.0_ReKi) ) & call SetErrStat(ErrID_Fatal,'StC_Y_K must be > 0 when StC_Y_DOF is enabled', ErrStat,ErrMsg,RoutineName) + if (InputFileData%StC_DOF_MODE == DOFMode_Indept .and. InputFileData%StC_Z_DOF .and. (InputFileData%StC_Z_M <= 0.0_ReKi) ) & + call SetErrStat(ErrID_Fatal,'StC_Z_M must be > 0 when StC_Z_DOF is enabled', ErrStat,ErrMsg,RoutineName) + if (InputFileData%StC_DOF_MODE == DOFMode_Indept .and. InputFileData%StC_Z_DOF .and. (InputFileData%StC_Z_K <= 0.0_ReKi) ) & + call SetErrStat(ErrID_Fatal,'StC_Z_K must be > 0 when StC_Z_DOF is enabled', ErrStat,ErrMsg,RoutineName) + if (InputFileData%StC_DOF_MODE == DOFMode_Omni .and. (InputFileData%StC_XY_M <= 0.0_ReKi) ) & call SetErrStat(ErrID_Fatal,'StC_XY_M must be > 0 when DOF mode 2 (omni-directional) is used', ErrStat,ErrMsg,RoutineName) if (InputFileData%StC_DOF_MODE == DOFMode_Omni .and. (InputFileData%StC_X_K <= 0.0_ReKi) ) & @@ -2029,6 +2182,18 @@ subroutine StC_ValidatePrimaryData( InputFileData, InitInp, ErrStat, ErrMsg ) if (InputFileData%StC_DOF_MODE == DOFMode_Omni .and. (InputFileData%StC_Y_K <= 0.0_ReKi) ) & call SetErrStat(ErrID_Fatal,'StC_Y_K must be > 0 when DOF mode 2 (omni-directional) is used', ErrStat,ErrMsg,RoutineName) + ! Check spring preload in ZDof + TmpCh = trim(InputFileData%StC_Z_PreLdC) + call Conv2UC(TmpCh) + if ( INDEX(TmpCh, "GRAVITY") /= 1 ) then ! if not gravity, check that it reads ok + if ( INDEX(TmpCh, "NONE") /= 1 ) then ! if not NONE, check that it reads ok + READ (InputFileData%StC_Z_PreLdC,*,IOSTAT=ErrStat2) TmpRe ! attempt to read real number + if (ErrStat2 /= 0) then + call SetErrStat(ErrID_Fatal,'StC_Z_PreLd must be "gravity", "none" or a real number', ErrStat,ErrMsg,RoutineName) + endif + endif + endif + ! Sanity checks for the TLCD option !FIXME: add some sanity checks here @@ -2046,6 +2211,7 @@ SUBROUTINE StC_SetParameters( InputFileData, InitInp, p, Interval, ErrStat, ErrM CHARACTER(ErrMsgLen), INTENT( OUT) :: ErrMsg !< The error message, if an error occurred ! Local variables + character(10) :: TmpCh ! Temporary string for figuring out what to do with preload on Z spring INTEGER(IntKi) :: ErrStat2 ! Temporary error ID CHARACTER(ErrMsgLen) :: ErrMsg2 ! Temporary message describing error CHARACTER(*), PARAMETER :: RoutineName = 'StC_SetParameters' @@ -2140,10 +2306,26 @@ SUBROUTINE StC_SetParameters( InputFileData, InitInp, p, Interval, ErrStat, ErrM ! User Defined Stiffness Table p%Use_F_TBL = InputFileData%Use_F_TBL - call AllocAry(p%F_TBL,SIZE(InputFiledata%F_TBL,1),SIZE(InputFiledata%F_TBL,2),'F_TBL', ErrStat2, ErrMsg2) - CALL SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName); if (ErrStat >= ErrID_Fatal) return + if (allocated(InputFileData%F_TBL)) then + call AllocAry(p%F_TBL,SIZE(InputFiledata%F_TBL,1),SIZE(InputFiledata%F_TBL,2),'F_TBL', ErrStat2, ErrMsg2) + CALL SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName); if (ErrStat >= ErrID_Fatal) return + p%F_TBL = InputFileData%F_TBL + endif - p%F_TBL = InputFileData%F_TBL; + ! Spring preload in ZDof + p%StC_Z_PreLd = 0.0_ReKi + TmpCh = trim(InputFileData%StC_Z_PreLdC) + call Conv2UC(TmpCh) + if (InputFileData%StC_DOF_MODE == DOFMode_Indept .and. InputFileData%StC_Z_DOF .and. & + (INDEX(TmpCh, "NONE") /= 1) ) then + if (INDEX(TmpCh, "GRAVITY") == 1 ) then ! if gravity, then calculate + p%StC_Z_PreLd = -p%Gravity(3)*p%M_Z + else + READ (InputFileData%StC_Z_PreLdC,*,IOSTAT=ErrStat2) p%StC_Z_PreLd ! Read a real number and store + if (ErrStat2 /= 0) call SetErrStat(ErrID_Fatal,'StC_Z_PreLd must be "gravity", "none" or a real number', ErrStat,ErrMsg,RoutineName) + if (ErrStat >= ErrID_Fatal) return + endif + endif ! Prescribed forces p%PrescribedForcesCoordSys = InputFileData%PrescribedForcesCoordSys @@ -2153,6 +2335,14 @@ SUBROUTINE StC_SetParameters( InputFileData, InitInp, p, Interval, ErrStat, ErrM p%StC_PrescribedForce = InputFileData%StC_PrescribedForce endif + ! StC Control channels + call AllocAry( p%StC_CChan, p%NumMeshPts, 'p%StC_CChan', ErrStat2, ErrMsg2 ) + if (p%StC_CMODE == CMODE_ActiveDLL ) then + p%StC_CChan = InputFileData%StC_CChan + else + p%StC_CChan = 0 ! turn off regardless of input file request. + endif + END SUBROUTINE StC_SetParameters diff --git a/modules/servodyn/src/StrucCtrl_Registry.txt b/modules/servodyn/src/StrucCtrl_Registry.txt index d28e73612e..3883ed88a7 100644 --- a/modules/servodyn/src/StrucCtrl_Registry.txt +++ b/modules/servodyn/src/StrucCtrl_Registry.txt @@ -21,6 +21,7 @@ typedef ^ ^ LOGICAL StC_Z_DOF - - - "DOF on or off" - typedef ^ ^ ReKi StC_X_DSP - - - "StC_X initial displacement" m typedef ^ ^ ReKi StC_Y_DSP - - - "StC_Y initial displacement" m typedef ^ ^ ReKi StC_Z_DSP - - - "StC_Z initial displacement" m +typedef ^ ^ Character(10) StC_Z_PreLdC - - - "StC_Z spring preload" N typedef ^ ^ ReKi StC_X_M - - - "StC X mass" kg typedef ^ ^ ReKi StC_Y_M - - - "StC Y mass" kg typedef ^ ^ ReKi StC_Z_M - - - "StC Z mass" kg @@ -74,6 +75,7 @@ typedef ^ ^ ReKi F_TBL {:}{:} - - "user-defined spring force" "N" typedef ^ ^ IntKi PrescribedForcesCoordSys - - - "Prescribed forces coordinate system {0: global; 1: local}" - typedef ^ ^ CHARACTER(1024) PrescribedForcesFile - - - "Prescribed force time-series filename" - typedef ^ ^ ReKi StC_PrescribedForce {:}{:} - - "StC prescribed force time-series info" "(s,N,N-m)" +typedef ^ ^ IntKi StC_CChan {:} - - "StC control chan to use -- one per instance" - # ..... Initialization data ....................................................................................................... # Define inputs that the initialization routine may need here: # e.g., the name of the input file, the file root name, etc. @@ -81,24 +83,37 @@ typedef StrucCtrl/StC InitInputType CHARACTER(1024) InputFile - - typedef ^ InitInputType CHARACTER(1024) RootName - - - "RootName for writing output files" - typedef ^ ^ ReKi Gravity {3} - - "Gravitational acceleration vector" "m/s^2" typedef ^ InitInputType IntKi NumMeshPts - - - "Number of mesh points" - -typedef ^ InitInputType ReKi InitPosition {:}{:} - - "X-Y-Z reference position of point: i.e. each blade root (3 x NumBlades)" m -typedef ^ InitInputType R8Ki InitOrientation {:}{:}{:} - - "DCM reference orientation of point: i.e. each blade root (3x3 x NumBlades)" - +typedef ^ InitInputType ReKi InitRefPos {:}{:} - - "X-Y-Z reference position of point: i.e. each blade root (3 x NumBlades)" m +typedef ^ InitInputType R8Ki InitTransDisp {:}{:} - - "X-Y-Z displacement from position of point at init: i.e. each blade root (3 x NumBlades)" m +typedef ^ InitInputType R8Ki InitOrient {:}{:}{:} - - "DCM orientation of point at init: i.e. each blade root (3x3 x NumBlades)" - +typedef ^ InitInputType R8Ki InitRefOrient {:}{:}{:} - - "DCM reference orientation of point: i.e. each blade root (3x3 x NumBlades)" - typedef ^ InitInputType LOGICAL UseInputFile - .TRUE. - "Read from the input file. If false, must parse the string info passed" - typedef ^ InitInputType FileInfoType PassedPrimaryInputData - - - "Primary input file as FileInfoType (set by driver/glue code)" - typedef ^ InitInputType LOGICAL UseInputFile_PrescribeFrc - .TRUE. - "Read from the input file. If false, must parse the string info passed" - typedef ^ InitInputType FileInfoType PassedPrescribeFrcData - - - "Prescribed forces input file as FileInfoType (set by driver/glue code)" - +# ..... StC CtrlChan Info ....................................................................................................... +# This is a convenience type to simplify some setup initialization +# The controller is initialized after the StC's, but we want to pass the initial condition info into the controller +# Use case: controller does not change stiffness, but does change damping. We must pass the stiffness from the StC to the controller +# anyhow so that it is in the dll_data%StCCmdStiff. The controller won't touch the stiffness, but the dll_data%StCCmdStiff +# will overwrite the stiffness value in the StC (the StC instance does not know stiffness is not commanded by controller). +typedef ^ StC_CtrlChanInitInfoType CHARACTER(64) Requestor {:} - - "text string of which StC requests which cable control channel" - +typedef ^ StC_CtrlChanInitInfoType SiKi InitStiff {:}{:} - - "StC stiffness at initialization (3,NumStC_Control) -- passed from StC to let controller know the value during init" "N/m" +typedef ^ StC_CtrlChanInitInfoType SiKi InitDamp {:}{:} - - "StC damping at initialization (3,NumStC_Control) -- passed from StC to let controller know the value during init" "N/(m/s)" +typedef ^ StC_CtrlChanInitInfoType SiKi InitBrake {:}{:} - - "StC braking signal at initialization (3,NumStC_Control) -- passed from StC to let controller know the value during init" "N" +typedef ^ StC_CtrlChanInitInfoType SiKi InitForce {:}{:} - - "StC external force signal at initialization (3,NumStC_Control) -- passed from StC to let controller know the value during init (should be zero)" "N" +typedef ^ StC_CtrlChanInitInfoType SiKi InitMeasDisp {:}{:} - - "StC measured local displacement signal from StC at initialization (3,NumStC_Control)" "m" +typedef ^ StC_CtrlChanInitInfoType SiKi InitMeasVel {:}{:} - - "StC measured local velocity signal from StC at initialization (3,NumStC_Control)" "m/s" + # Define outputs from the initialization routine here: -typedef ^ InitOutputType SiKi DummyInitOut - - - "dummy init output" - -#typedef ^ InitOutputType CHARACTER(ChanLen) WriteOutputHdr {:} - - "Names of the output-to-file channels" - -#typedef ^ InitOutputType CHARACTER(ChanLen) WriteOutputUnt {:}- - "Units of the output-to-file channels" - +typedef ^ InitOutputType ReKi RelPosition {:}{:} - - "StC position relative to reference point (3,NumMeshPts)" m # ..... States .................................................................................................................... # Define continuous (differentiable) states here: -typedef ^ ContinuousStateType ReKi DummyContState - - - "Remove this variable if you have continuous states" - typedef ^ ContinuousStateType ReKi StC_x {:}{:} - - "Continuous States -- StrucCtrl x" - -typedef ^ ContinuousStateType ReKi StC_xdot {:}{:} - - "Continuous States -- StrucCtrl xdot" - +#typedef ^ ContinuousStateType ReKi StC_xdot {:}{:} - - "Continuous States -- StrucCtrl xdot" - # Define discrete (nondifferentiable) states here: typedef ^ DiscreteStateType ReKi DummyDiscState - - - "Remove this variable if you have discrete states" - # Define constraint states here: @@ -109,8 +124,9 @@ typedef ^ OtherStateType Reki DummyOtherState - - - "Remove this variable if # Define any misc data used only for efficiency purposes (indices for searching in an array, copies of previous calculations of output # at a given time, etc.) or other data that do not depend on time typedef ^ MiscVarType Reki F_stop {:}{:} - - "Stop forces" - -typedef ^ MiscVarType ReKi F_ext {:}{:} - - "External forces (user defined)" - +typedef ^ MiscVarType ReKi F_ext {:}{:} - - "External forces (user defined or from controller)" - typedef ^ MiscVarType ReKi F_fr {:}{:} - - "Friction forces" - +typedef ^ MiscVarType ReKi K {:}{:} - - "Stiffness -- might be changed if controller controls this" N/m typedef ^ MiscVarType ReKi C_ctrl {:}{:} - - "Controlled Damping (On/Off)" - typedef ^ MiscVarType ReKi C_Brake {:}{:} - - "Braking Damping" - typedef ^ MiscVarType ReKi F_table {:}{:} - - "Tabled Stiffness" - @@ -136,6 +152,7 @@ typedef ^ ^ INTEGER StC_DOF_MODE - - - "DOF mode {0: NO StC_DOF; 1: StC_X_ typedef ^ ^ LOGICAL StC_X_DOF - - - "DOF on or off" - typedef ^ ^ LOGICAL StC_Y_DOF - - - "DOF on or off" - typedef ^ ^ LOGICAL StC_Z_DOF - - - "DOF on or off" - +typedef ^ ^ ReKi StC_Z_PreLd - - - "StC_Z spring preload" N typedef ^ ^ ReKi M_X - - - "StC mass" kg typedef ^ ^ ReKi M_Y - - - "StC mass" kg typedef ^ ^ ReKi M_Z - - - "StC mass" kg @@ -151,8 +168,8 @@ typedef ^ ^ ReKi C_S {3} - - "StC stop damping" "N/(m/s)" typedef ^ ^ ReKi P_SP {3} - - "Positive stop position (maximum mass displacement)" m typedef ^ ^ ReKi N_SP {3} - - "Negative stop position (minimum X mass displacement)" m typedef ^ ^ ReKi Gravity {3} - - "Gravitational acceleration vector" "m/s^2" -typedef ^ ^ INTEGER StC_CMODE - - - "control mode {0:none; 1: Semi-Active Control Mode; 2: Active Control Mode;} " - -typedef ^ ^ INTEGER StC_SA_MODE - - - "Semi-Active control mode {1: velocity-based ground hook control; 2: Inverse velocity-based ground hook control; 3: displacement-based ground hook control 4: Phase difference Algorithm with Friction Force 5: Phase difference Algorithm with Damping Force} " - +typedef ^ ^ IntKi StC_CMODE - - - "control mode {0:none; 1: Semi-Active Control Mode; 4: Active Control Mode through Simulink (not available); 5: Active Control Mode through Bladed interface} " - +typedef ^ ^ IntKi StC_SA_MODE - - - "Semi-Active control mode {1: velocity-based ground hook control; 2: Inverse velocity-based ground hook control; 3: displacement-based ground hook control 4: Phase difference Algorithm with Friction Force 5: Phase difference Algorithm with Damping Force} " - typedef ^ ^ ReKi StC_X_C_HIGH - - - "StC X high damping for ground hook control" "N/(m/s)" typedef ^ ^ ReKi StC_X_C_LOW - - - "StC X low damping for ground hook control" "N/(m/s)" typedef ^ ^ ReKi StC_Y_C_HIGH - - - "StC Y high damping for ground hook control" "N/(m/s)" @@ -179,11 +196,19 @@ typedef ^ ^ ReKi F_TBL {:}{:} - - "user-defined spring force" "N" typedef ^ ParameterType IntKi NumMeshPts - - - "Number of mesh points" - typedef ^ ^ IntKi PrescribedForcesCoordSys - - - "Prescribed forces coordinate system {0: global; 1: local}" - typedef ^ ^ ReKi StC_PrescribedForce {:}{:} - - "StC prescribed force time-series info" "(s,N,N-m)" +typedef ^ ^ IntKi StC_CChan {:} - - "StC control chan to use" - # ..... Inputs .................................................................................................................... # Define inputs that are contained on the mesh here: typedef ^ InputType MeshType Mesh {:} - - "Displacements at the StC reference point(s) P in the inertial frame" - +typedef ^ ^ ReKi CmdStiff {:}{:} - - "StC stiffness from controller" "N/m" +typedef ^ ^ ReKi CmdDamp {:}{:} - - "StC damping from controller" "N/(m/s)" +typedef ^ ^ ReKi CmdBrake {:}{:} - - "StC braking from controller" "N/(m/s)" +typedef ^ ^ ReKi CmdForce {:}{:} - - "StC force from controller" "N" # ..... Outputs ................................................................................................................... # Define outputs that are contained on the mesh here: typedef ^ OutputType MeshType Mesh {:} - - "Loads at the StC reference points in the inertial frame" - +typedef ^ ^ ReKi MeasDisp {:}{:} - - "StC measured relative displacement of tmd mass (local coordinates) signal to controller" "m" +typedef ^ ^ ReKi MeasVel {:}{:} - - "StC measured relative velocity of tmd mass (local coordinates) signal to controller" "m/s" + # Define outputs that are not on this mesh here: #typedef ^ OutputType ReKi WriteOutput {:} - - "Data to be written to an output file: see WriteOutputHdr for names of each variable" "see WriteOutputUnt" diff --git a/modules/servodyn/src/StrucCtrl_Types.f90 b/modules/servodyn/src/StrucCtrl_Types.f90 index 6e56561efa..d8bc847c52 100644 --- a/modules/servodyn/src/StrucCtrl_Types.f90 +++ b/modules/servodyn/src/StrucCtrl_Types.f90 @@ -46,6 +46,7 @@ MODULE StrucCtrl_Types REAL(ReKi) :: StC_X_DSP !< StC_X initial displacement [m] REAL(ReKi) :: StC_Y_DSP !< StC_Y initial displacement [m] REAL(ReKi) :: StC_Z_DSP !< StC_Z initial displacement [m] + Character(10) :: StC_Z_PreLdC !< StC_Z spring preload [N] REAL(ReKi) :: StC_X_M !< StC X mass [kg] REAL(ReKi) :: StC_Y_M !< StC Y mass [kg] REAL(ReKi) :: StC_Z_M !< StC Z mass [kg] @@ -99,6 +100,7 @@ MODULE StrucCtrl_Types INTEGER(IntKi) :: PrescribedForcesCoordSys !< Prescribed forces coordinate system {0: global; 1: local} [-] CHARACTER(1024) :: PrescribedForcesFile !< Prescribed force time-series filename [-] REAL(ReKi) , DIMENSION(:,:), ALLOCATABLE :: StC_PrescribedForce !< StC prescribed force time-series info [(s,N,N-m)] + INTEGER(IntKi) , DIMENSION(:), ALLOCATABLE :: StC_CChan !< StC control chan to use -- one per instance [-] END TYPE StC_InputFile ! ======================= ! ========= StC_InitInputType ======= @@ -107,24 +109,35 @@ MODULE StrucCtrl_Types CHARACTER(1024) :: RootName !< RootName for writing output files [-] REAL(ReKi) , DIMENSION(1:3) :: Gravity !< Gravitational acceleration vector [m/s^2] INTEGER(IntKi) :: NumMeshPts !< Number of mesh points [-] - REAL(ReKi) , DIMENSION(:,:), ALLOCATABLE :: InitPosition !< X-Y-Z reference position of point: i.e. each blade root (3 x NumBlades) [m] - REAL(R8Ki) , DIMENSION(:,:,:), ALLOCATABLE :: InitOrientation !< DCM reference orientation of point: i.e. each blade root (3x3 x NumBlades) [-] + REAL(ReKi) , DIMENSION(:,:), ALLOCATABLE :: InitRefPos !< X-Y-Z reference position of point: i.e. each blade root (3 x NumBlades) [m] + REAL(R8Ki) , DIMENSION(:,:), ALLOCATABLE :: InitTransDisp !< X-Y-Z displacement from position of point at init: i.e. each blade root (3 x NumBlades) [m] + REAL(R8Ki) , DIMENSION(:,:,:), ALLOCATABLE :: InitOrient !< DCM orientation of point at init: i.e. each blade root (3x3 x NumBlades) [-] + REAL(R8Ki) , DIMENSION(:,:,:), ALLOCATABLE :: InitRefOrient !< DCM reference orientation of point: i.e. each blade root (3x3 x NumBlades) [-] LOGICAL :: UseInputFile = .TRUE. !< Read from the input file. If false, must parse the string info passed [-] TYPE(FileInfoType) :: PassedPrimaryInputData !< Primary input file as FileInfoType (set by driver/glue code) [-] LOGICAL :: UseInputFile_PrescribeFrc = .TRUE. !< Read from the input file. If false, must parse the string info passed [-] TYPE(FileInfoType) :: PassedPrescribeFrcData !< Prescribed forces input file as FileInfoType (set by driver/glue code) [-] END TYPE StC_InitInputType ! ======================= +! ========= StC_CtrlChanInitInfoType ======= + TYPE, PUBLIC :: StC_CtrlChanInitInfoType + CHARACTER(64) , DIMENSION(:), ALLOCATABLE :: Requestor !< text string of which StC requests which cable control channel [-] + REAL(SiKi) , DIMENSION(:,:), ALLOCATABLE :: InitStiff !< StC stiffness at initialization (3,NumStC_Control) -- passed from StC to let controller know the value during init [N/m] + REAL(SiKi) , DIMENSION(:,:), ALLOCATABLE :: InitDamp !< StC damping at initialization (3,NumStC_Control) -- passed from StC to let controller know the value during init [N/(m/s)] + REAL(SiKi) , DIMENSION(:,:), ALLOCATABLE :: InitBrake !< StC braking signal at initialization (3,NumStC_Control) -- passed from StC to let controller know the value during init [N] + REAL(SiKi) , DIMENSION(:,:), ALLOCATABLE :: InitForce !< StC external force signal at initialization (3,NumStC_Control) -- passed from StC to let controller know the value during init (should be zero) [N] + REAL(SiKi) , DIMENSION(:,:), ALLOCATABLE :: InitMeasDisp !< StC measured local displacement signal from StC at initialization (3,NumStC_Control) [m] + REAL(SiKi) , DIMENSION(:,:), ALLOCATABLE :: InitMeasVel !< StC measured local velocity signal from StC at initialization (3,NumStC_Control) [m/s] + END TYPE StC_CtrlChanInitInfoType +! ======================= ! ========= StC_InitOutputType ======= TYPE, PUBLIC :: StC_InitOutputType - REAL(SiKi) :: DummyInitOut !< dummy init output [-] + REAL(ReKi) , DIMENSION(:,:), ALLOCATABLE :: RelPosition !< StC position relative to reference point (3,NumMeshPts) [m] END TYPE StC_InitOutputType ! ======================= ! ========= StC_ContinuousStateType ======= TYPE, PUBLIC :: StC_ContinuousStateType - REAL(ReKi) :: DummyContState !< Remove this variable if you have continuous states [-] REAL(ReKi) , DIMENSION(:,:), ALLOCATABLE :: StC_x !< Continuous States -- StrucCtrl x [-] - REAL(ReKi) , DIMENSION(:,:), ALLOCATABLE :: StC_xdot !< Continuous States -- StrucCtrl xdot [-] END TYPE StC_ContinuousStateType ! ======================= ! ========= StC_DiscreteStateType ======= @@ -145,8 +158,9 @@ MODULE StrucCtrl_Types ! ========= StC_MiscVarType ======= TYPE, PUBLIC :: StC_MiscVarType REAL(ReKi) , DIMENSION(:,:), ALLOCATABLE :: F_stop !< Stop forces [-] - REAL(ReKi) , DIMENSION(:,:), ALLOCATABLE :: F_ext !< External forces (user defined) [-] + REAL(ReKi) , DIMENSION(:,:), ALLOCATABLE :: F_ext !< External forces (user defined or from controller) [-] REAL(ReKi) , DIMENSION(:,:), ALLOCATABLE :: F_fr !< Friction forces [-] + REAL(ReKi) , DIMENSION(:,:), ALLOCATABLE :: K !< Stiffness -- might be changed if controller controls this [N/m] REAL(ReKi) , DIMENSION(:,:), ALLOCATABLE :: C_ctrl !< Controlled Damping (On/Off) [-] REAL(ReKi) , DIMENSION(:,:), ALLOCATABLE :: C_Brake !< Braking Damping [-] REAL(ReKi) , DIMENSION(:,:), ALLOCATABLE :: F_table !< Tabled Stiffness [-] @@ -171,6 +185,7 @@ MODULE StrucCtrl_Types LOGICAL :: StC_X_DOF !< DOF on or off [-] LOGICAL :: StC_Y_DOF !< DOF on or off [-] LOGICAL :: StC_Z_DOF !< DOF on or off [-] + REAL(ReKi) :: StC_Z_PreLd !< StC_Z spring preload [N] REAL(ReKi) :: M_X !< StC mass [kg] REAL(ReKi) :: M_Y !< StC mass [kg] REAL(ReKi) :: M_Z !< StC mass [kg] @@ -186,7 +201,7 @@ MODULE StrucCtrl_Types REAL(ReKi) , DIMENSION(1:3) :: P_SP !< Positive stop position (maximum mass displacement) [m] REAL(ReKi) , DIMENSION(1:3) :: N_SP !< Negative stop position (minimum X mass displacement) [m] REAL(ReKi) , DIMENSION(1:3) :: Gravity !< Gravitational acceleration vector [m/s^2] - INTEGER(IntKi) :: StC_CMODE !< control mode {0:none; 1: Semi-Active Control Mode; 2: Active Control Mode;} [-] + INTEGER(IntKi) :: StC_CMODE !< control mode {0:none; 1: Semi-Active Control Mode; 4: Active Control Mode through Simulink (not available); 5: Active Control Mode through Bladed interface} [-] INTEGER(IntKi) :: StC_SA_MODE !< Semi-Active control mode {1: velocity-based ground hook control; 2: Inverse velocity-based ground hook control; 3: displacement-based ground hook control 4: Phase difference Algorithm with Friction Force 5: Phase difference Algorithm with Damping Force} [-] REAL(ReKi) :: StC_X_C_HIGH !< StC X high damping for ground hook control [N/(m/s)] REAL(ReKi) :: StC_X_C_LOW !< StC X low damping for ground hook control [N/(m/s)] @@ -214,16 +229,23 @@ MODULE StrucCtrl_Types INTEGER(IntKi) :: NumMeshPts !< Number of mesh points [-] INTEGER(IntKi) :: PrescribedForcesCoordSys !< Prescribed forces coordinate system {0: global; 1: local} [-] REAL(ReKi) , DIMENSION(:,:), ALLOCATABLE :: StC_PrescribedForce !< StC prescribed force time-series info [(s,N,N-m)] + INTEGER(IntKi) , DIMENSION(:), ALLOCATABLE :: StC_CChan !< StC control chan to use [-] END TYPE StC_ParameterType ! ======================= ! ========= StC_InputType ======= TYPE, PUBLIC :: StC_InputType TYPE(MeshType) , DIMENSION(:), ALLOCATABLE :: Mesh !< Displacements at the StC reference point(s) P in the inertial frame [-] + REAL(ReKi) , DIMENSION(:,:), ALLOCATABLE :: CmdStiff !< StC stiffness from controller [N/m] + REAL(ReKi) , DIMENSION(:,:), ALLOCATABLE :: CmdDamp !< StC damping from controller [N/(m/s)] + REAL(ReKi) , DIMENSION(:,:), ALLOCATABLE :: CmdBrake !< StC braking from controller [N/(m/s)] + REAL(ReKi) , DIMENSION(:,:), ALLOCATABLE :: CmdForce !< StC force from controller [N] END TYPE StC_InputType ! ======================= ! ========= StC_OutputType ======= TYPE, PUBLIC :: StC_OutputType TYPE(MeshType) , DIMENSION(:), ALLOCATABLE :: Mesh !< Loads at the StC reference points in the inertial frame [-] + REAL(ReKi) , DIMENSION(:,:), ALLOCATABLE :: MeasDisp !< StC measured relative displacement of tmd mass (local coordinates) signal to controller [m] + REAL(ReKi) , DIMENSION(:,:), ALLOCATABLE :: MeasVel !< StC measured relative velocity of tmd mass (local coordinates) signal to controller [m/s] END TYPE StC_OutputType ! ======================= CONTAINS @@ -255,6 +277,7 @@ SUBROUTINE StC_CopyInputFile( SrcInputFileData, DstInputFileData, CtrlCode, ErrS DstInputFileData%StC_X_DSP = SrcInputFileData%StC_X_DSP DstInputFileData%StC_Y_DSP = SrcInputFileData%StC_Y_DSP DstInputFileData%StC_Z_DSP = SrcInputFileData%StC_Z_DSP + DstInputFileData%StC_Z_PreLdC = SrcInputFileData%StC_Z_PreLdC DstInputFileData%StC_X_M = SrcInputFileData%StC_X_M DstInputFileData%StC_Y_M = SrcInputFileData%StC_Y_M DstInputFileData%StC_Z_M = SrcInputFileData%StC_Z_M @@ -333,6 +356,18 @@ SUBROUTINE StC_CopyInputFile( SrcInputFileData, DstInputFileData, CtrlCode, ErrS END IF END IF DstInputFileData%StC_PrescribedForce = SrcInputFileData%StC_PrescribedForce +ENDIF +IF (ALLOCATED(SrcInputFileData%StC_CChan)) THEN + i1_l = LBOUND(SrcInputFileData%StC_CChan,1) + i1_u = UBOUND(SrcInputFileData%StC_CChan,1) + IF (.NOT. ALLOCATED(DstInputFileData%StC_CChan)) THEN + ALLOCATE(DstInputFileData%StC_CChan(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstInputFileData%StC_CChan.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DstInputFileData%StC_CChan = SrcInputFileData%StC_CChan ENDIF END SUBROUTINE StC_CopyInputFile @@ -350,6 +385,9 @@ SUBROUTINE StC_DestroyInputFile( InputFileData, ErrStat, ErrMsg ) ENDIF IF (ALLOCATED(InputFileData%StC_PrescribedForce)) THEN DEALLOCATE(InputFileData%StC_PrescribedForce) +ENDIF +IF (ALLOCATED(InputFileData%StC_CChan)) THEN + DEALLOCATE(InputFileData%StC_CChan) ENDIF END SUBROUTINE StC_DestroyInputFile @@ -399,6 +437,7 @@ SUBROUTINE StC_PackInputFile( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMs Re_BufSz = Re_BufSz + 1 ! StC_X_DSP Re_BufSz = Re_BufSz + 1 ! StC_Y_DSP Re_BufSz = Re_BufSz + 1 ! StC_Z_DSP + Int_BufSz = Int_BufSz + 1*LEN(InData%StC_Z_PreLdC) ! StC_Z_PreLdC Re_BufSz = Re_BufSz + 1 ! StC_X_M Re_BufSz = Re_BufSz + 1 ! StC_Y_M Re_BufSz = Re_BufSz + 1 ! StC_Z_M @@ -460,6 +499,11 @@ SUBROUTINE StC_PackInputFile( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMs Int_BufSz = Int_BufSz + 2*2 ! StC_PrescribedForce upper/lower bounds for each dimension Re_BufSz = Re_BufSz + SIZE(InData%StC_PrescribedForce) ! StC_PrescribedForce END IF + Int_BufSz = Int_BufSz + 1 ! StC_CChan allocated yes/no + IF ( ALLOCATED(InData%StC_CChan) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! StC_CChan upper/lower bounds for each dimension + Int_BufSz = Int_BufSz + SIZE(InData%StC_CChan) ! StC_CChan + END IF IF ( Re_BufSz .GT. 0 ) THEN ALLOCATE( ReKiBuf( Re_BufSz ), STAT=ErrStat2 ) IF (ErrStat2 /= 0) THEN @@ -511,6 +555,10 @@ SUBROUTINE StC_PackInputFile( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMs Re_Xferred = Re_Xferred + 1 ReKiBuf(Re_Xferred) = InData%StC_Z_DSP Re_Xferred = Re_Xferred + 1 + DO I = 1, LEN(InData%StC_Z_PreLdC) + IntKiBuf(Int_Xferred) = ICHAR(InData%StC_Z_PreLdC(I:I), IntKi) + Int_Xferred = Int_Xferred + 1 + END DO ! I ReKiBuf(Re_Xferred) = InData%StC_X_M Re_Xferred = Re_Xferred + 1 ReKiBuf(Re_Xferred) = InData%StC_Y_M @@ -657,6 +705,21 @@ SUBROUTINE StC_PackInputFile( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMs END DO END DO END IF + IF ( .NOT. ALLOCATED(InData%StC_CChan) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%StC_CChan,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%StC_CChan,1) + Int_Xferred = Int_Xferred + 2 + + DO i1 = LBOUND(InData%StC_CChan,1), UBOUND(InData%StC_CChan,1) + IntKiBuf(Int_Xferred) = InData%StC_CChan(i1) + Int_Xferred = Int_Xferred + 1 + END DO + END IF END SUBROUTINE StC_PackInputFile SUBROUTINE StC_UnPackInputFile( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrMsg ) @@ -712,6 +775,10 @@ SUBROUTINE StC_UnPackInputFile( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, Er Re_Xferred = Re_Xferred + 1 OutData%StC_Z_DSP = ReKiBuf(Re_Xferred) Re_Xferred = Re_Xferred + 1 + DO I = 1, LEN(OutData%StC_Z_PreLdC) + OutData%StC_Z_PreLdC(I:I) = CHAR(IntKiBuf(Int_Xferred)) + Int_Xferred = Int_Xferred + 1 + END DO ! I OutData%StC_X_M = ReKiBuf(Re_Xferred) Re_Xferred = Re_Xferred + 1 OutData%StC_Y_M = ReKiBuf(Re_Xferred) @@ -864,6 +931,24 @@ SUBROUTINE StC_UnPackInputFile( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, Er END DO END DO END IF + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! StC_CChan not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%StC_CChan)) DEALLOCATE(OutData%StC_CChan) + ALLOCATE(OutData%StC_CChan(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%StC_CChan.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i1 = LBOUND(OutData%StC_CChan,1), UBOUND(OutData%StC_CChan,1) + OutData%StC_CChan(i1) = IntKiBuf(Int_Xferred) + Int_Xferred = Int_Xferred + 1 + END DO + END IF END SUBROUTINE StC_UnPackInputFile SUBROUTINE StC_CopyInitInput( SrcInitInputData, DstInitInputData, CtrlCode, ErrStat, ErrMsg ) @@ -887,35 +972,65 @@ SUBROUTINE StC_CopyInitInput( SrcInitInputData, DstInitInputData, CtrlCode, ErrS DstInitInputData%RootName = SrcInitInputData%RootName DstInitInputData%Gravity = SrcInitInputData%Gravity DstInitInputData%NumMeshPts = SrcInitInputData%NumMeshPts -IF (ALLOCATED(SrcInitInputData%InitPosition)) THEN - i1_l = LBOUND(SrcInitInputData%InitPosition,1) - i1_u = UBOUND(SrcInitInputData%InitPosition,1) - i2_l = LBOUND(SrcInitInputData%InitPosition,2) - i2_u = UBOUND(SrcInitInputData%InitPosition,2) - IF (.NOT. ALLOCATED(DstInitInputData%InitPosition)) THEN - ALLOCATE(DstInitInputData%InitPosition(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) +IF (ALLOCATED(SrcInitInputData%InitRefPos)) THEN + i1_l = LBOUND(SrcInitInputData%InitRefPos,1) + i1_u = UBOUND(SrcInitInputData%InitRefPos,1) + i2_l = LBOUND(SrcInitInputData%InitRefPos,2) + i2_u = UBOUND(SrcInitInputData%InitRefPos,2) + IF (.NOT. ALLOCATED(DstInitInputData%InitRefPos)) THEN + ALLOCATE(DstInitInputData%InitRefPos(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstInitInputData%InitRefPos.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DstInitInputData%InitRefPos = SrcInitInputData%InitRefPos +ENDIF +IF (ALLOCATED(SrcInitInputData%InitTransDisp)) THEN + i1_l = LBOUND(SrcInitInputData%InitTransDisp,1) + i1_u = UBOUND(SrcInitInputData%InitTransDisp,1) + i2_l = LBOUND(SrcInitInputData%InitTransDisp,2) + i2_u = UBOUND(SrcInitInputData%InitTransDisp,2) + IF (.NOT. ALLOCATED(DstInitInputData%InitTransDisp)) THEN + ALLOCATE(DstInitInputData%InitTransDisp(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstInitInputData%InitTransDisp.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DstInitInputData%InitTransDisp = SrcInitInputData%InitTransDisp +ENDIF +IF (ALLOCATED(SrcInitInputData%InitOrient)) THEN + i1_l = LBOUND(SrcInitInputData%InitOrient,1) + i1_u = UBOUND(SrcInitInputData%InitOrient,1) + i2_l = LBOUND(SrcInitInputData%InitOrient,2) + i2_u = UBOUND(SrcInitInputData%InitOrient,2) + i3_l = LBOUND(SrcInitInputData%InitOrient,3) + i3_u = UBOUND(SrcInitInputData%InitOrient,3) + IF (.NOT. ALLOCATED(DstInitInputData%InitOrient)) THEN + ALLOCATE(DstInitInputData%InitOrient(i1_l:i1_u,i2_l:i2_u,i3_l:i3_u),STAT=ErrStat2) IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating DstInitInputData%InitPosition.', ErrStat, ErrMsg,RoutineName) + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstInitInputData%InitOrient.', ErrStat, ErrMsg,RoutineName) RETURN END IF END IF - DstInitInputData%InitPosition = SrcInitInputData%InitPosition + DstInitInputData%InitOrient = SrcInitInputData%InitOrient ENDIF -IF (ALLOCATED(SrcInitInputData%InitOrientation)) THEN - i1_l = LBOUND(SrcInitInputData%InitOrientation,1) - i1_u = UBOUND(SrcInitInputData%InitOrientation,1) - i2_l = LBOUND(SrcInitInputData%InitOrientation,2) - i2_u = UBOUND(SrcInitInputData%InitOrientation,2) - i3_l = LBOUND(SrcInitInputData%InitOrientation,3) - i3_u = UBOUND(SrcInitInputData%InitOrientation,3) - IF (.NOT. ALLOCATED(DstInitInputData%InitOrientation)) THEN - ALLOCATE(DstInitInputData%InitOrientation(i1_l:i1_u,i2_l:i2_u,i3_l:i3_u),STAT=ErrStat2) +IF (ALLOCATED(SrcInitInputData%InitRefOrient)) THEN + i1_l = LBOUND(SrcInitInputData%InitRefOrient,1) + i1_u = UBOUND(SrcInitInputData%InitRefOrient,1) + i2_l = LBOUND(SrcInitInputData%InitRefOrient,2) + i2_u = UBOUND(SrcInitInputData%InitRefOrient,2) + i3_l = LBOUND(SrcInitInputData%InitRefOrient,3) + i3_u = UBOUND(SrcInitInputData%InitRefOrient,3) + IF (.NOT. ALLOCATED(DstInitInputData%InitRefOrient)) THEN + ALLOCATE(DstInitInputData%InitRefOrient(i1_l:i1_u,i2_l:i2_u,i3_l:i3_u),STAT=ErrStat2) IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating DstInitInputData%InitOrientation.', ErrStat, ErrMsg,RoutineName) + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstInitInputData%InitRefOrient.', ErrStat, ErrMsg,RoutineName) RETURN END IF END IF - DstInitInputData%InitOrientation = SrcInitInputData%InitOrientation + DstInitInputData%InitRefOrient = SrcInitInputData%InitRefOrient ENDIF DstInitInputData%UseInputFile = SrcInitInputData%UseInputFile CALL NWTC_Library_Copyfileinfotype( SrcInitInputData%PassedPrimaryInputData, DstInitInputData%PassedPrimaryInputData, CtrlCode, ErrStat2, ErrMsg2 ) @@ -936,11 +1051,17 @@ SUBROUTINE StC_DestroyInitInput( InitInputData, ErrStat, ErrMsg ) ! ErrStat = ErrID_None ErrMsg = "" -IF (ALLOCATED(InitInputData%InitPosition)) THEN - DEALLOCATE(InitInputData%InitPosition) +IF (ALLOCATED(InitInputData%InitRefPos)) THEN + DEALLOCATE(InitInputData%InitRefPos) +ENDIF +IF (ALLOCATED(InitInputData%InitTransDisp)) THEN + DEALLOCATE(InitInputData%InitTransDisp) ENDIF -IF (ALLOCATED(InitInputData%InitOrientation)) THEN - DEALLOCATE(InitInputData%InitOrientation) +IF (ALLOCATED(InitInputData%InitOrient)) THEN + DEALLOCATE(InitInputData%InitOrient) +ENDIF +IF (ALLOCATED(InitInputData%InitRefOrient)) THEN + DEALLOCATE(InitInputData%InitRefOrient) ENDIF CALL NWTC_Library_Destroyfileinfotype( InitInputData%PassedPrimaryInputData, ErrStat, ErrMsg ) CALL NWTC_Library_Destroyfileinfotype( InitInputData%PassedPrescribeFrcData, ErrStat, ErrMsg ) @@ -985,15 +1106,25 @@ SUBROUTINE StC_PackInitInput( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMs Int_BufSz = Int_BufSz + 1*LEN(InData%RootName) ! RootName Re_BufSz = Re_BufSz + SIZE(InData%Gravity) ! Gravity Int_BufSz = Int_BufSz + 1 ! NumMeshPts - Int_BufSz = Int_BufSz + 1 ! InitPosition allocated yes/no - IF ( ALLOCATED(InData%InitPosition) ) THEN - Int_BufSz = Int_BufSz + 2*2 ! InitPosition upper/lower bounds for each dimension - Re_BufSz = Re_BufSz + SIZE(InData%InitPosition) ! InitPosition - END IF - Int_BufSz = Int_BufSz + 1 ! InitOrientation allocated yes/no - IF ( ALLOCATED(InData%InitOrientation) ) THEN - Int_BufSz = Int_BufSz + 2*3 ! InitOrientation upper/lower bounds for each dimension - Db_BufSz = Db_BufSz + SIZE(InData%InitOrientation) ! InitOrientation + Int_BufSz = Int_BufSz + 1 ! InitRefPos allocated yes/no + IF ( ALLOCATED(InData%InitRefPos) ) THEN + Int_BufSz = Int_BufSz + 2*2 ! InitRefPos upper/lower bounds for each dimension + Re_BufSz = Re_BufSz + SIZE(InData%InitRefPos) ! InitRefPos + END IF + Int_BufSz = Int_BufSz + 1 ! InitTransDisp allocated yes/no + IF ( ALLOCATED(InData%InitTransDisp) ) THEN + Int_BufSz = Int_BufSz + 2*2 ! InitTransDisp upper/lower bounds for each dimension + Db_BufSz = Db_BufSz + SIZE(InData%InitTransDisp) ! InitTransDisp + END IF + Int_BufSz = Int_BufSz + 1 ! InitOrient allocated yes/no + IF ( ALLOCATED(InData%InitOrient) ) THEN + Int_BufSz = Int_BufSz + 2*3 ! InitOrient upper/lower bounds for each dimension + Db_BufSz = Db_BufSz + SIZE(InData%InitOrient) ! InitOrient + END IF + Int_BufSz = Int_BufSz + 1 ! InitRefOrient allocated yes/no + IF ( ALLOCATED(InData%InitRefOrient) ) THEN + Int_BufSz = Int_BufSz + 2*3 ! InitRefOrient upper/lower bounds for each dimension + Db_BufSz = Db_BufSz + SIZE(InData%InitRefOrient) ! InitRefOrient END IF Int_BufSz = Int_BufSz + 1 ! UseInputFile ! Allocate buffers for subtypes, if any (we'll get sizes from these) @@ -1073,46 +1204,91 @@ SUBROUTINE StC_PackInitInput( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMs END DO IntKiBuf(Int_Xferred) = InData%NumMeshPts Int_Xferred = Int_Xferred + 1 - IF ( .NOT. ALLOCATED(InData%InitPosition) ) THEN + IF ( .NOT. ALLOCATED(InData%InitRefPos) ) THEN IntKiBuf( Int_Xferred ) = 0 Int_Xferred = Int_Xferred + 1 ELSE IntKiBuf( Int_Xferred ) = 1 Int_Xferred = Int_Xferred + 1 - IntKiBuf( Int_Xferred ) = LBOUND(InData%InitPosition,1) - IntKiBuf( Int_Xferred + 1) = UBOUND(InData%InitPosition,1) + IntKiBuf( Int_Xferred ) = LBOUND(InData%InitRefPos,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%InitRefPos,1) Int_Xferred = Int_Xferred + 2 - IntKiBuf( Int_Xferred ) = LBOUND(InData%InitPosition,2) - IntKiBuf( Int_Xferred + 1) = UBOUND(InData%InitPosition,2) + IntKiBuf( Int_Xferred ) = LBOUND(InData%InitRefPos,2) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%InitRefPos,2) Int_Xferred = Int_Xferred + 2 - DO i2 = LBOUND(InData%InitPosition,2), UBOUND(InData%InitPosition,2) - DO i1 = LBOUND(InData%InitPosition,1), UBOUND(InData%InitPosition,1) - ReKiBuf(Re_Xferred) = InData%InitPosition(i1,i2) + DO i2 = LBOUND(InData%InitRefPos,2), UBOUND(InData%InitRefPos,2) + DO i1 = LBOUND(InData%InitRefPos,1), UBOUND(InData%InitRefPos,1) + ReKiBuf(Re_Xferred) = InData%InitRefPos(i1,i2) Re_Xferred = Re_Xferred + 1 END DO END DO END IF - IF ( .NOT. ALLOCATED(InData%InitOrientation) ) THEN + IF ( .NOT. ALLOCATED(InData%InitTransDisp) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%InitTransDisp,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%InitTransDisp,1) + Int_Xferred = Int_Xferred + 2 + IntKiBuf( Int_Xferred ) = LBOUND(InData%InitTransDisp,2) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%InitTransDisp,2) + Int_Xferred = Int_Xferred + 2 + + DO i2 = LBOUND(InData%InitTransDisp,2), UBOUND(InData%InitTransDisp,2) + DO i1 = LBOUND(InData%InitTransDisp,1), UBOUND(InData%InitTransDisp,1) + DbKiBuf(Db_Xferred) = InData%InitTransDisp(i1,i2) + Db_Xferred = Db_Xferred + 1 + END DO + END DO + END IF + IF ( .NOT. ALLOCATED(InData%InitOrient) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%InitOrient,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%InitOrient,1) + Int_Xferred = Int_Xferred + 2 + IntKiBuf( Int_Xferred ) = LBOUND(InData%InitOrient,2) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%InitOrient,2) + Int_Xferred = Int_Xferred + 2 + IntKiBuf( Int_Xferred ) = LBOUND(InData%InitOrient,3) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%InitOrient,3) + Int_Xferred = Int_Xferred + 2 + + DO i3 = LBOUND(InData%InitOrient,3), UBOUND(InData%InitOrient,3) + DO i2 = LBOUND(InData%InitOrient,2), UBOUND(InData%InitOrient,2) + DO i1 = LBOUND(InData%InitOrient,1), UBOUND(InData%InitOrient,1) + DbKiBuf(Db_Xferred) = InData%InitOrient(i1,i2,i3) + Db_Xferred = Db_Xferred + 1 + END DO + END DO + END DO + END IF + IF ( .NOT. ALLOCATED(InData%InitRefOrient) ) THEN IntKiBuf( Int_Xferred ) = 0 Int_Xferred = Int_Xferred + 1 ELSE IntKiBuf( Int_Xferred ) = 1 Int_Xferred = Int_Xferred + 1 - IntKiBuf( Int_Xferred ) = LBOUND(InData%InitOrientation,1) - IntKiBuf( Int_Xferred + 1) = UBOUND(InData%InitOrientation,1) + IntKiBuf( Int_Xferred ) = LBOUND(InData%InitRefOrient,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%InitRefOrient,1) Int_Xferred = Int_Xferred + 2 - IntKiBuf( Int_Xferred ) = LBOUND(InData%InitOrientation,2) - IntKiBuf( Int_Xferred + 1) = UBOUND(InData%InitOrientation,2) + IntKiBuf( Int_Xferred ) = LBOUND(InData%InitRefOrient,2) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%InitRefOrient,2) Int_Xferred = Int_Xferred + 2 - IntKiBuf( Int_Xferred ) = LBOUND(InData%InitOrientation,3) - IntKiBuf( Int_Xferred + 1) = UBOUND(InData%InitOrientation,3) + IntKiBuf( Int_Xferred ) = LBOUND(InData%InitRefOrient,3) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%InitRefOrient,3) Int_Xferred = Int_Xferred + 2 - DO i3 = LBOUND(InData%InitOrientation,3), UBOUND(InData%InitOrientation,3) - DO i2 = LBOUND(InData%InitOrientation,2), UBOUND(InData%InitOrientation,2) - DO i1 = LBOUND(InData%InitOrientation,1), UBOUND(InData%InitOrientation,1) - DbKiBuf(Db_Xferred) = InData%InitOrientation(i1,i2,i3) + DO i3 = LBOUND(InData%InitRefOrient,3), UBOUND(InData%InitRefOrient,3) + DO i2 = LBOUND(InData%InitRefOrient,2), UBOUND(InData%InitRefOrient,2) + DO i1 = LBOUND(InData%InitRefOrient,1), UBOUND(InData%InitRefOrient,1) + DbKiBuf(Db_Xferred) = InData%InitRefOrient(i1,i2,i3) Db_Xferred = Db_Xferred + 1 END DO END DO @@ -1225,7 +1401,7 @@ SUBROUTINE StC_UnPackInitInput( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, Er END DO OutData%NumMeshPts = IntKiBuf(Int_Xferred) Int_Xferred = Int_Xferred + 1 - IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! InitPosition not allocated + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! InitRefPos not allocated Int_Xferred = Int_Xferred + 1 ELSE Int_Xferred = Int_Xferred + 1 @@ -1235,20 +1411,71 @@ SUBROUTINE StC_UnPackInitInput( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, Er i2_l = IntKiBuf( Int_Xferred ) i2_u = IntKiBuf( Int_Xferred + 1) Int_Xferred = Int_Xferred + 2 - IF (ALLOCATED(OutData%InitPosition)) DEALLOCATE(OutData%InitPosition) - ALLOCATE(OutData%InitPosition(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) + IF (ALLOCATED(OutData%InitRefPos)) DEALLOCATE(OutData%InitRefPos) + ALLOCATE(OutData%InitRefPos(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%InitPosition.', ErrStat, ErrMsg,RoutineName) + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%InitRefPos.', ErrStat, ErrMsg,RoutineName) RETURN END IF - DO i2 = LBOUND(OutData%InitPosition,2), UBOUND(OutData%InitPosition,2) - DO i1 = LBOUND(OutData%InitPosition,1), UBOUND(OutData%InitPosition,1) - OutData%InitPosition(i1,i2) = ReKiBuf(Re_Xferred) + DO i2 = LBOUND(OutData%InitRefPos,2), UBOUND(OutData%InitRefPos,2) + DO i1 = LBOUND(OutData%InitRefPos,1), UBOUND(OutData%InitRefPos,1) + OutData%InitRefPos(i1,i2) = ReKiBuf(Re_Xferred) Re_Xferred = Re_Xferred + 1 END DO END DO END IF - IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! InitOrientation not allocated + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! InitTransDisp not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + i2_l = IntKiBuf( Int_Xferred ) + i2_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%InitTransDisp)) DEALLOCATE(OutData%InitTransDisp) + ALLOCATE(OutData%InitTransDisp(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%InitTransDisp.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i2 = LBOUND(OutData%InitTransDisp,2), UBOUND(OutData%InitTransDisp,2) + DO i1 = LBOUND(OutData%InitTransDisp,1), UBOUND(OutData%InitTransDisp,1) + OutData%InitTransDisp(i1,i2) = REAL(DbKiBuf(Db_Xferred), R8Ki) + Db_Xferred = Db_Xferred + 1 + END DO + END DO + END IF + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! InitOrient not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + i2_l = IntKiBuf( Int_Xferred ) + i2_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + i3_l = IntKiBuf( Int_Xferred ) + i3_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%InitOrient)) DEALLOCATE(OutData%InitOrient) + ALLOCATE(OutData%InitOrient(i1_l:i1_u,i2_l:i2_u,i3_l:i3_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%InitOrient.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i3 = LBOUND(OutData%InitOrient,3), UBOUND(OutData%InitOrient,3) + DO i2 = LBOUND(OutData%InitOrient,2), UBOUND(OutData%InitOrient,2) + DO i1 = LBOUND(OutData%InitOrient,1), UBOUND(OutData%InitOrient,1) + OutData%InitOrient(i1,i2,i3) = REAL(DbKiBuf(Db_Xferred), R8Ki) + Db_Xferred = Db_Xferred + 1 + END DO + END DO + END DO + END IF + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! InitRefOrient not allocated Int_Xferred = Int_Xferred + 1 ELSE Int_Xferred = Int_Xferred + 1 @@ -1261,16 +1488,16 @@ SUBROUTINE StC_UnPackInitInput( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, Er i3_l = IntKiBuf( Int_Xferred ) i3_u = IntKiBuf( Int_Xferred + 1) Int_Xferred = Int_Xferred + 2 - IF (ALLOCATED(OutData%InitOrientation)) DEALLOCATE(OutData%InitOrientation) - ALLOCATE(OutData%InitOrientation(i1_l:i1_u,i2_l:i2_u,i3_l:i3_u),STAT=ErrStat2) + IF (ALLOCATED(OutData%InitRefOrient)) DEALLOCATE(OutData%InitRefOrient) + ALLOCATE(OutData%InitRefOrient(i1_l:i1_u,i2_l:i2_u,i3_l:i3_u),STAT=ErrStat2) IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%InitOrientation.', ErrStat, ErrMsg,RoutineName) + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%InitRefOrient.', ErrStat, ErrMsg,RoutineName) RETURN END IF - DO i3 = LBOUND(OutData%InitOrientation,3), UBOUND(OutData%InitOrientation,3) - DO i2 = LBOUND(OutData%InitOrientation,2), UBOUND(OutData%InitOrientation,2) - DO i1 = LBOUND(OutData%InitOrientation,1), UBOUND(OutData%InitOrientation,1) - OutData%InitOrientation(i1,i2,i3) = REAL(DbKiBuf(Db_Xferred), R8Ki) + DO i3 = LBOUND(OutData%InitRefOrient,3), UBOUND(OutData%InitRefOrient,3) + DO i2 = LBOUND(OutData%InitRefOrient,2), UBOUND(OutData%InitRefOrient,2) + DO i1 = LBOUND(OutData%InitRefOrient,1), UBOUND(OutData%InitRefOrient,1) + OutData%InitRefOrient(i1,i2,i3) = REAL(DbKiBuf(Db_Xferred), R8Ki) Db_Xferred = Db_Xferred + 1 END DO END DO @@ -1362,39 +1589,157 @@ SUBROUTINE StC_UnPackInitInput( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, Er IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) END SUBROUTINE StC_UnPackInitInput - SUBROUTINE StC_CopyInitOutput( SrcInitOutputData, DstInitOutputData, CtrlCode, ErrStat, ErrMsg ) - TYPE(StC_InitOutputType), INTENT(IN) :: SrcInitOutputData - TYPE(StC_InitOutputType), INTENT(INOUT) :: DstInitOutputData + SUBROUTINE StC_CopyCtrlChanInitInfoType( SrcCtrlChanInitInfoTypeData, DstCtrlChanInitInfoTypeData, CtrlCode, ErrStat, ErrMsg ) + TYPE(StC_CtrlChanInitInfoType), INTENT(IN) :: SrcCtrlChanInitInfoTypeData + TYPE(StC_CtrlChanInitInfoType), INTENT(INOUT) :: DstCtrlChanInitInfoTypeData INTEGER(IntKi), INTENT(IN ) :: CtrlCode INTEGER(IntKi), INTENT( OUT) :: ErrStat CHARACTER(*), INTENT( OUT) :: ErrMsg ! Local INTEGER(IntKi) :: i,j,k + INTEGER(IntKi) :: i1, i1_l, i1_u ! bounds (upper/lower) for an array dimension 1 + INTEGER(IntKi) :: i2, i2_l, i2_u ! bounds (upper/lower) for an array dimension 2 INTEGER(IntKi) :: ErrStat2 CHARACTER(ErrMsgLen) :: ErrMsg2 - CHARACTER(*), PARAMETER :: RoutineName = 'StC_CopyInitOutput' + CHARACTER(*), PARAMETER :: RoutineName = 'StC_CopyCtrlChanInitInfoType' ! ErrStat = ErrID_None ErrMsg = "" - DstInitOutputData%DummyInitOut = SrcInitOutputData%DummyInitOut - END SUBROUTINE StC_CopyInitOutput +IF (ALLOCATED(SrcCtrlChanInitInfoTypeData%Requestor)) THEN + i1_l = LBOUND(SrcCtrlChanInitInfoTypeData%Requestor,1) + i1_u = UBOUND(SrcCtrlChanInitInfoTypeData%Requestor,1) + IF (.NOT. ALLOCATED(DstCtrlChanInitInfoTypeData%Requestor)) THEN + ALLOCATE(DstCtrlChanInitInfoTypeData%Requestor(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstCtrlChanInitInfoTypeData%Requestor.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DstCtrlChanInitInfoTypeData%Requestor = SrcCtrlChanInitInfoTypeData%Requestor +ENDIF +IF (ALLOCATED(SrcCtrlChanInitInfoTypeData%InitStiff)) THEN + i1_l = LBOUND(SrcCtrlChanInitInfoTypeData%InitStiff,1) + i1_u = UBOUND(SrcCtrlChanInitInfoTypeData%InitStiff,1) + i2_l = LBOUND(SrcCtrlChanInitInfoTypeData%InitStiff,2) + i2_u = UBOUND(SrcCtrlChanInitInfoTypeData%InitStiff,2) + IF (.NOT. ALLOCATED(DstCtrlChanInitInfoTypeData%InitStiff)) THEN + ALLOCATE(DstCtrlChanInitInfoTypeData%InitStiff(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstCtrlChanInitInfoTypeData%InitStiff.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DstCtrlChanInitInfoTypeData%InitStiff = SrcCtrlChanInitInfoTypeData%InitStiff +ENDIF +IF (ALLOCATED(SrcCtrlChanInitInfoTypeData%InitDamp)) THEN + i1_l = LBOUND(SrcCtrlChanInitInfoTypeData%InitDamp,1) + i1_u = UBOUND(SrcCtrlChanInitInfoTypeData%InitDamp,1) + i2_l = LBOUND(SrcCtrlChanInitInfoTypeData%InitDamp,2) + i2_u = UBOUND(SrcCtrlChanInitInfoTypeData%InitDamp,2) + IF (.NOT. ALLOCATED(DstCtrlChanInitInfoTypeData%InitDamp)) THEN + ALLOCATE(DstCtrlChanInitInfoTypeData%InitDamp(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstCtrlChanInitInfoTypeData%InitDamp.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DstCtrlChanInitInfoTypeData%InitDamp = SrcCtrlChanInitInfoTypeData%InitDamp +ENDIF +IF (ALLOCATED(SrcCtrlChanInitInfoTypeData%InitBrake)) THEN + i1_l = LBOUND(SrcCtrlChanInitInfoTypeData%InitBrake,1) + i1_u = UBOUND(SrcCtrlChanInitInfoTypeData%InitBrake,1) + i2_l = LBOUND(SrcCtrlChanInitInfoTypeData%InitBrake,2) + i2_u = UBOUND(SrcCtrlChanInitInfoTypeData%InitBrake,2) + IF (.NOT. ALLOCATED(DstCtrlChanInitInfoTypeData%InitBrake)) THEN + ALLOCATE(DstCtrlChanInitInfoTypeData%InitBrake(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstCtrlChanInitInfoTypeData%InitBrake.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DstCtrlChanInitInfoTypeData%InitBrake = SrcCtrlChanInitInfoTypeData%InitBrake +ENDIF +IF (ALLOCATED(SrcCtrlChanInitInfoTypeData%InitForce)) THEN + i1_l = LBOUND(SrcCtrlChanInitInfoTypeData%InitForce,1) + i1_u = UBOUND(SrcCtrlChanInitInfoTypeData%InitForce,1) + i2_l = LBOUND(SrcCtrlChanInitInfoTypeData%InitForce,2) + i2_u = UBOUND(SrcCtrlChanInitInfoTypeData%InitForce,2) + IF (.NOT. ALLOCATED(DstCtrlChanInitInfoTypeData%InitForce)) THEN + ALLOCATE(DstCtrlChanInitInfoTypeData%InitForce(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstCtrlChanInitInfoTypeData%InitForce.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DstCtrlChanInitInfoTypeData%InitForce = SrcCtrlChanInitInfoTypeData%InitForce +ENDIF +IF (ALLOCATED(SrcCtrlChanInitInfoTypeData%InitMeasDisp)) THEN + i1_l = LBOUND(SrcCtrlChanInitInfoTypeData%InitMeasDisp,1) + i1_u = UBOUND(SrcCtrlChanInitInfoTypeData%InitMeasDisp,1) + i2_l = LBOUND(SrcCtrlChanInitInfoTypeData%InitMeasDisp,2) + i2_u = UBOUND(SrcCtrlChanInitInfoTypeData%InitMeasDisp,2) + IF (.NOT. ALLOCATED(DstCtrlChanInitInfoTypeData%InitMeasDisp)) THEN + ALLOCATE(DstCtrlChanInitInfoTypeData%InitMeasDisp(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstCtrlChanInitInfoTypeData%InitMeasDisp.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DstCtrlChanInitInfoTypeData%InitMeasDisp = SrcCtrlChanInitInfoTypeData%InitMeasDisp +ENDIF +IF (ALLOCATED(SrcCtrlChanInitInfoTypeData%InitMeasVel)) THEN + i1_l = LBOUND(SrcCtrlChanInitInfoTypeData%InitMeasVel,1) + i1_u = UBOUND(SrcCtrlChanInitInfoTypeData%InitMeasVel,1) + i2_l = LBOUND(SrcCtrlChanInitInfoTypeData%InitMeasVel,2) + i2_u = UBOUND(SrcCtrlChanInitInfoTypeData%InitMeasVel,2) + IF (.NOT. ALLOCATED(DstCtrlChanInitInfoTypeData%InitMeasVel)) THEN + ALLOCATE(DstCtrlChanInitInfoTypeData%InitMeasVel(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstCtrlChanInitInfoTypeData%InitMeasVel.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DstCtrlChanInitInfoTypeData%InitMeasVel = SrcCtrlChanInitInfoTypeData%InitMeasVel +ENDIF + END SUBROUTINE StC_CopyCtrlChanInitInfoType - SUBROUTINE StC_DestroyInitOutput( InitOutputData, ErrStat, ErrMsg ) - TYPE(StC_InitOutputType), INTENT(INOUT) :: InitOutputData + SUBROUTINE StC_DestroyCtrlChanInitInfoType( CtrlChanInitInfoTypeData, ErrStat, ErrMsg ) + TYPE(StC_CtrlChanInitInfoType), INTENT(INOUT) :: CtrlChanInitInfoTypeData INTEGER(IntKi), INTENT( OUT) :: ErrStat CHARACTER(*), INTENT( OUT) :: ErrMsg - CHARACTER(*), PARAMETER :: RoutineName = 'StC_DestroyInitOutput' + CHARACTER(*), PARAMETER :: RoutineName = 'StC_DestroyCtrlChanInitInfoType' INTEGER(IntKi) :: i, i1, i2, i3, i4, i5 ! ErrStat = ErrID_None ErrMsg = "" - END SUBROUTINE StC_DestroyInitOutput +IF (ALLOCATED(CtrlChanInitInfoTypeData%Requestor)) THEN + DEALLOCATE(CtrlChanInitInfoTypeData%Requestor) +ENDIF +IF (ALLOCATED(CtrlChanInitInfoTypeData%InitStiff)) THEN + DEALLOCATE(CtrlChanInitInfoTypeData%InitStiff) +ENDIF +IF (ALLOCATED(CtrlChanInitInfoTypeData%InitDamp)) THEN + DEALLOCATE(CtrlChanInitInfoTypeData%InitDamp) +ENDIF +IF (ALLOCATED(CtrlChanInitInfoTypeData%InitBrake)) THEN + DEALLOCATE(CtrlChanInitInfoTypeData%InitBrake) +ENDIF +IF (ALLOCATED(CtrlChanInitInfoTypeData%InitForce)) THEN + DEALLOCATE(CtrlChanInitInfoTypeData%InitForce) +ENDIF +IF (ALLOCATED(CtrlChanInitInfoTypeData%InitMeasDisp)) THEN + DEALLOCATE(CtrlChanInitInfoTypeData%InitMeasDisp) +ENDIF +IF (ALLOCATED(CtrlChanInitInfoTypeData%InitMeasVel)) THEN + DEALLOCATE(CtrlChanInitInfoTypeData%InitMeasVel) +ENDIF + END SUBROUTINE StC_DestroyCtrlChanInitInfoType - SUBROUTINE StC_PackInitOutput( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg, SizeOnly ) + SUBROUTINE StC_PackCtrlChanInitInfoType( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg, SizeOnly ) REAL(ReKi), ALLOCATABLE, INTENT( OUT) :: ReKiBuf(:) REAL(DbKi), ALLOCATABLE, INTENT( OUT) :: DbKiBuf(:) INTEGER(IntKi), ALLOCATABLE, INTENT( OUT) :: IntKiBuf(:) - TYPE(StC_InitOutputType), INTENT(IN) :: InData + TYPE(StC_CtrlChanInitInfoType), INTENT(IN) :: InData INTEGER(IntKi), INTENT( OUT) :: ErrStat CHARACTER(*), INTENT( OUT) :: ErrMsg LOGICAL,OPTIONAL, INTENT(IN ) :: SizeOnly @@ -1409,7 +1754,7 @@ SUBROUTINE StC_PackInitOutput( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrM LOGICAL :: OnlySize ! if present and true, do not pack, just allocate buffers INTEGER(IntKi) :: ErrStat2 CHARACTER(ErrMsgLen) :: ErrMsg2 - CHARACTER(*), PARAMETER :: RoutineName = 'StC_PackInitOutput' + CHARACTER(*), PARAMETER :: RoutineName = 'StC_PackCtrlChanInitInfoType' ! buffers to store subtypes, if any REAL(ReKi), ALLOCATABLE :: Re_Buf(:) REAL(DbKi), ALLOCATABLE :: Db_Buf(:) @@ -1425,7 +1770,41 @@ SUBROUTINE StC_PackInitOutput( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrM Re_BufSz = 0 Db_BufSz = 0 Int_BufSz = 0 - Re_BufSz = Re_BufSz + 1 ! DummyInitOut + Int_BufSz = Int_BufSz + 1 ! Requestor allocated yes/no + IF ( ALLOCATED(InData%Requestor) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! Requestor upper/lower bounds for each dimension + Int_BufSz = Int_BufSz + SIZE(InData%Requestor)*LEN(InData%Requestor) ! Requestor + END IF + Int_BufSz = Int_BufSz + 1 ! InitStiff allocated yes/no + IF ( ALLOCATED(InData%InitStiff) ) THEN + Int_BufSz = Int_BufSz + 2*2 ! InitStiff upper/lower bounds for each dimension + Re_BufSz = Re_BufSz + SIZE(InData%InitStiff) ! InitStiff + END IF + Int_BufSz = Int_BufSz + 1 ! InitDamp allocated yes/no + IF ( ALLOCATED(InData%InitDamp) ) THEN + Int_BufSz = Int_BufSz + 2*2 ! InitDamp upper/lower bounds for each dimension + Re_BufSz = Re_BufSz + SIZE(InData%InitDamp) ! InitDamp + END IF + Int_BufSz = Int_BufSz + 1 ! InitBrake allocated yes/no + IF ( ALLOCATED(InData%InitBrake) ) THEN + Int_BufSz = Int_BufSz + 2*2 ! InitBrake upper/lower bounds for each dimension + Re_BufSz = Re_BufSz + SIZE(InData%InitBrake) ! InitBrake + END IF + Int_BufSz = Int_BufSz + 1 ! InitForce allocated yes/no + IF ( ALLOCATED(InData%InitForce) ) THEN + Int_BufSz = Int_BufSz + 2*2 ! InitForce upper/lower bounds for each dimension + Re_BufSz = Re_BufSz + SIZE(InData%InitForce) ! InitForce + END IF + Int_BufSz = Int_BufSz + 1 ! InitMeasDisp allocated yes/no + IF ( ALLOCATED(InData%InitMeasDisp) ) THEN + Int_BufSz = Int_BufSz + 2*2 ! InitMeasDisp upper/lower bounds for each dimension + Re_BufSz = Re_BufSz + SIZE(InData%InitMeasDisp) ! InitMeasDisp + END IF + Int_BufSz = Int_BufSz + 1 ! InitMeasVel allocated yes/no + IF ( ALLOCATED(InData%InitMeasVel) ) THEN + Int_BufSz = Int_BufSz + 2*2 ! InitMeasVel upper/lower bounds for each dimension + Re_BufSz = Re_BufSz + SIZE(InData%InitMeasVel) ! InitMeasVel + END IF IF ( Re_BufSz .GT. 0 ) THEN ALLOCATE( ReKiBuf( Re_BufSz ), STAT=ErrStat2 ) IF (ErrStat2 /= 0) THEN @@ -1453,15 +1832,150 @@ SUBROUTINE StC_PackInitOutput( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrM Db_Xferred = 1 Int_Xferred = 1 - ReKiBuf(Re_Xferred) = InData%DummyInitOut - Re_Xferred = Re_Xferred + 1 - END SUBROUTINE StC_PackInitOutput + IF ( .NOT. ALLOCATED(InData%Requestor) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%Requestor,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%Requestor,1) + Int_Xferred = Int_Xferred + 2 - SUBROUTINE StC_UnPackInitOutput( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrMsg ) + DO i1 = LBOUND(InData%Requestor,1), UBOUND(InData%Requestor,1) + DO I = 1, LEN(InData%Requestor) + IntKiBuf(Int_Xferred) = ICHAR(InData%Requestor(i1)(I:I), IntKi) + Int_Xferred = Int_Xferred + 1 + END DO ! I + END DO + END IF + IF ( .NOT. ALLOCATED(InData%InitStiff) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%InitStiff,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%InitStiff,1) + Int_Xferred = Int_Xferred + 2 + IntKiBuf( Int_Xferred ) = LBOUND(InData%InitStiff,2) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%InitStiff,2) + Int_Xferred = Int_Xferred + 2 + + DO i2 = LBOUND(InData%InitStiff,2), UBOUND(InData%InitStiff,2) + DO i1 = LBOUND(InData%InitStiff,1), UBOUND(InData%InitStiff,1) + ReKiBuf(Re_Xferred) = InData%InitStiff(i1,i2) + Re_Xferred = Re_Xferred + 1 + END DO + END DO + END IF + IF ( .NOT. ALLOCATED(InData%InitDamp) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%InitDamp,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%InitDamp,1) + Int_Xferred = Int_Xferred + 2 + IntKiBuf( Int_Xferred ) = LBOUND(InData%InitDamp,2) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%InitDamp,2) + Int_Xferred = Int_Xferred + 2 + + DO i2 = LBOUND(InData%InitDamp,2), UBOUND(InData%InitDamp,2) + DO i1 = LBOUND(InData%InitDamp,1), UBOUND(InData%InitDamp,1) + ReKiBuf(Re_Xferred) = InData%InitDamp(i1,i2) + Re_Xferred = Re_Xferred + 1 + END DO + END DO + END IF + IF ( .NOT. ALLOCATED(InData%InitBrake) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%InitBrake,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%InitBrake,1) + Int_Xferred = Int_Xferred + 2 + IntKiBuf( Int_Xferred ) = LBOUND(InData%InitBrake,2) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%InitBrake,2) + Int_Xferred = Int_Xferred + 2 + + DO i2 = LBOUND(InData%InitBrake,2), UBOUND(InData%InitBrake,2) + DO i1 = LBOUND(InData%InitBrake,1), UBOUND(InData%InitBrake,1) + ReKiBuf(Re_Xferred) = InData%InitBrake(i1,i2) + Re_Xferred = Re_Xferred + 1 + END DO + END DO + END IF + IF ( .NOT. ALLOCATED(InData%InitForce) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%InitForce,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%InitForce,1) + Int_Xferred = Int_Xferred + 2 + IntKiBuf( Int_Xferred ) = LBOUND(InData%InitForce,2) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%InitForce,2) + Int_Xferred = Int_Xferred + 2 + + DO i2 = LBOUND(InData%InitForce,2), UBOUND(InData%InitForce,2) + DO i1 = LBOUND(InData%InitForce,1), UBOUND(InData%InitForce,1) + ReKiBuf(Re_Xferred) = InData%InitForce(i1,i2) + Re_Xferred = Re_Xferred + 1 + END DO + END DO + END IF + IF ( .NOT. ALLOCATED(InData%InitMeasDisp) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%InitMeasDisp,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%InitMeasDisp,1) + Int_Xferred = Int_Xferred + 2 + IntKiBuf( Int_Xferred ) = LBOUND(InData%InitMeasDisp,2) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%InitMeasDisp,2) + Int_Xferred = Int_Xferred + 2 + + DO i2 = LBOUND(InData%InitMeasDisp,2), UBOUND(InData%InitMeasDisp,2) + DO i1 = LBOUND(InData%InitMeasDisp,1), UBOUND(InData%InitMeasDisp,1) + ReKiBuf(Re_Xferred) = InData%InitMeasDisp(i1,i2) + Re_Xferred = Re_Xferred + 1 + END DO + END DO + END IF + IF ( .NOT. ALLOCATED(InData%InitMeasVel) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%InitMeasVel,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%InitMeasVel,1) + Int_Xferred = Int_Xferred + 2 + IntKiBuf( Int_Xferred ) = LBOUND(InData%InitMeasVel,2) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%InitMeasVel,2) + Int_Xferred = Int_Xferred + 2 + + DO i2 = LBOUND(InData%InitMeasVel,2), UBOUND(InData%InitMeasVel,2) + DO i1 = LBOUND(InData%InitMeasVel,1), UBOUND(InData%InitMeasVel,1) + ReKiBuf(Re_Xferred) = InData%InitMeasVel(i1,i2) + Re_Xferred = Re_Xferred + 1 + END DO + END DO + END IF + END SUBROUTINE StC_PackCtrlChanInitInfoType + + SUBROUTINE StC_UnPackCtrlChanInitInfoType( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrMsg ) REAL(ReKi), ALLOCATABLE, INTENT(IN ) :: ReKiBuf(:) REAL(DbKi), ALLOCATABLE, INTENT(IN ) :: DbKiBuf(:) INTEGER(IntKi), ALLOCATABLE, INTENT(IN ) :: IntKiBuf(:) - TYPE(StC_InitOutputType), INTENT(INOUT) :: OutData + TYPE(StC_CtrlChanInitInfoType), INTENT(INOUT) :: OutData INTEGER(IntKi), INTENT( OUT) :: ErrStat CHARACTER(*), INTENT( OUT) :: ErrMsg ! Local variables @@ -1470,9 +1984,11 @@ SUBROUTINE StC_UnPackInitOutput( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, E INTEGER(IntKi) :: Db_Xferred INTEGER(IntKi) :: Int_Xferred INTEGER(IntKi) :: i + INTEGER(IntKi) :: i1, i1_l, i1_u ! bounds (upper/lower) for an array dimension 1 + INTEGER(IntKi) :: i2, i2_l, i2_u ! bounds (upper/lower) for an array dimension 2 INTEGER(IntKi) :: ErrStat2 CHARACTER(ErrMsgLen) :: ErrMsg2 - CHARACTER(*), PARAMETER :: RoutineName = 'StC_UnPackInitOutput' + CHARACTER(*), PARAMETER :: RoutineName = 'StC_UnPackCtrlChanInitInfoType' ! buffers to store meshes, if any REAL(ReKi), ALLOCATABLE :: Re_Buf(:) REAL(DbKi), ALLOCATABLE :: Db_Buf(:) @@ -1483,12 +1999,356 @@ SUBROUTINE StC_UnPackInitOutput( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, E Re_Xferred = 1 Db_Xferred = 1 Int_Xferred = 1 - OutData%DummyInitOut = REAL(ReKiBuf(Re_Xferred), SiKi) - Re_Xferred = Re_Xferred + 1 - END SUBROUTINE StC_UnPackInitOutput - - SUBROUTINE StC_CopyContState( SrcContStateData, DstContStateData, CtrlCode, ErrStat, ErrMsg ) - TYPE(StC_ContinuousStateType), INTENT(IN) :: SrcContStateData + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! Requestor not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%Requestor)) DEALLOCATE(OutData%Requestor) + ALLOCATE(OutData%Requestor(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%Requestor.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i1 = LBOUND(OutData%Requestor,1), UBOUND(OutData%Requestor,1) + DO I = 1, LEN(OutData%Requestor) + OutData%Requestor(i1)(I:I) = CHAR(IntKiBuf(Int_Xferred)) + Int_Xferred = Int_Xferred + 1 + END DO ! I + END DO + END IF + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! InitStiff not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + i2_l = IntKiBuf( Int_Xferred ) + i2_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%InitStiff)) DEALLOCATE(OutData%InitStiff) + ALLOCATE(OutData%InitStiff(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%InitStiff.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i2 = LBOUND(OutData%InitStiff,2), UBOUND(OutData%InitStiff,2) + DO i1 = LBOUND(OutData%InitStiff,1), UBOUND(OutData%InitStiff,1) + OutData%InitStiff(i1,i2) = REAL(ReKiBuf(Re_Xferred), SiKi) + Re_Xferred = Re_Xferred + 1 + END DO + END DO + END IF + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! InitDamp not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + i2_l = IntKiBuf( Int_Xferred ) + i2_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%InitDamp)) DEALLOCATE(OutData%InitDamp) + ALLOCATE(OutData%InitDamp(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%InitDamp.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i2 = LBOUND(OutData%InitDamp,2), UBOUND(OutData%InitDamp,2) + DO i1 = LBOUND(OutData%InitDamp,1), UBOUND(OutData%InitDamp,1) + OutData%InitDamp(i1,i2) = REAL(ReKiBuf(Re_Xferred), SiKi) + Re_Xferred = Re_Xferred + 1 + END DO + END DO + END IF + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! InitBrake not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + i2_l = IntKiBuf( Int_Xferred ) + i2_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%InitBrake)) DEALLOCATE(OutData%InitBrake) + ALLOCATE(OutData%InitBrake(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%InitBrake.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i2 = LBOUND(OutData%InitBrake,2), UBOUND(OutData%InitBrake,2) + DO i1 = LBOUND(OutData%InitBrake,1), UBOUND(OutData%InitBrake,1) + OutData%InitBrake(i1,i2) = REAL(ReKiBuf(Re_Xferred), SiKi) + Re_Xferred = Re_Xferred + 1 + END DO + END DO + END IF + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! InitForce not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + i2_l = IntKiBuf( Int_Xferred ) + i2_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%InitForce)) DEALLOCATE(OutData%InitForce) + ALLOCATE(OutData%InitForce(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%InitForce.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i2 = LBOUND(OutData%InitForce,2), UBOUND(OutData%InitForce,2) + DO i1 = LBOUND(OutData%InitForce,1), UBOUND(OutData%InitForce,1) + OutData%InitForce(i1,i2) = REAL(ReKiBuf(Re_Xferred), SiKi) + Re_Xferred = Re_Xferred + 1 + END DO + END DO + END IF + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! InitMeasDisp not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + i2_l = IntKiBuf( Int_Xferred ) + i2_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%InitMeasDisp)) DEALLOCATE(OutData%InitMeasDisp) + ALLOCATE(OutData%InitMeasDisp(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%InitMeasDisp.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i2 = LBOUND(OutData%InitMeasDisp,2), UBOUND(OutData%InitMeasDisp,2) + DO i1 = LBOUND(OutData%InitMeasDisp,1), UBOUND(OutData%InitMeasDisp,1) + OutData%InitMeasDisp(i1,i2) = REAL(ReKiBuf(Re_Xferred), SiKi) + Re_Xferred = Re_Xferred + 1 + END DO + END DO + END IF + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! InitMeasVel not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + i2_l = IntKiBuf( Int_Xferred ) + i2_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%InitMeasVel)) DEALLOCATE(OutData%InitMeasVel) + ALLOCATE(OutData%InitMeasVel(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%InitMeasVel.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i2 = LBOUND(OutData%InitMeasVel,2), UBOUND(OutData%InitMeasVel,2) + DO i1 = LBOUND(OutData%InitMeasVel,1), UBOUND(OutData%InitMeasVel,1) + OutData%InitMeasVel(i1,i2) = REAL(ReKiBuf(Re_Xferred), SiKi) + Re_Xferred = Re_Xferred + 1 + END DO + END DO + END IF + END SUBROUTINE StC_UnPackCtrlChanInitInfoType + + SUBROUTINE StC_CopyInitOutput( SrcInitOutputData, DstInitOutputData, CtrlCode, ErrStat, ErrMsg ) + TYPE(StC_InitOutputType), INTENT(IN) :: SrcInitOutputData + TYPE(StC_InitOutputType), INTENT(INOUT) :: DstInitOutputData + INTEGER(IntKi), INTENT(IN ) :: CtrlCode + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg +! Local + INTEGER(IntKi) :: i,j,k + INTEGER(IntKi) :: i1, i1_l, i1_u ! bounds (upper/lower) for an array dimension 1 + INTEGER(IntKi) :: i2, i2_l, i2_u ! bounds (upper/lower) for an array dimension 2 + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'StC_CopyInitOutput' +! + ErrStat = ErrID_None + ErrMsg = "" +IF (ALLOCATED(SrcInitOutputData%RelPosition)) THEN + i1_l = LBOUND(SrcInitOutputData%RelPosition,1) + i1_u = UBOUND(SrcInitOutputData%RelPosition,1) + i2_l = LBOUND(SrcInitOutputData%RelPosition,2) + i2_u = UBOUND(SrcInitOutputData%RelPosition,2) + IF (.NOT. ALLOCATED(DstInitOutputData%RelPosition)) THEN + ALLOCATE(DstInitOutputData%RelPosition(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstInitOutputData%RelPosition.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DstInitOutputData%RelPosition = SrcInitOutputData%RelPosition +ENDIF + END SUBROUTINE StC_CopyInitOutput + + SUBROUTINE StC_DestroyInitOutput( InitOutputData, ErrStat, ErrMsg ) + TYPE(StC_InitOutputType), INTENT(INOUT) :: InitOutputData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + CHARACTER(*), PARAMETER :: RoutineName = 'StC_DestroyInitOutput' + INTEGER(IntKi) :: i, i1, i2, i3, i4, i5 +! + ErrStat = ErrID_None + ErrMsg = "" +IF (ALLOCATED(InitOutputData%RelPosition)) THEN + DEALLOCATE(InitOutputData%RelPosition) +ENDIF + END SUBROUTINE StC_DestroyInitOutput + + SUBROUTINE StC_PackInitOutput( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg, SizeOnly ) + REAL(ReKi), ALLOCATABLE, INTENT( OUT) :: ReKiBuf(:) + REAL(DbKi), ALLOCATABLE, INTENT( OUT) :: DbKiBuf(:) + INTEGER(IntKi), ALLOCATABLE, INTENT( OUT) :: IntKiBuf(:) + TYPE(StC_InitOutputType), INTENT(IN) :: InData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + LOGICAL,OPTIONAL, INTENT(IN ) :: SizeOnly + ! Local variables + INTEGER(IntKi) :: Re_BufSz + INTEGER(IntKi) :: Re_Xferred + INTEGER(IntKi) :: Db_BufSz + INTEGER(IntKi) :: Db_Xferred + INTEGER(IntKi) :: Int_BufSz + INTEGER(IntKi) :: Int_Xferred + INTEGER(IntKi) :: i,i1,i2,i3,i4,i5 + LOGICAL :: OnlySize ! if present and true, do not pack, just allocate buffers + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'StC_PackInitOutput' + ! buffers to store subtypes, if any + REAL(ReKi), ALLOCATABLE :: Re_Buf(:) + REAL(DbKi), ALLOCATABLE :: Db_Buf(:) + INTEGER(IntKi), ALLOCATABLE :: Int_Buf(:) + + OnlySize = .FALSE. + IF ( PRESENT(SizeOnly) ) THEN + OnlySize = SizeOnly + ENDIF + ! + ErrStat = ErrID_None + ErrMsg = "" + Re_BufSz = 0 + Db_BufSz = 0 + Int_BufSz = 0 + Int_BufSz = Int_BufSz + 1 ! RelPosition allocated yes/no + IF ( ALLOCATED(InData%RelPosition) ) THEN + Int_BufSz = Int_BufSz + 2*2 ! RelPosition upper/lower bounds for each dimension + Re_BufSz = Re_BufSz + SIZE(InData%RelPosition) ! RelPosition + END IF + IF ( Re_BufSz .GT. 0 ) THEN + ALLOCATE( ReKiBuf( Re_BufSz ), STAT=ErrStat2 ) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating ReKiBuf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + IF ( Db_BufSz .GT. 0 ) THEN + ALLOCATE( DbKiBuf( Db_BufSz ), STAT=ErrStat2 ) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DbKiBuf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + IF ( Int_BufSz .GT. 0 ) THEN + ALLOCATE( IntKiBuf( Int_BufSz ), STAT=ErrStat2 ) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating IntKiBuf.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + IF(OnlySize) RETURN ! return early if only trying to allocate buffers (not pack them) + + Re_Xferred = 1 + Db_Xferred = 1 + Int_Xferred = 1 + + IF ( .NOT. ALLOCATED(InData%RelPosition) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%RelPosition,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%RelPosition,1) + Int_Xferred = Int_Xferred + 2 + IntKiBuf( Int_Xferred ) = LBOUND(InData%RelPosition,2) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%RelPosition,2) + Int_Xferred = Int_Xferred + 2 + + DO i2 = LBOUND(InData%RelPosition,2), UBOUND(InData%RelPosition,2) + DO i1 = LBOUND(InData%RelPosition,1), UBOUND(InData%RelPosition,1) + ReKiBuf(Re_Xferred) = InData%RelPosition(i1,i2) + Re_Xferred = Re_Xferred + 1 + END DO + END DO + END IF + END SUBROUTINE StC_PackInitOutput + + SUBROUTINE StC_UnPackInitOutput( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrMsg ) + REAL(ReKi), ALLOCATABLE, INTENT(IN ) :: ReKiBuf(:) + REAL(DbKi), ALLOCATABLE, INTENT(IN ) :: DbKiBuf(:) + INTEGER(IntKi), ALLOCATABLE, INTENT(IN ) :: IntKiBuf(:) + TYPE(StC_InitOutputType), INTENT(INOUT) :: OutData + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + ! Local variables + INTEGER(IntKi) :: Buf_size + INTEGER(IntKi) :: Re_Xferred + INTEGER(IntKi) :: Db_Xferred + INTEGER(IntKi) :: Int_Xferred + INTEGER(IntKi) :: i + INTEGER(IntKi) :: i1, i1_l, i1_u ! bounds (upper/lower) for an array dimension 1 + INTEGER(IntKi) :: i2, i2_l, i2_u ! bounds (upper/lower) for an array dimension 2 + INTEGER(IntKi) :: ErrStat2 + CHARACTER(ErrMsgLen) :: ErrMsg2 + CHARACTER(*), PARAMETER :: RoutineName = 'StC_UnPackInitOutput' + ! buffers to store meshes, if any + REAL(ReKi), ALLOCATABLE :: Re_Buf(:) + REAL(DbKi), ALLOCATABLE :: Db_Buf(:) + INTEGER(IntKi), ALLOCATABLE :: Int_Buf(:) + ! + ErrStat = ErrID_None + ErrMsg = "" + Re_Xferred = 1 + Db_Xferred = 1 + Int_Xferred = 1 + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! RelPosition not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + i2_l = IntKiBuf( Int_Xferred ) + i2_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%RelPosition)) DEALLOCATE(OutData%RelPosition) + ALLOCATE(OutData%RelPosition(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%RelPosition.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i2 = LBOUND(OutData%RelPosition,2), UBOUND(OutData%RelPosition,2) + DO i1 = LBOUND(OutData%RelPosition,1), UBOUND(OutData%RelPosition,1) + OutData%RelPosition(i1,i2) = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + END DO + END DO + END IF + END SUBROUTINE StC_UnPackInitOutput + + SUBROUTINE StC_CopyContState( SrcContStateData, DstContStateData, CtrlCode, ErrStat, ErrMsg ) + TYPE(StC_ContinuousStateType), INTENT(IN) :: SrcContStateData TYPE(StC_ContinuousStateType), INTENT(INOUT) :: DstContStateData INTEGER(IntKi), INTENT(IN ) :: CtrlCode INTEGER(IntKi), INTENT( OUT) :: ErrStat @@ -1503,7 +2363,6 @@ SUBROUTINE StC_CopyContState( SrcContStateData, DstContStateData, CtrlCode, ErrS ! ErrStat = ErrID_None ErrMsg = "" - DstContStateData%DummyContState = SrcContStateData%DummyContState IF (ALLOCATED(SrcContStateData%StC_x)) THEN i1_l = LBOUND(SrcContStateData%StC_x,1) i1_u = UBOUND(SrcContStateData%StC_x,1) @@ -1517,20 +2376,6 @@ SUBROUTINE StC_CopyContState( SrcContStateData, DstContStateData, CtrlCode, ErrS END IF END IF DstContStateData%StC_x = SrcContStateData%StC_x -ENDIF -IF (ALLOCATED(SrcContStateData%StC_xdot)) THEN - i1_l = LBOUND(SrcContStateData%StC_xdot,1) - i1_u = UBOUND(SrcContStateData%StC_xdot,1) - i2_l = LBOUND(SrcContStateData%StC_xdot,2) - i2_u = UBOUND(SrcContStateData%StC_xdot,2) - IF (.NOT. ALLOCATED(DstContStateData%StC_xdot)) THEN - ALLOCATE(DstContStateData%StC_xdot(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating DstContStateData%StC_xdot.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - END IF - DstContStateData%StC_xdot = SrcContStateData%StC_xdot ENDIF END SUBROUTINE StC_CopyContState @@ -1545,9 +2390,6 @@ SUBROUTINE StC_DestroyContState( ContStateData, ErrStat, ErrMsg ) ErrMsg = "" IF (ALLOCATED(ContStateData%StC_x)) THEN DEALLOCATE(ContStateData%StC_x) -ENDIF -IF (ALLOCATED(ContStateData%StC_xdot)) THEN - DEALLOCATE(ContStateData%StC_xdot) ENDIF END SUBROUTINE StC_DestroyContState @@ -1586,17 +2428,11 @@ SUBROUTINE StC_PackContState( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMs Re_BufSz = 0 Db_BufSz = 0 Int_BufSz = 0 - Re_BufSz = Re_BufSz + 1 ! DummyContState Int_BufSz = Int_BufSz + 1 ! StC_x allocated yes/no IF ( ALLOCATED(InData%StC_x) ) THEN Int_BufSz = Int_BufSz + 2*2 ! StC_x upper/lower bounds for each dimension Re_BufSz = Re_BufSz + SIZE(InData%StC_x) ! StC_x END IF - Int_BufSz = Int_BufSz + 1 ! StC_xdot allocated yes/no - IF ( ALLOCATED(InData%StC_xdot) ) THEN - Int_BufSz = Int_BufSz + 2*2 ! StC_xdot upper/lower bounds for each dimension - Re_BufSz = Re_BufSz + SIZE(InData%StC_xdot) ! StC_xdot - END IF IF ( Re_BufSz .GT. 0 ) THEN ALLOCATE( ReKiBuf( Re_BufSz ), STAT=ErrStat2 ) IF (ErrStat2 /= 0) THEN @@ -1624,8 +2460,6 @@ SUBROUTINE StC_PackContState( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMs Db_Xferred = 1 Int_Xferred = 1 - ReKiBuf(Re_Xferred) = InData%DummyContState - Re_Xferred = Re_Xferred + 1 IF ( .NOT. ALLOCATED(InData%StC_x) ) THEN IntKiBuf( Int_Xferred ) = 0 Int_Xferred = Int_Xferred + 1 @@ -1646,26 +2480,6 @@ SUBROUTINE StC_PackContState( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMs END DO END DO END IF - IF ( .NOT. ALLOCATED(InData%StC_xdot) ) THEN - IntKiBuf( Int_Xferred ) = 0 - Int_Xferred = Int_Xferred + 1 - ELSE - IntKiBuf( Int_Xferred ) = 1 - Int_Xferred = Int_Xferred + 1 - IntKiBuf( Int_Xferred ) = LBOUND(InData%StC_xdot,1) - IntKiBuf( Int_Xferred + 1) = UBOUND(InData%StC_xdot,1) - Int_Xferred = Int_Xferred + 2 - IntKiBuf( Int_Xferred ) = LBOUND(InData%StC_xdot,2) - IntKiBuf( Int_Xferred + 1) = UBOUND(InData%StC_xdot,2) - Int_Xferred = Int_Xferred + 2 - - DO i2 = LBOUND(InData%StC_xdot,2), UBOUND(InData%StC_xdot,2) - DO i1 = LBOUND(InData%StC_xdot,1), UBOUND(InData%StC_xdot,1) - ReKiBuf(Re_Xferred) = InData%StC_xdot(i1,i2) - Re_Xferred = Re_Xferred + 1 - END DO - END DO - END IF END SUBROUTINE StC_PackContState SUBROUTINE StC_UnPackContState( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrMsg ) @@ -1696,8 +2510,6 @@ SUBROUTINE StC_UnPackContState( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, Er Re_Xferred = 1 Db_Xferred = 1 Int_Xferred = 1 - OutData%DummyContState = ReKiBuf(Re_Xferred) - Re_Xferred = Re_Xferred + 1 IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! StC_x not allocated Int_Xferred = Int_Xferred + 1 ELSE @@ -1721,29 +2533,6 @@ SUBROUTINE StC_UnPackContState( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, Er END DO END DO END IF - IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! StC_xdot not allocated - Int_Xferred = Int_Xferred + 1 - ELSE - Int_Xferred = Int_Xferred + 1 - i1_l = IntKiBuf( Int_Xferred ) - i1_u = IntKiBuf( Int_Xferred + 1) - Int_Xferred = Int_Xferred + 2 - i2_l = IntKiBuf( Int_Xferred ) - i2_u = IntKiBuf( Int_Xferred + 1) - Int_Xferred = Int_Xferred + 2 - IF (ALLOCATED(OutData%StC_xdot)) DEALLOCATE(OutData%StC_xdot) - ALLOCATE(OutData%StC_xdot(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) - IF (ErrStat2 /= 0) THEN - CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%StC_xdot.', ErrStat, ErrMsg,RoutineName) - RETURN - END IF - DO i2 = LBOUND(OutData%StC_xdot,2), UBOUND(OutData%StC_xdot,2) - DO i1 = LBOUND(OutData%StC_xdot,1), UBOUND(OutData%StC_xdot,1) - OutData%StC_xdot(i1,i2) = ReKiBuf(Re_Xferred) - Re_Xferred = Re_Xferred + 1 - END DO - END DO - END IF END SUBROUTINE StC_UnPackContState SUBROUTINE StC_CopyDiscState( SrcDiscStateData, DstDiscStateData, CtrlCode, ErrStat, ErrMsg ) @@ -2179,6 +2968,20 @@ SUBROUTINE StC_CopyMisc( SrcMiscData, DstMiscData, CtrlCode, ErrStat, ErrMsg ) END IF DstMiscData%F_fr = SrcMiscData%F_fr ENDIF +IF (ALLOCATED(SrcMiscData%K)) THEN + i1_l = LBOUND(SrcMiscData%K,1) + i1_u = UBOUND(SrcMiscData%K,1) + i2_l = LBOUND(SrcMiscData%K,2) + i2_u = UBOUND(SrcMiscData%K,2) + IF (.NOT. ALLOCATED(DstMiscData%K)) THEN + ALLOCATE(DstMiscData%K(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstMiscData%K.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DstMiscData%K = SrcMiscData%K +ENDIF IF (ALLOCATED(SrcMiscData%C_ctrl)) THEN i1_l = LBOUND(SrcMiscData%C_ctrl,1) i1_u = UBOUND(SrcMiscData%C_ctrl,1) @@ -2382,6 +3185,9 @@ SUBROUTINE StC_DestroyMisc( MiscData, ErrStat, ErrMsg ) IF (ALLOCATED(MiscData%F_fr)) THEN DEALLOCATE(MiscData%F_fr) ENDIF +IF (ALLOCATED(MiscData%K)) THEN + DEALLOCATE(MiscData%K) +ENDIF IF (ALLOCATED(MiscData%C_ctrl)) THEN DEALLOCATE(MiscData%C_ctrl) ENDIF @@ -2473,6 +3279,11 @@ SUBROUTINE StC_PackMisc( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg, Si Int_BufSz = Int_BufSz + 2*2 ! F_fr upper/lower bounds for each dimension Re_BufSz = Re_BufSz + SIZE(InData%F_fr) ! F_fr END IF + Int_BufSz = Int_BufSz + 1 ! K allocated yes/no + IF ( ALLOCATED(InData%K) ) THEN + Int_BufSz = Int_BufSz + 2*2 ! K upper/lower bounds for each dimension + Re_BufSz = Re_BufSz + SIZE(InData%K) ! K + END IF Int_BufSz = Int_BufSz + 1 ! C_ctrl allocated yes/no IF ( ALLOCATED(InData%C_ctrl) ) THEN Int_BufSz = Int_BufSz + 2*2 ! C_ctrl upper/lower bounds for each dimension @@ -2626,6 +3437,26 @@ SUBROUTINE StC_PackMisc( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg, Si END DO END DO END IF + IF ( .NOT. ALLOCATED(InData%K) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%K,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%K,1) + Int_Xferred = Int_Xferred + 2 + IntKiBuf( Int_Xferred ) = LBOUND(InData%K,2) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%K,2) + Int_Xferred = Int_Xferred + 2 + + DO i2 = LBOUND(InData%K,2), UBOUND(InData%K,2) + DO i1 = LBOUND(InData%K,1), UBOUND(InData%K,1) + ReKiBuf(Re_Xferred) = InData%K(i1,i2) + Re_Xferred = Re_Xferred + 1 + END DO + END DO + END IF IF ( .NOT. ALLOCATED(InData%C_ctrl) ) THEN IntKiBuf( Int_Xferred ) = 0 Int_Xferred = Int_Xferred + 1 @@ -2987,6 +3818,29 @@ SUBROUTINE StC_UnPackMisc( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrMsg END DO END DO END IF + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! K not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + i2_l = IntKiBuf( Int_Xferred ) + i2_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%K)) DEALLOCATE(OutData%K) + ALLOCATE(OutData%K(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%K.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i2 = LBOUND(OutData%K,2), UBOUND(OutData%K,2) + DO i1 = LBOUND(OutData%K,1), UBOUND(OutData%K,1) + OutData%K(i1,i2) = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + END DO + END DO + END IF IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! C_ctrl not allocated Int_Xferred = Int_Xferred + 1 ELSE @@ -3312,6 +4166,7 @@ SUBROUTINE StC_CopyParam( SrcParamData, DstParamData, CtrlCode, ErrStat, ErrMsg DstParamData%StC_X_DOF = SrcParamData%StC_X_DOF DstParamData%StC_Y_DOF = SrcParamData%StC_Y_DOF DstParamData%StC_Z_DOF = SrcParamData%StC_Z_DOF + DstParamData%StC_Z_PreLd = SrcParamData%StC_Z_PreLd DstParamData%M_X = SrcParamData%M_X DstParamData%M_Y = SrcParamData%M_Y DstParamData%M_Z = SrcParamData%M_Z @@ -3380,6 +4235,18 @@ SUBROUTINE StC_CopyParam( SrcParamData, DstParamData, CtrlCode, ErrStat, ErrMsg END IF END IF DstParamData%StC_PrescribedForce = SrcParamData%StC_PrescribedForce +ENDIF +IF (ALLOCATED(SrcParamData%StC_CChan)) THEN + i1_l = LBOUND(SrcParamData%StC_CChan,1) + i1_u = UBOUND(SrcParamData%StC_CChan,1) + IF (.NOT. ALLOCATED(DstParamData%StC_CChan)) THEN + ALLOCATE(DstParamData%StC_CChan(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstParamData%StC_CChan.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DstParamData%StC_CChan = SrcParamData%StC_CChan ENDIF END SUBROUTINE StC_CopyParam @@ -3397,6 +4264,9 @@ SUBROUTINE StC_DestroyParam( ParamData, ErrStat, ErrMsg ) ENDIF IF (ALLOCATED(ParamData%StC_PrescribedForce)) THEN DEALLOCATE(ParamData%StC_PrescribedForce) +ENDIF +IF (ALLOCATED(ParamData%StC_CChan)) THEN + DEALLOCATE(ParamData%StC_CChan) ENDIF END SUBROUTINE StC_DestroyParam @@ -3441,6 +4311,7 @@ SUBROUTINE StC_PackParam( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg, S Int_BufSz = Int_BufSz + 1 ! StC_X_DOF Int_BufSz = Int_BufSz + 1 ! StC_Y_DOF Int_BufSz = Int_BufSz + 1 ! StC_Z_DOF + Re_BufSz = Re_BufSz + 1 ! StC_Z_PreLd Re_BufSz = Re_BufSz + 1 ! M_X Re_BufSz = Re_BufSz + 1 ! M_Y Re_BufSz = Re_BufSz + 1 ! M_Z @@ -3492,6 +4363,11 @@ SUBROUTINE StC_PackParam( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg, S Int_BufSz = Int_BufSz + 2*2 ! StC_PrescribedForce upper/lower bounds for each dimension Re_BufSz = Re_BufSz + SIZE(InData%StC_PrescribedForce) ! StC_PrescribedForce END IF + Int_BufSz = Int_BufSz + 1 ! StC_CChan allocated yes/no + IF ( ALLOCATED(InData%StC_CChan) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! StC_CChan upper/lower bounds for each dimension + Int_BufSz = Int_BufSz + SIZE(InData%StC_CChan) ! StC_CChan + END IF IF ( Re_BufSz .GT. 0 ) THEN ALLOCATE( ReKiBuf( Re_BufSz ), STAT=ErrStat2 ) IF (ErrStat2 /= 0) THEN @@ -3533,6 +4409,8 @@ SUBROUTINE StC_PackParam( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg, S Int_Xferred = Int_Xferred + 1 IntKiBuf(Int_Xferred) = TRANSFER(InData%StC_Z_DOF, IntKiBuf(1)) Int_Xferred = Int_Xferred + 1 + ReKiBuf(Re_Xferred) = InData%StC_Z_PreLd + Re_Xferred = Re_Xferred + 1 ReKiBuf(Re_Xferred) = InData%M_X Re_Xferred = Re_Xferred + 1 ReKiBuf(Re_Xferred) = InData%M_Y @@ -3658,11 +4536,26 @@ SUBROUTINE StC_PackParam( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg, S IntKiBuf( Int_Xferred + 1) = UBOUND(InData%StC_PrescribedForce,2) Int_Xferred = Int_Xferred + 2 - DO i2 = LBOUND(InData%StC_PrescribedForce,2), UBOUND(InData%StC_PrescribedForce,2) - DO i1 = LBOUND(InData%StC_PrescribedForce,1), UBOUND(InData%StC_PrescribedForce,1) - ReKiBuf(Re_Xferred) = InData%StC_PrescribedForce(i1,i2) - Re_Xferred = Re_Xferred + 1 - END DO + DO i2 = LBOUND(InData%StC_PrescribedForce,2), UBOUND(InData%StC_PrescribedForce,2) + DO i1 = LBOUND(InData%StC_PrescribedForce,1), UBOUND(InData%StC_PrescribedForce,1) + ReKiBuf(Re_Xferred) = InData%StC_PrescribedForce(i1,i2) + Re_Xferred = Re_Xferred + 1 + END DO + END DO + END IF + IF ( .NOT. ALLOCATED(InData%StC_CChan) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%StC_CChan,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%StC_CChan,1) + Int_Xferred = Int_Xferred + 2 + + DO i1 = LBOUND(InData%StC_CChan,1), UBOUND(InData%StC_CChan,1) + IntKiBuf(Int_Xferred) = InData%StC_CChan(i1) + Int_Xferred = Int_Xferred + 1 END DO END IF END SUBROUTINE StC_PackParam @@ -3709,6 +4602,8 @@ SUBROUTINE StC_UnPackParam( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrMsg Int_Xferred = Int_Xferred + 1 OutData%StC_Z_DOF = TRANSFER(IntKiBuf(Int_Xferred), OutData%StC_Z_DOF) Int_Xferred = Int_Xferred + 1 + OutData%StC_Z_PreLd = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 OutData%M_X = ReKiBuf(Re_Xferred) Re_Xferred = Re_Xferred + 1 OutData%M_Y = ReKiBuf(Re_Xferred) @@ -3857,6 +4752,24 @@ SUBROUTINE StC_UnPackParam( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrMsg END DO END DO END IF + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! StC_CChan not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%StC_CChan)) DEALLOCATE(OutData%StC_CChan) + ALLOCATE(OutData%StC_CChan(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%StC_CChan.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i1 = LBOUND(OutData%StC_CChan,1), UBOUND(OutData%StC_CChan,1) + OutData%StC_CChan(i1) = IntKiBuf(Int_Xferred) + Int_Xferred = Int_Xferred + 1 + END DO + END IF END SUBROUTINE StC_UnPackParam SUBROUTINE StC_CopyInput( SrcInputData, DstInputData, CtrlCode, ErrStat, ErrMsg ) @@ -3868,6 +4781,7 @@ SUBROUTINE StC_CopyInput( SrcInputData, DstInputData, CtrlCode, ErrStat, ErrMsg ! Local INTEGER(IntKi) :: i,j,k INTEGER(IntKi) :: i1, i1_l, i1_u ! bounds (upper/lower) for an array dimension 1 + INTEGER(IntKi) :: i2, i2_l, i2_u ! bounds (upper/lower) for an array dimension 2 INTEGER(IntKi) :: ErrStat2 CHARACTER(ErrMsgLen) :: ErrMsg2 CHARACTER(*), PARAMETER :: RoutineName = 'StC_CopyInput' @@ -3889,6 +4803,62 @@ SUBROUTINE StC_CopyInput( SrcInputData, DstInputData, CtrlCode, ErrStat, ErrMsg CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat>=AbortErrLev) RETURN ENDDO +ENDIF +IF (ALLOCATED(SrcInputData%CmdStiff)) THEN + i1_l = LBOUND(SrcInputData%CmdStiff,1) + i1_u = UBOUND(SrcInputData%CmdStiff,1) + i2_l = LBOUND(SrcInputData%CmdStiff,2) + i2_u = UBOUND(SrcInputData%CmdStiff,2) + IF (.NOT. ALLOCATED(DstInputData%CmdStiff)) THEN + ALLOCATE(DstInputData%CmdStiff(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstInputData%CmdStiff.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DstInputData%CmdStiff = SrcInputData%CmdStiff +ENDIF +IF (ALLOCATED(SrcInputData%CmdDamp)) THEN + i1_l = LBOUND(SrcInputData%CmdDamp,1) + i1_u = UBOUND(SrcInputData%CmdDamp,1) + i2_l = LBOUND(SrcInputData%CmdDamp,2) + i2_u = UBOUND(SrcInputData%CmdDamp,2) + IF (.NOT. ALLOCATED(DstInputData%CmdDamp)) THEN + ALLOCATE(DstInputData%CmdDamp(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstInputData%CmdDamp.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DstInputData%CmdDamp = SrcInputData%CmdDamp +ENDIF +IF (ALLOCATED(SrcInputData%CmdBrake)) THEN + i1_l = LBOUND(SrcInputData%CmdBrake,1) + i1_u = UBOUND(SrcInputData%CmdBrake,1) + i2_l = LBOUND(SrcInputData%CmdBrake,2) + i2_u = UBOUND(SrcInputData%CmdBrake,2) + IF (.NOT. ALLOCATED(DstInputData%CmdBrake)) THEN + ALLOCATE(DstInputData%CmdBrake(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstInputData%CmdBrake.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DstInputData%CmdBrake = SrcInputData%CmdBrake +ENDIF +IF (ALLOCATED(SrcInputData%CmdForce)) THEN + i1_l = LBOUND(SrcInputData%CmdForce,1) + i1_u = UBOUND(SrcInputData%CmdForce,1) + i2_l = LBOUND(SrcInputData%CmdForce,2) + i2_u = UBOUND(SrcInputData%CmdForce,2) + IF (.NOT. ALLOCATED(DstInputData%CmdForce)) THEN + ALLOCATE(DstInputData%CmdForce(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstInputData%CmdForce.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DstInputData%CmdForce = SrcInputData%CmdForce ENDIF END SUBROUTINE StC_CopyInput @@ -3906,6 +4876,18 @@ SUBROUTINE StC_DestroyInput( InputData, ErrStat, ErrMsg ) CALL MeshDestroy( InputData%Mesh(i1), ErrStat, ErrMsg ) ENDDO DEALLOCATE(InputData%Mesh) +ENDIF +IF (ALLOCATED(InputData%CmdStiff)) THEN + DEALLOCATE(InputData%CmdStiff) +ENDIF +IF (ALLOCATED(InputData%CmdDamp)) THEN + DEALLOCATE(InputData%CmdDamp) +ENDIF +IF (ALLOCATED(InputData%CmdBrake)) THEN + DEALLOCATE(InputData%CmdBrake) +ENDIF +IF (ALLOCATED(InputData%CmdForce)) THEN + DEALLOCATE(InputData%CmdForce) ENDIF END SUBROUTINE StC_DestroyInput @@ -3968,6 +4950,26 @@ SUBROUTINE StC_PackInput( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg, S END IF END DO END IF + Int_BufSz = Int_BufSz + 1 ! CmdStiff allocated yes/no + IF ( ALLOCATED(InData%CmdStiff) ) THEN + Int_BufSz = Int_BufSz + 2*2 ! CmdStiff upper/lower bounds for each dimension + Re_BufSz = Re_BufSz + SIZE(InData%CmdStiff) ! CmdStiff + END IF + Int_BufSz = Int_BufSz + 1 ! CmdDamp allocated yes/no + IF ( ALLOCATED(InData%CmdDamp) ) THEN + Int_BufSz = Int_BufSz + 2*2 ! CmdDamp upper/lower bounds for each dimension + Re_BufSz = Re_BufSz + SIZE(InData%CmdDamp) ! CmdDamp + END IF + Int_BufSz = Int_BufSz + 1 ! CmdBrake allocated yes/no + IF ( ALLOCATED(InData%CmdBrake) ) THEN + Int_BufSz = Int_BufSz + 2*2 ! CmdBrake upper/lower bounds for each dimension + Re_BufSz = Re_BufSz + SIZE(InData%CmdBrake) ! CmdBrake + END IF + Int_BufSz = Int_BufSz + 1 ! CmdForce allocated yes/no + IF ( ALLOCATED(InData%CmdForce) ) THEN + Int_BufSz = Int_BufSz + 2*2 ! CmdForce upper/lower bounds for each dimension + Re_BufSz = Re_BufSz + SIZE(InData%CmdForce) ! CmdForce + END IF IF ( Re_BufSz .GT. 0 ) THEN ALLOCATE( ReKiBuf( Re_BufSz ), STAT=ErrStat2 ) IF (ErrStat2 /= 0) THEN @@ -4036,6 +5038,86 @@ SUBROUTINE StC_PackInput( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg, S ENDIF END DO END IF + IF ( .NOT. ALLOCATED(InData%CmdStiff) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%CmdStiff,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%CmdStiff,1) + Int_Xferred = Int_Xferred + 2 + IntKiBuf( Int_Xferred ) = LBOUND(InData%CmdStiff,2) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%CmdStiff,2) + Int_Xferred = Int_Xferred + 2 + + DO i2 = LBOUND(InData%CmdStiff,2), UBOUND(InData%CmdStiff,2) + DO i1 = LBOUND(InData%CmdStiff,1), UBOUND(InData%CmdStiff,1) + ReKiBuf(Re_Xferred) = InData%CmdStiff(i1,i2) + Re_Xferred = Re_Xferred + 1 + END DO + END DO + END IF + IF ( .NOT. ALLOCATED(InData%CmdDamp) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%CmdDamp,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%CmdDamp,1) + Int_Xferred = Int_Xferred + 2 + IntKiBuf( Int_Xferred ) = LBOUND(InData%CmdDamp,2) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%CmdDamp,2) + Int_Xferred = Int_Xferred + 2 + + DO i2 = LBOUND(InData%CmdDamp,2), UBOUND(InData%CmdDamp,2) + DO i1 = LBOUND(InData%CmdDamp,1), UBOUND(InData%CmdDamp,1) + ReKiBuf(Re_Xferred) = InData%CmdDamp(i1,i2) + Re_Xferred = Re_Xferred + 1 + END DO + END DO + END IF + IF ( .NOT. ALLOCATED(InData%CmdBrake) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%CmdBrake,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%CmdBrake,1) + Int_Xferred = Int_Xferred + 2 + IntKiBuf( Int_Xferred ) = LBOUND(InData%CmdBrake,2) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%CmdBrake,2) + Int_Xferred = Int_Xferred + 2 + + DO i2 = LBOUND(InData%CmdBrake,2), UBOUND(InData%CmdBrake,2) + DO i1 = LBOUND(InData%CmdBrake,1), UBOUND(InData%CmdBrake,1) + ReKiBuf(Re_Xferred) = InData%CmdBrake(i1,i2) + Re_Xferred = Re_Xferred + 1 + END DO + END DO + END IF + IF ( .NOT. ALLOCATED(InData%CmdForce) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%CmdForce,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%CmdForce,1) + Int_Xferred = Int_Xferred + 2 + IntKiBuf( Int_Xferred ) = LBOUND(InData%CmdForce,2) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%CmdForce,2) + Int_Xferred = Int_Xferred + 2 + + DO i2 = LBOUND(InData%CmdForce,2), UBOUND(InData%CmdForce,2) + DO i1 = LBOUND(InData%CmdForce,1), UBOUND(InData%CmdForce,1) + ReKiBuf(Re_Xferred) = InData%CmdForce(i1,i2) + Re_Xferred = Re_Xferred + 1 + END DO + END DO + END IF END SUBROUTINE StC_PackInput SUBROUTINE StC_UnPackInput( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrMsg ) @@ -4052,6 +5134,7 @@ SUBROUTINE StC_UnPackInput( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrMsg INTEGER(IntKi) :: Int_Xferred INTEGER(IntKi) :: i INTEGER(IntKi) :: i1, i1_l, i1_u ! bounds (upper/lower) for an array dimension 1 + INTEGER(IntKi) :: i2, i2_l, i2_u ! bounds (upper/lower) for an array dimension 2 INTEGER(IntKi) :: ErrStat2 CHARACTER(ErrMsgLen) :: ErrMsg2 CHARACTER(*), PARAMETER :: RoutineName = 'StC_UnPackInput' @@ -4121,6 +5204,98 @@ SUBROUTINE StC_UnPackInput( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrMsg IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) END DO END IF + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! CmdStiff not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + i2_l = IntKiBuf( Int_Xferred ) + i2_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%CmdStiff)) DEALLOCATE(OutData%CmdStiff) + ALLOCATE(OutData%CmdStiff(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%CmdStiff.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i2 = LBOUND(OutData%CmdStiff,2), UBOUND(OutData%CmdStiff,2) + DO i1 = LBOUND(OutData%CmdStiff,1), UBOUND(OutData%CmdStiff,1) + OutData%CmdStiff(i1,i2) = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + END DO + END DO + END IF + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! CmdDamp not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + i2_l = IntKiBuf( Int_Xferred ) + i2_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%CmdDamp)) DEALLOCATE(OutData%CmdDamp) + ALLOCATE(OutData%CmdDamp(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%CmdDamp.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i2 = LBOUND(OutData%CmdDamp,2), UBOUND(OutData%CmdDamp,2) + DO i1 = LBOUND(OutData%CmdDamp,1), UBOUND(OutData%CmdDamp,1) + OutData%CmdDamp(i1,i2) = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + END DO + END DO + END IF + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! CmdBrake not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + i2_l = IntKiBuf( Int_Xferred ) + i2_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%CmdBrake)) DEALLOCATE(OutData%CmdBrake) + ALLOCATE(OutData%CmdBrake(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%CmdBrake.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i2 = LBOUND(OutData%CmdBrake,2), UBOUND(OutData%CmdBrake,2) + DO i1 = LBOUND(OutData%CmdBrake,1), UBOUND(OutData%CmdBrake,1) + OutData%CmdBrake(i1,i2) = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + END DO + END DO + END IF + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! CmdForce not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + i2_l = IntKiBuf( Int_Xferred ) + i2_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%CmdForce)) DEALLOCATE(OutData%CmdForce) + ALLOCATE(OutData%CmdForce(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%CmdForce.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i2 = LBOUND(OutData%CmdForce,2), UBOUND(OutData%CmdForce,2) + DO i1 = LBOUND(OutData%CmdForce,1), UBOUND(OutData%CmdForce,1) + OutData%CmdForce(i1,i2) = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + END DO + END DO + END IF END SUBROUTINE StC_UnPackInput SUBROUTINE StC_CopyOutput( SrcOutputData, DstOutputData, CtrlCode, ErrStat, ErrMsg ) @@ -4132,6 +5307,7 @@ SUBROUTINE StC_CopyOutput( SrcOutputData, DstOutputData, CtrlCode, ErrStat, ErrM ! Local INTEGER(IntKi) :: i,j,k INTEGER(IntKi) :: i1, i1_l, i1_u ! bounds (upper/lower) for an array dimension 1 + INTEGER(IntKi) :: i2, i2_l, i2_u ! bounds (upper/lower) for an array dimension 2 INTEGER(IntKi) :: ErrStat2 CHARACTER(ErrMsgLen) :: ErrMsg2 CHARACTER(*), PARAMETER :: RoutineName = 'StC_CopyOutput' @@ -4153,6 +5329,34 @@ SUBROUTINE StC_CopyOutput( SrcOutputData, DstOutputData, CtrlCode, ErrStat, ErrM CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) IF (ErrStat>=AbortErrLev) RETURN ENDDO +ENDIF +IF (ALLOCATED(SrcOutputData%MeasDisp)) THEN + i1_l = LBOUND(SrcOutputData%MeasDisp,1) + i1_u = UBOUND(SrcOutputData%MeasDisp,1) + i2_l = LBOUND(SrcOutputData%MeasDisp,2) + i2_u = UBOUND(SrcOutputData%MeasDisp,2) + IF (.NOT. ALLOCATED(DstOutputData%MeasDisp)) THEN + ALLOCATE(DstOutputData%MeasDisp(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstOutputData%MeasDisp.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DstOutputData%MeasDisp = SrcOutputData%MeasDisp +ENDIF +IF (ALLOCATED(SrcOutputData%MeasVel)) THEN + i1_l = LBOUND(SrcOutputData%MeasVel,1) + i1_u = UBOUND(SrcOutputData%MeasVel,1) + i2_l = LBOUND(SrcOutputData%MeasVel,2) + i2_u = UBOUND(SrcOutputData%MeasVel,2) + IF (.NOT. ALLOCATED(DstOutputData%MeasVel)) THEN + ALLOCATE(DstOutputData%MeasVel(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstOutputData%MeasVel.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DstOutputData%MeasVel = SrcOutputData%MeasVel ENDIF END SUBROUTINE StC_CopyOutput @@ -4170,6 +5374,12 @@ SUBROUTINE StC_DestroyOutput( OutputData, ErrStat, ErrMsg ) CALL MeshDestroy( OutputData%Mesh(i1), ErrStat, ErrMsg ) ENDDO DEALLOCATE(OutputData%Mesh) +ENDIF +IF (ALLOCATED(OutputData%MeasDisp)) THEN + DEALLOCATE(OutputData%MeasDisp) +ENDIF +IF (ALLOCATED(OutputData%MeasVel)) THEN + DEALLOCATE(OutputData%MeasVel) ENDIF END SUBROUTINE StC_DestroyOutput @@ -4232,6 +5442,16 @@ SUBROUTINE StC_PackOutput( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg, END IF END DO END IF + Int_BufSz = Int_BufSz + 1 ! MeasDisp allocated yes/no + IF ( ALLOCATED(InData%MeasDisp) ) THEN + Int_BufSz = Int_BufSz + 2*2 ! MeasDisp upper/lower bounds for each dimension + Re_BufSz = Re_BufSz + SIZE(InData%MeasDisp) ! MeasDisp + END IF + Int_BufSz = Int_BufSz + 1 ! MeasVel allocated yes/no + IF ( ALLOCATED(InData%MeasVel) ) THEN + Int_BufSz = Int_BufSz + 2*2 ! MeasVel upper/lower bounds for each dimension + Re_BufSz = Re_BufSz + SIZE(InData%MeasVel) ! MeasVel + END IF IF ( Re_BufSz .GT. 0 ) THEN ALLOCATE( ReKiBuf( Re_BufSz ), STAT=ErrStat2 ) IF (ErrStat2 /= 0) THEN @@ -4300,6 +5520,46 @@ SUBROUTINE StC_PackOutput( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMsg, ENDIF END DO END IF + IF ( .NOT. ALLOCATED(InData%MeasDisp) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%MeasDisp,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%MeasDisp,1) + Int_Xferred = Int_Xferred + 2 + IntKiBuf( Int_Xferred ) = LBOUND(InData%MeasDisp,2) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%MeasDisp,2) + Int_Xferred = Int_Xferred + 2 + + DO i2 = LBOUND(InData%MeasDisp,2), UBOUND(InData%MeasDisp,2) + DO i1 = LBOUND(InData%MeasDisp,1), UBOUND(InData%MeasDisp,1) + ReKiBuf(Re_Xferred) = InData%MeasDisp(i1,i2) + Re_Xferred = Re_Xferred + 1 + END DO + END DO + END IF + IF ( .NOT. ALLOCATED(InData%MeasVel) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%MeasVel,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%MeasVel,1) + Int_Xferred = Int_Xferred + 2 + IntKiBuf( Int_Xferred ) = LBOUND(InData%MeasVel,2) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%MeasVel,2) + Int_Xferred = Int_Xferred + 2 + + DO i2 = LBOUND(InData%MeasVel,2), UBOUND(InData%MeasVel,2) + DO i1 = LBOUND(InData%MeasVel,1), UBOUND(InData%MeasVel,1) + ReKiBuf(Re_Xferred) = InData%MeasVel(i1,i2) + Re_Xferred = Re_Xferred + 1 + END DO + END DO + END IF END SUBROUTINE StC_PackOutput SUBROUTINE StC_UnPackOutput( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrMsg ) @@ -4316,6 +5576,7 @@ SUBROUTINE StC_UnPackOutput( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrMs INTEGER(IntKi) :: Int_Xferred INTEGER(IntKi) :: i INTEGER(IntKi) :: i1, i1_l, i1_u ! bounds (upper/lower) for an array dimension 1 + INTEGER(IntKi) :: i2, i2_l, i2_u ! bounds (upper/lower) for an array dimension 2 INTEGER(IntKi) :: ErrStat2 CHARACTER(ErrMsgLen) :: ErrMsg2 CHARACTER(*), PARAMETER :: RoutineName = 'StC_UnPackOutput' @@ -4385,6 +5646,52 @@ SUBROUTINE StC_UnPackOutput( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrMs IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf) END DO END IF + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! MeasDisp not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + i2_l = IntKiBuf( Int_Xferred ) + i2_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%MeasDisp)) DEALLOCATE(OutData%MeasDisp) + ALLOCATE(OutData%MeasDisp(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%MeasDisp.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i2 = LBOUND(OutData%MeasDisp,2), UBOUND(OutData%MeasDisp,2) + DO i1 = LBOUND(OutData%MeasDisp,1), UBOUND(OutData%MeasDisp,1) + OutData%MeasDisp(i1,i2) = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + END DO + END DO + END IF + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! MeasVel not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + i2_l = IntKiBuf( Int_Xferred ) + i2_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%MeasVel)) DEALLOCATE(OutData%MeasVel) + ALLOCATE(OutData%MeasVel(i1_l:i1_u,i2_l:i2_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%MeasVel.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i2 = LBOUND(OutData%MeasVel,2), UBOUND(OutData%MeasVel,2) + DO i1 = LBOUND(OutData%MeasVel,1), UBOUND(OutData%MeasVel,1) + OutData%MeasVel(i1,i2) = ReKiBuf(Re_Xferred) + Re_Xferred = Re_Xferred + 1 + END DO + END DO + END IF END SUBROUTINE StC_UnPackOutput @@ -4467,7 +5774,9 @@ SUBROUTINE StC_Input_ExtrapInterp1(u1, u2, tin, u_out, tin_out, ErrStat, ErrMsg INTEGER(IntKi) :: ErrStat2 ! local errors CHARACTER(ErrMsgLen) :: ErrMsg2 ! local errors INTEGER :: i01 ! dim1 level 0 counter variable for arrays of ddts + INTEGER :: i02 ! dim2 level 0 counter variable for arrays of ddts INTEGER :: i1 ! dim1 counter variable for arrays + INTEGER :: i2 ! dim2 counter variable for arrays ! Initialize ErrStat ErrStat = ErrID_None ErrMsg = "" @@ -4487,6 +5796,38 @@ SUBROUTINE StC_Input_ExtrapInterp1(u1, u2, tin, u_out, tin_out, ErrStat, ErrMsg CALL MeshExtrapInterp1(u1%Mesh(i1), u2%Mesh(i1), tin, u_out%Mesh(i1), tin_out, ErrStat2, ErrMsg2 ) CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) ENDDO +END IF ! check if allocated +IF (ALLOCATED(u_out%CmdStiff) .AND. ALLOCATED(u1%CmdStiff)) THEN + DO i2 = LBOUND(u_out%CmdStiff,2),UBOUND(u_out%CmdStiff,2) + DO i1 = LBOUND(u_out%CmdStiff,1),UBOUND(u_out%CmdStiff,1) + b = -(u1%CmdStiff(i1,i2) - u2%CmdStiff(i1,i2)) + u_out%CmdStiff(i1,i2) = u1%CmdStiff(i1,i2) + b * ScaleFactor + END DO + END DO +END IF ! check if allocated +IF (ALLOCATED(u_out%CmdDamp) .AND. ALLOCATED(u1%CmdDamp)) THEN + DO i2 = LBOUND(u_out%CmdDamp,2),UBOUND(u_out%CmdDamp,2) + DO i1 = LBOUND(u_out%CmdDamp,1),UBOUND(u_out%CmdDamp,1) + b = -(u1%CmdDamp(i1,i2) - u2%CmdDamp(i1,i2)) + u_out%CmdDamp(i1,i2) = u1%CmdDamp(i1,i2) + b * ScaleFactor + END DO + END DO +END IF ! check if allocated +IF (ALLOCATED(u_out%CmdBrake) .AND. ALLOCATED(u1%CmdBrake)) THEN + DO i2 = LBOUND(u_out%CmdBrake,2),UBOUND(u_out%CmdBrake,2) + DO i1 = LBOUND(u_out%CmdBrake,1),UBOUND(u_out%CmdBrake,1) + b = -(u1%CmdBrake(i1,i2) - u2%CmdBrake(i1,i2)) + u_out%CmdBrake(i1,i2) = u1%CmdBrake(i1,i2) + b * ScaleFactor + END DO + END DO +END IF ! check if allocated +IF (ALLOCATED(u_out%CmdForce) .AND. ALLOCATED(u1%CmdForce)) THEN + DO i2 = LBOUND(u_out%CmdForce,2),UBOUND(u_out%CmdForce,2) + DO i1 = LBOUND(u_out%CmdForce,1),UBOUND(u_out%CmdForce,1) + b = -(u1%CmdForce(i1,i2) - u2%CmdForce(i1,i2)) + u_out%CmdForce(i1,i2) = u1%CmdForce(i1,i2) + b * ScaleFactor + END DO + END DO END IF ! check if allocated END SUBROUTINE StC_Input_ExtrapInterp1 @@ -4524,7 +5865,9 @@ SUBROUTINE StC_Input_ExtrapInterp2(u1, u2, u3, tin, u_out, tin_out, ErrStat, Err CHARACTER(ErrMsgLen) :: ErrMsg2 ! local errors CHARACTER(*), PARAMETER :: RoutineName = 'StC_Input_ExtrapInterp2' INTEGER :: i01 ! dim1 level 0 counter variable for arrays of ddts + INTEGER :: i02 ! dim2 level 0 counter variable for arrays of ddts INTEGER :: i1 ! dim1 counter variable for arrays + INTEGER :: i2 ! dim2 counter variable for arrays ! Initialize ErrStat ErrStat = ErrID_None ErrMsg = "" @@ -4550,6 +5893,42 @@ SUBROUTINE StC_Input_ExtrapInterp2(u1, u2, u3, tin, u_out, tin_out, ErrStat, Err CALL MeshExtrapInterp2(u1%Mesh(i1), u2%Mesh(i1), u3%Mesh(i1), tin, u_out%Mesh(i1), tin_out, ErrStat2, ErrMsg2 ) CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) ENDDO +END IF ! check if allocated +IF (ALLOCATED(u_out%CmdStiff) .AND. ALLOCATED(u1%CmdStiff)) THEN + DO i2 = LBOUND(u_out%CmdStiff,2),UBOUND(u_out%CmdStiff,2) + DO i1 = LBOUND(u_out%CmdStiff,1),UBOUND(u_out%CmdStiff,1) + b = (t(3)**2*(u1%CmdStiff(i1,i2) - u2%CmdStiff(i1,i2)) + t(2)**2*(-u1%CmdStiff(i1,i2) + u3%CmdStiff(i1,i2)))* scaleFactor + c = ( (t(2)-t(3))*u1%CmdStiff(i1,i2) + t(3)*u2%CmdStiff(i1,i2) - t(2)*u3%CmdStiff(i1,i2) ) * scaleFactor + u_out%CmdStiff(i1,i2) = u1%CmdStiff(i1,i2) + b + c * t_out + END DO + END DO +END IF ! check if allocated +IF (ALLOCATED(u_out%CmdDamp) .AND. ALLOCATED(u1%CmdDamp)) THEN + DO i2 = LBOUND(u_out%CmdDamp,2),UBOUND(u_out%CmdDamp,2) + DO i1 = LBOUND(u_out%CmdDamp,1),UBOUND(u_out%CmdDamp,1) + b = (t(3)**2*(u1%CmdDamp(i1,i2) - u2%CmdDamp(i1,i2)) + t(2)**2*(-u1%CmdDamp(i1,i2) + u3%CmdDamp(i1,i2)))* scaleFactor + c = ( (t(2)-t(3))*u1%CmdDamp(i1,i2) + t(3)*u2%CmdDamp(i1,i2) - t(2)*u3%CmdDamp(i1,i2) ) * scaleFactor + u_out%CmdDamp(i1,i2) = u1%CmdDamp(i1,i2) + b + c * t_out + END DO + END DO +END IF ! check if allocated +IF (ALLOCATED(u_out%CmdBrake) .AND. ALLOCATED(u1%CmdBrake)) THEN + DO i2 = LBOUND(u_out%CmdBrake,2),UBOUND(u_out%CmdBrake,2) + DO i1 = LBOUND(u_out%CmdBrake,1),UBOUND(u_out%CmdBrake,1) + b = (t(3)**2*(u1%CmdBrake(i1,i2) - u2%CmdBrake(i1,i2)) + t(2)**2*(-u1%CmdBrake(i1,i2) + u3%CmdBrake(i1,i2)))* scaleFactor + c = ( (t(2)-t(3))*u1%CmdBrake(i1,i2) + t(3)*u2%CmdBrake(i1,i2) - t(2)*u3%CmdBrake(i1,i2) ) * scaleFactor + u_out%CmdBrake(i1,i2) = u1%CmdBrake(i1,i2) + b + c * t_out + END DO + END DO +END IF ! check if allocated +IF (ALLOCATED(u_out%CmdForce) .AND. ALLOCATED(u1%CmdForce)) THEN + DO i2 = LBOUND(u_out%CmdForce,2),UBOUND(u_out%CmdForce,2) + DO i1 = LBOUND(u_out%CmdForce,1),UBOUND(u_out%CmdForce,1) + b = (t(3)**2*(u1%CmdForce(i1,i2) - u2%CmdForce(i1,i2)) + t(2)**2*(-u1%CmdForce(i1,i2) + u3%CmdForce(i1,i2)))* scaleFactor + c = ( (t(2)-t(3))*u1%CmdForce(i1,i2) + t(3)*u2%CmdForce(i1,i2) - t(2)*u3%CmdForce(i1,i2) ) * scaleFactor + u_out%CmdForce(i1,i2) = u1%CmdForce(i1,i2) + b + c * t_out + END DO + END DO END IF ! check if allocated END SUBROUTINE StC_Input_ExtrapInterp2 @@ -4633,7 +6012,9 @@ SUBROUTINE StC_Output_ExtrapInterp1(y1, y2, tin, y_out, tin_out, ErrStat, ErrMsg INTEGER(IntKi) :: ErrStat2 ! local errors CHARACTER(ErrMsgLen) :: ErrMsg2 ! local errors INTEGER :: i01 ! dim1 level 0 counter variable for arrays of ddts + INTEGER :: i02 ! dim2 level 0 counter variable for arrays of ddts INTEGER :: i1 ! dim1 counter variable for arrays + INTEGER :: i2 ! dim2 counter variable for arrays ! Initialize ErrStat ErrStat = ErrID_None ErrMsg = "" @@ -4653,6 +6034,22 @@ SUBROUTINE StC_Output_ExtrapInterp1(y1, y2, tin, y_out, tin_out, ErrStat, ErrMsg CALL MeshExtrapInterp1(y1%Mesh(i1), y2%Mesh(i1), tin, y_out%Mesh(i1), tin_out, ErrStat2, ErrMsg2 ) CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) ENDDO +END IF ! check if allocated +IF (ALLOCATED(y_out%MeasDisp) .AND. ALLOCATED(y1%MeasDisp)) THEN + DO i2 = LBOUND(y_out%MeasDisp,2),UBOUND(y_out%MeasDisp,2) + DO i1 = LBOUND(y_out%MeasDisp,1),UBOUND(y_out%MeasDisp,1) + b = -(y1%MeasDisp(i1,i2) - y2%MeasDisp(i1,i2)) + y_out%MeasDisp(i1,i2) = y1%MeasDisp(i1,i2) + b * ScaleFactor + END DO + END DO +END IF ! check if allocated +IF (ALLOCATED(y_out%MeasVel) .AND. ALLOCATED(y1%MeasVel)) THEN + DO i2 = LBOUND(y_out%MeasVel,2),UBOUND(y_out%MeasVel,2) + DO i1 = LBOUND(y_out%MeasVel,1),UBOUND(y_out%MeasVel,1) + b = -(y1%MeasVel(i1,i2) - y2%MeasVel(i1,i2)) + y_out%MeasVel(i1,i2) = y1%MeasVel(i1,i2) + b * ScaleFactor + END DO + END DO END IF ! check if allocated END SUBROUTINE StC_Output_ExtrapInterp1 @@ -4690,7 +6087,9 @@ SUBROUTINE StC_Output_ExtrapInterp2(y1, y2, y3, tin, y_out, tin_out, ErrStat, Er CHARACTER(ErrMsgLen) :: ErrMsg2 ! local errors CHARACTER(*), PARAMETER :: RoutineName = 'StC_Output_ExtrapInterp2' INTEGER :: i01 ! dim1 level 0 counter variable for arrays of ddts + INTEGER :: i02 ! dim2 level 0 counter variable for arrays of ddts INTEGER :: i1 ! dim1 counter variable for arrays + INTEGER :: i2 ! dim2 counter variable for arrays ! Initialize ErrStat ErrStat = ErrID_None ErrMsg = "" @@ -4716,6 +6115,24 @@ SUBROUTINE StC_Output_ExtrapInterp2(y1, y2, y3, tin, y_out, tin_out, ErrStat, Er CALL MeshExtrapInterp2(y1%Mesh(i1), y2%Mesh(i1), y3%Mesh(i1), tin, y_out%Mesh(i1), tin_out, ErrStat2, ErrMsg2 ) CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg,RoutineName) ENDDO +END IF ! check if allocated +IF (ALLOCATED(y_out%MeasDisp) .AND. ALLOCATED(y1%MeasDisp)) THEN + DO i2 = LBOUND(y_out%MeasDisp,2),UBOUND(y_out%MeasDisp,2) + DO i1 = LBOUND(y_out%MeasDisp,1),UBOUND(y_out%MeasDisp,1) + b = (t(3)**2*(y1%MeasDisp(i1,i2) - y2%MeasDisp(i1,i2)) + t(2)**2*(-y1%MeasDisp(i1,i2) + y3%MeasDisp(i1,i2)))* scaleFactor + c = ( (t(2)-t(3))*y1%MeasDisp(i1,i2) + t(3)*y2%MeasDisp(i1,i2) - t(2)*y3%MeasDisp(i1,i2) ) * scaleFactor + y_out%MeasDisp(i1,i2) = y1%MeasDisp(i1,i2) + b + c * t_out + END DO + END DO +END IF ! check if allocated +IF (ALLOCATED(y_out%MeasVel) .AND. ALLOCATED(y1%MeasVel)) THEN + DO i2 = LBOUND(y_out%MeasVel,2),UBOUND(y_out%MeasVel,2) + DO i1 = LBOUND(y_out%MeasVel,1),UBOUND(y_out%MeasVel,1) + b = (t(3)**2*(y1%MeasVel(i1,i2) - y2%MeasVel(i1,i2)) + t(2)**2*(-y1%MeasVel(i1,i2) + y3%MeasVel(i1,i2)))* scaleFactor + c = ( (t(2)-t(3))*y1%MeasVel(i1,i2) + t(3)*y2%MeasVel(i1,i2) - t(2)*y3%MeasVel(i1,i2) ) * scaleFactor + y_out%MeasVel(i1,i2) = y1%MeasVel(i1,i2) + b + c * t_out + END DO + END DO END IF ! check if allocated END SUBROUTINE StC_Output_ExtrapInterp2 diff --git a/modules/subdyn/src/SD_FEM.f90 b/modules/subdyn/src/SD_FEM.f90 index e03a8a0991..bee8e4a9e7 100644 --- a/modules/subdyn/src/SD_FEM.f90 +++ b/modules/subdyn/src/SD_FEM.f90 @@ -1150,14 +1150,19 @@ INTEGER(IntKi) FUNCTION nDOF_Unconstrained() END SUBROUTINE AssembleKM !> Map control cable index to control channel index -subroutine ControlCableMapping(Init, uInit, p, ErrStat, ErrMsg) +!! Also set the InitOut%CableCChanRqst logical array to indicate which channels were requested +!! The array element is set to true for the corresponding requested channel (SD does not need +!! to request a contiguous block of channels) +subroutine ControlCableMapping(Init, uInit, p, InitOut, ErrStat, ErrMsg) type(SD_InitType), intent(in ) :: Init !< init type(SD_InputType), intent(inout) :: uInit !< init input guess type(SD_ParameterType), intent(inout) :: p !< param + type(SD_InitOutputType), intent(inout) :: InitOut !< Output for initialization routine integer(IntKi), intent( out) :: ErrStat !< Error status of the operation character(*), intent( out) :: ErrMsg !< Error message if ErrStat /= ErrID_None ! Local variables integer(IntKi) :: i, nCC, idCProp, iElem !< index, number of controlable cables, id of Cable Prop + integer(IntKi) :: maxCC !< max control chan number integer(IntKi) :: ErrStat2 character(ErrMsgLen) :: ErrMsg2 ErrMsg = "" @@ -1165,12 +1170,14 @@ subroutine ControlCableMapping(Init, uInit, p, ErrStat, ErrMsg) ! --- Count number of Controllable cables nCC = 0 + maxCC = 0 do i = 1, size(p%ElemProps) if (p%ElemProps(i)%eType==idMemberCable) then idCProp= p%Elems(i,iMProp) - if (Init%PropsC(idCProp, 5 )>0) then + if (NINT(Init%PropsC(idCProp, 5 ))>0) then !print*,'Cable Element',i,'controllable with channel',Init%PropsC(idCProp, 5 ) nCC=nCC+1 + maxCC = max( maxCC, NINT(Init%PropsC(idCProp,5)) ) endif endif enddo @@ -1179,15 +1186,23 @@ subroutine ControlCableMapping(Init, uInit, p, ErrStat, ErrMsg) endif call AllocAry( p%CtrlElem2Channel, nCC, 2, 'p%CtrlElem2Channel', ErrStat2, ErrMsg2); if(Failed()) return; ! Constant cable force + ! --- create array for telling calling code which channels are requested -- leave unallocated if none found!!! + if (nCC>0) then + if (allocated(InitOut%CableCChanRqst)) deallocate(InitOut%CableCChanRqst) + call AllocAry(InitOut%CableCChanRqst, maxCC, 'InitOut%CableCChanRqst', ErrStat2, ErrMsg2); if(Failed()) return; + InitOut%CableCChanRqst = .FALSE. ! Initialize to false + endif + ! --- Store mapping nCC = 0 do i = 1, size(p%ElemProps) if (p%ElemProps(i)%eType==idMemberCable) then idCProp= p%Elems(i,iMProp) - if (Init%PropsC(idCProp, 5 )>0) then + if (NINT(Init%PropsC(idCProp, 5 ))>0) then nCC=nCC+1 p%CtrlElem2Channel(nCC, 1) = i ! Element index (in p%Elems and p%ElemProps) - p%CtrlElem2Channel(nCC, 2) = Init%PropsC(idCProp,5) ! Control channel + p%CtrlElem2Channel(nCC, 2) = NINT(Init%PropsC(idCProp,5),IntKi) ! Control channel + InitOut%CableCChanRqst(NINT(Init%PropsC(idCProp, 5 ),IntKi)) = .TRUE. endif endif enddo @@ -1198,7 +1213,8 @@ subroutine ControlCableMapping(Init, uInit, p, ErrStat, ErrMsg) do i = 1, nCC iElem = p%CtrlElem2Channel(i,1) ! DeltaL 0 = - Le T0 / (EA + T0) = - Le eps0 / (1+eps0) - uInit%CableDeltaL(i) = - p%ElemProps(iElem)%Length * p%ElemProps(iElem)%T0 / (p%ElemProps(iElem)%YoungE*p%ElemProps(iElem)%Area + p%ElemProps(iElem)%T0) + !uInit%CableDeltaL(i) = - p%ElemProps(iElem)%Length * p%ElemProps(iElem)%T0 / (p%ElemProps(iElem)%YoungE*p%ElemProps(iElem)%Area + p%ElemProps(iElem)%T0) + uInit%CableDeltaL(i) = 0.0_ReKi enddo contains diff --git a/modules/subdyn/src/SubDyn.f90 b/modules/subdyn/src/SubDyn.f90 index 84872fbcee..d4b759cf86 100644 --- a/modules/subdyn/src/SubDyn.f90 +++ b/modules/subdyn/src/SubDyn.f90 @@ -271,7 +271,7 @@ SUBROUTINE SD_Init( InitInput, u, p, x, xd, z, OtherState, y, m, Interval, InitO CALL NodeCon(Init, p, ErrStat2, ErrMsg2); if(Failed()) return !Store mapping between controllable elements and control channels, and return guess input - CALL ControlCableMapping(Init, u, p, ErrStat2, ErrMsg2); if(Failed()) return + CALL ControlCableMapping(Init, u, p, InitOut, ErrStat2, ErrMsg2); if(Failed()) return ! --- Allocate DOF indices to joints and members call DistributeDOF(Init, p ,ErrStat2, ErrMsg2); if(Failed()) return; @@ -291,8 +291,6 @@ SUBROUTINE SD_Init( InitInput, u, p, x, xd, z, OtherState, y, m, Interval, InitO ! --- Prepare for control cable load, RHS if (size(p%CtrlElem2Channel,1)>0) then CALL ControlCableForceInit(p, m, ErrStat2, ErrMsg2); if(Failed()) return - print*,'Controlable cables are present, this feature is not ready at the glue code level.' - STOP endif ! -------------------------------------------------------------------------------- @@ -3107,6 +3105,7 @@ SUBROUTINE GetExtForceOnInternalDOF(u, p, x, m, F_L, ErrStat, ErrMsg, GuyanLoadC integer :: iCC, iElem, iChannel !< Index on control cables, element, Channel integer(IntKi), dimension(12) :: IDOF ! 12 DOF indices in global unconstrained system real(ReKi) :: CableTension ! Controllable Cable force + real(ReKi) :: DeltaL ! Change of length real(ReKi) :: rotations(3) real(ReKi) :: du(3), Moment(3), Force(3) real(ReKi) :: u_TP(6) @@ -3116,16 +3115,23 @@ SUBROUTINE GetExtForceOnInternalDOF(u, p, x, m, F_L, ErrStat, ErrMsg, GuyanLoadC real(ReKi), dimension(3) :: duP ! Displacement of node due to rigid rotation real(R8Ki), dimension(3,3) :: Rb2g ! Rotation matrix body 2 global real(R8Ki), dimension(3,3) :: Rg2b ! Rotation matrix global 2 body coordinates - ! - real(ReKi), parameter :: myNaN = -9999998.989_ReKi if (GuyanLoadCorrection) then ! Compute node displacements "DU_full" for lever arm call LeverArm(u, p, x, m, m%DU_full, bGuyan=.True., bElastic=.False., U_full=U_full) endif + ! TODO + ! Rewrite this function into five steps: + ! - Setup loads by simple sum on physial nodes of LMesh, FG and FC_ + ! - Rotate them if needed + ! - Introduce lever arm if needed + ! - Spread moment on nodes + ! - Perform reduction using T_red + ! This could make things slightly cleaner and avoid the if statement in the do-loop for the moment + ! --- Build vector of external forces (including gravity) (Moment done below) - m%Fext= myNaN + m%Fext= 0.0_ReKi if (RotateLoads) then ! Forces in body coordinates Rg2b(1:3,1:3) = u%TPMesh%Orientation(:,:,1) ! global 2 body coordinates do iNode = 1,p%nNodes @@ -3149,27 +3155,33 @@ SUBROUTINE GetExtForceOnInternalDOF(u, p, x, m, F_L, ErrStat, ErrMsg, GuyanLoadC iElem = p%CtrlElem2Channel(iCC,1) iChannel = p%CtrlElem2Channel(iCC,2) IDOF = p%ElemsDOF(1:12, iElem) + ! DeltaL = DeltaL0 + DeltaL_control = - Le T0/(EA+T0) + DeltaL_control + DeltaL = - p%ElemProps(iElem)%Length * p%ElemProps(iElem)%T0 / (p%ElemProps(iElem)%YoungE*p%ElemProps(iElem)%Area + p%ElemProps(iElem)%T0) + DeltaL = DeltaL + u%CableDeltaL(iChannel) ! T(t) = - EA * DeltaL(t) /(Le + Delta L(t)) ! NOTE DeltaL<0 - CableTension = -p%ElemProps(iElem)%YoungE*p%ElemProps(iElem)%Area * u%CableDeltaL(iChannel) / (p%ElemProps(iElem)%Length + u%CableDeltaL(iChannel)) - print*,'TODO, Controllable pretension cable needs thinking for moment' - STOP - !if (RotateLoads) then ! in body coordinate - ! m%Fext(IDOF) = m%Fext(IDOF) + matmul(Rg2b,m%FC_unit( IDOF ) * (CableTension - p%ElemProps(iElem)%T0)) - !else ! in global - ! m%Fext(IDOF) = m%Fext(IDOF) + m%FC_unit( IDOF ) * (CableTension - p%ElemProps(iElem)%T0) - !endif + CableTension = -p%ElemProps(iElem)%YoungE*p%ElemProps(iElem)%Area * DeltaL / (p%ElemProps(iElem)%Length + DeltaL) + if (RotateLoads) then ! in body coordinate + ! We only rotate the loads, moments are rotated below + m%Fext(IDOF(1:3)) = m%Fext(IDOF(1:3)) + matmul(Rg2b,m%FC_unit( IDOF(1:3) ) * (CableTension - p%ElemProps(iElem)%T0)) + m%Fext(IDOF(7:9)) = m%Fext(IDOF(7:9)) + matmul(Rg2b,m%FC_unit( IDOF(7:9) ) * (CableTension - p%ElemProps(iElem)%T0)) + m%Fext(IDOF(4:6)) = m%Fext(IDOF(4:6)) + m%FC_unit( IDOF(4:6) ) * (CableTension - p%ElemProps(iElem)%T0) + m%Fext(IDOF(10:12)) = m%Fext(IDOF(10:12)) + m%FC_unit( IDOF(10:12) ) * (CableTension - p%ElemProps(iElem)%T0) + else ! in global + m%Fext(IDOF) = m%Fext(IDOF) + m%FC_unit( IDOF ) * (CableTension - p%ElemProps(iElem)%T0) + endif enddo endif ! --- Build vector of external moment do iNode = 1,p%nNodes Force(1:3) = m%Fext(p%NodesDOF(iNode)%List(1:3) ) ! Controllable cable + External Forces on LMesh + Moment(1:3) = m%Fext(p%NodesDOF(iNode)%List(4:6) ) ! Controllable cable ! Moment ext + gravity if (RotateLoads) then ! In body coordinates - Moment(1:3) = matmul(Rg2b, u%LMesh%Moment(1:3,iNode) + p%FG(p%NodesDOF(iNode)%List(4:6))) + Moment(1:3) = matmul(Rg2b, Moment(1:3)+ u%LMesh%Moment(1:3,iNode) + p%FG(p%NodesDOF(iNode)%List(4:6))) else - Moment(1:3) = u%LMesh%Moment(1:3,iNode) + p%FG(p%NodesDOF(iNode)%List(4:6)) + Moment(1:3) = Moment(1:3)+ u%LMesh%Moment(1:3,iNode) + p%FG(p%NodesDOF(iNode)%List(4:6)) endif ! Extra moment dm = Delta u x (fe + fg) @@ -3187,14 +3199,6 @@ SUBROUTINE GetExtForceOnInternalDOF(u, p, x, m, F_L, ErrStat, ErrMsg, GuyanLoadC m%Fext( p%NodesDOF(iNode)%List(6::3)) = Moment(3)/nMembers enddo - ! TODO: remove test below in the future - if (DEV_VERSION) then - if (any(m%Fext == myNaN)) then - print*,'Error in setting up Fext' - STOP - endif - endif - ! --- Reduced vector of external force if (p%reduced) then m%Fext_red = matmul(p%T_red_T, m%Fext) diff --git a/modules/subdyn/src/SubDyn_Registry.txt b/modules/subdyn/src/SubDyn_Registry.txt index eb82c52b6a..9bcd06aff0 100644 --- a/modules/subdyn/src/SubDyn_Registry.txt +++ b/modules/subdyn/src/SubDyn_Registry.txt @@ -67,6 +67,7 @@ typedef ^ InitOutputType LOGICAL RotFrame_x {:} - - "Fl typedef ^ InitOutputType LOGICAL RotFrame_u {:} - - "Flag that tells FAST/MBC3 if the inputs used in linearization are in the rotating frame" - typedef ^ InitOutputType LOGICAL IsLoad_u {:} - - "Flag that tells FAST if the inputs used in linearization are loads (for preconditioning matrix)" - typedef ^ InitOutputType IntKi DerivOrder_x {:} - - "Integer that tells FAST/MBC3 the maximum derivative order of continuous states used in linearization" - +typedef ^ ^ LOGICAL CableCChanRqst {:} .FALSE. - "flag indicating control channel for active cable tensioning is requested" - # ============================== Define initialization data (not from glue code) here: ============================================================================================================================================ typedef ^ SD_InitType CHARACTER(1024) RootName - - - "SubDyn rootname" diff --git a/modules/subdyn/src/SubDyn_Types.f90 b/modules/subdyn/src/SubDyn_Types.f90 index 1b8467f30c..d35659a9df 100644 --- a/modules/subdyn/src/SubDyn_Types.f90 +++ b/modules/subdyn/src/SubDyn_Types.f90 @@ -105,6 +105,7 @@ MODULE SubDyn_Types LOGICAL , DIMENSION(:), ALLOCATABLE :: RotFrame_u !< Flag that tells FAST/MBC3 if the inputs used in linearization are in the rotating frame [-] LOGICAL , DIMENSION(:), ALLOCATABLE :: IsLoad_u !< Flag that tells FAST if the inputs used in linearization are loads (for preconditioning matrix) [-] INTEGER(IntKi) , DIMENSION(:), ALLOCATABLE :: DerivOrder_x !< Integer that tells FAST/MBC3 the maximum derivative order of continuous states used in linearization [-] + LOGICAL , DIMENSION(:), ALLOCATABLE :: CableCChanRqst !< flag indicating control channel for active cable tensioning is requested [-] END TYPE SD_InitOutputType ! ======================= ! ========= SD_InitType ======= @@ -2357,6 +2358,18 @@ SUBROUTINE SD_CopyInitOutput( SrcInitOutputData, DstInitOutputData, CtrlCode, Er END IF END IF DstInitOutputData%DerivOrder_x = SrcInitOutputData%DerivOrder_x +ENDIF +IF (ALLOCATED(SrcInitOutputData%CableCChanRqst)) THEN + i1_l = LBOUND(SrcInitOutputData%CableCChanRqst,1) + i1_u = UBOUND(SrcInitOutputData%CableCChanRqst,1) + IF (.NOT. ALLOCATED(DstInitOutputData%CableCChanRqst)) THEN + ALLOCATE(DstInitOutputData%CableCChanRqst(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating DstInitOutputData%CableCChanRqst.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + END IF + DstInitOutputData%CableCChanRqst = SrcInitOutputData%CableCChanRqst ENDIF END SUBROUTINE SD_CopyInitOutput @@ -2399,6 +2412,9 @@ SUBROUTINE SD_DestroyInitOutput( InitOutputData, ErrStat, ErrMsg ) ENDIF IF (ALLOCATED(InitOutputData%DerivOrder_x)) THEN DEALLOCATE(InitOutputData%DerivOrder_x) +ENDIF +IF (ALLOCATED(InitOutputData%CableCChanRqst)) THEN + DEALLOCATE(InitOutputData%CableCChanRqst) ENDIF END SUBROUTINE SD_DestroyInitOutput @@ -2505,6 +2521,11 @@ SUBROUTINE SD_PackInitOutput( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMs Int_BufSz = Int_BufSz + 2*1 ! DerivOrder_x upper/lower bounds for each dimension Int_BufSz = Int_BufSz + SIZE(InData%DerivOrder_x) ! DerivOrder_x END IF + Int_BufSz = Int_BufSz + 1 ! CableCChanRqst allocated yes/no + IF ( ALLOCATED(InData%CableCChanRqst) ) THEN + Int_BufSz = Int_BufSz + 2*1 ! CableCChanRqst upper/lower bounds for each dimension + Int_BufSz = Int_BufSz + SIZE(InData%CableCChanRqst) ! CableCChanRqst + END IF IF ( Re_BufSz .GT. 0 ) THEN ALLOCATE( ReKiBuf( Re_BufSz ), STAT=ErrStat2 ) IF (ErrStat2 /= 0) THEN @@ -2720,6 +2741,21 @@ SUBROUTINE SD_PackInitOutput( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMs Int_Xferred = Int_Xferred + 1 END DO END IF + IF ( .NOT. ALLOCATED(InData%CableCChanRqst) ) THEN + IntKiBuf( Int_Xferred ) = 0 + Int_Xferred = Int_Xferred + 1 + ELSE + IntKiBuf( Int_Xferred ) = 1 + Int_Xferred = Int_Xferred + 1 + IntKiBuf( Int_Xferred ) = LBOUND(InData%CableCChanRqst,1) + IntKiBuf( Int_Xferred + 1) = UBOUND(InData%CableCChanRqst,1) + Int_Xferred = Int_Xferred + 2 + + DO i1 = LBOUND(InData%CableCChanRqst,1), UBOUND(InData%CableCChanRqst,1) + IntKiBuf(Int_Xferred) = TRANSFER(InData%CableCChanRqst(i1), IntKiBuf(1)) + Int_Xferred = Int_Xferred + 1 + END DO + END IF END SUBROUTINE SD_PackInitOutput SUBROUTINE SD_UnPackInitOutput( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrMsg ) @@ -2979,6 +3015,24 @@ SUBROUTINE SD_UnPackInitOutput( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, Er Int_Xferred = Int_Xferred + 1 END DO END IF + IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! CableCChanRqst not allocated + Int_Xferred = Int_Xferred + 1 + ELSE + Int_Xferred = Int_Xferred + 1 + i1_l = IntKiBuf( Int_Xferred ) + i1_u = IntKiBuf( Int_Xferred + 1) + Int_Xferred = Int_Xferred + 2 + IF (ALLOCATED(OutData%CableCChanRqst)) DEALLOCATE(OutData%CableCChanRqst) + ALLOCATE(OutData%CableCChanRqst(i1_l:i1_u),STAT=ErrStat2) + IF (ErrStat2 /= 0) THEN + CALL SetErrStat(ErrID_Fatal, 'Error allocating OutData%CableCChanRqst.', ErrStat, ErrMsg,RoutineName) + RETURN + END IF + DO i1 = LBOUND(OutData%CableCChanRqst,1), UBOUND(OutData%CableCChanRqst,1) + OutData%CableCChanRqst(i1) = TRANSFER(IntKiBuf(Int_Xferred), OutData%CableCChanRqst(i1)) + Int_Xferred = Int_Xferred + 1 + END DO + END IF END SUBROUTINE SD_UnPackInitOutput SUBROUTINE SD_CopyInitType( SrcInitTypeData, DstInitTypeData, CtrlCode, ErrStat, ErrMsg ) diff --git a/reg_tests/r-test b/reg_tests/r-test index b69a590efa..061441958a 160000 --- a/reg_tests/r-test +++ b/reg_tests/r-test @@ -1 +1 @@ -Subproject commit b69a590efa8f6c72f4ed9606e31f51bbeb0c227d +Subproject commit 061441958a2eef7f494d69ee097f8ec050d5a129 diff --git a/vs-build/FASTlib/FASTlib.vfproj b/vs-build/FASTlib/FASTlib.vfproj index 880205f5bf..8b50656451 100644 --- a/vs-build/FASTlib/FASTlib.vfproj +++ b/vs-build/FASTlib/FASTlib.vfproj @@ -2375,6 +2375,7 @@ +