OpenFAST
Wind turbine multiphysics simulator
Functions/Subroutines | Variables
extptfm_mckf Module Reference

The ExtPtfm_MCKF and ExtPtfm_MCKF_Types modules make up a template for creating user-defined calculations in the FAST Modularization Framework. More...

Functions/Subroutines

subroutine seterrstatsimple (ErrStat, ErrMess, RoutineName, LineNumber)
 Helper functions for the module. More...
 
subroutine, public extptfm_init (InitInp, u, p, x, xd, z, OtherState, y, m, dt_gluecode, InitOut, ErrStat, ErrMsg)
 This routine is called at the start of the simulation to perform initialization steps. More...
 
subroutine setstatematrices (p, ErrStat, ErrMsg)
 
subroutine init_meshes (u, y, InitInp, ErrStat, ErrMsg)
 
subroutine, public extptfm_end (u, p, x, xd, z, OtherState, y, m, ErrStat, ErrMsg)
 This routine is called at the end of the simulation. More...
 
subroutine extptfm_ab4 (t, n, u, utimes, p, x, xd, z, OtherState, m, ErrStat, ErrMsg)
 This subroutine implements the fourth-order Adams-Bashforth Method (RK4) for numerically integrating ordinary differential equations: Let f(t, x) = xdot denote the time (t) derivative of the continuous states (x). More...
 
subroutine extptfm_abm4 (t, n, u, utimes, p, x, xd, z, OtherState, m, ErrStat, ErrMsg)
 This subroutine implements the fourth-order Adams-Bashforth-Moulton Method (RK4) for numerically integrating ordinary differential equations: Let f(t, x) = xdot denote the time (t) derivative of the continuous states (x). More...
 
subroutine extptfm_rk4 (t, n, u, utimes, p, x, xd, z, OtherState, m, ErrStat, ErrMsg)
 This subroutine implements the fourth-order Runge-Kutta Method (RK4) for numerically integrating ordinary differential equations: Let f(t, x) = xdot denote the time (t) derivative of the continuous states (x). More...
 
subroutine, public extptfm_updatestates (t, n, Inputs, InputTimes, p, x, xd, z, OtherState, m, ErrStat, ErrMsg)
 This is a loose coupling routine for solving constraint states, integrating continuous states, and updating discrete and other states. More...
 
subroutine, public extptfm_calcoutput (t, u, p, x, xd, z, OtherState, y, m, ErrStat, ErrMsg)
 This is a routine for computing outputs, used in both loose and tight coupling. More...
 
subroutine, public extptfm_calccontstatederiv (t, u, p, x, xd, z, OtherState, m, dxdt, ErrStat, ErrMsg)
 This is a tight coupling routine for computing derivatives of continuous states. More...
 
subroutine, public extptfm_updatediscstate (t, n, u, p, x, xd, z, OtherState, m, ErrStat, ErrMsg)
 This is a tight coupling routine for updating discrete states. More...
 
subroutine, public extptfm_calcconstrstateresidual (t, u, p, x, xd, z, OtherState, m, Z_residual, ErrStat, ErrMsg)
 This is a tight coupling routine for solving for the residual of the constraint state functions. More...
 
subroutine, public extptfm_jacobianpinput (t, u, p, x, xd, z, OtherState, y, m, ErrStat, ErrMsg, dYdu, dXdu, dXddu, dZdu)
 Routine to compute the Jacobians of the output (Y), continuous- (X), discrete- (Xd), and constraint-state (Z) functions with respect to the inputs (u). More...
 
subroutine, public extptfm_jacobianpcontstate (t, u, p, x, xd, z, OtherState, y, m, ErrStat, ErrMsg, dYdx, dXdx, dXddx, dZdx)
 Routine to compute the Jacobians of the output (Y), continuous- (X), discrete- (Xd), and constraint-state (Z) functions with respect to the continuous states (x). More...
 
subroutine, public extptfm_jacobianpdiscstate (t, u, p, x, xd, z, OtherState, y, m, ErrStat, ErrMsg, dYdxd, dXdxd, dXddxd, dZdxd)
 Routine to compute the Jacobians of the output (Y), continuous- (X), discrete- (Xd), and constraint-state (Z) functions with respect to the discrete states (xd). More...
 
