Skip to content

Commit aa2fd1a

Browse files
authored
Merge pull request #3158 from andrew-platt/b/StC_Ctrl_Frc
SrvD: updates to StC control from DLL
2 parents 4fac4c3 + 7795154 commit aa2fd1a

File tree

7 files changed

+195
-48
lines changed

7 files changed

+195
-48
lines changed

modules/servodyn/src/BladedInterface_EX.f90

Lines changed: 24 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ MODULE BladedInterface_EX
6464
integer(IntKi), parameter :: CableCtrl_MaxChan = 200 !< Maximum channels in cable control group
6565
integer(IntKi), parameter :: StCCtrl_StartIdx = 2801 !< Starting index for the StC control
6666
integer(IntKi), parameter :: StCCtrl_MaxChan = 200 !< Maximum channels in StC control group
67-
integer(IntKi), parameter :: StCCtrl_ChanPerSet = 20 !< Channels needed per set (10 sets for total channels)
67+
integer(IntKi), parameter :: StCCtrl_ChanPerSet = 25 !< Channels needed per set (8 sets for total channels)
6868

6969

7070
CONTAINS
@@ -277,25 +277,26 @@ end subroutine InitCableCtrl
277277
subroutine InitStCCtrl()
278278
integer(IntKi) :: I,J ! Generic counters
279279

280-
! Error check the Cable Ctrl
280+
! Error check the StC Ctrl
281281
if (.not. allocated(StC_CtrlChanInitInfo%Requestor)) then
282282
ErrStat2=ErrID_Fatal
283-
ErrMsg2='StC control string array indicating which module requested cable controls is missing (StC_CtrlChanInitInfo%Requestor)'
283+
ErrMsg2='StC control string array indicating which module requested StC controls is missing (StC_CtrlChanInitInfo%Requestor)'
284284
if (Failed()) return
285285
endif
286286
if (size(StC_CtrlChanInitInfo%Requestor) /= p%NumStC_Control) then
287287
ErrStat2=ErrID_Fatal
288-
ErrMsg2='Size of StC control string array (StC_CtrlChanInitInfo%Requestor) does not match the number of requested cable control channels.'
288+
ErrMsg2='Size of StC control string array (StC_CtrlChanInitInfo%Requestor) does not match the number of requested StC control channels.'
289289
if (Failed()) return
290290
endif
291291
if ( (size(StC_CtrlChanInitInfo%InitMeasDisp,2) /= p%NumStC_Control) .or. &
292292
(size(StC_CtrlChanInitInfo%InitMeasVel ,2) /= p%NumStC_Control) .or. &
293293
(size(StC_CtrlChanInitInfo%InitStiff ,2) /= p%NumStC_Control) .or. &
294294
(size(StC_CtrlChanInitInfo%InitDamp ,2) /= p%NumStC_Control) .or. &
295295
(size(StC_CtrlChanInitInfo%InitBrake ,2) /= p%NumStC_Control) .or. &
296-
(size(StC_CtrlChanInitInfo%InitForce ,2) /= p%NumStC_Control) ) then
296+
(size(StC_CtrlChanInitInfo%InitForce ,2) /= p%NumStC_Control) .or. &
297+
(size(StC_CtrlChanInitInfo%InitMoment ,2) /= p%NumStC_Control) ) then
297298
ErrStat2=ErrID_Fatal
298-
ErrMsg2='Size of StC control initialization arrays (StC_CtrlChanInitInfo%Init*) do not match the number of requested cable control channels. Programming error somewhere.'
299+
ErrMsg2='Size of StC control initialization arrays (StC_CtrlChanInitInfo%Init*) do not match the number of requested StC control channels. Programming error somewhere.'
299300
if (Failed()) return
300301
endif
301302
if ( p%NumStC_Control*StCCtrl_ChanPerSet > StCCtrl_MaxChan ) then
@@ -324,6 +325,8 @@ subroutine InitStCCtrl()
324325
if (Failed()) return
325326
call AllocAry( dll_data%PrevStCCmdForce, 3, p%NumStC_Control, 'PrevStCCmdForce', ErrStat2, ErrMsg2 )
326327
if (Failed()) return
328+
call AllocAry( dll_data%PrevStCCmdMoment,3, p%NumStC_Control, 'PrevStCCmdMoment',ErrStat2, ErrMsg2 )
329+
if (Failed()) return
327330
call AllocAry( dll_data%StCCmdStiff, 3, p%NumStC_Control, 'StCCmdStiff', ErrStat2, ErrMsg2 )
328331
if (Failed()) return
329332
call AllocAry( dll_data%StCCmdDamp, 3, p%NumStC_Control, 'StCCmdDamp', ErrStat2, ErrMsg2 )
@@ -332,17 +335,21 @@ subroutine InitStCCtrl()
332335
if (Failed()) return
333336
call AllocAry( dll_data%StCCmdForce, 3, p%NumStC_Control, 'StCCmdForce', ErrStat2, ErrMsg2 )
334337
if (Failed()) return
338+
call AllocAry( dll_data%StCCmdMoment, 3, p%NumStC_Control, 'StCCmdMoment', ErrStat2, ErrMsg2 )
339+
if (Failed()) return
335340
! Initialize to values passed in
336341
dll_data%StCMeasDisp = real(StC_CtrlChanInitInfo%InitMeasDisp,SiKi)
337342
dll_data%StCMeasVel = real(StC_CtrlChanInitInfo%InitMeasVel ,SiKi)
338343
dll_data%PrevStCCmdStiff = real(StC_CtrlChanInitInfo%InitStiff ,SiKi)
339344
dll_data%PrevStCCmdDamp = real(StC_CtrlChanInitInfo%InitDamp ,SiKi)
340345
dll_data%PrevStCCmdBrake = real(StC_CtrlChanInitInfo%InitBrake ,SiKi)
341346
dll_data%PrevStCCmdForce = real(StC_CtrlChanInitInfo%InitForce ,SiKi)
347+
dll_data%PrevStCCmdMoment = real(StC_CtrlChanInitInfo%InitMoment ,SiKi)
342348
dll_data%StCCmdStiff = real(StC_CtrlChanInitInfo%InitStiff ,SiKi)
343349
dll_data%StCCmdDamp = real(StC_CtrlChanInitInfo%InitDamp ,SiKi)
344350
dll_data%StCCmdBrake = real(StC_CtrlChanInitInfo%InitBrake ,SiKi)
345351
dll_data%StCCmdForce = real(StC_CtrlChanInitInfo%InitForce ,SiKi)
352+
dll_data%StCCmdMoment = real(StC_CtrlChanInitInfo%InitMoment ,SiKi)
346353

