![]() |
OpenFAST
Wind turbine multiphysics simulator
|
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'/) |
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
|
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.
[in] | t | Current simulation time in seconds |
[in] | n | time step number |
[in,out] | u | Inputs at t |
[in] | utimes | times of input |
[in] | p | Parameters |
[in,out] | x | Continuous states at t on input at t + dt on output |
[in] | xd | Discrete states at t |
[in] | z | Constraint states at t (possibly a guess) |
[in,out] | otherstate | Other states at t on input at t + dt on output |
[in,out] | m | Misc/optimization variables |
[out] | errstat | Error status of the operation |
[out] | errmsg | Error message if ErrStat /= ErrID_None |
|
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.
[in] | t | Current simulation time in seconds |
[in] | n | time step number |
[in,out] | u | Inputs at t |
[in] | utimes | times of input |
[in] | p | Parameters |
[in,out] | x | Continuous states at t on input at t + dt on output ! TODO TODO TODO IN |
[in] | xd | Discrete states at t |
[in] | z | Constraint states at t (possibly a guess) |
[in,out] | otherstate | Other states at t on input at t + dt on output |
[in,out] | m | Misc/optimization variables |
[out] | errstat | Error status of the operation |
[out] | errmsg | Error message if ErrStat /= ErrID_None |
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.
[in] | t | Current simulation time in seconds |
[in] | u | Inputs at t |
[in] | p | Parameters |
[in] | x | Continuous states at t |
[in] | xd | Discrete states at t |
[in] | z | Constraint states at t (possibly a guess) |
[in] | otherstate | Other states at t |
[in,out] | m | Misc variables for optimization (not copied in glue code) |
[out] | z_residual | Residual of the constraint state functions using the input values described above |
[out] | errstat | Error status of the operation |
[out] | errmsg | Error message if ErrStat /= ErrID_None |
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.
[in] | t | Current simulation time in seconds |
[in] | u | Inputs at t |
[in] | p | Parameters |
[in] | x | Continuous states at t |
[in] | xd | Discrete states at t |
[in] | z | Constraint states at t |
[in] | otherstate | Other states at t |
[in,out] | m | Misc variables for optimization (not copied in glue code) |
[out] | dxdt | Continuous state derivatives at t |
[out] | errstat | Error status of the operation |
[out] | errmsg | Error message if ErrStat /= ErrID_None |
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.
[in] | t | Current simulation time in seconds |
[in] | u | Inputs at t |
[in] | p | Parameters |
[in] | x | Continuous states at t |
[in] | xd | Discrete states at t |
[in] | z | Constraint states at t |
[in] | otherstate | Other states at t |
[in,out] | m | Misc variables for optimization (not copied in glue code) |
[in,out] | y | Outputs computed at t (Input only so that mesh con- nectivity information does not have to be recalculated) |
[out] | errstat | Error status of the operation |
[out] | errmsg | Error message if ErrStat /= ErrID_None |
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.
[in,out] | u | System inputs |
[in,out] | p | Parameters |
[in,out] | x | Continuous states |
[in,out] | xd | Discrete states |
[in,out] | z | Constraint states |
[in,out] | otherstate | Other states |
[in,out] | y | System outputs |
[in,out] | m | Misc variables for optimization (not copied in glue code) |
[out] | errstat | Error status of the operation |
[out] | errmsg | Error message if ErrStat /= ErrID_None |
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.
[in] | t | Time in seconds at operating point |
[in] | u | Inputs at operating point (may change to inout if a mesh copy is required) |
[in] | p | Parameters |
[in] | x | Continuous states at operating point |
[in] | xd | Discrete states at operating point |
[in] | z | Constraint states at operating point |
[in] | otherstate | Other states at operating point |
[in] | y | Output at operating point |
[in,out] | m | Misc/optimization variables |
[out] | errstat | Error status of the operation |
[out] | errmsg | Error message if ErrStat /= ErrID_None |
[in,out] | u_op | values of linearized inputs |
[in,out] | y_op | values of linearized outputs |
[in,out] | x_op | values of linearized continuous states |
[in,out] | dx_op | values of first time derivatives of linearized continuous states |
[in,out] | xd_op | values of linearized discrete states |
[in,out] | z_op | values of linearized constraint states |
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.
[in] | initinp | Input data for initialization routine |
[out] | u | An initial guess for the input; input mesh must be defined |
[out] | p | Parameters |
[out] | x | Initial continuous states |
[out] | xd | Initial discrete states |
[out] | z | Initial guess of the constraint states |
[out] | otherstate | Initial other states (logical, etc) |
[out] | y | Initial system outputs (outputs are not calculated; only the output mesh is initialized) |
[out] | m | Misc variables for optimization (not copied in glue code) |
[in,out] | dt_gluecode | Coupling 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] | initout | Output for initialization routine |
[out] | errstat | Error status of the operation |
[out] | errmsg | Error message if ErrStat /= ErrID_None |
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.
[in] | t | Time in seconds at operating point |
[in] | u | Inputs at operating point (may change to inout if a mesh copy is required) |
[in] | p | Parameters |
[in] | x | Continuous states at operating point |
[in] | xd | Discrete states at operating point |
[in] | z | Constraint states at operating point |
[in] | otherstate | Other states at operating point |
[in] | y | Output (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] | m | Misc/optimization variables |
[out] | errstat | Error status of the operation |
[out] | errmsg | Error message if ErrStat /= ErrID_None |
[in,out] | dydz | Partial derivatives of output functions (Y) with respect to the constraint states (z) [intent in to avoid deallocation] |
[in,out] | dxdz | Partial derivatives of continuous state functions (X) with respect to the constraint states (z) [intent in to avoid deallocation] |
[in,out] | dxddz | Partial derivatives of discrete state functions (Xd) with respect to the constraint states (z) [intent in to avoid deallocation] |
[in,out] | dzdz | Partial derivatives of constraint |
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.
[in] | t | Time in seconds at operating point |
[in] | u | Inputs at operating point (may change to inout if a mesh copy is required) |
[in] | p | Parameters |
[in] | x | Continuous states at operating point |
[in] | xd | Discrete states at operating point |
[in] | z | Constraint states at operating point |
[in] | otherstate | Other states at operating point |
[in] | y | Output (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] | m | Misc/optimization variables |
[out] | errstat | Error status of the operation |
[out] | errmsg | Error message if ErrStat /= ErrID_None |
[in,out] | dydx | Partial derivatives of output functions (Y) with respect to the continuous states (x) [intent in to avoid deallocation] |
[in,out] | dxdx | Partial derivatives of continuous state functions (X) with respect to the continuous states (x) [intent in to avoid deallocation] |
[in,out] | dxddx | Partial derivatives of discrete state functions (Xd) with respect to the continuous states (x) [intent in to avoid deallocation] |
[in,out] | dzdx | Partial derivatives of constraint state functions (Z) with respect to the continuous states (x) [intent in to avoid deallocation] |
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.
[in] | t | Time in seconds at operating point |
[in] | u | Inputs at operating point (may change to inout if a mesh copy is required) |
[in] | p | Parameters |
[in] | x | Continuous states at operating point |
[in] | xd | Discrete states at operating point |
[in] | z | Constraint states at operating point |
[in] | otherstate | Other states at operating point |
[in] | y | Output (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] | m | Misc/optimization variables |
[out] | errstat | Error status of the operation |
[out] | errmsg | Error message if ErrStat /= ErrID_None |
[in,out] | dydxd | Partial derivatives of output functions (Y) with respect to the discrete states (xd) [intent in to avoid deallocation] |
[in,out] | dxdxd | Partial derivatives of continuous state functions (X) with respect to the discrete states (xd) [intent in to avoid deallocation] |
[in,out] | dxddxd | Partial derivatives of discrete state functions (Xd) with respect to the discrete states (xd) [intent in to avoid deallocation] |
[in,out] | dzdxd | Partial derivatives of constraint state functions (Z) with respect to the |
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.
[in] | t | Time in seconds at operating point |
[in] | u | Inputs at operating point (may change to inout if a mesh copy is required) |
[in] | p | Parameters |
[in] | x | Continuous states at operating point |
[in] | xd | Discrete states at operating point |
[in] | z | Constraint states at operating point |
[in] | otherstate | Other states at operating point |
[in] | y | Output (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] | m | Misc/optimization variables |
[out] | errstat | Error status of the operation |
[out] | errmsg | Error message if ErrStat /= ErrID_None |
[in,out] | dydu | Partial derivatives of output functions (Y) with respect to the inputs (u) [intent in to avoid deallocation] |
[in,out] | dxdu | Partial derivatives of continuous state functions (X) with respect to the inputs (u) [intent in to avoid deallocation] |
[in,out] | dxddu | Partial derivatives of discrete state functions (Xd) with respect to the inputs (u) [intent in to avoid deallocation] |
[in,out] | dzdu | Partial derivatives of constraint state functions (Z) with respect to the inputs (u) [intent in to avoid deallocation] |
|
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.
[in] | t | Current simulation time in seconds |
[in] | n | time step number |
[in,out] | u | Inputs at t |
[in] | utimes | times of input |
[in] | p | Parameters |
[in,out] | x | Continuous states at t on input at t + dt on output |
[in] | xd | Discrete states at t |
[in] | z | Constraint states at t (possibly a guess) |
[in,out] | otherstate | Other states at t on input at t + dt on output |
[in,out] | m | Misc/optimization variables |
[out] | errstat | Error status of the operation |
[out] | errmsg | Error message if ErrStat /= ErrID_None |
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.
[in] | t | Current simulation time in seconds |
[in] | n | Current step of the simulation: t = n*Interval |
[in] | u | Inputs at t |
[in] | p | Parameters |
[in] | x | Continuous states at t |
[in,out] | xd | Input: Discrete states at t, Output: Discrete states at t + Interval |
[in] | z | Constraint states at t |
[in] | otherstate | Other states at t |
[in,out] | m | Misc variables for optimization (not copied in glue code) |
[out] | errstat | Error status of the operation |
[out] | errmsg | Error message if ErrStat /= ErrID_None |
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.
[in] | t | Current simulation time in seconds |
[in] | n | Current step of the simulation: t = n*Interval |
[in,out] | inputs | Inputs at InputTimes (output from this routine only because of record keeping in routines that copy meshes) |
[in] | inputtimes | Times in seconds associated with Inputs |
[in] | p | Parameters |
[in,out] | x | Input: Continuous states at t; Output: Continuous states at t + Interval |
[in,out] | xd | Input: Discrete states at t; Output: Discrete states at t + Interval |
[in,out] | z | Input: Constraint states at t; Output: Constraint states at t + Interval |
[in,out] | otherstate | Other states: Other states at t; Output: Other states at t + Interval |
[in,out] | m | Misc variables for optimization (not copied in glue code) |
[out] | errstat | Error status of the operation |
[out] | errmsg | Error message if ErrStat /= ErrID_None |
|
private |
[in,out] | u | System inputs |
[in,out] | y | System outputs |
[in] | initinp | Input data for initialization routine |
[out] | errstat | Error status of the operation |
[out] | errmsg | Error message if ErrStat /= ErrID_None |
|
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
|
private |
[in,out] | p | All the parameter matrices stored in this input file |
[out] | errstat | Error status |
[out] | errmsg | Error message |