subroutine, public extptfm_jacobianpconstrstate (t, u, p, x, xd, z, OtherState, y, m, ErrStat, ErrMsg, dYdz, dXdz, dXddz, dZdz)
 Routine to compute the Jacobians of the output (Y), continuous- (X), discrete- (Xd), and constraint-state (Z) functions with respect to the constraint states (z). More...
 
subroutine, public extptfm_getop (t, u, p, x, xd, z, OtherState, y, m, ErrStat, ErrMsg, u_op, y_op, x_op, dx_op, xd_op, z_op)
 Routine to pack the data structures representing the operating points into arrays for linearization. More...
 

Variables

character(len=1), dimension(3), parameter xyz =(/'X','Y','Z'/)
 

Detailed Description

The ExtPtfm_MCKF and ExtPtfm_MCKF_Types modules make up a template for creating user-defined calculations in the FAST Modularization Framework.

ExtPtfm_MCKF_Types will be auto-generated by the FAST registry program, based on the variables specified in the ExtPtfm_MCKF_Registry.txt file.

This template file contains comments in the style required for Doxygen, and it contains methods for handling errors.

"ExtPtfm_MCKF" should be replaced with the name of your module. Example: ElastoDyn
"ExtPtfm" (in ExtPtfm_*) should be replaced with the module name or an abbreviation of it. Example: ED

Function/Subroutine Documentation

◆ extptfm_ab4()

subroutine extptfm_mckf::extptfm_ab4 ( real(dbki), intent(in)  t,
integer(intki), intent(in)  n,
type(extptfm_inputtype), dimension(:), intent(inout)  u,
real(dbki), dimension(:), intent(in)  utimes,
type(extptfm_parametertype), intent(in)  p,
type(extptfm_continuousstatetype), intent(inout)  x,
type(extptfm_discretestatetype), intent(in)  xd,
type(extptfm_constraintstatetype), intent(in)  z,
type(extptfm_otherstatetype), intent(inout)  OtherState,
type(extptfm_miscvartype), intent(inout)  m,
integer(intki), intent(out)  ErrStat,
character(*), intent(out)  ErrMsg 
)
private

This subroutine implements the fourth-order Adams-Bashforth Method (RK4) for numerically integrating ordinary differential equations: Let f(t, x) = xdot denote the time (t) derivative of the continuous states (x).

x(t+dt) = x(t) + (dt / 24.) * ( 55.*f(t,x) - 59.*f(t-dt,x) + 37.*f(t-2.*dt,x) - 9.*f(t-3.*dt,x) ) See, e.g., http://en.wikipedia.org/wiki/Linear_multistep_method K. E. Atkinson, "An Introduction to Numerical Analysis", 1989, John Wiley & Sons, Inc, Second Edition.

Parameters
[in]tCurrent simulation time in seconds
[in]ntime step number
[in,out]uInputs at t
[in]utimestimes of input
[in]pParameters
[in,out]xContinuous states at t on input at t + dt on output
[in]xdDiscrete states at t
[in]zConstraint states at t (possibly a guess)
[in,out]otherstateOther states at t on input at t + dt on output
[in,out]mMisc/optimization variables
[out]errstatError status of the operation
[out]errmsgError message if ErrStat /= ErrID_None

◆ extptfm_abm4()

subroutine extptfm_mckf::extptfm_abm4 ( real(dbki), intent(in)  t,
integer(intki), intent(in)  n,
type(extptfm_inputtype), dimension(:), intent(inout)  u,
real(dbki), dimension(:), intent(in)  utimes,
type(extptfm_parametertype), intent(in)  p,
type(extptfm_continuousstatetype), intent(inout)  x,
type(extptfm_discretestatetype), intent(in)  xd,
type(extptfm_constraintstatetype), intent(in)  z,
type(extptfm_otherstatetype), intent(inout)  OtherState,
type(extptfm_miscvartype), intent(inout)  m,
integer(intki), intent(out)  ErrStat,
character(*), intent(out)  ErrMsg 
)
private

This subroutine implements the fourth-order Adams-Bashforth-Moulton Method (RK4) for numerically integrating ordinary differential equations: Let f(t, x) = xdot denote the time (t) derivative of the continuous states (x).

