/*
 * File: NXTway_ET2012.h
 *
 * Code generated for Simulink model 'NXTway_ET2012'.
 *
 * Model version                  : 1.617
 * Simulink Coder version         : 8.2 (R2012a) 29-Dec-2011
 * TLC version                    : 8.2 (Dec 29 2011)
 * C/C++ source code generated on : Mon Apr 16 09:34:27 2012
 *
 * Target selection: realtime.tlc
 * Embedded hardware selection: ARM Compatible->ARM 7
 * Code generation objectives: Unspecified
 * Validation result: Not run
 */

#ifndef RTW_HEADER_NXTway_ET2012_h_
#define RTW_HEADER_NXTway_ET2012_h_
#ifndef NXTway_ET2012_COMMON_INCLUDES_
# define NXTway_ET2012_COMMON_INCLUDES_
#include <math.h>
#include <string.h>
#include "rtwtypes.h"
#include "rtw_continuous.h"
#include "rtw_solver.h"
#include "driver_nxt.h"
#include "rtGetInf.h"
#include "rtGetNaN.h"
#include "rt_nonfinite.h"
#endif                                 /* NXTway_ET2012_COMMON_INCLUDES_ */

#include "NXTway_ET2012_types.h"

/* Macros for accessing real-time model data structure */
#ifndef rtmGetErrorStatus
# define rtmGetErrorStatus(rtm)        ((rtm)->errorStatus)
#endif

#ifndef rtmSetErrorStatus
# define rtmSetErrorStatus(rtm, val)   ((rtm)->errorStatus = (val))
#endif

/* Block signals (auto storage) */
typedef struct {
  real32_T Sum;                        /* '<S18>/Sum' */
  real32_T Sum_l;                      /* '<S21>/Sum' */
  real32_T Sum_j;                      /* '<S17>/Sum' */
  real32_T Sum_l2;                     /* '<S20>/Sum' */
  real32_T Sum_h;                      /* '<S15>/Sum' */
  int32_T TailAngleforDrive;           /* '<S9>/Tail Angle for Drive' */
  int16_T GyroSensor;                  /* '<S1>/Gyro Sensor' */
  uint16_T LightSensor;                /* '<S1>/Light Sensor' */
  int8_T DataTypeConversion1;          /* '<S11>/Data Type Conversion1' */
  int8_T DataTypeConversion8;          /* '<S11>/Data Type Conversion8' */
  boolean_T ON;                        /* '<S9>/ON' */
} BlockIO_NXTway_ET2012;

/* Block states (auto storage) for system '<Root>' */
typedef struct {
  real32_T DiscreteFilter_DSTATE;      /* '<S6>/Discrete Filter' */
  real32_T UnitDelay_DSTATE;           /* '<S15>/Unit Delay' */
  real32_T UnitDelay_DSTATE_a;         /* '<S17>/Unit Delay' */
  real32_T UnitDelay_DSTATE_g;         /* '<S18>/Unit Delay' */
  real32_T UnitDelay_DSTATE_p;         /* '<S20>/Unit Delay' */
  real32_T UnitDelay_DSTATE_e;         /* '<S21>/Unit Delay' */
  real32_T UnitDelay_DSTATE_g4;        /* '<S19>/Unit Delay' */
  real32_T DiscreteFilter_tmp;         /* '<S6>/Discrete Filter' */
} D_Work_NXTway_ET2012;

/* Zero-crossing (trigger) state */
typedef struct {
  ZCSigState StartActions_Trig_ZCE;    /* '<S2>/Start Actions' */
} PrevZCSigStates_NXTway_ET2012;

/* Constant parameters (auto storage) */
typedef struct {
  /* Expression: lcdStr1
   * Referenced by: '<S22>/LCD'
   */
  uint8_T LCD_p1[6];

  /* Expression: lcdStr1
   * Referenced by: '<S23>/LCD'
   */
  uint8_T LCD_p1_m[7];
} ConstParam_NXTway_ET2012;

