External forces#

Main command block – Force#

Sub command - Base#

This command block can be used to specify a user-defined constant external force and/or moment on a node on the structure.

Obl.

Command name

Explanation and parameters

name

1. Name used to reference the force DLL from output sensors.

mbdy

1. Name of mainbody.

node

1. Node number.

force

External force in global coordinates

1. Fx [N]

1. Fy [N]

1. Fz [N]

moment

External moment in global coordinates

1. Mx [Nm]

1. My [Nm]

1. Mz [Nm]

Sub command - DLL#

This command block can be used when a user defined external force is applied to the structure. The main difference between this DLL format and the normal DLL control interface (used with external controllers) is that added stiffness is calculated initially leading to a more robust a fast solution of the coupled system. This force module can with good results be applied for external equivalent soil-springs or hydrodynamic forces for floating constructions or mooring lines.

Obl.

Command name

Explanation and parameters

name

1. Name used to reference the force DLL from output sensors.

*

filename

1. Filename incl. relative path to the external DLL (example ./dll/force.dll)

dll

deprecated alternative to filename

init

1. Name of subroutine in the DLL that is called before the simulation starts.

2. String passed to the init subroutine.

*

update

1. Name of subroutine in the DLL that is called at each time step to provide the forces and moments.

output

1. Name of subroutine in the DLL that is called at each time step to send the DLL output in the HAWC2 results file.

output_label

1. Name of subroutine in the DLL that is called at the beginning of the simulation to label the output channels. Requires the “output” command.

*

mbdy

1. Name of main body to which force DLL is coupled.

*

node

1. Node number of main body to which this force DLL is coupled.

Example of a DLL interface written in fortran90#


!
! Demonstration of force DLL
!
SUBROUTINE DemoForceDLL(time,x,xdot,xdot2,amat,omega,omegadot,F,M)
!DEC$ ATTRIBUTES DLLEXPORT::DemoForceDLL
!DEC$ ATTRIBUTES ALIAS:'demoforcedll' :: DemoForceDLL
! input
DOUBLE PRECISION         :: time  ! time
DOUBLE PRECISION ,DIMENSION(3)  :: x	   ! global pos. of reference node
DOUBLE PRECISION ,DIMENSION(3)  :: xdot  ! global vel. of reference node
DOUBLE PRECISION ,DIMENSION(3)  :: xdot2  ! global acc. of reference node 
DOUBLE PRECISION ,DIMENSION(3)  :: omega  ! angular vel. of ref. node 
					   ! (global base)
DOUBLE PRECISION ,DIMENSION(3)  :: omegadot ! angular acc. of ref. node 
						! (global base)
DOUBLE PRECISION ,DIMENSION(3,3) :: amat   ! rotation matrix (body -> 
						!         global)
! output
DOUBLE PRECISION ,DIMENSION(3)  :: F    ! External force in reference 
						! node (global base)
DOUBLE PRECISION ,DIMENSION(3)  :: M    ! External moment in reference 
						! node (global base)
! locals
LOGICAL, SAVE          :: bInit = .FALSE. ! Initialization flag
DOUBLE PRECISION         :: mass = 0.d0  ! Point mass
!
! Initialise on first call
IF (.NOT.bInit) THEN
  bInit = .TRUE.
  ! Open file and read mass
  OPEN(10,FILE="DemoForceDLL_mass.dat")
  READ(10,*) mass
  CLOSE(10)
ENDIF
!
! Calc. force
F = mass*((/0.d0,0.d0,9.81d0/) - xdot2)
M = 0.d0
!
END SUBROUTINE DemoForceDLL

Example of a DLL interface written in Lazarus / Pascal#


library force_dll;

Type
  vect = array[0..2] of double;
  mat  = array[0..2,0..2] of double;

procedure update(var time:double;var x:vect;var xdot:vect;var xdot2:vect;
      var amat:mat;var omega:mat;var omegadot:vect;
      var F,M:vect);stdcall;

// Example of applying a step up force in the x-direction:
begin
if time < 10 then
  F[0] := 0.0;
if time >= 10 then
  F[0] := 20000.0;
if time >= 20 then
  F[0] := 40000.0;
end;

exports update;

begin
  writeln('The DLL force_dll.dll is loaded with succes');
end.