Adams-Bashforth Predictor: x^p(t+dt) = x(t) + (dt / 24.) * ( 55.*f(t,x) - 59.*f(t-dt,x) + 37.*f(t-2.*dt,x) - 9.*f(t-3.*dt,x) ) Adams-Moulton Corrector: x(t+dt) = x(t) + (dt / 24.) * ( 9.*f(t+dt,x^p) + 19.*f(t,x) - 5.*f(t-dt,x) + 1.*f(t-2.*dt,x) ) See, e.g., http://en.wikipedia.org/wiki/Linear_multistep_method K. E. Atkinson, "An Introduction to Numerical Analysis", 1989, John Wiley & Sons, Inc, Second Edition.

Parameters
[in]tCurrent simulation time in seconds
[in]ntime step number
[in,out]uInputs at t
[in]utimestimes of input
[in]pParameters
[in,out]xContinuous states at t on input at t + dt on output ! TODO TODO TODO IN
[in]xdDiscrete states at t
[in]zConstraint states at t (possibly a guess)
[in,out]otherstateOther states at t on input at t + dt on output
[in,out]mMisc/optimization variables
[out]errstatError status of the operation
[out]errmsgError message if ErrStat /= ErrID_None

◆ extptfm_calcconstrstateresidual()

subroutine, public extptfm_mckf::extptfm_calcconstrstateresidual ( real(dbki), intent(in)  t,
type(extptfm_inputtype), intent(in)  u,
type(extptfm_parametertype), intent(in)  p,
type(extptfm_continuousstatetype), intent(in)  x,
type(extptfm_discretestatetype), intent(in)  xd,
type(extptfm_constraintstatetype), intent(in)  z,
type(extptfm_otherstatetype), intent(in)  OtherState,
type(extptfm_miscvartype), intent(inout)  m,
type(extptfm_constraintstatetype), intent(out)  Z_residual,
integer(intki), intent(out)  ErrStat,
character(*), intent(out)  ErrMsg 
)

This is a tight coupling routine for solving for the residual of the constraint state functions.

Parameters
[in]tCurrent simulation time in seconds
[in]uInputs at t
[in]pParameters
[in]xContinuous states at t
[in]xdDiscrete states at t
[in]zConstraint states at t (possibly a guess)
[in]otherstateOther states at t
[in,out]mMisc variables for optimization (not copied in glue code)
[out]z_residualResidual of the constraint state functions using the input values described above
[out]errstatError status of the operation
[out]errmsgError message if ErrStat /= ErrID_None

◆ extptfm_calccontstatederiv()

subroutine, public extptfm_mckf::extptfm_calccontstatederiv ( real(dbki), intent(in)  t,
type(extptfm_inputtype), intent(in)  u,
type(extptfm_parametertype), intent(in)  p,
type(extptfm_continuousstatetype), intent(in)  x,
type(extptfm_discretestatetype), intent(in)  xd,
type(extptfm_constraintstatetype), intent(in)  z,
type(extptfm_otherstatetype), intent(in)  OtherState,
type(extptfm_miscvartype), intent(inout)  m,
type(extptfm_continuousstatetype), intent(out)  dxdt,
integer(intki), intent(out)  ErrStat,
character(*), intent(out)  ErrMsg 
)

This is a tight coupling routine for computing derivatives of continuous states.

Parameters
[in]tCurrent simulation time in seconds
[in]uInputs at t
[in]pParameters
[in]xContinuous states at t
[in]xdDiscrete states at t
[in]zConstraint states at t
[in]otherstateOther states at t
[in,out]mMisc variables for optimization (not copied in glue code)
[out]dxdtContinuous state derivatives at t
[out]errstatError status of the operation
[out]errmsgError message if ErrStat /= ErrID_None

◆ extptfm_calcoutput()

subroutine, public extptfm_mckf::extptfm_calcoutput ( real(dbki), intent(in)  t,
type(extptfm_inputtype), intent(in)  u,
type(extptfm_parametertype), intent(in)  p,
type(extptfm_continuousstatetype), intent(in)  x,
type(extptfm_discretestatetype), intent(in)  xd,
type(extptfm_constraintstatetype), intent(in)  z,
type(extptfm_otherstatetype), intent(in)  OtherState,
type(extptfm_outputtype), intent(inout)  y,
type(extptfm_miscvartype), intent(inout)  m,
integer(intki), intent(out)  ErrStat,
character(*), intent(out)  ErrMsg 
)

This is a routine for computing outputs, used in both loose and tight coupling.