/* Parameters (auto storage) */
struct Parameters_NXTway_ET2012_ {
  real32_T Constant_Value;             /* Computed Parameter: Constant_Value
                                        * Referenced by: '<S16>/Constant'
                                        */
  real32_T Gain3_Gain;                 /* Computed Parameter: Gain3_Gain
                                        * Referenced by: '<S16>/Gain3'
                                        */
  real32_T UnitDelay_X0;               /* Computed Parameter: UnitDelay_X0
                                        * Referenced by: '<S15>/Unit Delay'
                                        */
  real32_T IntegralGain_Gain;          /* Computed Parameter: IntegralGain_Gain
                                        * Referenced by: '<S11>/Integral Gain'
                                        */
  real32_T UnitDelay_X0_g;             /* Computed Parameter: UnitDelay_X0_g
                                        * Referenced by: '<S17>/Unit Delay'
                                        */
  real32_T Constant2_Value;            /* Computed Parameter: Constant2_Value
                                        * Referenced by: '<S13>/Constant2'
                                        */
  real32_T Gain1_Gain;                 /* Computed Parameter: Gain1_Gain
                                        * Referenced by: '<S13>/Gain1'
                                        */
  real32_T Gain3_Gain_a;               /* Computed Parameter: Gain3_Gain_a
                                        * Referenced by: '<S18>/Gain3'
                                        */
  real32_T UnitDelay_X0_m;             /* Computed Parameter: UnitDelay_X0_m
                                        * Referenced by: '<S18>/Unit Delay'
                                        */
  real32_T Gain2_Gain;                 /* Computed Parameter: Gain2_Gain
                                        * Referenced by: '<S18>/Gain2'
                                        */
  real32_T Constant3_Value;            /* Computed Parameter: Constant3_Value
                                        * Referenced by: '<S13>/Constant3'
                                        */
  real32_T deg2rad_Gain;               /* Computed Parameter: deg2rad_Gain
                                        * Referenced by: '<S14>/deg2rad'
                                        */
  real32_T UnitDelay_X0_k;             /* Computed Parameter: UnitDelay_X0_k
                                        * Referenced by: '<S20>/Unit Delay'
                                        */
  real32_T deg2rad1_Gain;              /* Computed Parameter: deg2rad1_Gain
                                        * Referenced by: '<S14>/deg2rad1'
                                        */
  real32_T Gain_Gain;                  /* Computed Parameter: Gain_Gain
                                        * Referenced by: '<S14>/Gain'
                                        */
  real32_T Gain3_Gain_g;               /* Computed Parameter: Gain3_Gain_g
                                        * Referenced by: '<S21>/Gain3'
                                        */
  real32_T UnitDelay_X0_h;             /* Computed Parameter: UnitDelay_X0_h
                                        * Referenced by: '<S21>/Unit Delay'
                                        */
  real32_T Gain2_Gain_n;               /* Computed Parameter: Gain2_Gain_n
                                        * Referenced by: '<S21>/Gain2'
                                        */
  real32_T UnitDelay_X0_l;             /* Computed Parameter: UnitDelay_X0_l
                                        * Referenced by: '<S19>/Unit Delay'
                                        */
  real32_T Gain_Gain_c;                /* Computed Parameter: Gain_Gain_c
                                        * Referenced by: '<S19>/Gain'
                                        */
  real32_T deg2rad2_Gain;              /* Computed Parameter: deg2rad2_Gain
                                        * Referenced by: '<S14>/deg2rad2'
                                        */
  real32_T FeedbackGain_Gain[4];       /* Computed Parameter: FeedbackGain_Gain
                                        * Referenced by: '<S11>/Feedback Gain'
                                        */
  real32_T Gain_Gain_a;                /* Computed Parameter: Gain_Gain_a
                                        * Referenced by: '<S12>/Gain'
                                        */
  real32_T Gain2_Gain_b;               /* Computed Parameter: Gain2_Gain_b
                                        * Referenced by: '<S13>/Gain2'
                                        */
  real32_T Saturation_UpperSat;        /* Computed Parameter: Saturation_UpperSat
                                        * Referenced by: '<S12>/Saturation'
                                        */
  real32_T Saturation_LowerSat;        /* Computed Parameter: Saturation_LowerSat
                                        * Referenced by: '<S12>/Saturation'
                                        */
  real32_T Saturation1_UpperSat;       /* Computed Parameter: Saturation1_UpperSat
                                        * Referenced by: '<S12>/Saturation1'
                                        */
  real32_T Saturation1_LowerSat;       /* Computed Parameter: Saturation1_LowerSat
                                        * Referenced by: '<S12>/Saturation1'
                                        */
  real32_T Gain_Gain_i;                /* Computed Parameter: Gain_Gain_i
                                        * Referenced by: '<S17>/Gain'
                                        */
  real32_T Gain_Gain_h;                /* Computed Parameter: Gain_Gain_h
                                        * Referenced by: '<S20>/Gain'
                                        */
  real32_T Gain_Gain_f;                /* Computed Parameter: Gain_Gain_f
                                        * Referenced by: '<S15>/Gain'
                                        */
  real32_T DiscreteFilter_InitialStates;/* Computed Parameter: DiscreteFilter_InitialStates
                                         * Referenced by: '<S6>/Discrete Filter'
                                         */
  real32_T DiscreteFilter_NumCoef;     /* Computed Parameter: DiscreteFilter_NumCoef
                                        * Referenced by: '<S6>/Discrete Filter'
                                        */
  real32_T DiscreteFilter_DenCoef[2];  /* Computed Parameter: DiscreteFilter_DenCoef
                                        * Referenced by: '<S6>/Discrete Filter'
                                        */
  real32_T Turnleft_Value;             /* Computed Parameter: Turnleft_Value
                                        * Referenced by: '<S7>/Turn left'
                                        */
  real32_T Turnright_Value;            /* Computed Parameter: Turnright_Value
                                        * Referenced by: '<S7>/Turn right'
                                        */
  real32_T ForwardSpeed_Value;         /* Computed Parameter: ForwardSpeed_Value
                                        * Referenced by: '<S7>/Forward Speed'
                                        */
  real32_T PGain_Gain;                 /* Computed Parameter: PGain_Gain
                                        * Referenced by: '<S10>/P Gain'
                                        */
  real32_T Saturation_UpperSat_m;      /* Computed Parameter: Saturation_UpperSat_m
                                        * Referenced by: '<S10>/Saturation'
                                        */
  real32_T Saturation_LowerSat_c;      /* Computed Parameter: Saturation_LowerSat_c
                                        * Referenced by: '<S10>/Saturation'
                                        */
  int32_T TailAngle_Y0;                /* Computed Parameter: TailAngle_Y0
                                        * Referenced by: '<S9>/Tail Angle'
                                        */
  int32_T TailAngleforDrive_Value;     /* Computed Parameter: TailAngleforDrive_Value
                                        * Referenced by: '<S9>/Tail Angle for Drive'
                                        */
  int32_T GyroOffset_Value;            /* Computed Parameter: GyroOffset_Value
                                        * Referenced by: '<S2>/Gyro Offset'
                                        */
  uint16_T LineEdge_Value;             /* Computed Parameter: LineEdge_Value
                                        * Referenced by: '<S7>/Line Edge'
                                        */
  int8_T Constant6_Value;              /* Computed Parameter: Constant6_Value
                                        * Referenced by: '<S13>/Constant6'
                                        */
  int8_T Constant1_Value;              /* Computed Parameter: Constant1_Value
                                        * Referenced by: '<S13>/Constant1'
                                        */
  boolean_T Balancerswitch_Y0;         /* Computed Parameter: Balancerswitch_Y0
                                        * Referenced by: '<S9>/Balancer switch  '
                                        */
  boolean_T ON_Value;                  /* Computed Parameter: ON_Value
                                        * Referenced by: '<S9>/ON'
                                        */
};