347354
! Create info for summary file about channels
348355
if (UnSum > 0) then
@@ -366,8 +373,13 @@ subroutine InitStCCtrl()
366373
call WrSumInfoRcvd( J+16,StC_CtrlChanInitInfo%Requestor(I),'StC control channel group '//trim(Num2LStr(I))//' -- StC_Force_X (additional force)')
367374
call WrSumInfoRcvd( J+17,StC_CtrlChanInitInfo%Requestor(I),'StC control channel group '//trim(Num2LStr(I))//' -- StC_Force_Y (additional force)')
368375
call WrSumInfoRcvd( J+18,StC_CtrlChanInitInfo%Requestor(I),'StC control channel group '//trim(Num2LStr(I))//' -- StC_Force_Z (additional force)')
369-
call WrSumInfoRcvd( J+19,StC_CtrlChanInitInfo%Requestor(I),'StC control channel group '//trim(Num2LStr(I))//' -- Reserved for future')
370-
call WrSumInfoRcvd( J+20,StC_CtrlChanInitInfo%Requestor(I),'StC control channel group '//trim(Num2LStr(I))//' -- Reserved for future')
376+
call WrSumInfoRcvd( J+19,StC_CtrlChanInitInfo%Requestor(I),'StC control channel group '//trim(Num2LStr(I))//' -- StC_Moment_X (additional moment)')
377+
call WrSumInfoRcvd( J+20,StC_CtrlChanInitInfo%Requestor(I),'StC control channel group '//trim(Num2LStr(I))//' -- StC_Moment_Y (additional moment)')
378+
call WrSumInfoRcvd( J+21,StC_CtrlChanInitInfo%Requestor(I),'StC control channel group '//trim(Num2LStr(I))//' -- StC_Moment_Z (additional moment)')
379+
call WrSumInfoRcvd( J+22,StC_CtrlChanInitInfo%Requestor(I),'StC control channel group '//trim(Num2LStr(I))//' -- Reserved for future')
380+
call WrSumInfoRcvd( J+23,StC_CtrlChanInitInfo%Requestor(I),'StC control channel group '//trim(Num2LStr(I))//' -- Reserved for future')
381+
call WrSumInfoRcvd( J+24,StC_CtrlChanInitInfo%Requestor(I),'StC control channel group '//trim(Num2LStr(I))//' -- Reserved for future')
382+
call WrSumInfoRcvd( J+25,StC_CtrlChanInitInfo%Requestor(I),'StC control channel group '//trim(Num2LStr(I))//' -- Reserved for future')
371383
enddo
372384
endif
373385
end subroutine InitStCCtrl
@@ -569,7 +581,8 @@ subroutine SetEXavrStC_Sensors()
569581
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)
570582
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))
571583
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)
572-
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)
584+
dll_data%avrswap(J+16:J+18) = dll_data%PrevStCCmdForce(1:3,I) ! StC initial force -- StC_Force_X, StC_Force_Y, StC_Force_Z (N)
585+
dll_data%avrswap(J+19:J+21) = dll_data%PrevStCCmdMoment(1:3,I) ! StC initial moment -- StC_Moment_X, StC_Moment_Y, StC_Moment_Z (N)
573586
enddo
574587
endif
575588
end subroutine SetEXavrStC_Sensors
@@ -645,7 +658,8 @@ subroutine Retrieve_EXavrSWAP_StControls ()
645658
dll_data%StCCmdStiff(1:3,I) = dll_data%avrswap(J+ 7:J+ 9) ! StC commanded stiffness -- StC_Stiff_X, StC_Stiff_Y, StC_Stiff_Z (N/m)
646659
dll_data%StCCmdDamp( 1:3,I) = dll_data%avrswap(J+10:J+12) ! StC commanded damping -- StC_Damp_X, StC_Damp_Y, StC_Damp_Z (N/(m/s))
647660
dll_data%StCCmdBrake(1:3,I) = dll_data%avrswap(J+13:J+15) ! StC commanded brake -- StC_Brake_X, StC_Brake_Y, StC_Brake_Z (N)
648-
dll_data%StCCmdForce(1:3,I) = dll_data%avrswap(J+16:J+18) ! StC commanded brake -- StC_Force_X, StC_Force_Y, StC_Force_Z (N)
661+
dll_data%StCCmdForce(1:3,I) = dll_data%avrswap(J+16:J+18) ! StC commanded force -- StC_Force_X, StC_Force_Y, StC_Force_Z (N)
662+
dll_data%StCCmdMoment(1:3,I)= dll_data%avrswap(J+19:J+21) ! StC commanded moment -- StC_Moment_X, StC_Moment_Y, StC_Moment_Z (N)
649663
enddo
650664

651665
end subroutine Retrieve_EXavrSWAP_StControls

0 commit comments

Comments
 (0)