Parameters
[in]tCurrent simulation time in seconds
[in]uInputs at t
[in]pParameters
[in]xContinuous states at t
[in]xdDiscrete states at t
[in]zConstraint states at t
[in]otherstateOther states at t
[in,out]mMisc variables for optimization (not copied in glue code)
[in,out]yOutputs computed at t (Input only so that mesh con- nectivity information does not have to be recalculated)
[out]errstatError status of the operation
[out]errmsgError message if ErrStat /= ErrID_None

◆ extptfm_end()

subroutine, public extptfm_mckf::extptfm_end ( type(extptfm_inputtype), intent(inout)  u,
type(extptfm_parametertype), intent(inout)  p,
type(extptfm_continuousstatetype), intent(inout)  x,
type(extptfm_discretestatetype), intent(inout)  xd,
type(extptfm_constraintstatetype), intent(inout)  z,
type(extptfm_otherstatetype), intent(inout)  OtherState,
type(extptfm_outputtype), intent(inout)  y,
type(extptfm_miscvartype), intent(inout)  m,
integer(intki), intent(out)  ErrStat,
character(*), intent(out)  ErrMsg 
)

This routine is called at the end of the simulation.

Parameters
[in,out]uSystem inputs
[in,out]pParameters
[in,out]xContinuous states
[in,out]xdDiscrete states
[in,out]zConstraint states
[in,out]otherstateOther states
[in,out]ySystem outputs
[in,out]mMisc variables for optimization (not copied in glue code)
[out]errstatError status of the operation
[out]errmsgError message if ErrStat /= ErrID_None

◆ extptfm_getop()

subroutine, public extptfm_mckf::extptfm_getop ( real(dbki), intent(in)  t,
type(extptfm_inputtype), intent(in)  u,
type(extptfm_parametertype), intent(in)  p,
type(extptfm_continuousstatetype), intent(in)  x,
type(extptfm_discretestatetype), intent(in)  xd,
type(extptfm_constraintstatetype), intent(in)  z,
type(extptfm_otherstatetype), intent(in)  OtherState,
type(extptfm_outputtype), intent(in)  y,
type(extptfm_miscvartype), intent(inout)  m,
integer(intki), intent(out)  ErrStat,
character(*), intent(out)  ErrMsg,
real(reki), dimension(:), intent(inout), optional, allocatable  u_op,
real(reki), dimension(:), intent(inout), optional, allocatable  y_op,
real(reki), dimension(:), intent(inout), optional, allocatable  x_op,
real(reki), dimension(:), intent(inout), optional, allocatable  dx_op,
real(reki), dimension(:), intent(inout), optional, allocatable  xd_op,
real(reki), dimension(:), intent(inout), optional, allocatable  z_op 
)

Routine to pack the data structures representing the operating points into arrays for linearization.

Parameters
[in]tTime in seconds at operating point
[in]uInputs at operating point (may change to inout if a mesh copy is required)
[in]pParameters
[in]xContinuous states at operating point
[in]xdDiscrete states at operating point
[in]zConstraint states at operating point
[in]otherstateOther states at operating point
[in]yOutput at operating point
[in,out]mMisc/optimization variables
[out]errstatError status of the operation
[out]errmsgError message if ErrStat /= ErrID_None
[in,out]u_opvalues of linearized inputs
[in,out]y_opvalues of linearized outputs
[in,out]x_opvalues of linearized continuous states
[in,out]dx_opvalues of first time derivatives of linearized continuous states
[in,out]xd_opvalues of linearized discrete states
[in,out]z_opvalues of linearized constraint states

◆ extptfm_init()

subroutine, public extptfm_mckf::extptfm_init ( type(extptfm_initinputtype), intent(in)  InitInp,
type(extptfm_inputtype), intent(out)  u,
type(extptfm_parametertype), intent(out)  p,
type(extptfm_continuousstatetype), intent(out)  x,
type(extptfm_discretestatetype), intent(out)  xd,
type(extptfm_constraintstatetype), intent(out)  z,
type(extptfm_otherstatetype), intent(out)  OtherState,
type(extptfm_outputtype), intent(out)  y,
type(extptfm_miscvartype), intent(out)  m,
real(dbki), intent(inout)  dt_gluecode,
type(extptfm_initoutputtype), intent(out)  InitOut,
integer(intki), intent(out)  ErrStat,
character(*), intent(out)  ErrMsg 
)

