MATLAB SIMULINK 7 - DEVELOPING S-FUNCTIONS User's Guide Page 111

  • Download
  • Add to my manuals
  • Print
  • Page
    / 210
  • Table of contents
  • BOOKMARKS
  • Rated. / 5. Based on customer reviews
Page view 110
Examples of C MEX-File S-Function Blocks
3-67
/* Take care when specifying exception free code - see sfuntmpl.doc. */
ssSetOptions(S, SS_OPTION_EXCEPTION_FREE_CODE);
}
/* Function: mdlInitializeSampleTimes =========================================
* Abstract:
* Two tasks: One continuous, one with discrete sample time of 1.0
*/
static void mdlInitializeSampleTimes(SimStruct *S)
{
ssSetSampleTime(S, 0, CONTINUOUS_SAMPLE_TIME);
ssSetSampleTime(S, 1, 1.0);
ssSetOffsetTime(S, 0, 0.0);
ssSetOffsetTime(S, 1, 0.0);
}
#define MDL_INITIALIZE_CONDITIONS
/* Function: mdlInitializeConditions ========================================
* Abstract:
* Initialize both continuous states to zero.
*/
static void mdlInitializeConditions(SimStruct *S)
{
real_T *xC0 = ssGetContStates(S);
real_T *xD0 = ssGetRealDiscStates(S);
xC0[0] = 1.0;
xD0[0] = 1.0;
}
/* Function: mdlOutputs =======================================================
* Abstract:
* y = xD
*/
static void mdlOutputs(SimStruct *S, int_T tid)
{
real_T *y = ssGetOutputPortRealSignal(S,0);
real_T *xD = ssGetRealDiscStates(S);
/* y=xD */
if (ssIsSampleHit(S, 1, tid)) {
y[0]=xD[0];
}
}
#define MDL_UPDATE
/* Function: mdlUpdate ======================================================
* Abstract:
* xD = xC
*/
static void mdlUpdate(SimStruct *S, int_T tid)
{
Page view 110
1 2 ... 106 107 108 109 110 111 112 113 114 115 116 ... 209 210

Comments to this Manuals

No comments

VTech Phones user manuals

Starting on S

Click on an alphabet below to scroll to the full list of models starting with that letter

Models Document Type
S2100 Spec Sheets
User Manual   VTech S2100 Spec Sheets User Manual, 2 pages
S2220 Spec Sheets
User Manual   VTech S2220 Spec Sheets User Manual, 3 pages
S2221 Data Sheets
User Manual   VTech S2221 Data Sheets User Manual, 1 pages
S2221 Manual
User Manual   VTech S2221 Manual User Manual, 37 pages
S2221 Spec Sheets
User Manual   VTech S2221 Spec Sheets User Manual, 3 pages
S2320 Spec Sheets
User Manual   VTech S2320 Spec Sheets User Manual, 4 pages
SN6107 Manual
User Manual   VTech SN6107 Manual User Manual, 14 pages
SN6127_-2 Abridged manual
User Manual   VTech SN6127_-2 Abridged manual User Manual, 101 pages
SN6127_-2 Manual
User Manual   VTech SN6127_-2 Manual User Manual, 116 pages
SN6127_-2 Quick start
User Manual   VTech SN6127_-2 Quick start User Manual, 12 pages
SN6167 Manual
User Manual   VTech SN6167 Manual User Manual, 12 pages
SN6187 Abridged manual
User Manual   VTech SN6187 Abridged manual User Manual, 125 pages
SN6187 Manual
User Manual   VTech SN6187 Manual User Manual, 127 pages
SN6187 Quick start
User Manual   VTech SN6187 Quick start User Manual, 20 pages
SN6197_-2 Abridged manual
User Manual   VTech SN6197_-2 Abridged manual User Manual, 93 pages
SN6197_-2 Manual
User Manual   VTech SN6197_-2 Manual User Manual, 162 pages
SN6197_-2 Quick start
User Manual   VTech SN6197_-2 Quick start User Manual, 20 pages