HQP  1.9.6
Hxi_SimStruct.h File Reference

Declaration of Simulink(R) S-function methods supported by Hqp. More...

#include <stdio.h>
#include <stdlib.h>
#include "Hxi_sfun_types.h"
#include "Hxi_SimStruct_methods.h"
Include dependency graph for Hxi_SimStruct.h:
This graph shows which files directly or indirectly include this file:

Macros

#define HXI_EXTERN   extern
 
Definitions used outside S-functions as well

Avoid multiple inclusion

#define CONTINUOUS_SAMPLE_TIME   0.0
 
Declaration of S-function methods.

defined(HXI_INLINE_S_FUNCTION)

#define HXI_SS_IS0(ITEM)
 
#define HXI_SS_NOSET0(ITEM)
 
#define HXI_SS_SETGET1(ITEM, TYPE, ARG)
 
#define HXI_SS_SET1(ITEM, TYPE, ARG)
 
#define HXI_SS_NOSET1(ITEM, TYPE, ARG)
 
#define HXI_SS_GET1(ITEM, TYPE)
 
#define HXI_SS_IS1(ITEM, TYPE1, ARG1)
 
#define HXI_SS_SETGET2(ITEM, TYPE1, ARG1, TYPE, ARG)
 
#define HXI_SS_NOSETGET2(ITEM, TYPE1, ARG1, TYPE, ARG)
 
#define HXI_SS_SET2(ITEM, TYPE1, ARG1, TYPE, ARG)
 
#define HXI_SS_NOSET2(ITEM, TYPE1, ARG1, TYPE, ARG)
 
#define HXI_SS_GET2(ITEM, TYPE1, ARG1, TYPE)
 
#define HXI_SS_IS2(ITEM, TYPE1, ARG1, TYPE2, ARG2)
 
Declarations of mxArray methods.
#define HXI_MX_CREATE1(WHAT, TYPE1, ARG1)
 
#define HXI_MX_CREATE3(WHAT, TYPE1, ARG1, TYPE2, ARG2, TYPE3, ARG3)
 
#define HXI_MX_DESTROY(WHAT)
 
#define HXI_MX_IS0(ITEM)
 
#define HXI_MX_SETGET1(ITEM, TYPE, ARG)
 
#define HXI_MX_GET1(ITEM, TYPE)
 
#define HXI_MX_TO1(ITEM, TYPE)
 

Typedefs

typedef struct SimStruct SimStruct
 
typedef struct mxArray mxArray
 
typedef void( SFunctionMethod1_type )(SimStruct *S)
 S-function method type. More...
 
typedef void( SFunctionMethod2_type )(SimStruct *S, int_T tid)
 S-function method type with additional task id argument. More...
 

Functions

HXI_EXTERN SimStruct * Hxi_SimStruct_create (const char *path)
 Construct a SimStruct for given path. More...
 
HXI_EXTERN void Hxi_SimStruct_destroy (SimStruct *S)
 Delete a SimStruct. More...
 
HXI_EXTERN void mxFree (void *p)
 Free memory allocated though mx methods, e.g. More...
 
Supported S-function methods.
HXI_EXTERN void Hxi_mdlInitializeSizes (SimStruct *S)
 Initialize sizes of data vectors in SimStruct. More...
 
HXI_EXTERN void Hxi_mdlStart (SimStruct *S)
 Optional: Allocate local ressources for simulation. More...
 
HXI_EXTERN void Hxi_mdlInitializeSampleTimes (SimStruct *S)
 Initialize sample times. More...
 
HXI_EXTERN void Hxi_mdlInitializeConditions (SimStruct *S)
 Optional: Compute initial conditions. More...
 
HXI_EXTERN void Hxi_mdlOutputs (SimStruct *S, int_T tid)
 Compute model outputs. More...
 
HXI_EXTERN void Hxi_mdlUpdate (SimStruct *S, int_T tid)
 Optional: Update discrete-time states. More...
 
HXI_EXTERN void Hxi_mdlDerivatives (SimStruct *S)
 Optional: Compute derivatives for continuous-time states. More...
 
HXI_EXTERN void Hxi_mdlJacobian (SimStruct *S)
 Optional: Compute Jacobian J = d(dxc,xd,y)/d(xc,xd,u). More...
 
HXI_EXTERN void Hxi_mdlTerminate (SimStruct *S)
 Release resources allocated for simulation. More...
 

Detailed Description

Declaration of Simulink(R) S-function methods supported by Hqp.

(Simulink is a registered trademark of The MathWorks, Inc.)

rf, 05/05/2001

Macro Definition Documentation