This routine is called at the start of the simulation to perform initialization steps.

The parameters are set here and not changed during the simulation. The initial states and initial guess for the input are defined.

Parameters
[in]initinpInput data for initialization routine
[out]uAn initial guess for the input; input mesh must be defined
[out]pParameters
[out]xInitial continuous states
[out]xdInitial discrete states
[out]zInitial guess of the constraint states
[out]otherstateInitial other states (logical, etc)
[out]yInitial system outputs (outputs are not calculated; only the output mesh is initialized)
[out]mMisc variables for optimization (not copied in glue code)
[in,out]dt_gluecodeCoupling interval in seconds: the rate that (1) ExtPtfm_UpdateStates() is called in loose coupling & (2) ExtPtfm_UpdateDiscState() is called in tight coupling. Input is the suggested time from the glue code; Output is the actual coupling interval that will be used by the glue code.
[out]initoutOutput for initialization routine
[out]errstatError status of the operation
[out]errmsgError message if ErrStat /= ErrID_None

◆ extptfm_jacobianpconstrstate()

subroutine, public extptfm_mckf::extptfm_jacobianpconstrstate ( real(dbki), intent(in)  t,
type(extptfm_inputtype), intent(in)  u,
type(extptfm_parametertype), intent(in)  p,
type(extptfm_continuousstatetype), intent(in)  x,
type(extptfm_discretestatetype), intent(in)  xd,
type(extptfm_constraintstatetype), intent(in)  z,
type(extptfm_otherstatetype), intent(in)  OtherState,
type(extptfm_outputtype), intent(in)  y,
type(extptfm_miscvartype), intent(inout)  m,
integer(intki), intent(out)  ErrStat,
character(*), intent(out)  ErrMsg,
real(r8ki), dimension(:,:), intent(inout), optional, allocatable  dYdz,
real(r8ki), dimension(:,:), intent(inout), optional, allocatable  dXdz,
real(r8ki), dimension(:,:), intent(inout), optional, allocatable  dXddz,
real(r8ki), dimension(:,:), intent(inout), optional, allocatable  dZdz 
)

Routine to compute the Jacobians of the output (Y), continuous- (X), discrete- (Xd), and constraint-state (Z) functions with respect to the constraint states (z).

The partial derivatives dY/dz, dX/dz, dXd/dz, and DZ/dz are returned.

Parameters
[in]tTime in seconds at operating point
[in]uInputs at operating point (may change to inout if a mesh copy is required)
[in]pParameters
[in]xContinuous states at operating point
[in]xdDiscrete states at operating point
[in]zConstraint states at operating point
[in]otherstateOther states at operating point
[in]yOutput (change to inout if a mesh copy is required); Output fields are not used by this routine, but type is available here so that mesh parameter information (i.e., connectivity) does not have to be recalculated for dYdz.
[in,out]mMisc/optimization variables
[out]errstatError status of the operation
[out]errmsgError message if ErrStat /= ErrID_None
[in,out]dydzPartial derivatives of output functions (Y) with respect to the constraint states (z) [intent in to avoid deallocation]
[in,out]dxdzPartial derivatives of continuous state functions (X) with respect to the constraint states (z) [intent in to avoid deallocation]
[in,out]dxddzPartial derivatives of discrete state functions (Xd) with respect to the constraint states (z) [intent in to avoid deallocation]
[in,out]dzdzPartial derivatives of constraint

◆ extptfm_jacobianpcontstate()

subroutine, public extptfm_mckf::extptfm_jacobianpcontstate ( real(dbki), intent(in)  t,
type(extptfm_inputtype), intent(in)  u,
type(extptfm_parametertype), intent(in)  p,
type(extptfm_continuousstatetype), intent(in)  x,
type(extptfm_discretestatetype), intent(in)  xd,
type(extptfm_constraintstatetype), intent(in)  z,
type(extptfm_otherstatetype), intent(in)  OtherState,
type(extptfm_outputtype), intent(in)  y,
type(extptfm_miscvartype), intent(inout)  m,
integer(intki), intent(out)  ErrStat,
character(*), intent(out)  ErrMsg,
real(r8ki), dimension(:,:), intent(inout), optional, allocatable  dYdx,
real(r8ki), dimension(:,:), intent(inout), optional, allocatable  dXdx,
real(r8ki), dimension(:,:), intent(inout), optional, allocatable  dXddx,
real(r8ki), dimension(:,:), intent(inout), optional, allocatable  dZdx 
)

