Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Linux updates to the DLL code #4

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions src/flap_servo/flap_servo.f90
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,12 @@ module flap_servo_mod
integer :: stepno = 0
contains
!**************************************************************************************************
subroutine init_flap_servo(array1, array2)
subroutine init_flap_servo(array1, array2) bind(c,name="init_flap_servo")
! Initialize Cyclic Flap Controller
implicit none
!DEC$ IF .NOT. DEFINED(__LINUX__)
!DEC$ ATTRIBUTES DLLEXPORT, C, ALIAS:'init_flap_servo'::init_flap_servo
!DEC$ END IF
real(mk) array1(3), array2(1)
! Input parameters
! 1: constant 1 ; Low-pass filter time constant [s]
Expand All @@ -36,9 +38,11 @@ subroutine init_flap_servo(array1, array2)
return
end subroutine init_flap_servo
!**************************************************************************************************
subroutine update_flap_servo(array1, array2)
subroutine update_flap_servo(array1, array2) bind(c,name="update_flap_servo")
implicit none
!DEC$ IF .NOT. DEFINED(__LINUX__)
!DEC$ ATTRIBUTES DLLEXPORT, C, ALIAS:'update_flap_servo'::update_flap_servo
!DEC$ END IF
real(mk) array1(4), array2(3)
! Input array1 must contains
!
Expand Down
23 changes: 16 additions & 7 deletions src/generator_servo/generator_servo.f90
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
module generator_servo_mod
use generator_servo_fcns
implicit none
contains
!**************************************************************************************************
subroutine init_generator_servo(array1,array2)
subroutine init_generator_servo(array1,array2) bind(c,name="init_generator_servo")
use write_version_mod
implicit none
!DEC$ IF .NOT. DEFINED(__LINUX__)
Expand Down Expand Up @@ -41,7 +42,7 @@ subroutine init_generator_servo(array1,array2)
array2 = 0.0_mk
end subroutine init_generator_servo
!**************************************************************************************************
subroutine init_generator_servo_var_eta(array1,array2)
subroutine init_generator_servo_var_eta(array1,array2) bind(c,name="init_generator_servo_var_eta")
implicit none
!DEC$ IF .NOT. DEFINED(__LINUX__)
!DEC$ ATTRIBUTES DLLEXPORT, C, ALIAS:'init_generator_servo_var_eta'::init_generator_servo_var_eta
Expand Down Expand Up @@ -107,7 +108,7 @@ subroutine init_generator_servo_var_eta(array1,array2)
return
end subroutine init_generator_servo_var_eta
!**************************************************************************************************
subroutine update_generator_servo(array1, array2)
subroutine update_generator_servo(array1, array2) bind(c,name="update_generator_servo")
implicit none
!DEC$ IF .NOT. DEFINED(__LINUX__)
!DEC$ ATTRIBUTES DLLEXPORT, C, ALIAS:'update_generator_servo'::update_generator_servo
Expand All @@ -119,8 +120,7 @@ subroutine update_generator_servo(array1, array2)
! 2: dll inpvec 1 1 ; Electrical torque reference [Nm]
! 3: constraint bearing1 shaft_rot 1 only 2 ; Generator LSS speed [rad/s]
!....4: mbdy momentvec shaft 1 1 shaft # only 3;
!
! Output array2 contains
! ! Output array2 contains
!
! 1: Generator LSS torque [Nm]
! 2: Electrical generator power [W]
Expand Down Expand Up @@ -149,7 +149,11 @@ subroutine update_generator_servo(array1, array2)
Qshaft = array1(4)
omegagen = array1(3)
! Reference mech. torque
mech_Qgref = min(Qgref/generatorvar%eta, generatorvar%max_lss_torque)
if(generatorvar%eta==0.0) then
mech_Qgref = generatorvar%max_lss_torque
else
mech_Qgref = min(Qgref/generatorvar%eta, generatorvar%max_lss_torque)
endif
! Low-pass filter generator speed (LSS)
Qgdummy = lowpass2orderfilt(generatorvar%deltat, generatorvar%stepno, lowpass2ordergen, mech_Qgref)
mech_Qg = Qgdummy(1)
Expand Down Expand Up @@ -177,7 +181,12 @@ subroutine update_generator_servo(array1, array2)
end select
! Output
if ((time.gt.TimeGridLoss).and.(TimeGridLoss.gt.0.d0)) then
array2 = 0.d0
array2(1) = 0.d0
array2(2) = 0.d0
array2(3) = 0.d0
array2(4) = 0.d0
array2(5) = 0.d0
array2(6) = 0.d0
array2(8) = 1.d0
else
array2(1) = -mech_Qg
Expand Down
4 changes: 2 additions & 2 deletions src/mech_brake/mech_brake.f90
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
subroutine init_mech_brake(array1,array2)
subroutine init_mech_brake(array1,array2) bind(c,name="init_mech_brake")
use mech_brake_fcns
use write_version_mod
implicit none
Expand Down Expand Up @@ -28,7 +28,7 @@ subroutine init_mech_brake(array1,array2)
return
end subroutine init_mech_brake
!***********************************************************************
subroutine update_mech_brake(array1,array2)
subroutine update_mech_brake(array1,array2) bind(c,name="update_mech_brake")
use mech_brake_fcns
! use imsl
implicit none
Expand Down
4 changes: 2 additions & 2 deletions src/servo_with_limits/servo_with_limits.f90
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
subroutine init_servo_with_limits(array1,array2)
subroutine init_servo_with_limits(array1,array2) bind(c,name="init_servo_with_limits")
use servo_with_limits_data
use write_version_mod
implicit none
Expand Down Expand Up @@ -49,7 +49,7 @@ subroutine init_servo_with_limits(array1,array2)
return
end subroutine init_servo_with_limits
!***********************************************************************
subroutine update_servo_with_limits(array1,array2)
subroutine update_servo_with_limits(array1,array2) bind(c,name="update_servo_with_limits")
use servo_with_limits_data
! use imsl
implicit none
Expand Down