#define HXI_MX_CREATE1 (   WHAT,
  TYPE1,
  ARG1 
)
Value:
HXI_EXTERN mxArray* hmxCreate##WHAT(SimStruct *S, TYPE1 ARG1); \
inline mxArray* mxCreate##WHAT(TYPE1 ARG1) { \
return hmxCreate##WHAT(NULL, ARG1); \
}
#define HXI_MX_CREATE3 (   WHAT,
  TYPE1,
  ARG1,
  TYPE2,
  ARG2,
  TYPE3,
  ARG3 
)
Value:
HXI_EXTERN mxArray* hmxCreate##WHAT(SimStruct *S, TYPE1 ARG1, TYPE2 ARG2, TYPE3 ARG3); \
inline mxArray* mxCreate##WHAT(TYPE1 ARG1, TYPE2 ARG2, TYPE3 ARG3) { \
return hmxCreate##WHAT(NULL, ARG1, ARG2, ARG3); \
}
#define HXI_MX_DESTROY (   WHAT)
Value:
HXI_EXTERN void hmxDestroy##WHAT(mxArray *a); \
inline void mxDestroy##WHAT(mxArray *a) { \
hmxDestroy##WHAT(a); \
}
#define HXI_MX_GET1 (   ITEM,
  TYPE 
)
Value:
HXI_EXTERN TYPE hmxGet##ITEM(const mxArray *a); \
inline TYPE mxGet##ITEM(const mxArray *a) { \
return hmxGet##ITEM(a); \
}
#define HXI_MX_IS0 (   ITEM)
Value:
HXI_EXTERN int_T hmxIs##ITEM(const mxArray *a); \
inline int_T mxIs##ITEM(const mxArray *a) { \
return hmxIs##ITEM(a); \
}
int int_T
Integer type used in S-function.
Definition: Hxi_sfun_types.h:32
#define HXI_MX_SETGET1 (   ITEM,
  TYPE,
  ARG 
)
Value:
HXI_EXTERN void hmxSet##ITEM(mxArray *a, TYPE ARG); \
inline void mxSet##ITEM(mxArray *a, TYPE ARG) { \
hmxSet##ITEM(a, ARG); \
} \
HXI_EXTERN TYPE hmxGet##ITEM(const mxArray *a); \
inline TYPE mxGet##ITEM(const mxArray *a) { \
return hmxGet##ITEM(a); \
}
#define HXI_MX_TO1 (   ITEM,
  TYPE 
)
Value:
HXI_EXTERN TYPE hmxArrayTo##ITEM(const mxArray *a); \
inline TYPE mxArrayTo##ITEM(const mxArray *a) { \
return hmxArrayTo##ITEM(a); \
}
#define HXI_SS_GET1 (   ITEM,
  TYPE 
)
Value:
HXI_EXTERN TYPE hssGet##ITEM(SimStruct *S); \
inline TYPE ssGet##ITEM(SimStruct *S) { \
return hssGet##ITEM(S); \
}
#define HXI_SS_GET2 (   ITEM,
  TYPE1,
  ARG1,
  TYPE 
)
Value:
HXI_EXTERN TYPE hssGet##ITEM(SimStruct *S, TYPE1 ARG1); \
inline TYPE ssGet##ITEM(SimStruct *S, TYPE1 ARG1) { \
return hssGet##ITEM(S, ARG1); \
}
#define HXI_SS_IS0 (   ITEM)
Value:
HXI_EXTERN int_T hssIs##ITEM(SimStruct *S); \
inline int_T ssIs##ITEM(SimStruct *S) { \
return hssIs##ITEM(S); \
}
int int_T
Integer type used in S-function.
Definition: Hxi_sfun_types.h:32
#define HXI_SS_IS1 (   ITEM,
  TYPE1,
  ARG1 
)
Value:
HXI_EXTERN int_T hssIs##ITEM(SimStruct *S, TYPE1 ARG1); \
inline int_T ssIs##ITEM(SimStruct *S, TYPE1 ARG1) { \
return hssIs##ITEM(S, ARG1); \
}
int int_T
Integer type used in S-function.
Definition: Hxi_sfun_types.h:32
#define HXI_SS_IS2 (   ITEM,
  TYPE1,
  ARG1,
  TYPE2,
  ARG2 
)
Value:
HXI_EXTERN int_T hssIs##ITEM(SimStruct *S, TYPE1 ARG1, TYPE2 ARG2); \
inline int_T ssIs##ITEM(SimStruct *S, TYPE1 ARG1, TYPE2 ARG2) { \
return hssIs##ITEM(S, ARG1, ARG2); \
}
int int_T
Integer type used in S-function.
Definition: Hxi_sfun_types.h:32
#define HXI_SS_NOSET0 (   ITEM)
Value:
inline void ssSet##ITEM(SimStruct *S) { \
}
#define HXI_SS_NOSET1 (   ITEM,
  TYPE,
  ARG 
)
Value:
inline TYPE ssSet##ITEM(SimStruct *S, TYPE ARG) { \
return (TYPE)0; \
}
#define HXI_SS_NOSET2 (   ITEM,
  TYPE1,
  ARG1,
  TYPE,
  ARG 
)
Value:
inline TYPE ssSet##ITEM(SimStruct *S, TYPE1 ARG1, TYPE ARG) { \
return (TYPE)0; \
}
#define HXI_SS_NOSETGET2 (   ITEM,
  TYPE1,
  ARG1,
  TYPE,
  ARG 
)
Value:
inline TYPE ssSet##ITEM(SimStruct *S, TYPE1 ARG1, TYPE ARG) { \
return (TYPE)0; \
} \
inline TYPE ssGet##ITEM(SimStruct *S, TYPE1 ARG1) { \
return (TYPE)0; \
}
#define HXI_SS_SET1 (   ITEM,
  TYPE,
  ARG 
)
Value:
HXI_EXTERN TYPE hssSet##ITEM(SimStruct *S, TYPE ARG); \
inline TYPE ssSet##ITEM(SimStruct *S, TYPE ARG) { \
return hssSet##ITEM(S, ARG); \
}
#define HXI_SS_SET2 (   ITEM,
  TYPE1,
  ARG1,
  TYPE,
  ARG 
)
Value:
HXI_EXTERN TYPE hssSet##ITEM(SimStruct *S, TYPE1 ARG1, TYPE ARG); \
inline TYPE ssSet##ITEM(SimStruct *S, TYPE1 ARG1, TYPE ARG) { \
return hssSet##ITEM(S, ARG1, ARG); \
}
#define HXI_SS_SETGET1 (   ITEM,
  TYPE,
  ARG 
)
Value:
HXI_EXTERN TYPE hssSet##ITEM(SimStruct *S, TYPE ARG); \
inline TYPE ssSet##ITEM(SimStruct *S, TYPE ARG) { \
return hssSet##ITEM(S, ARG); \
} \
HXI_EXTERN TYPE hssGet##ITEM(SimStruct *S); \
inline TYPE ssGet##ITEM(SimStruct *S) { \
return hssGet##ITEM(S); \
}
#define HXI_SS_SETGET2 (   ITEM,
  TYPE1,
  ARG1,
  TYPE,
  ARG 
)
Value:
HXI_EXTERN TYPE hssSet##ITEM(SimStruct *S, TYPE1 ARG1, TYPE ARG); \
inline TYPE ssSet##ITEM(SimStruct *S, TYPE1 ARG1, TYPE ARG) { \
return hssSet##ITEM(S, ARG1, ARG); \
} \
HXI_EXTERN TYPE hssGet##ITEM(SimStruct *S, TYPE1 ARG1); \
inline TYPE ssGet##ITEM(SimStruct *S, TYPE1 ARG1) { \
return hssGet##ITEM(S, ARG1); \
}