Routine to compute the Jacobians of the output (Y), continuous- (X), discrete- (Xd), and constraint-state (Z) functions with respect to the continuous states (x).

The partial derivatives dY/dx, dX/dx, dXd/dx, and DZ/dx are returned.

Parameters
[in]tTime in seconds at operating point
[in]uInputs at operating point (may change to inout if a mesh copy is required)
[in]pParameters
[in]xContinuous states at operating point
[in]xdDiscrete states at operating point
[in]zConstraint states at operating point
[in]otherstateOther states at operating point
[in]yOutput (change to inout if a mesh copy is required); Output fields are not used by this routine, but type is available here so that mesh parameter information (i.e., connectivity) does not have to be recalculated for dYdx.
[in,out]mMisc/optimization variables
[out]errstatError status of the operation
[out]errmsgError message if ErrStat /= ErrID_None
[in,out]dydxPartial derivatives of output functions (Y) with respect to the continuous states (x) [intent in to avoid deallocation]
[in,out]dxdxPartial derivatives of continuous state functions (X) with respect to the continuous states (x) [intent in to avoid deallocation]
[in,out]dxddxPartial derivatives of discrete state functions (Xd) with respect to the continuous states (x) [intent in to avoid deallocation]
[in,out]dzdxPartial derivatives of constraint state functions (Z) with respect to the continuous states (x) [intent in to avoid deallocation]

◆ extptfm_jacobianpdiscstate()

subroutine, public extptfm_mckf::extptfm_jacobianpdiscstate ( real(dbki), intent(in)  t,
type(extptfm_inputtype), intent(in)  u,
type(extptfm_parametertype), intent(in)  p,
type(extptfm_continuousstatetype), intent(in)  x,
type(extptfm_discretestatetype), intent(in)  xd,
type(extptfm_constraintstatetype), intent(in)  z,
type(extptfm_otherstatetype), intent(in)  OtherState,
type(extptfm_outputtype), intent(in)  y,
type(extptfm_miscvartype), intent(inout)  m,
integer(intki), intent(out)  ErrStat,
character(*), intent(out)  ErrMsg,
real(r8ki), dimension(:,:), intent(inout), optional, allocatable  dYdxd,
real(r8ki), dimension(:,:), intent(inout), optional, allocatable  dXdxd,
real(r8ki), dimension(:,:), intent(inout), optional, allocatable  dXddxd,
real(r8ki), dimension(:,:), intent(inout), optional, allocatable  dZdxd 
)

Routine to compute the Jacobians of the output (Y), continuous- (X), discrete- (Xd), and constraint-state (Z) functions with respect to the discrete states (xd).

The partial derivatives dY/dxd, dX/dxd, dXd/dxd, and DZ/dxd are returned.

Parameters
[in]tTime in seconds at operating point
[in]uInputs at operating point (may change to inout if a mesh copy is required)
[in]pParameters
[in]xContinuous states at operating point
[in]xdDiscrete states at operating point
[in]zConstraint states at operating point
[in]otherstateOther states at operating point
[in]yOutput (change to inout if a mesh copy is required); Output fields are not used by this routine, but type is available here so that mesh parameter information (i.e., connectivity) does not have to be recalculated for dYdxd.
[in,out]mMisc/optimization variables
[out]errstatError status of the operation
[out]errmsgError message if ErrStat /= ErrID_None
[in,out]dydxdPartial derivatives of output functions (Y) with respect to the discrete states (xd) [intent in to avoid deallocation]
[in,out]dxdxdPartial derivatives of continuous state functions (X) with respect to the discrete states (xd) [intent in to avoid deallocation]
[in,out]dxddxdPartial derivatives of discrete state functions (Xd) with respect to the discrete states (xd) [intent in to avoid deallocation]
[in,out]dzdxdPartial derivatives of constraint state functions (Z) with respect to the

◆ extptfm_jacobianpinput()