/* Real-time Model Data Structure */
struct RT_MODEL_NXTway_ET2012 {
  const char_T * volatile errorStatus;

  /*
   * Timing:
   * The following substructure contains information regarding
   * the timing information for the model.
   */
  struct {
    struct {
      uint8_T TID[2];
    } TaskCounters;
  } Timing;
};

/* Block parameters (auto storage) */
extern Parameters_NXTway_ET2012 NXTway_ET2012_P;

/* Block signals (auto storage) */
extern BlockIO_NXTway_ET2012 NXTway_ET2012_B;

/* Block states (auto storage) */
extern D_Work_NXTway_ET2012 NXTway_ET2012_DWork;

/* Constant parameters (auto storage) */
extern const ConstParam_NXTway_ET2012 NXTway_ET2012_ConstP;

/* Model entry point functions */
extern void NXTway_ET2012_initialize(void);
extern void NXTway_ET2012_output(void);
extern void NXTway_ET2012_update(void);
extern void NXTway_ET2012_terminate(void);

/* Real-time Model object */
extern struct RT_MODEL_NXTway_ET2012 *const NXTway_ET2012_M;

/*-
 * The generated code includes comments that allow you to trace directly
 * back to the appropriate location in the model.  The basic format
 * is <system>/block_name, where system is the system number (uniquely
 * assigned by Simulink) and block_name is the name of the block.
 *
 * Use the MATLAB hilite_system command to trace the generated code back
 * to the model.  For example,
 *
 * hilite_system('<S3>')    - opens system 3
 * hilite_system('<S3>/Kp') - opens and selects block Kp which resides in S3
 *
 * Here is the system hierarchy for this model
 *
 * '<Root>' : 'NXTway_ET2012'
 * '<S1>'   : 'NXTway_ET2012/LineTracer'
 * '<S2>'   : 'NXTway_ET2012/LineTracer/Controller'
 * '<S3>'   : 'NXTway_ET2012/LineTracer/Left Wheel Motor'
 * '<S4>'   : 'NXTway_ET2012/LineTracer/Right Wheel Motor'
 * '<S5>'   : 'NXTway_ET2012/LineTracer/Tail Motor'
 * '<S6>'   : 'NXTway_ET2012/LineTracer/Controller/Balance and Drive Control'
 * '<S7>'   : 'NXTway_ET2012/LineTracer/Controller/Line Trace'
 * '<S8>'   : 'NXTway_ET2012/LineTracer/Controller/NXT LCD'
 * '<S9>'   : 'NXTway_ET2012/LineTracer/Controller/Start Actions'
 * '<S10>'  : 'NXTway_ET2012/LineTracer/Controller/Tail Control'
 * '<S11>'  : 'NXTway_ET2012/LineTracer/Controller/Balance and Drive Control/NXTway-GS Balance Control'
 * '<S12>'  : 'NXTway_ET2012/LineTracer/Controller/Balance and Drive Control/NXTway-GS Balance Control/Cal PWM'
 * '<S13>'  : 'NXTway_ET2012/LineTracer/Controller/Balance and Drive Control/NXTway-GS Balance Control/Cal Reference'
 * '<S14>'  : 'NXTway_ET2012/LineTracer/Controller/Balance and Drive Control/NXTway-GS Balance Control/Cal x1'
 * '<S15>'  : 'NXTway_ET2012/LineTracer/Controller/Balance and Drive Control/NXTway-GS Balance Control/Discrete Integrator (forward euler)'
 * '<S16>'  : 'NXTway_ET2012/LineTracer/Controller/Balance and Drive Control/NXTway-GS Balance Control/Cal PWM/Cal vol_max'
 * '<S17>'  : 'NXTway_ET2012/LineTracer/Controller/Balance and Drive Control/NXTway-GS Balance Control/Cal Reference/Discrete Integrator (forward euler)'
 * '<S18>'  : 'NXTway_ET2012/LineTracer/Controller/Balance and Drive Control/NXTway-GS Balance Control/Cal Reference/Low Path Filter'
 * '<S19>'  : 'NXTway_ET2012/LineTracer/Controller/Balance and Drive Control/NXTway-GS Balance Control/Cal x1/Discrete Derivative (backward difference)'
 * '<S20>'  : 'NXTway_ET2012/LineTracer/Controller/Balance and Drive Control/NXTway-GS Balance Control/Cal x1/Discrete Integrator (forward euler)'
 * '<S21>'  : 'NXTway_ET2012/LineTracer/Controller/Balance and Drive Control/NXTway-GS Balance Control/Cal x1/Low Path Filter'
 * '<S22>'  : 'NXTway_ET2012/LineTracer/Controller/NXT LCD/LCD'
 * '<S23>'  : 'NXTway_ET2012/LineTracer/Controller/NXT LCD/LCD1'
 */
#endif                                 /* RTW_HEADER_NXTway_ET2012_h_ */

/*
 * File trailer for generated code.
 *
 * [EOF]
 */