Typedef Documentation

typedef void( SFunctionMethod1_type)(SimStruct *S)

S-function method type.

typedef void( SFunctionMethod2_type)(SimStruct *S, int_T tid)

S-function method type with additional task id argument.

Function Documentation

HXI_EXTERN void Hxi_mdlDerivatives ( SimStruct *  S)

Optional: Compute derivatives for continuous-time states.

Referenced by mdlDerivatives().

HXI_EXTERN void Hxi_mdlInitializeConditions ( SimStruct *  S)

Optional: Compute initial conditions.

Referenced by mdlInitializeConditions().

HXI_EXTERN void Hxi_mdlInitializeSampleTimes ( SimStruct *  S)

Initialize sample times.

Referenced by mdlInitializeSampleTimes().

HXI_EXTERN void Hxi_mdlInitializeSizes ( SimStruct *  S)

Initialize sizes of data vectors in SimStruct.

This function works with the shared object found under ssGetPath(S), calls the S-function method mdlInitializeSizes and allocates memory required for a level 2 S-function. The model parameters must have been initialized prior to calling this function.

Referenced by mdlInitializeSizes().

HXI_EXTERN void Hxi_mdlJacobian ( SimStruct *  S)

Optional: Compute Jacobian J = d(dxc,xd,y)/d(xc,xd,u).

Referenced by mdlJacobian().

HXI_EXTERN void Hxi_mdlOutputs ( SimStruct *  S,
int_T  tid 
)

Compute model outputs.

Referenced by mdlOutputs().

HXI_EXTERN void Hxi_mdlStart ( SimStruct *  S)

Optional: Allocate local ressources for simulation.

Referenced by mdlStart().

HXI_EXTERN void Hxi_mdlTerminate ( SimStruct *  S)

Release resources allocated for simulation.

Referenced by mdlTerminate().

HXI_EXTERN void Hxi_mdlUpdate ( SimStruct *  S,
int_T  tid 
)

Optional: Update discrete-time states.

Referenced by mdlUpdate().

HXI_EXTERN SimStruct* Hxi_SimStruct_create ( const char *  path)

Construct a SimStruct for given path.

Store path in SimStruct.

HXI_EXTERN void Hxi_SimStruct_destroy ( SimStruct *  S)

Delete a SimStruct.

HXI_EXTERN void mxFree ( void *  p)

Free memory allocated though mx methods, e.g.

mxArrayToString.

Referenced by Hxi::mx_foutput(), and ssSetSFcnParamsCount().