subroutine, public extptfm_mckf::extptfm_jacobianpinput ( real(dbki), intent(in)  t,
type(extptfm_inputtype), intent(in)  u,
type(extptfm_parametertype), intent(in)  p,
type(extptfm_continuousstatetype), intent(in)  x,
type(extptfm_discretestatetype), intent(in)  xd,
type(extptfm_constraintstatetype), intent(in)  z,
type(extptfm_otherstatetype), intent(in)  OtherState,
type(extptfm_outputtype), intent(in)  y,
type(extptfm_miscvartype), intent(inout)  m,
integer(intki), intent(out)  ErrStat,
character(*), intent(out)  ErrMsg,
real(r8ki), dimension(:,:), intent(inout), optional, allocatable  dYdu,
real(r8ki), dimension(:,:), intent(inout), optional, allocatable  dXdu,
real(r8ki), dimension(:,:), intent(inout), optional, allocatable  dXddu,
real(r8ki), dimension(:,:), intent(inout), optional, allocatable  dZdu 
)

Routine to compute the Jacobians of the output (Y), continuous- (X), discrete- (Xd), and constraint-state (Z) functions with respect to the inputs (u).

The partial derivatives dY/du, dX/du, dXd/du, and DZ/du are returned.

Parameters
[in]tTime in seconds at operating point
[in]uInputs at operating point (may change to inout if a mesh copy is required)
[in]pParameters
[in]xContinuous states at operating point
[in]xdDiscrete states at operating point
[in]zConstraint states at operating point
[in]otherstateOther states at operating point
[in]yOutput (change to inout if a mesh copy is required); Output fields are not used by this routine, but type is available here so that mesh parameter information (i.e., connectivity) does not have to be recalculated for dYdu.
[in,out]mMisc/optimization variables
[out]errstatError status of the operation
[out]errmsgError message if ErrStat /= ErrID_None
[in,out]dyduPartial derivatives of output functions (Y) with respect to the inputs (u) [intent in to avoid deallocation]
[in,out]dxduPartial derivatives of continuous state functions (X) with respect to the inputs (u) [intent in to avoid deallocation]
[in,out]dxdduPartial derivatives of discrete state functions (Xd) with respect to the inputs (u) [intent in to avoid deallocation]
[in,out]dzduPartial derivatives of constraint state functions (Z) with respect to the inputs (u) [intent in to avoid deallocation]

◆ extptfm_rk4()

subroutine extptfm_mckf::extptfm_rk4 ( real(dbki), intent(in)  t,
integer(intki), intent(in)  n,
type(extptfm_inputtype), dimension(:), intent(inout)  u,
real(dbki), dimension(:), intent(in)  utimes,
type(extptfm_parametertype), intent(in)  p,
type(extptfm_continuousstatetype), intent(inout)  x,
type(extptfm_discretestatetype), intent(in)  xd,
type(extptfm_constraintstatetype), intent(in)  z,
type(extptfm_otherstatetype), intent(inout)  OtherState,
type(extptfm_miscvartype), intent(inout)  m,
integer(intki), intent(out)  ErrStat,
character(*), intent(out)  ErrMsg 
)
private

This subroutine implements the fourth-order Runge-Kutta Method (RK4) for numerically integrating ordinary differential equations: Let f(t, x) = xdot denote the time (t) derivative of the continuous states (x).

Define constants k1, k2, k3, and k4 as k1 = dt * f(t , x_t ) k2 = dt * f(t + dt/2 , x_t + k1/2 ) k3 = dt * f(t + dt/2 , x_t + k2/2 ), and k4 = dt * f(t + dt , x_t + k3 ). Then the continuous states at t = t + dt are x_(t+dt) = x_t + k1/6 + k2/3 + k3/3 + k4/6 + O(dt^5) For details, see: Press, W. H.; Flannery, B. P.; Teukolsky, S. A.; and Vetterling, W. T. "Runge-Kutta Method" and "Adaptive Step Size Control for Runge-Kutta." sections 16.1 and 16.2 in Numerical Recipes in FORTRAN: The Art of Scientific Computing, 2nd ed. Cambridge, England: Cambridge University Press, pp. 704-716, 1992.

Parameters
[in]tCurrent simulation time in seconds
[in]ntime step number
[in,out]uInputs at t
[in]utimestimes of input
[in]pParameters
[in,out]xContinuous states at t on input at t + dt on output
[in]xdDiscrete states at t
[in]zConstraint states at t (possibly a guess)
[in,out]otherstateOther states at t on input at t + dt on output
[in,out]mMisc/optimization variables
[out]errstatError status of the operation
[out]errmsgError message if ErrStat /= ErrID_None

◆ extptfm_updatediscstate()

subroutine, public extptfm_mckf::extptfm_updatediscstate ( real(dbki), intent(in)  t,
integer(intki), intent(in)  n,
type(extptfm_inputtype), intent(in)  u,
type(extptfm_parametertype), intent(in)  p,
type(extptfm_continuousstatetype), intent(in)  x,
type(extptfm_discretestatetype), intent(inout)  xd,
type(extptfm_constraintstatetype), intent(in)  z,
type(extptfm_otherstatetype), intent(in)  OtherState,
type(extptfm_miscvartype), intent(inout)  m,
integer(intki), intent(out)  ErrStat,
character(*), intent(out)  ErrMsg 
)

This is a tight coupling routine for updating discrete states.

Parameters
[in]tCurrent simulation time in seconds
[in]nCurrent step of the simulation: t = n*Interval
[in]uInputs at t
[in]pParameters
[in]xContinuous states at t
[in,out]xdInput: Discrete states at t, Output: Discrete states at t + Interval
[in]zConstraint states at t
[in]otherstateOther states at t
[in,out]mMisc variables for optimization (not copied in glue code)
[out]errstatError status of the operation
[out]errmsgError message if ErrStat /= ErrID_None

◆ extptfm_updatestates()

subroutine, public extptfm_mckf::extptfm_updatestates ( real(dbki), intent(in)  t,
integer(intki), intent(in)  n,
type(extptfm_inputtype), dimension(:), intent(inout)  Inputs,
real(dbki), dimension(:), intent(in)  InputTimes,
type(extptfm_parametertype), intent(in)  p,
type(extptfm_continuousstatetype), intent(inout)  x,
type(extptfm_discretestatetype), intent(inout)  xd,
type(extptfm_constraintstatetype), intent(inout)  z,
type(extptfm_otherstatetype), intent(inout)  OtherState,
type(extptfm_miscvartype), intent(inout)  m,
integer(intki), intent(out)  ErrStat,
character(*), intent(out)  ErrMsg 
)

This is a loose coupling routine for solving constraint states, integrating continuous states, and updating discrete and other states.

Continuous, constraint, discrete, and other states are updated to values at t + Interval.

Parameters
[in]tCurrent simulation time in seconds
[in]nCurrent step of the simulation: t = n*Interval
[in,out]inputsInputs at InputTimes (output from this routine only because of record keeping in routines that copy meshes)
[in]inputtimesTimes in seconds associated with Inputs
[in]pParameters
[in,out]xInput: Continuous states at t; Output: Continuous states at t + Interval
[in,out]xdInput: Discrete states at t; Output: Discrete states at t + Interval
[in,out]zInput: Constraint states at t; Output: Constraint states at t + Interval
[in,out]otherstateOther states: Other states at t; Output: Other states at t + Interval
[in,out]mMisc variables for optimization (not copied in glue code)
[out]errstatError status of the operation
[out]errmsgError message if ErrStat /= ErrID_None

◆ init_meshes()

subroutine extptfm_mckf::init_meshes ( type(extptfm_inputtype), intent(inout)  u,
type(extptfm_outputtype), intent(inout)  y,
type(extptfm_initinputtype), intent(in)  InitInp,
integer(intki), intent(out)  ErrStat,
character(*), intent(out)  ErrMsg 
)
private
Parameters
[in,out]uSystem inputs
[in,out]ySystem outputs
[in]initinpInput data for initialization routine
[out]errstatError status of the operation
[out]errmsgError message if ErrStat /= ErrID_None

◆ seterrstatsimple()

subroutine extptfm_mckf::seterrstatsimple ( integer(intki), intent(inout)  ErrStat,
character(*), intent(inout)  ErrMess,
character(*), intent(in)  RoutineName,
integer(intki), intent(in), optional  LineNumber 
)
private

Helper functions for the module.

This routine sets the error status and error message for a routine, it's a simplified version of SetErrStat from NWTC_Library

◆ setstatematrices()

subroutine extptfm_mckf::setstatematrices ( type(extptfm_parametertype), intent(inout)  p,
integer(intki), intent(out)  ErrStat,
character(*), intent(out)  ErrMsg 
)
private
Parameters
[in,out]pAll the parameter matrices stored in this input file
[out]errstatError status
[out]errmsgError message