static void sf_c22_BuckBoost1(SFc22_BuckBoost1InstanceStruct *chartInstance)
{
  real_T c22_hoistedGlobal;
  real_T c22_b_hoistedGlobal;
  real_T c22_Carrier;
  real_T c22_Duty;
  uint32_T c22_debug_family_var_map[6];
  real_T c22_Err1;
  real_T c22_nargin = 2.0;
  real_T c22_nargout = 1.0;
  real_T c22_PWM;
  real_T *c22_b_PWM;
  real_T *c22_b_Carrier;
  real_T *c22_b_Duty;
  c22_b_Duty = (real_T *)ssGetInputPortSignal(chartInstance->S, 1);
  c22_b_Carrier = (real_T *)ssGetInputPortSignal(chartInstance->S, 0);
  c22_b_PWM = (real_T *)ssGetOutputPortSignal(chartInstance->S, 1);
  _sfTime_ = (real_T)ssGetT(chartInstance->S);
  _SFD_CC_CALL(CHART_ENTER_SFUNCTION_TAG, 3U, chartInstance->c22_sfEvent);
  _SFD_DATA_RANGE_CHECK(*c22_b_PWM, 0U);
  _SFD_DATA_RANGE_CHECK(*c22_b_Carrier, 1U);
  _SFD_DATA_RANGE_CHECK(*c22_b_Duty, 2U);
  chartInstance->c22_sfEvent = CALL_EVENT;
  _SFD_CC_CALL(CHART_ENTER_DURING_FUNCTION_TAG, 3U, chartInstance->c22_sfEvent);
  c22_hoistedGlobal = *c22_b_Carrier;
  c22_b_hoistedGlobal = *c22_b_Duty;
  c22_Carrier = c22_hoistedGlobal;
  c22_Duty = c22_b_hoistedGlobal;
  sf_debug_symbol_scope_push_eml(0U, 6U, 6U, c22_debug_family_names,
    c22_debug_family_var_map);
  sf_debug_symbol_scope_add_eml_importable(&c22_Err1, 0U, c22_sf_marshallOut,
    c22_sf_marshallIn);
  sf_debug_symbol_scope_add_eml_importable(&c22_nargin, 1U, c22_sf_marshallOut,
    c22_sf_marshallIn);
  sf_debug_symbol_scope_add_eml_importable(&c22_nargout, 2U, c22_sf_marshallOut,
    c22_sf_marshallIn);
  sf_debug_symbol_scope_add_eml(&c22_Carrier, 3U, c22_sf_marshallOut);
  sf_debug_symbol_scope_add_eml(&c22_Duty, 4U, c22_sf_marshallOut);
  sf_debug_symbol_scope_add_eml_importable(&c22_PWM, 5U, c22_sf_marshallOut,
    c22_sf_marshallIn);
  CV_EML_FCN(0, 0);
  _SFD_EML_CALL(0U, chartInstance->c22_sfEvent, 3);
  c22_Err1 = c22_Duty - c22_Carrier;
  _SFD_EML_CALL(0U, chartInstance->c22_sfEvent, 5);
  if (CV_EML_IF(0, 1, 0, c22_Err1 > 0.0)) {
    _SFD_EML_CALL(0U, chartInstance->c22_sfEvent, 6);
    c22_PWM = 1.0;
  } else {
    _SFD_EML_CALL(0U, chartInstance->c22_sfEvent, 8);
    c22_PWM = 0.0;
  }

  _SFD_EML_CALL(0U, chartInstance->c22_sfEvent, -8);
  sf_debug_symbol_scope_pop();
  *c22_b_PWM = c22_PWM;
  _SFD_CC_CALL(EXIT_OUT_OF_FUNCTION_TAG, 3U, chartInstance->c22_sfEvent);
  sf_debug_check_for_state_inconsistency(_BuckBoost1MachineNumber_,
    chartInstance->chartNumber, chartInstance->instanceNumber);
}
示例#2
0
static void sf_c2_hapticsSimBlk_pd(SFc2_hapticsSimBlk_pdInstanceStruct
  *chartInstance)
{
  int32_T c2_i2;
  int32_T c2_i3;
  int32_T c2_i4;
  real_T c2_u[3];
  uint32_T c2_debug_family_var_map[4];
  real_T c2_nargin = 1.0;
  real_T c2_nargout = 1.0;
  real_T c2_y[3];
  int32_T c2_i5;
  int32_T c2_i6;
  real_T (*c2_b_y)[3];
  real_T (*c2_b_u)[3];
  c2_b_y = (real_T (*)[3])ssGetOutputPortSignal(chartInstance->S, 1);
  c2_b_u = (real_T (*)[3])ssGetInputPortSignal(chartInstance->S, 0);
  _sfTime_ = (real_T)ssGetT(chartInstance->S);
  _SFD_CC_CALL(CHART_ENTER_SFUNCTION_TAG, 0U, chartInstance->c2_sfEvent);
  for (c2_i2 = 0; c2_i2 < 3; c2_i2++) {
    _SFD_DATA_RANGE_CHECK((*c2_b_u)[c2_i2], 0U);
  }

  for (c2_i3 = 0; c2_i3 < 3; c2_i3++) {
    _SFD_DATA_RANGE_CHECK((*c2_b_y)[c2_i3], 1U);
  }

  chartInstance->c2_sfEvent = CALL_EVENT;
  _SFD_CC_CALL(CHART_ENTER_DURING_FUNCTION_TAG, 0U, chartInstance->c2_sfEvent);
  for (c2_i4 = 0; c2_i4 < 3; c2_i4++) {
    c2_u[c2_i4] = (*c2_b_u)[c2_i4];
  }

  sf_debug_symbol_scope_push_eml(0U, 4U, 4U, c2_debug_family_names,
    c2_debug_family_var_map);
  sf_debug_symbol_scope_add_eml_importable(&c2_nargin, 0U, c2_b_sf_marshallOut,
    c2_b_sf_marshallIn);
  sf_debug_symbol_scope_add_eml_importable(&c2_nargout, 1U, c2_b_sf_marshallOut,
    c2_b_sf_marshallIn);
  sf_debug_symbol_scope_add_eml(c2_u, 2U, c2_sf_marshallOut);
  sf_debug_symbol_scope_add_eml_importable(c2_y, 3U, c2_sf_marshallOut,
    c2_sf_marshallIn);
  CV_EML_FCN(0, 0);
  _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 5);
  for (c2_i5 = 0; c2_i5 < 3; c2_i5++) {
    c2_y[c2_i5] = c2_u[c2_i5];
  }

  _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, -5);
  sf_debug_symbol_scope_pop();
  for (c2_i6 = 0; c2_i6 < 3; c2_i6++) {
    (*c2_b_y)[c2_i6] = c2_y[c2_i6];
  }

  _SFD_CC_CALL(EXIT_OUT_OF_FUNCTION_TAG, 0U, chartInstance->c2_sfEvent);
  sf_debug_check_for_state_inconsistency(_hapticsSimBlk_pdMachineNumber_,
    chartInstance->chartNumber, chartInstance->instanceNumber);
}
示例#3
0
static void sf_c2_tablerot_id(SFc2_tablerot_idInstanceStruct *chartInstance)
{
int32_T c2_i3;
int32_T c2_i4;
int32_T c2_previousEvent;
int32_T c2_i5;
real_T c2_hoistedGlobal[6];
int32_T c2_i6;
real_T c2_u[6];
uint32_T c2_debug_family_var_map[4];
static const char *c2_sv0[4] = { "nargin", "nargout", "u", "y" };
real_T c2_nargin = 1.0;
real_T c2_nargout = 1.0;
real_T c2_y[3];
int32_T c2_i7;
int32_T c2_i8;
real_T (*c2_b_y)[3];
real_T (*c2_b_u)[6];
c2_b_y = (real_T (*)[3])ssGetOutputPortSignal(chartInstance->S, 1);
c2_b_u = (real_T (*)[6])ssGetInputPortSignal(chartInstance->S, 0);
_sfTime_ = (real_T)ssGetT(chartInstance->S);
_SFD_CC_CALL(CHART_ENTER_SFUNCTION_TAG,1);
for(c2_i3 = 0; c2_i3 < 6; c2_i3 = c2_i3 + 1) {
_SFD_DATA_RANGE_CHECK((*c2_b_u)[c2_i3], 0U);
}
for(c2_i4 = 0; c2_i4 < 3; c2_i4 = c2_i4 + 1) {
_SFD_DATA_RANGE_CHECK((*c2_b_y)[c2_i4], 1U);
}
c2_previousEvent = _sfEvent_;
_sfEvent_ = CALL_EVENT;
_SFD_CC_CALL(CHART_ENTER_DURING_FUNCTION_TAG,1);
for(c2_i5 = 0; c2_i5 < 6; c2_i5 = c2_i5 + 1) {
c2_hoistedGlobal[c2_i5] = (*c2_b_u)[c2_i5];
}
for(c2_i6 = 0; c2_i6 < 6; c2_i6 = c2_i6 + 1) {
c2_u[c2_i6] = c2_hoistedGlobal[c2_i6];
}
sf_debug_symbol_scope_push_eml(0U, 4U, 4U, c2_sv0, c2_debug_family_var_map);
sf_debug_symbol_scope_add_eml(&c2_nargin, c2_c_sf_marshall, 0U);
sf_debug_symbol_scope_add_eml(&c2_nargout, c2_c_sf_marshall, 1U);
sf_debug_symbol_scope_add_eml(&c2_u, c2_b_sf_marshall, 2U);
sf_debug_symbol_scope_add_eml(&c2_y, c2_sf_marshall, 3U);
CV_EML_FCN(0, 0);
_SFD_EML_CALL(0,4);
for(c2_i7 = 0; c2_i7 < 3; c2_i7 = c2_i7 + 1) {
c2_y[c2_i7] = c2_u[c2_i7 + 3];
}
_SFD_EML_CALL(0,-4);
sf_debug_symbol_scope_pop();
for(c2_i8 = 0; c2_i8 < 3; c2_i8 = c2_i8 + 1) {
(*c2_b_y)[c2_i8] = c2_y[c2_i8];
}
_SFD_CC_CALL(EXIT_OUT_OF_FUNCTION_TAG,1);
_sfEvent_ = c2_previousEvent;
sf_debug_check_for_state_inconsistency(_tablerot_idMachineNumber_, chartInstance->chartNumber, chartInstance->instanceNumber);
}
static void sf_c2_SALTStabilizationInnerOuterLoopSIM
  (SFc2_SALTStabilizationInnerOuterLoopSIMInstanceStruct *chartInstance)
{
  real32_T c2_hoistedGlobal;
  real32_T c2_u;
  uint32_T c2_debug_family_var_map[4];
  real_T c2_nargin = 1.0;
  real_T c2_nargout = 1.0;
  real32_T c2_y;
  real32_T c2_A;
  real32_T c2_x;
  real32_T c2_b_x;
  real32_T c2_b_y;
  real32_T c2_a;
  real32_T c2_c_y;
  real32_T c2_b_a;
  real32_T *c2_b_u;
  real32_T *c2_d_y;
  c2_d_y = (real32_T *)ssGetOutputPortSignal(chartInstance->S, 1);
  c2_b_u = (real32_T *)ssGetInputPortSignal(chartInstance->S, 0);
  _sfTime_ = (real_T)ssGetT(chartInstance->S);
  _SFD_CC_CALL(CHART_ENTER_SFUNCTION_TAG, 1U, chartInstance->c2_sfEvent);
  _SFD_DATA_RANGE_CHECK((real_T)*c2_b_u, 0U);
  _SFD_DATA_RANGE_CHECK((real_T)*c2_d_y, 1U);
  chartInstance->c2_sfEvent = CALL_EVENT;
  _SFD_CC_CALL(CHART_ENTER_DURING_FUNCTION_TAG, 1U, chartInstance->c2_sfEvent);
  c2_hoistedGlobal = *c2_b_u;
  c2_u = c2_hoistedGlobal;
  sf_debug_symbol_scope_push_eml(0U, 4U, 4U, c2_debug_family_names,
    c2_debug_family_var_map);
  sf_debug_symbol_scope_add_eml_importable(&c2_nargin, 0U, c2_b_sf_marshallOut,
    c2_b_sf_marshallIn);
  sf_debug_symbol_scope_add_eml_importable(&c2_nargout, 1U, c2_b_sf_marshallOut,
    c2_b_sf_marshallIn);
  sf_debug_symbol_scope_add_eml(&c2_u, 2U, c2_sf_marshallOut);
  sf_debug_symbol_scope_add_eml_importable(&c2_y, 3U, c2_sf_marshallOut,
    c2_sf_marshallIn);
  CV_EML_FCN(0, 0);
  _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 4);
  c2_A = c2_u;
  c2_x = c2_A;
  c2_b_x = c2_x;
  c2_b_y = c2_b_x / 131.0F;
  c2_a = c2_b_y;
  c2_c_y = c2_a * 0.0174532924F;
  c2_b_a = c2_c_y;
  c2_y = c2_b_a * 5.0F;
  _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, -4);
  sf_debug_symbol_scope_pop();
  *c2_d_y = c2_y;
  _SFD_CC_CALL(EXIT_OUT_OF_FUNCTION_TAG, 1U, chartInstance->c2_sfEvent);
  sf_debug_check_for_state_inconsistency
    (_SALTStabilizationInnerOuterLoopSIMMachineNumber_,
     chartInstance->chartNumber, chartInstance->instanceNumber);
}
static void sf_c6_adcs_v15_integral_Power_no_charge_in_detumb(void)
{
  int32_T c6_previousEvent;
  real_T c6_a;
  real_T c6_b;
  real_T c6_nargout = 1.0;
  real_T c6_nargin = 2.0;
  real_T c6_c;
  real_T c6_y;
  real_T *c6_b_a;
  real_T *c6_b_y;
  real_T *c6_b_b;
  c6_b_y = (real_T *)ssGetOutputPortSignal(chartInstance.S, 1);
  c6_b_a = (real_T *)ssGetInputPortSignal(chartInstance.S, 0);
  c6_b_b = (real_T *)ssGetInputPortSignal(chartInstance.S, 1);
  _sfTime_ = (real_T)ssGetT(chartInstance.S);
  _SFD_CC_CALL(CHART_ENTER_SFUNCTION_TAG,4);
  _SFD_DATA_RANGE_CHECK(*c6_b_a, 0U);
  _SFD_DATA_RANGE_CHECK(*c6_b_y, 1U);
  _SFD_DATA_RANGE_CHECK(*c6_b_b, 2U);
  c6_previousEvent = _sfEvent_;
  _sfEvent_ = CALL_EVENT;
  _SFD_CC_CALL(CHART_ENTER_DURING_FUNCTION_TAG,4);
  c6_a = *c6_b_a;
  c6_b = *c6_b_b;
  sf_debug_symbol_scope_push(6U, 0U);
  sf_debug_symbol_scope_add("nargout", &c6_nargout, c6_sf_marshall);
  sf_debug_symbol_scope_add("nargin", &c6_nargin, c6_sf_marshall);
  sf_debug_symbol_scope_add("c", &c6_c, c6_sf_marshall);
  sf_debug_symbol_scope_add("y", &c6_y, c6_sf_marshall);
  sf_debug_symbol_scope_add("b", &c6_b, c6_sf_marshall);
  sf_debug_symbol_scope_add("a", &c6_a, c6_sf_marshall);
  CV_EML_FCN(0, 0);
  _SFD_EML_CALL(0,4);
  c6_c = 1.0 - c6_a;
  _SFD_EML_CALL(0,6);
  c6_y = c6_c + c6_b;
  _SFD_EML_CALL(0,7);
  if (CV_EML_IF(0, 0, c6_y > 1.0)) {
    _SFD_EML_CALL(0,8);
    c6_y = 1.0;
  }

  _SFD_EML_CALL(0,-8);
  sf_debug_symbol_scope_pop();
  *c6_b_y = c6_y;
  _SFD_CC_CALL(EXIT_OUT_OF_FUNCTION_TAG,4);
  _sfEvent_ = c6_previousEvent;
  sf_debug_check_for_state_inconsistency
    (_adcs_v15_integral_Power_no_charge_in_detumbMachineNumber_,
     chartInstance.chartNumber,
     chartInstance.instanceNumber);
}
示例#6
0
static void sf_c17_ekffedepre(SFc17_ekffedepreInstanceStruct *chartInstance)
{
  real_T c17_hoistedGlobal;
  real_T c17_u;
  uint32_T c17_debug_family_var_map[4];
  real_T c17_nargin = 1.0;
  real_T c17_nargout = 1.0;
  real_T c17_y;
  real_T *c17_b_u;
  real_T *c17_b_y;
  c17_b_y = (real_T *)ssGetOutputPortSignal(chartInstance->S, 1);
  c17_b_u = (real_T *)ssGetInputPortSignal(chartInstance->S, 0);
  _sfTime_ = (real_T)ssGetT(chartInstance->S);
  _SFD_CC_CALL(CHART_ENTER_SFUNCTION_TAG, 16U, chartInstance->c17_sfEvent);
  _SFD_DATA_RANGE_CHECK(*c17_b_u, 0U);
  _SFD_DATA_RANGE_CHECK(*c17_b_y, 1U);
  chartInstance->c17_sfEvent = CALL_EVENT;
  _SFD_CC_CALL(CHART_ENTER_DURING_FUNCTION_TAG, 16U, chartInstance->c17_sfEvent);
  c17_hoistedGlobal = *c17_b_u;
  c17_u = c17_hoistedGlobal;
  sf_debug_symbol_scope_push_eml(0U, 4U, 4U, c17_debug_family_names,
    c17_debug_family_var_map);
  sf_debug_symbol_scope_add_eml_importable(&c17_nargin, 0U, c17_sf_marshallOut,
    c17_sf_marshallIn);
  sf_debug_symbol_scope_add_eml_importable(&c17_nargout, 1U, c17_sf_marshallOut,
    c17_sf_marshallIn);
  sf_debug_symbol_scope_add_eml(&c17_u, 2U, c17_sf_marshallOut);
  sf_debug_symbol_scope_add_eml_importable(&c17_y, 3U, c17_sf_marshallOut,
    c17_sf_marshallIn);
  CV_EML_FCN(0, 0);
  _SFD_EML_CALL(0U, chartInstance->c17_sfEvent, 4);
  if (CV_EML_IF(0, 0, c17_u > 1.5)) {
    _SFD_EML_CALL(0U, chartInstance->c17_sfEvent, 5);
    c17_y = 0.85;
  } else {
    _SFD_EML_CALL(0U, chartInstance->c17_sfEvent, 7);
    c17_y = 0.0;
  }

  _SFD_EML_CALL(0U, chartInstance->c17_sfEvent, -7);
  sf_debug_symbol_scope_pop();
  *c17_b_y = c17_y;
  _SFD_CC_CALL(EXIT_OUT_OF_FUNCTION_TAG, 16U, chartInstance->c17_sfEvent);
  sf_debug_check_for_state_inconsistency(_ekffedepreMachineNumber_,
    chartInstance->chartNumber, chartInstance->instanceNumber);
}
static void sf_c1_QPSK_Transmit_v5_w_FIFO
  (SFc1_QPSK_Transmit_v5_w_FIFOInstanceStruct *chartInstance)
{
  real_T c1_hoistedGlobal;
  real_T c1_d_in;
  uint32_T c1_debug_family_var_map[7];
  real_T c1_OS_RATE;
  real_T c1_f[17];
  real_T c1_nargin = 1.0;
  real_T c1_nargout = 1.0;
  creal_T c1_d_out;
  uint32_T c1_b_debug_family_var_map[3];
  real_T c1_y[17];
  real_T c1_b_nargin = 0.0;
  real_T c1_b_nargout = 1.0;
  int32_T c1_i2;
  static real_T c1_b[17] = { 0.006690562067, -0.00576859381, -0.011827354519,
    0.020586915021, 0.016726405168, -0.053692342207, -0.020253031546,
    0.196043589067, 0.33682241319, 0.196043589067, -0.020253031546,
    -0.053692342207, 0.016726405168, 0.020586915021, -0.011827354519,
    -0.00576859381, 0.006690562067 };

  int32_T c1_i3;
  int32_T c1_i4;
  int32_T c1_i5;
  creal_T c1_dcv1[17];
  int32_T c1_i6;
  int32_T c1_i7;
  creal_T c1_b_hoistedGlobal[17];
  creal_T c1_dc0;
  int32_T c1_i8;
  creal_T c1_b_b;
  creal_T c1_c_hoistedGlobal;
  real_T *c1_b_d_in;
  creal_T *c1_b_d_out;
  c1_b_d_out = (creal_T *)ssGetOutputPortSignal(chartInstance->S, 1);
  c1_b_d_in = (real_T *)ssGetInputPortSignal(chartInstance->S, 0);
  _sfTime_ = (real_T)ssGetT(chartInstance->S);
  _SFD_CC_CALL(CHART_ENTER_SFUNCTION_TAG, 0U, chartInstance->c1_sfEvent);
  _SFD_DATA_RANGE_CHECK(*c1_b_d_in, 0U);
  chartInstance->c1_sfEvent = CALL_EVENT;
  _SFD_CC_CALL(CHART_ENTER_DURING_FUNCTION_TAG, 0U, chartInstance->c1_sfEvent);
  c1_hoistedGlobal = *c1_b_d_in;
  c1_d_in = c1_hoistedGlobal;
  sf_debug_symbol_scope_push_eml(0U, 7U, 7U, c1_debug_family_names,
    c1_debug_family_var_map);
  sf_debug_symbol_scope_add_eml(&c1_OS_RATE, 0U, c1_c_sf_marshallOut);
  sf_debug_symbol_scope_add_eml(c1_f, 1U, c1_d_sf_marshallOut);
  sf_debug_symbol_scope_add_eml_importable(&c1_nargin, 2U, c1_c_sf_marshallOut,
    c1_c_sf_marshallIn);
  sf_debug_symbol_scope_add_eml_importable(&c1_nargout, 3U, c1_c_sf_marshallOut,
    c1_c_sf_marshallIn);
  sf_debug_symbol_scope_add_eml(&c1_d_in, 4U, c1_c_sf_marshallOut);
  sf_debug_symbol_scope_add_eml_importable(&c1_d_out, 5U, c1_b_sf_marshallOut,
    c1_b_sf_marshallIn);
  sf_debug_symbol_scope_add_eml_importable(chartInstance->c1_buf, 6U,
    c1_sf_marshallOut, c1_sf_marshallIn);
  CV_EML_FCN(0, 0);
  _SFD_EML_CALL(0U, chartInstance->c1_sfEvent, 3);
  _SFD_EML_CALL(0U, chartInstance->c1_sfEvent, 5);
  c1_OS_RATE = 8.0;
  _SFD_EML_CALL(0U, chartInstance->c1_sfEvent, 6);
  sf_debug_symbol_scope_push_eml(0U, 3U, 3U, c1_b_debug_family_names,
    c1_b_debug_family_var_map);
  sf_debug_symbol_scope_add_eml_importable(c1_y, 0U, c1_d_sf_marshallOut,
    c1_d_sf_marshallIn);
  sf_debug_symbol_scope_add_eml_importable(&c1_b_nargin, 1U, c1_c_sf_marshallOut,
    c1_c_sf_marshallIn);
  sf_debug_symbol_scope_add_eml_importable(&c1_b_nargout, 2U,
    c1_c_sf_marshallOut, c1_c_sf_marshallIn);
  CV_SCRIPT_FCN(0, 0);
  _SFD_SCRIPT_CALL(0U, chartInstance->c1_sfEvent, 3);
  for (c1_i2 = 0; c1_i2 < 17; c1_i2++) {
    c1_y[c1_i2] = c1_b[c1_i2];
  }

  _SFD_SCRIPT_CALL(0U, chartInstance->c1_sfEvent, -3);
  sf_debug_symbol_scope_pop();
  for (c1_i3 = 0; c1_i3 < 17; c1_i3++) {
    c1_f[c1_i3] = c1_b[c1_i3];
  }

  _SFD_EML_CALL(0U, chartInstance->c1_sfEvent, 8);
  if (CV_EML_IF(0, 1, 0, !chartInstance->c1_buf_not_empty)) {
    _SFD_EML_CALL(0U, chartInstance->c1_sfEvent, 9);
    for (c1_i4 = 0; c1_i4 < 17; c1_i4++) {
      chartInstance->c1_buf[c1_i4].re = 0.0;
      chartInstance->c1_buf[c1_i4].im = 0.0;
    }

    chartInstance->c1_buf_not_empty = TRUE;
  }

  _SFD_EML_CALL(0U, chartInstance->c1_sfEvent, 12);
  for (c1_i5 = 0; c1_i5 < 16; c1_i5++) {
    c1_dcv1[c1_i5] = chartInstance->c1_buf[c1_i5 + 1];
  }

  c1_dcv1[16].re = c1_d_in;
  c1_dcv1[16].im = 0.0;
  for (c1_i6 = 0; c1_i6 < 17; c1_i6++) {
    chartInstance->c1_buf[c1_i6] = c1_dcv1[c1_i6];
  }

  _SFD_EML_CALL(0U, chartInstance->c1_sfEvent, 14);
  for (c1_i7 = 0; c1_i7 < 17; c1_i7++) {
    c1_b_hoistedGlobal[c1_i7] = chartInstance->c1_buf[c1_i7];
  }

  c1_dc0.re = 0.0;
  c1_dc0.im = 0.0;
  for (c1_i8 = 0; c1_i8 < 17; c1_i8++) {
    c1_b_b.re = c1_b[c1_i8];
    c1_b_b.im = 0.0;
    c1_c_hoistedGlobal.re = c1_b_hoistedGlobal[c1_i8].re * c1_b_b.re -
      c1_b_hoistedGlobal[c1_i8].im * c1_b_b.im;
    c1_c_hoistedGlobal.im = c1_b_hoistedGlobal[c1_i8].re * c1_b_b.im +
      c1_b_hoistedGlobal[c1_i8].im * c1_b_b.re;
    c1_dc0.re += c1_c_hoistedGlobal.re;
    c1_dc0.im += c1_c_hoistedGlobal.im;
  }

  c1_d_out = c1_dc0;
  _SFD_EML_CALL(0U, chartInstance->c1_sfEvent, -14);
  sf_debug_symbol_scope_pop();
  c1_b_d_out->re = c1_d_out.re;
  c1_b_d_out->im = c1_d_out.im;
  _SFD_CC_CALL(EXIT_OUT_OF_FUNCTION_TAG, 0U, chartInstance->c1_sfEvent);
  sf_debug_check_for_state_inconsistency(_QPSK_Transmit_v5_w_FIFOMachineNumber_,
    chartInstance->chartNumber, chartInstance->instanceNumber);
}
示例#8
0
static void sf_c3_canudas_goal3(SFc3_canudas_goal3InstanceStruct *chartInstance)
{
  int32_T c3_i0;
  int32_T c3_i1;
  real_T c3_hoistedGlobal;
  real_T c3_b_hoistedGlobal;
  real_T c3_c_hoistedGlobal;
  real_T c3_d_hoistedGlobal;
  int32_T c3_i2;
  real_T c3_z[2];
  real_T c3_thetad;
  real_T c3_r;
  int32_T c3_i3;
  real_T c3_qe[3];
  real_T c3_k1;
  real_T c3_k2;
  uint32_T c3_debug_family_var_map[13];
  real_T c3_b;
  real_T c3_b1;
  real_T c3_b2;
  real_T c3_nargin = 6.0;
  real_T c3_nargout = 2.0;
  real_T c3_w;
  real_T c3_v;
  real_T c3_A;
  real_T c3_B;
  real_T c3_x;
  real_T c3_y;
  real_T c3_b_x;
  real_T c3_b_y;
  real_T c3_c_x;
  real_T c3_d_x;
  real_T c3_b_A;
  real_T c3_b_B;
  real_T c3_e_x;
  real_T c3_c_y;
  real_T c3_f_x;
  real_T c3_d_y;
  real_T c3_e_y;
  real_T c3_a;
  real_T c3_b_b;
  real_T c3_f_y;
  real_T c3_g_x;
  real_T c3_h_x;
  real_T c3_c_B;
  real_T c3_g_y;
  real_T c3_h_y;
  real_T c3_i_y;
  real_T c3_b_a;
  real_T c3_c_b;
  real_T c3_j_y;
  real_T c3_c_A;
  real_T c3_i_x;
  real_T c3_j_x;
  real_T c3_k_y;
  real_T c3_d_B;
  real_T c3_l_y;
  real_T c3_m_y;
  real_T c3_n_y;
  real_T c3_c_a;
  real_T c3_d_b;
  real_T c3_o_y;
  real_T c3_k_x;
  real_T c3_l_x;
  real_T c3_d_a;
  real_T c3_p_y;
  real_T c3_e_a;
  real_T c3_e_b;
  real_T c3_q_y;
  real_T c3_f_a;
  real_T c3_f_b;
  real_T c3_r_y;
  real_T c3_d_A;
  real_T c3_e_B;
  real_T c3_m_x;
  real_T c3_s_y;
  real_T c3_n_x;
  real_T c3_t_y;
  real_T c3_u_y;
  real_T c3_o_x;
  real_T c3_p_x;
  real_T c3_g_a;
  real_T c3_v_y;
  real_T c3_h_a;
  real_T c3_g_b;
  real_T c3_w_y;
  real_T c3_e_A;
  real_T c3_f_B;
  real_T c3_q_x;
  real_T c3_x_y;
  real_T c3_r_x;
  real_T c3_y_y;
  real_T c3_ab_y;
  real_T c3_i_a;
  real_T c3_h_b;
  real_T c3_bb_y;
  real_T c3_j_a;
  real_T c3_i_b;
  real_T c3_k_a;
  real_T c3_j_b;
  real_T c3_cb_y;
  real_T c3_l_a;
  real_T c3_k_b;
  real_T c3_db_y;
  real_T *c3_b_v;
  real_T *c3_b_w;
  real_T *c3_b_k2;
  real_T *c3_b_k1;
  real_T *c3_b_r;
  real_T *c3_b_thetad;
  real_T (*c3_b_qe)[3];
  real_T (*c3_b_z)[2];
  c3_b_k2 = (real_T *)ssGetInputPortSignal(chartInstance->S, 5);
  c3_b_k1 = (real_T *)ssGetInputPortSignal(chartInstance->S, 4);
  c3_b_qe = (real_T (*)[3])ssGetInputPortSignal(chartInstance->S, 3);
  c3_b_v = (real_T *)ssGetOutputPortSignal(chartInstance->S, 2);
  c3_b_r = (real_T *)ssGetInputPortSignal(chartInstance->S, 2);
  c3_b_thetad = (real_T *)ssGetInputPortSignal(chartInstance->S, 1);
  c3_b_z = (real_T (*)[2])ssGetInputPortSignal(chartInstance->S, 0);
  c3_b_w = (real_T *)ssGetOutputPortSignal(chartInstance->S, 1);
  _sfTime_ = (real_T)ssGetT(chartInstance->S);
  _SFD_CC_CALL(CHART_ENTER_SFUNCTION_TAG, 2U, chartInstance->c3_sfEvent);
  _SFD_DATA_RANGE_CHECK(*c3_b_w, 0U);
  for (c3_i0 = 0; c3_i0 < 2; c3_i0++) {
    _SFD_DATA_RANGE_CHECK((*c3_b_z)[c3_i0], 1U);
  }

  _SFD_DATA_RANGE_CHECK(*c3_b_thetad, 2U);
  _SFD_DATA_RANGE_CHECK(*c3_b_r, 3U);
  _SFD_DATA_RANGE_CHECK(*c3_b_v, 4U);
  for (c3_i1 = 0; c3_i1 < 3; c3_i1++) {
    _SFD_DATA_RANGE_CHECK((*c3_b_qe)[c3_i1], 5U);
  }

  _SFD_DATA_RANGE_CHECK(*c3_b_k1, 6U);
  _SFD_DATA_RANGE_CHECK(*c3_b_k2, 7U);
  chartInstance->c3_sfEvent = CALL_EVENT;
  _SFD_CC_CALL(CHART_ENTER_DURING_FUNCTION_TAG, 2U, chartInstance->c3_sfEvent);
  c3_hoistedGlobal = *c3_b_thetad;
  c3_b_hoistedGlobal = *c3_b_r;
  c3_c_hoistedGlobal = *c3_b_k1;
  c3_d_hoistedGlobal = *c3_b_k2;
  for (c3_i2 = 0; c3_i2 < 2; c3_i2++) {
    c3_z[c3_i2] = (*c3_b_z)[c3_i2];
  }

  c3_thetad = c3_hoistedGlobal;
  c3_r = c3_b_hoistedGlobal;
  for (c3_i3 = 0; c3_i3 < 3; c3_i3++) {
    c3_qe[c3_i3] = (*c3_b_qe)[c3_i3];
  }

  c3_k1 = c3_c_hoistedGlobal;
  c3_k2 = c3_d_hoistedGlobal;
  sf_debug_symbol_scope_push_eml(0U, 13U, 13U, c3_debug_family_names,
    c3_debug_family_var_map);
  sf_debug_symbol_scope_add_eml_importable(&c3_b, 0U, c3_sf_marshallOut,
    c3_sf_marshallIn);
  sf_debug_symbol_scope_add_eml_importable(&c3_b1, 1U, c3_sf_marshallOut,
    c3_sf_marshallIn);
  sf_debug_symbol_scope_add_eml_importable(&c3_b2, 2U, c3_sf_marshallOut,
    c3_sf_marshallIn);
  sf_debug_symbol_scope_add_eml_importable(&c3_nargin, 3U, c3_sf_marshallOut,
    c3_sf_marshallIn);
  sf_debug_symbol_scope_add_eml_importable(&c3_nargout, 4U, c3_sf_marshallOut,
    c3_sf_marshallIn);
  sf_debug_symbol_scope_add_eml(c3_z, 5U, c3_c_sf_marshallOut);
  sf_debug_symbol_scope_add_eml(&c3_thetad, 6U, c3_sf_marshallOut);
  sf_debug_symbol_scope_add_eml(&c3_r, 7U, c3_sf_marshallOut);
  sf_debug_symbol_scope_add_eml(c3_qe, 8U, c3_b_sf_marshallOut);
  sf_debug_symbol_scope_add_eml(&c3_k1, 9U, c3_sf_marshallOut);
  sf_debug_symbol_scope_add_eml(&c3_k2, 10U, c3_sf_marshallOut);
  sf_debug_symbol_scope_add_eml_importable(&c3_w, 11U, c3_sf_marshallOut,
    c3_sf_marshallIn);
  sf_debug_symbol_scope_add_eml_importable(&c3_v, 12U, c3_sf_marshallOut,
    c3_sf_marshallIn);
  CV_EML_FCN(0, 0);
  _SFD_EML_CALL(0U, chartInstance->c3_sfEvent, 4);
  c3_A = c3_qe[1];
  c3_B = c3_qe[0];
  c3_x = c3_A;
  c3_y = c3_B;
  c3_b_x = c3_x;
  c3_b_y = c3_y;
  c3_b = c3_b_x / c3_b_y;
  _SFD_EML_CALL(0U, chartInstance->c3_sfEvent, 5);
  c3_c_x = c3_qe[2];
  c3_d_x = c3_c_x;
  c3_d_x = muDoubleScalarCos(c3_d_x);
  c3_b_A = c3_thetad;
  c3_b_B = c3_b;
  c3_e_x = c3_b_A;
  c3_c_y = c3_b_B;
  c3_f_x = c3_e_x;
  c3_d_y = c3_c_y;
  c3_e_y = c3_f_x / c3_d_y;
  c3_a = c3_d_x;
  c3_b_b = c3_e_y - 1.0;
  c3_f_y = c3_a * c3_b_b;
  c3_g_x = c3_qe[2];
  c3_h_x = c3_g_x;
  c3_h_x = muDoubleScalarSin(c3_h_x);
  c3_c_B = c3_mpower(chartInstance, c3_b);
  c3_g_y = c3_c_B;
  c3_h_y = c3_g_y;
  c3_i_y = 1.0 / c3_h_y;
  c3_b_a = c3_thetad;
  c3_c_b = 1.0 - c3_i_y;
  c3_j_y = c3_b_a * c3_c_b;
  c3_c_A = c3_j_y;
  c3_i_x = c3_c_A;
  c3_j_x = c3_i_x;
  c3_k_y = c3_j_x / 2.0;
  c3_d_B = c3_b;
  c3_l_y = c3_d_B;
  c3_m_y = c3_l_y;
  c3_n_y = 1.0 / c3_m_y;
  c3_c_a = c3_h_x;
  c3_d_b = c3_k_y + c3_n_y;
  c3_o_y = c3_c_a * c3_d_b;
  c3_b1 = c3_f_y + c3_o_y;
  _SFD_EML_CALL(0U, chartInstance->c3_sfEvent, 6);
  c3_k_x = c3_qe[2];
  c3_l_x = c3_k_x;
  c3_l_x = muDoubleScalarCos(c3_l_x);
  c3_d_a = c3_l_x;
  c3_p_y = c3_d_a * 2.0;
  c3_e_a = c3_p_y;
  c3_e_b = c3_b;
  c3_q_y = c3_e_a * c3_e_b;
  c3_f_a = 1.0 + c3_mpower(chartInstance, c3_b);
  c3_f_b = c3_qe[0];
  c3_r_y = c3_f_a * c3_f_b;
  c3_d_A = c3_q_y;
  c3_e_B = c3_r_y;
  c3_m_x = c3_d_A;
  c3_s_y = c3_e_B;
  c3_n_x = c3_m_x;
  c3_t_y = c3_s_y;
  c3_u_y = c3_n_x / c3_t_y;
  c3_o_x = c3_qe[2];
  c3_p_x = c3_o_x;
  c3_p_x = muDoubleScalarSin(c3_p_x);
  c3_g_a = c3_p_x;
  c3_v_y = c3_g_a * 2.0;
  c3_h_a = 1.0 + c3_mpower(chartInstance, c3_b);
  c3_g_b = c3_qe[0];
  c3_w_y = c3_h_a * c3_g_b;
  c3_e_A = c3_v_y;
  c3_f_B = c3_w_y;
  c3_q_x = c3_e_A;
  c3_x_y = c3_f_B;
  c3_r_x = c3_q_x;
  c3_y_y = c3_x_y;
  c3_ab_y = c3_r_x / c3_y_y;
  c3_b2 = c3_u_y - c3_ab_y;
  _SFD_EML_CALL(0U, chartInstance->c3_sfEvent, 8);
  c3_i_a = -c3_k1;
  c3_h_b = c3_b1;
  c3_bb_y = c3_i_a * c3_h_b;
  c3_j_a = c3_bb_y;
  c3_i_b = c3_z[0];
  c3_v = c3_j_a * c3_i_b;
  _SFD_EML_CALL(0U, chartInstance->c3_sfEvent, 9);
  c3_k_a = -c3_b2;
  c3_j_b = c3_v;
  c3_cb_y = c3_k_a * c3_j_b;
  c3_l_a = c3_k2;
  c3_k_b = c3_z[1];
  c3_db_y = c3_l_a * c3_k_b;
  c3_w = c3_cb_y - c3_db_y;
  _SFD_EML_CALL(0U, chartInstance->c3_sfEvent, -9);
  sf_debug_symbol_scope_pop();
  *c3_b_w = c3_w;
  *c3_b_v = c3_v;
  _SFD_CC_CALL(EXIT_OUT_OF_FUNCTION_TAG, 2U, chartInstance->c3_sfEvent);
  sf_debug_check_for_state_inconsistency(_canudas_goal3MachineNumber_,
    chartInstance->chartNumber, chartInstance->instanceNumber);
}
示例#9
0
static void sf_c3_ErdMond(SFc3_ErdMondInstanceStruct *chartInstance)
{
  int32_T c3_i2;
  int32_T c3_i3;
  int32_T c3_i4;
  real_T c3_xAktuell[2];
  uint32_T c3_debug_family_var_map[16];
  real_T c3_xE[2];
  real_T c3_eSE[2];
  real_T c3_xM[2];
  real_T c3_vSM[2];
  real_T c3_rSM;
  real_T c3_eSM[2];
  real_T c3_r;
  real_T c3_mE;
  real_T c3_mM;
  real_T c3_G;
  real_T c3_F_SE[2];
  real_T c3_F_SM[2];
  real_T c3_nargin = 1.0;
  real_T c3_nargout = 1.0;
  real_T c3_a[2];
  int32_T c3_i5;
  real_T c3_A[2];
  int32_T c3_i6;
  real_T c3_b_xAktuell[2];
  real_T c3_B;
  real_T c3_y;
  real_T c3_b_y;
  int32_T c3_i7;
  int32_T c3_i8;
  int32_T c3_i9;
  int32_T c3_i10;
  int32_T c3_i11;
  int32_T c3_i12;
  real_T c3_b_vSM[2];
  int32_T c3_i13;
  int32_T c3_i14;
  real_T c3_c_vSM[2];
  real_T c3_b_B;
  real_T c3_c_y;
  real_T c3_d_y;
  int32_T c3_i15;
  int32_T c3_i16;
  real_T c3_c_xAktuell[2];
  real_T c3_c_B;
  real_T c3_e_y;
  real_T c3_f_y;
  real_T c3_g_y;
  real_T c3_b_a;
  int32_T c3_i17;
  int32_T c3_i18;
  real_T c3_d_B;
  real_T c3_h_y;
  real_T c3_i_y;
  real_T c3_j_y;
  real_T c3_c_a;
  int32_T c3_i19;
  int32_T c3_i20;
  int32_T c3_i21;
  int32_T c3_i22;
  real_T (*c3_d_a)[2];
  real_T (*c3_d_xAktuell)[2];
  c3_d_a = (real_T (*)[2])ssGetOutputPortSignal(chartInstance->S, 1);
  c3_d_xAktuell = (real_T (*)[2])ssGetInputPortSignal(chartInstance->S, 0);
  _sfTime_ = (real_T)ssGetT(chartInstance->S);
  _SFD_CC_CALL(CHART_ENTER_SFUNCTION_TAG, 2U, chartInstance->c3_sfEvent);
  for (c3_i2 = 0; c3_i2 < 2; c3_i2++) {
    _SFD_DATA_RANGE_CHECK((*c3_d_xAktuell)[c3_i2], 0U);
  }

  for (c3_i3 = 0; c3_i3 < 2; c3_i3++) {
    _SFD_DATA_RANGE_CHECK((*c3_d_a)[c3_i3], 1U);
  }

  chartInstance->c3_sfEvent = CALL_EVENT;
  _SFD_CC_CALL(CHART_ENTER_DURING_FUNCTION_TAG, 2U, chartInstance->c3_sfEvent);
  for (c3_i4 = 0; c3_i4 < 2; c3_i4++) {
    c3_xAktuell[c3_i4] = (*c3_d_xAktuell)[c3_i4];
  }

  sf_debug_symbol_scope_push_eml(0U, 16U, 16U, c3_debug_family_names,
    c3_debug_family_var_map);
  sf_debug_symbol_scope_add_eml_importable(c3_xE, 0U, c3_sf_marshallOut,
    c3_sf_marshallIn);
  sf_debug_symbol_scope_add_eml_importable(c3_eSE, 1U, c3_sf_marshallOut,
    c3_sf_marshallIn);
  sf_debug_symbol_scope_add_eml_importable(c3_xM, 2U, c3_sf_marshallOut,
    c3_sf_marshallIn);
  sf_debug_symbol_scope_add_eml_importable(c3_vSM, 3U, c3_sf_marshallOut,
    c3_sf_marshallIn);
  sf_debug_symbol_scope_add_eml_importable(&c3_rSM, 4U, c3_b_sf_marshallOut,
    c3_b_sf_marshallIn);
  sf_debug_symbol_scope_add_eml_importable(c3_eSM, 5U, c3_sf_marshallOut,
    c3_sf_marshallIn);
  sf_debug_symbol_scope_add_eml_importable(&c3_r, 6U, c3_b_sf_marshallOut,
    c3_b_sf_marshallIn);
  sf_debug_symbol_scope_add_eml(&c3_mE, 7U, c3_b_sf_marshallOut);
  sf_debug_symbol_scope_add_eml(&c3_mM, 8U, c3_b_sf_marshallOut);
  sf_debug_symbol_scope_add_eml(&c3_G, 9U, c3_b_sf_marshallOut);
  sf_debug_symbol_scope_add_eml_importable(c3_F_SE, 10U, c3_sf_marshallOut,
    c3_sf_marshallIn);
  sf_debug_symbol_scope_add_eml_importable(c3_F_SM, 11U, c3_sf_marshallOut,
    c3_sf_marshallIn);
  sf_debug_symbol_scope_add_eml_importable(&c3_nargin, 12U, c3_b_sf_marshallOut,
    c3_b_sf_marshallIn);
  sf_debug_symbol_scope_add_eml_importable(&c3_nargout, 13U, c3_b_sf_marshallOut,
    c3_b_sf_marshallIn);
  sf_debug_symbol_scope_add_eml(c3_xAktuell, 14U, c3_sf_marshallOut);
  sf_debug_symbol_scope_add_eml_importable(c3_a, 15U, c3_sf_marshallOut,
    c3_sf_marshallIn);
  CV_EML_FCN(0, 0);
  _SFD_EML_CALL(0U, chartInstance->c3_sfEvent, 4);
  for (c3_i5 = 0; c3_i5 < 2; c3_i5++) {
    c3_A[c3_i5] = c3_xAktuell[c3_i5];
  }

  for (c3_i6 = 0; c3_i6 < 2; c3_i6++) {
    c3_b_xAktuell[c3_i6] = c3_xAktuell[c3_i6];
  }

  c3_B = c3_norm(chartInstance, c3_b_xAktuell);
  c3_y = c3_B;
  c3_b_y = c3_y;
  for (c3_i7 = 0; c3_i7 < 2; c3_i7++) {
    c3_xE[c3_i7] = c3_A[c3_i7] / c3_b_y;
  }

  _SFD_EML_CALL(0U, chartInstance->c3_sfEvent, 5);
  for (c3_i8 = 0; c3_i8 < 2; c3_i8++) {
    c3_A[c3_i8] = c3_xE[c3_i8];
  }

  for (c3_i9 = 0; c3_i9 < 2; c3_i9++) {
    c3_eSE[c3_i9] = -c3_A[c3_i9];
  }

  _SFD_EML_CALL(0U, chartInstance->c3_sfEvent, 7);
  for (c3_i10 = 0; c3_i10 < 2; c3_i10++) {
    c3_xM[c3_i10] = -3.8E+8 * (real_T)c3_i10;
  }

  _SFD_EML_CALL(0U, chartInstance->c3_sfEvent, 8);
  for (c3_i11 = 0; c3_i11 < 2; c3_i11++) {
    c3_vSM[c3_i11] = c3_xM[c3_i11] - c3_xAktuell[c3_i11];
  }

  _SFD_EML_CALL(0U, chartInstance->c3_sfEvent, 9);
  for (c3_i12 = 0; c3_i12 < 2; c3_i12++) {
    c3_b_vSM[c3_i12] = c3_vSM[c3_i12];
  }

  c3_rSM = c3_norm(chartInstance, c3_b_vSM);
  _SFD_EML_CALL(0U, chartInstance->c3_sfEvent, 10);
  for (c3_i13 = 0; c3_i13 < 2; c3_i13++) {
    c3_A[c3_i13] = c3_vSM[c3_i13];
  }

  for (c3_i14 = 0; c3_i14 < 2; c3_i14++) {
    c3_c_vSM[c3_i14] = c3_vSM[c3_i14];
  }

  c3_b_B = c3_norm(chartInstance, c3_c_vSM);
  c3_c_y = c3_b_B;
  c3_d_y = c3_c_y;
  for (c3_i15 = 0; c3_i15 < 2; c3_i15++) {
    c3_eSM[c3_i15] = c3_A[c3_i15] / c3_d_y;
  }

  _SFD_EML_CALL(0U, chartInstance->c3_sfEvent, 12);
  for (c3_i16 = 0; c3_i16 < 2; c3_i16++) {
    c3_c_xAktuell[c3_i16] = c3_xAktuell[c3_i16];
  }

  c3_r = c3_norm(chartInstance, c3_c_xAktuell);
  _SFD_EML_CALL(0U, chartInstance->c3_sfEvent, 14);
  c3_mE = 5.9736000000000006E+24;
  _SFD_EML_CALL(0U, chartInstance->c3_sfEvent, 15);
  c3_mM = 7.348E+22;
  _SFD_EML_CALL(0U, chartInstance->c3_sfEvent, 16);
  c3_G = 6.6743E-11;
  _SFD_EML_CALL(0U, chartInstance->c3_sfEvent, 18);
  c3_c_B = c3_mpower(chartInstance, c3_r);
  c3_e_y = c3_c_B;
  c3_f_y = c3_e_y;
  c3_g_y = 3.986959848E+14 / c3_f_y;
  c3_b_a = c3_g_y;
  for (c3_i17 = 0; c3_i17 < 2; c3_i17++) {
    c3_A[c3_i17] = c3_eSE[c3_i17];
  }

  for (c3_i18 = 0; c3_i18 < 2; c3_i18++) {
    c3_F_SE[c3_i18] = c3_b_a * c3_A[c3_i18];
  }

  _SFD_EML_CALL(0U, chartInstance->c3_sfEvent, 19);
  c3_d_B = c3_mpower(chartInstance, c3_rSM);
  c3_h_y = c3_d_B;
  c3_i_y = c3_h_y;
  c3_j_y = 4.904275639999999E+12 / c3_i_y;
  c3_c_a = c3_j_y;
  for (c3_i19 = 0; c3_i19 < 2; c3_i19++) {
    c3_A[c3_i19] = c3_eSM[c3_i19];
  }

  for (c3_i20 = 0; c3_i20 < 2; c3_i20++) {
    c3_F_SM[c3_i20] = c3_c_a * c3_A[c3_i20];
  }

  _SFD_EML_CALL(0U, chartInstance->c3_sfEvent, 21);
  for (c3_i21 = 0; c3_i21 < 2; c3_i21++) {
    c3_a[c3_i21] = c3_F_SE[c3_i21] + c3_F_SM[c3_i21];
  }

  _SFD_EML_CALL(0U, chartInstance->c3_sfEvent, -21);
  sf_debug_symbol_scope_pop();
  for (c3_i22 = 0; c3_i22 < 2; c3_i22++) {
    (*c3_d_a)[c3_i22] = c3_a[c3_i22];
  }

  _SFD_CC_CALL(EXIT_OUT_OF_FUNCTION_TAG, 2U, chartInstance->c3_sfEvent);
  sf_debug_check_for_state_inconsistency(_ErdMondMachineNumber_,
    chartInstance->chartNumber, chartInstance->instanceNumber);
}
示例#10
0
static void c11_chartstep_c11_Batman_Code(SFc11_Batman_CodeInstanceStruct
  *chartInstance)
{
  int32_T c11_i5;
  uint32_T c11_msg[2];
  int32_T c11_i6;
  uint16_T c11_cell_temperatures_in[12];
  uint32_T c11_debug_family_var_map[9];
  uint16_T c11_x1;
  uint16_T c11_x2;
  uint16_T c11_x3;
  uint16_T c11_x4;
  real_T c11_nargin = 2.0;
  real_T c11_nargout = 1.0;
  uint16_T c11_cell_temperatures_out[12];
  uint32_T c11_a;
  uint32_T c11_a1;
  uint32_T c11_c;
  uint32_T c11_b;
  uint32_T c11_b_c;
  uint32_T c11_u0;
  uint32_T c11_b_a;
  uint32_T c11_b_a1;
  uint32_T c11_c_c;
  uint32_T c11_b_b;
  uint32_T c11_d_c;
  uint32_T c11_u1;
  uint32_T c11_c_a;
  uint32_T c11_c_a1;
  uint32_T c11_e_c;
  uint32_T c11_c_b;
  uint32_T c11_f_c;
  uint32_T c11_u2;
  uint32_T c11_d_a;
  uint32_T c11_d_a1;
  uint32_T c11_g_c;
  uint32_T c11_d_b;
  uint32_T c11_h_c;
  uint32_T c11_u3;
  int32_T c11_i7;
  int32_T c11_i8;
  uint16_T (*c11_b_cell_temperatures_out)[12];
  uint16_T (*c11_b_cell_temperatures_in)[12];
  uint32_T (*c11_b_msg)[2];
  c11_b_cell_temperatures_out = (uint16_T (*)[12])ssGetOutputPortSignal
    (chartInstance->S, 1);
  c11_b_cell_temperatures_in = (uint16_T (*)[12])ssGetInputPortSignal
    (chartInstance->S, 1);
  c11_b_msg = (uint32_T (*)[2])ssGetInputPortSignal(chartInstance->S, 0);
  _SFD_CC_CALL(CHART_ENTER_DURING_FUNCTION_TAG, 7U, chartInstance->c11_sfEvent);
  for (c11_i5 = 0; c11_i5 < 2; c11_i5++) {
    c11_msg[c11_i5] = (*c11_b_msg)[c11_i5];
  }

  for (c11_i6 = 0; c11_i6 < 12; c11_i6++) {
    c11_cell_temperatures_in[c11_i6] = (*c11_b_cell_temperatures_in)[c11_i6];
  }

  sf_debug_symbol_scope_push_eml(0U, 9U, 9U, c11_debug_family_names,
    c11_debug_family_var_map);
  sf_debug_symbol_scope_add_eml_importable(&c11_x1, 0U, c11_d_sf_marshallOut,
    c11_c_sf_marshallIn);
  sf_debug_symbol_scope_add_eml_importable(&c11_x2, 1U, c11_d_sf_marshallOut,
    c11_c_sf_marshallIn);
  sf_debug_symbol_scope_add_eml_importable(&c11_x3, 2U, c11_d_sf_marshallOut,
    c11_c_sf_marshallIn);
  sf_debug_symbol_scope_add_eml_importable(&c11_x4, 3U, c11_d_sf_marshallOut,
    c11_c_sf_marshallIn);
  sf_debug_symbol_scope_add_eml_importable(&c11_nargin, 4U, c11_c_sf_marshallOut,
    c11_b_sf_marshallIn);
  sf_debug_symbol_scope_add_eml_importable(&c11_nargout, 5U,
    c11_c_sf_marshallOut, c11_b_sf_marshallIn);
  sf_debug_symbol_scope_add_eml(c11_msg, 6U, c11_b_sf_marshallOut);
  sf_debug_symbol_scope_add_eml(c11_cell_temperatures_in, 7U, c11_sf_marshallOut);
  sf_debug_symbol_scope_add_eml_importable(c11_cell_temperatures_out, 8U,
    c11_sf_marshallOut, c11_sf_marshallIn);
  CV_EML_FCN(0, 0);
  _SFD_EML_CALL(0U, chartInstance->c11_sfEvent, 6);
  c11_a = c11_msg[0];
  c11_a1 = c11_a;
  c11_c = c11_a1;
  c11_b = c11_c;
  c11_b_c = c11_b & 65535U;
  c11_u0 = c11_b_c;
  if (c11_u0 > 65535U) {
    c11_u0 = 65535U;
  }

  c11_x1 = (uint16_T)c11_u0;
  _SFD_EML_CALL(0U, chartInstance->c11_sfEvent, 7);
  c11_b_a = c11_msg[0];
  c11_b_a1 = c11_b_a;
  c11_c_c = c11_b_a1 >> 16U;
  c11_b_b = c11_c_c;
  c11_d_c = c11_b_b & 65535U;
  c11_u1 = c11_d_c;
  if (c11_u1 > 65535U) {
    c11_u1 = 65535U;
  }

  c11_x2 = (uint16_T)c11_u1;
  _SFD_EML_CALL(0U, chartInstance->c11_sfEvent, 8);
  c11_c_a = c11_msg[1];
  c11_c_a1 = c11_c_a;
  c11_e_c = c11_c_a1;
  c11_c_b = c11_e_c;
  c11_f_c = c11_c_b & 65535U;
  c11_u2 = c11_f_c;
  if (c11_u2 > 65535U) {
    c11_u2 = 65535U;
  }

  c11_x3 = (uint16_T)c11_u2;
  _SFD_EML_CALL(0U, chartInstance->c11_sfEvent, 9);
  c11_d_a = c11_msg[1];
  c11_d_a1 = c11_d_a;
  c11_g_c = c11_d_a1 >> 16U;
  c11_d_b = c11_g_c;
  c11_h_c = c11_d_b & 65535U;
  c11_u3 = c11_h_c;
  if (c11_u3 > 65535U) {
    c11_u3 = 65535U;
  }

  c11_x4 = (uint16_T)c11_u3;
  _SFD_EML_CALL(0U, chartInstance->c11_sfEvent, 11);
  c11_cell_temperatures_in[8] = c11_x1;
  _SFD_EML_CALL(0U, chartInstance->c11_sfEvent, 12);
  c11_cell_temperatures_in[9] = c11_x2;
  _SFD_EML_CALL(0U, chartInstance->c11_sfEvent, 13);
  c11_cell_temperatures_in[10] = c11_x3;
  _SFD_EML_CALL(0U, chartInstance->c11_sfEvent, 14);
  c11_cell_temperatures_in[11] = c11_x4;
  _SFD_EML_CALL(0U, chartInstance->c11_sfEvent, 18);
  for (c11_i7 = 0; c11_i7 < 12; c11_i7++) {
    c11_cell_temperatures_out[c11_i7] = c11_cell_temperatures_in[c11_i7];
  }

  _SFD_EML_CALL(0U, chartInstance->c11_sfEvent, -18);
  sf_debug_symbol_scope_pop();
  for (c11_i8 = 0; c11_i8 < 12; c11_i8++) {
    (*c11_b_cell_temperatures_out)[c11_i8] = c11_cell_temperatures_out[c11_i8];
  }

  _SFD_CC_CALL(EXIT_OUT_OF_FUNCTION_TAG, 7U, chartInstance->c11_sfEvent);
}
static void sf_c31_adcs_v15_integral_Power_no_charge_in_detumb(void)
{
  int32_T c31_previousEvent;
  real_T c31_Vbat;
  real_T c31_pow;
  real_T c31_nargout = 1.0;
  real_T c31_nargin = 2.0;
  real_T c31_battery;
  real_T c31_pow_drawn;
  real_T *c31_b_Vbat;
  real_T *c31_b_pow;
  real_T *c31_b_pow_drawn;
  c31_b_pow_drawn = (real_T *)ssGetOutputPortSignal(chartInstance.S, 1);
  c31_b_pow = (real_T *)ssGetInputPortSignal(chartInstance.S, 1);
  c31_b_Vbat = (real_T *)ssGetInputPortSignal(chartInstance.S, 0);
  _sfTime_ = (real_T)ssGetT(chartInstance.S);
  _SFD_CC_CALL(CHART_ENTER_SFUNCTION_TAG,24);
  _SFD_DATA_RANGE_CHECK(*c31_b_Vbat, 0U);
  _SFD_DATA_RANGE_CHECK(*c31_b_pow, 1U);
  _SFD_DATA_RANGE_CHECK(*c31_b_pow_drawn, 2U);
  c31_previousEvent = _sfEvent_;
  _sfEvent_ = CALL_EVENT;
  _SFD_CC_CALL(CHART_ENTER_DURING_FUNCTION_TAG,24);
  c31_Vbat = *c31_b_Vbat;
  c31_pow = *c31_b_pow;
  sf_debug_symbol_scope_push(6U, 0U);
  sf_debug_symbol_scope_add("nargout", &c31_nargout, c31_sf_marshall);
  sf_debug_symbol_scope_add("nargin", &c31_nargin, c31_sf_marshall);
  sf_debug_symbol_scope_add("battery", &c31_battery, c31_sf_marshall);
  sf_debug_symbol_scope_add("pow_drawn", &c31_pow_drawn, c31_sf_marshall);
  sf_debug_symbol_scope_add("pow", &c31_pow, c31_sf_marshall);
  sf_debug_symbol_scope_add("Vbat", &c31_Vbat, c31_sf_marshall);
  CV_EML_FCN(0, 0);

  /*  This block supports the Embedded MATLAB subset. */
  /*  See the help menu for details.  */
  _SFD_EML_CALL(0,5);
  c31_battery = 0.0;
  _SFD_EML_CALL(0,7);
  if (CV_EML_IF(0, 0, c31_Vbat > 3.0)) {
    _SFD_EML_CALL(0,8);
    c31_battery = 1.0;
  } else {
    _SFD_EML_CALL(0,10);
    c31_battery = 0.0;
  }

  _SFD_EML_CALL(0,13);
  if (CV_EML_IF(0, 1, c31_battery == 1.0)) {
    _SFD_EML_CALL(0,14);
    c31_pow_drawn = c31_pow;
  } else {
    _SFD_EML_CALL(0,16);
    c31_pow_drawn = 0.0;
  }

  _SFD_EML_CALL(0,-16);
  sf_debug_symbol_scope_pop();
  *c31_b_pow_drawn = c31_pow_drawn;
  _SFD_CC_CALL(EXIT_OUT_OF_FUNCTION_TAG,24);
  _sfEvent_ = c31_previousEvent;
  sf_debug_check_for_state_inconsistency
    (_adcs_v15_integral_Power_no_charge_in_detumbMachineNumber_,
     chartInstance.chartNumber,
     chartInstance.instanceNumber);
}
static void sf_c3_car_model(SFc3_car_modelInstanceStruct *chartInstance)
{
  int32_T c3_i3;
  int32_T c3_i4;
  int32_T c3_i5;
  int32_T c3_previousEvent;
  int32_T c3_i6;
  real_T c3_hoistedGlobal[4];
  int32_T c3_i7;
  real_T c3_b_hoistedGlobal[3];
  int32_T c3_i8;
  real_T c3_X[4];
  int32_T c3_i9;
  real_T c3_u[3];
  uint32_T c3_debug_family_var_map[22];
  real_T c3_l_F;
  real_T c3_l_R;
  real_T c3_Vx;
  real_T c3_Vy;
  real_T c3_r;
  real_T c3_psi;
  real_T c3_f_Fx;
  real_T c3_f_Rx;
  real_T c3_delta;
  real_T c3_beta;
  real_T c3_V;
  real_T c3_s_Fy_num;
  real_T c3_s_Fy_denum;
  real_T c3_s_Fy;
  real_T c3_s_Ry_num;
  real_T c3_s_Ry_denum;
  real_T c3_s_Ry;
  real_T c3_nargin = 2.0;
  real_T c3_nargout = 1.0;
  real_T c3_s[2];
  real_T c3_A;
  real_T c3_B;
  real_T c3_x;
  real_T c3_y;
  real_T c3_b_x;
  real_T c3_b_y;
  real_T c3_c_x;
  real_T c3_c_y;
  real_T c3_d_y;
  real_T c3_d_x;
  real_T c3_e_x;
  real_T c3_f_x;
  real_T c3_g_x;
  real_T c3_h_x;
  real_T c3_i_x;
  real_T c3_j_x;
  real_T c3_a;
  real_T c3_b;
  real_T c3_e_y;
  real_T c3_b_a;
  real_T c3_f_y;
  real_T c3_k_x;
  real_T c3_l_x;
  real_T c3_m_x;
  real_T c3_c_a;
  real_T c3_b_b;
  real_T c3_g_y;
  real_T c3_n_x;
  real_T c3_o_x;
  real_T c3_p_x;
  real_T c3_d_a;
  real_T c3_c_b;
  real_T c3_h_y;
  real_T c3_e_a;
  real_T c3_i_y;
  real_T c3_q_x;
  real_T c3_r_x;
  real_T c3_s_x;
  real_T c3_f_a;
  real_T c3_d_b;
  real_T c3_j_y;
  real_T c3_b_A;
  real_T c3_b_B;
  real_T c3_t_x;
  real_T c3_k_y;
  real_T c3_u_x;
  real_T c3_l_y;
  real_T c3_v_x;
  real_T c3_m_y;
  real_T c3_w_x;
  real_T c3_x_x;
  real_T c3_y_x;
  real_T c3_g_a;
  real_T c3_e_b;
  real_T c3_n_y;
  real_T c3_h_a;
  real_T c3_o_y;
  real_T c3_ab_x;
  real_T c3_bb_x;
  real_T c3_cb_x;
  real_T c3_i_a;
  real_T c3_f_b;
  real_T c3_c_A;
  real_T c3_c_B;
  real_T c3_db_x;
  real_T c3_p_y;
  real_T c3_eb_x;
  real_T c3_q_y;
  real_T c3_fb_x;
  real_T c3_r_y;
  int32_T c3_i10;
  real_T (*c3_b_s)[2];
  real_T (*c3_b_u)[3];
  real_T (*c3_b_X)[4];
  c3_b_u = (real_T (*)[3])ssGetInputPortSignal(chartInstance->S, 1);
  c3_b_s = (real_T (*)[2])ssGetOutputPortSignal(chartInstance->S, 1);
  c3_b_X = (real_T (*)[4])ssGetInputPortSignal(chartInstance->S, 0);
  _sfTime_ = (real_T)ssGetT(chartInstance->S);
  _SFD_CC_CALL(CHART_ENTER_SFUNCTION_TAG,2);
  for (c3_i3 = 0; c3_i3 < 4; c3_i3 = c3_i3 + 1) {
    _SFD_DATA_RANGE_CHECK((*c3_b_X)[c3_i3], 0U);
  }

  for (c3_i4 = 0; c3_i4 < 2; c3_i4 = c3_i4 + 1) {
    _SFD_DATA_RANGE_CHECK((*c3_b_s)[c3_i4], 1U);
  }

  for (c3_i5 = 0; c3_i5 < 3; c3_i5 = c3_i5 + 1) {
    _SFD_DATA_RANGE_CHECK((*c3_b_u)[c3_i5], 2U);
  }

  c3_previousEvent = _sfEvent_;
  _sfEvent_ = CALL_EVENT;
  _SFD_CC_CALL(CHART_ENTER_DURING_FUNCTION_TAG,2);
  for (c3_i6 = 0; c3_i6 < 4; c3_i6 = c3_i6 + 1) {
    c3_hoistedGlobal[c3_i6] = (*c3_b_X)[c3_i6];
  }

  for (c3_i7 = 0; c3_i7 < 3; c3_i7 = c3_i7 + 1) {
    c3_b_hoistedGlobal[c3_i7] = (*c3_b_u)[c3_i7];
  }

  for (c3_i8 = 0; c3_i8 < 4; c3_i8 = c3_i8 + 1) {
    c3_X[c3_i8] = c3_hoistedGlobal[c3_i8];
  }

  for (c3_i9 = 0; c3_i9 < 3; c3_i9 = c3_i9 + 1) {
    c3_u[c3_i9] = c3_b_hoistedGlobal[c3_i9];
  }

  sf_debug_symbol_scope_push_eml(0U, 22U, 22U, c3_debug_family_names,
    c3_debug_family_var_map);
  sf_debug_symbol_scope_add_eml(&c3_l_F, c3_d_sf_marshall, 0U);
  sf_debug_symbol_scope_add_eml(&c3_l_R, c3_d_sf_marshall, 1U);
  sf_debug_symbol_scope_add_eml(&c3_Vx, c3_d_sf_marshall, 2U);
  sf_debug_symbol_scope_add_eml(&c3_Vy, c3_d_sf_marshall, 3U);
  sf_debug_symbol_scope_add_eml(&c3_r, c3_d_sf_marshall, 4U);
  sf_debug_symbol_scope_add_eml(&c3_psi, c3_d_sf_marshall, 5U);
  sf_debug_symbol_scope_add_eml(&c3_f_Fx, c3_d_sf_marshall, 6U);
  sf_debug_symbol_scope_add_eml(&c3_f_Rx, c3_d_sf_marshall, 7U);
  sf_debug_symbol_scope_add_eml(&c3_delta, c3_d_sf_marshall, 8U);
  sf_debug_symbol_scope_add_eml(&c3_beta, c3_d_sf_marshall, 9U);
  sf_debug_symbol_scope_add_eml(&c3_V, c3_d_sf_marshall, 10U);
  sf_debug_symbol_scope_add_eml(&c3_s_Fy_num, c3_d_sf_marshall, 11U);
  sf_debug_symbol_scope_add_eml(&c3_s_Fy_denum, c3_d_sf_marshall, 12U);
  sf_debug_symbol_scope_add_eml(&c3_s_Fy, c3_d_sf_marshall, 13U);
  sf_debug_symbol_scope_add_eml(&c3_s_Ry_num, c3_d_sf_marshall, 14U);
  sf_debug_symbol_scope_add_eml(&c3_s_Ry_denum, c3_d_sf_marshall, 15U);
  sf_debug_symbol_scope_add_eml(&c3_s_Ry, c3_d_sf_marshall, 16U);
  sf_debug_symbol_scope_add_eml(&c3_nargin, c3_d_sf_marshall, 17U);
  sf_debug_symbol_scope_add_eml(&c3_nargout, c3_d_sf_marshall, 18U);
  sf_debug_symbol_scope_add_eml(&c3_X, c3_c_sf_marshall, 19U);
  sf_debug_symbol_scope_add_eml(&c3_u, c3_b_sf_marshall, 20U);
  sf_debug_symbol_scope_add_eml(&c3_s, c3_sf_marshall, 21U);
  CV_EML_FCN(0, 0);

  /*  l_F = param.l_F; */
  /*  l_R = param.l_R; */
  _SFD_EML_CALL(0,7);
  c3_l_F = 1.1;
  _SFD_EML_CALL(0,8);
  c3_l_R = 1.6;
  _SFD_EML_CALL(0,10);
  c3_Vx = c3_X[0];
  _SFD_EML_CALL(0,11);
  c3_Vy = c3_X[1];
  _SFD_EML_CALL(0,12);
  c3_r = c3_X[2];
  _SFD_EML_CALL(0,13);
  c3_psi = c3_X[3];
  _SFD_EML_CALL(0,15);
  c3_f_Fx = c3_u[0];
  _SFD_EML_CALL(0,16);
  c3_f_Rx = c3_u[1];
  _SFD_EML_CALL(0,17);
  c3_delta = c3_u[2];
  _SFD_EML_CALL(0,20);
  if (CV_EML_COND(0, 0, c3_Vx == 0.0)) {
    if (CV_EML_COND(0, 1, c3_Vy == 0.0)) {
      CV_EML_MCDC(0, 0, TRUE);
      CV_EML_IF(0, 0, TRUE);
      _SFD_EML_CALL(0,21);
      c3_beta = 0.0;
      goto label_1;
    }
  }

  CV_EML_MCDC(0, 0, FALSE);
  CV_EML_IF(0, 0, FALSE);
  _SFD_EML_CALL(0,23);
  c3_A = c3_Vy;
  c3_B = c3_Vx;
  c3_x = c3_A;
  c3_y = c3_B;
  c3_b_x = c3_x;
  c3_b_y = c3_y;
  c3_c_x = c3_b_x;
  c3_c_y = c3_b_y;
  c3_d_y = c3_c_x / c3_c_y;
  c3_d_x = c3_d_y;
  c3_beta = c3_d_x;
  c3_e_x = c3_beta;
  c3_beta = c3_e_x;
  c3_beta = muDoubleScalarAtan(c3_beta);
 label_1:
  ;
  _SFD_EML_CALL(0,26);
  c3_f_x = c3_mpower(chartInstance, c3_Vx) + c3_mpower(chartInstance, c3_Vy);
  c3_V = c3_f_x;
  if (c3_V < 0.0) {
    c3_eml_error(chartInstance);
  }

  c3_g_x = c3_V;
  c3_V = c3_g_x;
  c3_V = muDoubleScalarSqrt(c3_V);
  _SFD_EML_CALL(0,28);
  c3_h_x = c3_beta - c3_delta;
  c3_i_x = c3_h_x;
  c3_j_x = c3_i_x;
  c3_i_x = c3_j_x;
  c3_i_x = muDoubleScalarSin(c3_i_x);
  c3_a = c3_V;
  c3_b = c3_i_x;
  c3_e_y = c3_a * c3_b;
  c3_b_a = c3_r;
  c3_f_y = c3_b_a * 1.1;
  c3_k_x = c3_delta;
  c3_l_x = c3_k_x;
  c3_m_x = c3_l_x;
  c3_l_x = c3_m_x;
  c3_l_x = muDoubleScalarCos(c3_l_x);
  c3_c_a = c3_f_y;
  c3_b_b = c3_l_x;
  c3_g_y = c3_c_a * c3_b_b;
  c3_s_Fy_num = c3_e_y + c3_g_y;
  _SFD_EML_CALL(0,29);
  c3_n_x = c3_beta - c3_delta;
  c3_o_x = c3_n_x;
  c3_p_x = c3_o_x;
  c3_o_x = c3_p_x;
  c3_o_x = muDoubleScalarCos(c3_o_x);
  c3_d_a = c3_V;
  c3_c_b = c3_o_x;
  c3_h_y = c3_d_a * c3_c_b;
  c3_e_a = c3_r;
  c3_i_y = c3_e_a * 1.1;
  c3_q_x = c3_delta;
  c3_r_x = c3_q_x;
  c3_s_x = c3_r_x;
  c3_r_x = c3_s_x;
  c3_r_x = muDoubleScalarSin(c3_r_x);
  c3_f_a = c3_i_y;
  c3_d_b = c3_r_x;
  c3_j_y = c3_f_a * c3_d_b;
  c3_s_Fy_denum = c3_h_y + c3_j_y;
  _SFD_EML_CALL(0,31);
  if (CV_EML_COND(0, 2, c3_s_Fy_num == 0.0)) {
    if (CV_EML_COND(0, 3, c3_s_Fy_denum == 0.0)) {
      CV_EML_MCDC(0, 1, TRUE);
      CV_EML_IF(0, 1, TRUE);
      _SFD_EML_CALL(0,32);
      c3_s_Fy = 0.0;
      goto label_2;
    }
  }

  CV_EML_MCDC(0, 1, FALSE);
  CV_EML_IF(0, 1, FALSE);
  _SFD_EML_CALL(0,34);
  c3_b_A = c3_s_Fy_num;
  c3_b_B = c3_s_Fy_denum;
  c3_t_x = c3_b_A;
  c3_k_y = c3_b_B;
  c3_u_x = c3_t_x;
  c3_l_y = c3_k_y;
  c3_v_x = c3_u_x;
  c3_m_y = c3_l_y;
  c3_s_Fy = c3_v_x / c3_m_y;
 label_2:
  ;
  _SFD_EML_CALL(0,37);
  c3_w_x = c3_beta;
  c3_x_x = c3_w_x;
  c3_y_x = c3_x_x;
  c3_x_x = c3_y_x;
  c3_x_x = muDoubleScalarSin(c3_x_x);
  c3_g_a = c3_V;
  c3_e_b = c3_x_x;
  c3_n_y = c3_g_a * c3_e_b;
  c3_h_a = c3_r;
  c3_o_y = c3_h_a * 1.6;
  c3_s_Ry_num = c3_n_y - c3_o_y;
  _SFD_EML_CALL(0,38);
  c3_ab_x = c3_beta;
  c3_bb_x = c3_ab_x;
  c3_cb_x = c3_bb_x;
  c3_bb_x = c3_cb_x;
  c3_bb_x = muDoubleScalarCos(c3_bb_x);
  c3_i_a = c3_V;
  c3_f_b = c3_bb_x;
  c3_s_Ry_denum = c3_i_a * c3_f_b;
  _SFD_EML_CALL(0,40);
  if (CV_EML_COND(0, 4, c3_s_Ry_num == 0.0)) {
    if (CV_EML_COND(0, 5, c3_s_Ry_denum == 0.0)) {
      CV_EML_MCDC(0, 2, TRUE);
      CV_EML_IF(0, 2, TRUE);
      _SFD_EML_CALL(0,41);
      c3_s_Ry = 0.0;
      goto label_3;
    }
  }

  CV_EML_MCDC(0, 2, FALSE);
  CV_EML_IF(0, 2, FALSE);
  _SFD_EML_CALL(0,43);
  c3_c_A = c3_s_Ry_num;
  c3_c_B = c3_s_Ry_denum;
  c3_db_x = c3_c_A;
  c3_p_y = c3_c_B;
  c3_eb_x = c3_db_x;
  c3_q_y = c3_p_y;
  c3_fb_x = c3_eb_x;
  c3_r_y = c3_q_y;
  c3_s_Ry = c3_fb_x / c3_r_y;
 label_3:
  ;
  _SFD_EML_CALL(0,46);
  c3_s[0] = c3_s_Fy;
  c3_s[1] = c3_s_Ry;
  _SFD_EML_CALL(0,-46);
  sf_debug_symbol_scope_pop();
  for (c3_i10 = 0; c3_i10 < 2; c3_i10 = c3_i10 + 1) {
    (*c3_b_s)[c3_i10] = c3_s[c3_i10];
  }

  _SFD_CC_CALL(EXIT_OUT_OF_FUNCTION_TAG,2);
  _sfEvent_ = c3_previousEvent;
  sf_debug_check_for_state_inconsistency(_car_modelMachineNumber_,
    chartInstance->chartNumber, chartInstance->instanceNumber);
}
示例#13
0
static void c1_chartstep_c1_Qmod(SFc1_QmodInstanceStruct *chartInstance)
{
  real_T c1_hoistedGlobal;
  real_T c1_b_hoistedGlobal;
  real_T c1_c_hoistedGlobal;
  int32_T c1_i5;
  real_T c1_T[4];
  real_T c1_k;
  real_T c1_m;
  real_T c1_g;
  int32_T c1_i6;
  real_T c1_R[9];
  uint32_T c1_debug_family_var_map[9];
  real_T c1_Thrust[3];
  real_T c1_nargin = 5.0;
  real_T c1_nargout = 1.0;
  real_T c1_y[3];
  real_T c1_a;
  real_T c1_b;
  real_T c1_b_y;
  real_T c1_A;
  real_T c1_B;
  real_T c1_x;
  real_T c1_c_y;
  real_T c1_b_x;
  real_T c1_d_y;
  real_T c1_e_y;
  int32_T c1_i7;
  real_T c1_b_a[9];
  int32_T c1_i8;
  real_T c1_b_b[3];
  int32_T c1_i9;
  real_T c1_f_y[3];
  int32_T c1_i10;
  int32_T c1_i11;
  real_T c1_dv1[3];
  int32_T c1_i12;
  int32_T c1_i13;
  real_T *c1_b_k;
  real_T *c1_b_m;
  real_T *c1_b_g;
  real_T (*c1_g_y)[3];
  real_T (*c1_b_R)[9];
  real_T (*c1_b_T)[4];
  c1_b_R = (real_T (*)[9])ssGetInputPortSignal(chartInstance->S, 4);
  c1_g_y = (real_T (*)[3])ssGetOutputPortSignal(chartInstance->S, 1);
  c1_b_g = (real_T *)ssGetInputPortSignal(chartInstance->S, 3);
  c1_b_m = (real_T *)ssGetInputPortSignal(chartInstance->S, 2);
  c1_b_k = (real_T *)ssGetInputPortSignal(chartInstance->S, 1);
  c1_b_T = (real_T (*)[4])ssGetInputPortSignal(chartInstance->S, 0);
  _SFD_CC_CALL(CHART_ENTER_DURING_FUNCTION_TAG, 0U, chartInstance->c1_sfEvent);
  c1_hoistedGlobal = *c1_b_k;
  c1_b_hoistedGlobal = *c1_b_m;
  c1_c_hoistedGlobal = *c1_b_g;
  for (c1_i5 = 0; c1_i5 < 4; c1_i5++) {
    c1_T[c1_i5] = (*c1_b_T)[c1_i5];
  }

  c1_k = c1_hoistedGlobal;
  c1_m = c1_b_hoistedGlobal;
  c1_g = c1_c_hoistedGlobal;
  for (c1_i6 = 0; c1_i6 < 9; c1_i6++) {
    c1_R[c1_i6] = (*c1_b_R)[c1_i6];
  }

  sf_debug_symbol_scope_push_eml(0U, 9U, 9U, c1_debug_family_names,
    c1_debug_family_var_map);
  sf_debug_symbol_scope_add_eml_importable(c1_Thrust, 0U, c1_sf_marshallOut,
    c1_sf_marshallIn);
  sf_debug_symbol_scope_add_eml_importable(&c1_nargin, 1U, c1_c_sf_marshallOut,
    c1_b_sf_marshallIn);
  sf_debug_symbol_scope_add_eml_importable(&c1_nargout, 2U, c1_c_sf_marshallOut,
    c1_b_sf_marshallIn);
  sf_debug_symbol_scope_add_eml(c1_T, 3U, c1_d_sf_marshallOut);
  sf_debug_symbol_scope_add_eml(&c1_k, 4U, c1_c_sf_marshallOut);
  sf_debug_symbol_scope_add_eml(&c1_m, 5U, c1_c_sf_marshallOut);
  sf_debug_symbol_scope_add_eml(&c1_g, 6U, c1_c_sf_marshallOut);
  sf_debug_symbol_scope_add_eml(c1_R, 7U, c1_b_sf_marshallOut);
  sf_debug_symbol_scope_add_eml_importable(c1_y, 8U, c1_sf_marshallOut,
    c1_sf_marshallIn);
  CV_EML_FCN(0, 0);
  _SFD_EML_CALL(0U, chartInstance->c1_sfEvent, 5);
  c1_a = c1_k;
  c1_b = ((c1_T[0] + c1_T[1]) + c1_T[2]) + c1_T[3];
  c1_b_y = c1_a * c1_b;
  c1_A = c1_b_y;
  c1_B = c1_m;
  c1_x = c1_A;
  c1_c_y = c1_B;
  c1_b_x = c1_x;
  c1_d_y = c1_c_y;
  c1_e_y = c1_b_x / c1_d_y;
  c1_Thrust[0] = 0.0;
  c1_Thrust[1] = 0.0;
  c1_Thrust[2] = c1_e_y;
  _SFD_EML_CALL(0U, chartInstance->c1_sfEvent, 7);
  for (c1_i7 = 0; c1_i7 < 9; c1_i7++) {
    c1_b_a[c1_i7] = c1_R[c1_i7];
  }

  for (c1_i8 = 0; c1_i8 < 3; c1_i8++) {
    c1_b_b[c1_i8] = c1_Thrust[c1_i8];
  }

  c1_eml_scalar_eg(chartInstance);
  c1_eml_scalar_eg(chartInstance);
  for (c1_i9 = 0; c1_i9 < 3; c1_i9++) {
    c1_f_y[c1_i9] = 0.0;
    c1_i10 = 0;
    for (c1_i11 = 0; c1_i11 < 3; c1_i11++) {
      c1_f_y[c1_i9] += c1_b_a[c1_i10 + c1_i9] * c1_b_b[c1_i11];
      c1_i10 += 3;
    }
  }

  c1_dv1[0] = 0.0;
  c1_dv1[1] = 0.0;
  c1_dv1[2] = -c1_g;
  for (c1_i12 = 0; c1_i12 < 3; c1_i12++) {
    c1_y[c1_i12] = c1_f_y[c1_i12] - c1_dv1[c1_i12];
  }

  _SFD_EML_CALL(0U, chartInstance->c1_sfEvent, -7);
  sf_debug_symbol_scope_pop();
  for (c1_i13 = 0; c1_i13 < 3; c1_i13++) {
    (*c1_g_y)[c1_i13] = c1_y[c1_i13];
  }

  _SFD_CC_CALL(EXIT_OUT_OF_FUNCTION_TAG, 0U, chartInstance->c1_sfEvent);
}
static void sf_c25_BuckBoost1(SFc25_BuckBoost1InstanceStruct *chartInstance)
{
  real_T c25_hoistedGlobal;
  real_T c25_b_hoistedGlobal;
  real_T c25_Ts;
  real_T c25_TimeCNT_k1;
  uint32_T c25_debug_family_var_map[7];
  real_T c25_Tsimulation;
  real_T c25_CNT_Ts;
  real_T c25_nargin = 2.0;
  real_T c25_nargout = 1.0;
  real_T c25_TimeCNT_k;
  real_T c25_A;
  real_T c25_x;
  real_T c25_b_x;
  real_T c25_y;
  real_T *c25_b_TimeCNT_k1;
  real_T *c25_b_Ts;
  real_T *c25_b_TimeCNT_k;
  c25_b_TimeCNT_k = (real_T *)ssGetOutputPortSignal(chartInstance->S, 1);
  c25_b_TimeCNT_k1 = (real_T *)ssGetInputPortSignal(chartInstance->S, 1);
  c25_b_Ts = (real_T *)ssGetInputPortSignal(chartInstance->S, 0);
  _sfTime_ = (real_T)ssGetT(chartInstance->S);
  _SFD_CC_CALL(CHART_ENTER_SFUNCTION_TAG, 7U, chartInstance->c25_sfEvent);
  _SFD_DATA_RANGE_CHECK(*c25_b_Ts, 0U);
  _SFD_DATA_RANGE_CHECK(*c25_b_TimeCNT_k1, 1U);
  _SFD_DATA_RANGE_CHECK(*c25_b_TimeCNT_k, 2U);
  chartInstance->c25_sfEvent = CALL_EVENT;
  _SFD_CC_CALL(CHART_ENTER_DURING_FUNCTION_TAG, 7U, chartInstance->c25_sfEvent);
  c25_hoistedGlobal = *c25_b_Ts;
  c25_b_hoistedGlobal = *c25_b_TimeCNT_k1;
  c25_Ts = c25_hoistedGlobal;
  c25_TimeCNT_k1 = c25_b_hoistedGlobal;
  sf_debug_symbol_scope_push_eml(0U, 7U, 7U, c25_debug_family_names,
    c25_debug_family_var_map);
  sf_debug_symbol_scope_add_eml(&c25_Tsimulation, 0U, c25_sf_marshallOut);
  sf_debug_symbol_scope_add_eml_importable(&c25_CNT_Ts, 1U, c25_sf_marshallOut,
    c25_sf_marshallIn);
  sf_debug_symbol_scope_add_eml_importable(&c25_nargin, 2U, c25_sf_marshallOut,
    c25_sf_marshallIn);
  sf_debug_symbol_scope_add_eml_importable(&c25_nargout, 3U, c25_sf_marshallOut,
    c25_sf_marshallIn);
  sf_debug_symbol_scope_add_eml(&c25_Ts, 4U, c25_sf_marshallOut);
  sf_debug_symbol_scope_add_eml(&c25_TimeCNT_k1, 5U, c25_sf_marshallOut);
  sf_debug_symbol_scope_add_eml_importable(&c25_TimeCNT_k, 6U,
    c25_sf_marshallOut, c25_sf_marshallIn);
  CV_EML_FCN(0, 0);
  _SFD_EML_CALL(0U, chartInstance->c25_sfEvent, 3);
  c25_Tsimulation = 1.0E-6;
  _SFD_EML_CALL(0U, chartInstance->c25_sfEvent, 4);
  c25_A = c25_Ts;
  c25_x = c25_A;
  c25_b_x = c25_x;
  c25_y = c25_b_x / 1.0E-6;
  c25_CNT_Ts = c25_y - 1.0;
  _SFD_EML_CALL(0U, chartInstance->c25_sfEvent, 6);
  if (CV_EML_IF(0, 1, 0, c25_TimeCNT_k1 >= c25_CNT_Ts)) {
    _SFD_EML_CALL(0U, chartInstance->c25_sfEvent, 7);
    c25_TimeCNT_k = 0.0;
  } else {
    _SFD_EML_CALL(0U, chartInstance->c25_sfEvent, 9);
    c25_TimeCNT_k = c25_TimeCNT_k1 + 1.0;
  }

  _SFD_EML_CALL(0U, chartInstance->c25_sfEvent, -9);
  sf_debug_symbol_scope_pop();
  *c25_b_TimeCNT_k = c25_TimeCNT_k;
  _SFD_CC_CALL(EXIT_OUT_OF_FUNCTION_TAG, 7U, chartInstance->c25_sfEvent);
  sf_debug_check_for_state_inconsistency(_BuckBoost1MachineNumber_,
    chartInstance->chartNumber, chartInstance->instanceNumber);
}
static void sf_c19_adcs_v15_integral_Power_nom(void)
{
  int32_T c19_previousEvent;
  real_T c19_Latitude;
  real_T c19_Longitude;
  real_T c19_nargout = 4.0;
  real_T c19_nargin = 2.0;
  real_T c19_phi;
  real_T c19_flag_india;
  real_T c19_flag_france;
  real_T c19_flag_downlink;
  real_T c19_Downlink_power;
  real_T c19_a;
  real_T c19_A;
  real_T c19_x;
  real_T c19_b_x;
  real_T c19_c_x;
  real_T c19_d_x;
  real_T c19_b_a;
  real_T c19_e_x;
  real_T c19_b;
  real_T c19_y;
  real_T c19_c_a;
  real_T c19_b_A;
  real_T c19_f_x;
  real_T c19_g_x;
  real_T c19_h_x;
  real_T c19_i_x;
  real_T c19_d_a;
  real_T c19_j_x;
  real_T c19_b_b;
  real_T c19_b_y;
  real_T c19_e_a;
  real_T *c19_b_flag_india;
  real_T *c19_b_flag_france;
  real_T *c19_b_flag_downlink;
  real_T *c19_b_Downlink_power;
  real_T *c19_b_Longitude;
  real_T *c19_b_Latitude;
  c19_b_flag_france = (real_T *)ssGetOutputPortSignal(chartInstance.S, 3);
  c19_b_Downlink_power = (real_T *)ssGetOutputPortSignal(chartInstance.S, 1);
  c19_b_Latitude = (real_T *)ssGetInputPortSignal(chartInstance.S, 0);
  c19_b_Longitude = (real_T *)ssGetInputPortSignal(chartInstance.S, 1);
  c19_b_flag_india = (real_T *)ssGetOutputPortSignal(chartInstance.S, 4);
  c19_b_flag_downlink = (real_T *)ssGetOutputPortSignal(chartInstance.S, 2);
  _sfTime_ = (real_T)ssGetT(chartInstance.S);
  _SFD_CC_CALL(CHART_ENTER_SFUNCTION_TAG,13);
  _SFD_DATA_RANGE_CHECK(*c19_b_Latitude, 0U);
  _SFD_DATA_RANGE_CHECK(*c19_b_Longitude, 1U);
  _SFD_DATA_RANGE_CHECK(*c19_b_Downlink_power, 2U);
  _SFD_DATA_RANGE_CHECK(*c19_b_flag_downlink, 3U);
  _SFD_DATA_RANGE_CHECK(*c19_b_flag_france, 4U);
  _SFD_DATA_RANGE_CHECK(*c19_b_flag_india, 5U);
  c19_previousEvent = _sfEvent_;
  _sfEvent_ = CALL_EVENT;
  _SFD_CC_CALL(CHART_ENTER_DURING_FUNCTION_TAG,13);
  c19_Latitude = *c19_b_Latitude;
  c19_Longitude = *c19_b_Longitude;
  sf_debug_symbol_scope_push(9U, 0U);
  sf_debug_symbol_scope_add("nargout", &c19_nargout, c19_sf_marshall);
  sf_debug_symbol_scope_add("nargin", &c19_nargin, c19_sf_marshall);
  sf_debug_symbol_scope_add("phi", &c19_phi, c19_sf_marshall);
  sf_debug_symbol_scope_add("flag_india", &c19_flag_india, c19_sf_marshall);
  sf_debug_symbol_scope_add("flag_france", &c19_flag_france, c19_sf_marshall);
  sf_debug_symbol_scope_add("flag_downlink", &c19_flag_downlink, c19_sf_marshall);
  sf_debug_symbol_scope_add("Downlink_power", &c19_Downlink_power,
    c19_sf_marshall);
  sf_debug_symbol_scope_add("Longitude", &c19_Longitude, c19_sf_marshall);
  sf_debug_symbol_scope_add("Latitude", &c19_Latitude, c19_sf_marshall);
  CV_EML_FCN(0, 0);
  _SFD_EML_CALL(0,3);
  c19_phi = 10.0;
  _SFD_EML_CALL(0,4);
  c19_flag_france = 0.0;
  _SFD_EML_CALL(0,5);
  c19_flag_india = 0.0;
  _SFD_EML_CALL(0,6);
  c19_a = c19_Latitude;
  c19_A = c19_a * 3.1415926535897931E+000;
  c19_x = c19_A;
  c19_b_x = c19_x;
  c19_c_x = c19_b_x;
  c19_d_x = c19_c_x / 180.0;
  c19_b_a = c19_d_x;
  c19_e_x = c19_b_a;
  c19_b_a = c19_e_x;
  c19_b_a = muDoubleScalarCos(c19_b_a);
  c19_b = c19_mpower(c19_Longitude - 82.7666);
  c19_y = c19_b_a * c19_b;
  if (CV_EML_IF(0, 0, c19_mpower(c19_Latitude - 22.5833) + c19_y < c19_mpower
                (25.0))) {
    _SFD_EML_CALL(0,7);
    c19_flag_downlink = 1.0;
    _SFD_EML_CALL(0,8);
    c19_flag_india = 1.0;
  } else {
    _SFD_EML_CALL(0,9);
    c19_c_a = c19_Latitude;
    c19_b_A = c19_c_a * 3.1415926535897931E+000;
    c19_f_x = c19_b_A;
    c19_g_x = c19_f_x;
    c19_h_x = c19_g_x;
    c19_i_x = c19_h_x / 180.0;
    c19_d_a = c19_i_x;
    c19_j_x = c19_d_a;
    c19_d_a = c19_j_x;
    c19_d_a = muDoubleScalarCos(c19_d_a);
    c19_b_b = c19_mpower(c19_Longitude - 2.33);
    c19_b_y = c19_d_a * c19_b_b;
    if (CV_EML_IF(0, 1, c19_mpower(c19_Latitude - 48.8) + c19_b_y < c19_mpower
                  (10.0))) {
      _SFD_EML_CALL(0,10);
      c19_flag_downlink = 1.0;
      _SFD_EML_CALL(0,11);
      c19_flag_france = 1.0;
    } else {
      _SFD_EML_CALL(0,13);
      c19_flag_downlink = 0.0;
    }
  }

  _SFD_EML_CALL(0,16);
  c19_e_a = c19_flag_downlink;
  c19_Downlink_power = c19_e_a * 2.6;

  /* W */
  /*   */
  /*  y = u; */
  _SFD_EML_CALL(0,-16);
  sf_debug_symbol_scope_pop();
  *c19_b_Downlink_power = c19_Downlink_power;
  *c19_b_flag_downlink = c19_flag_downlink;
  *c19_b_flag_france = c19_flag_france;
  *c19_b_flag_india = c19_flag_india;
  _SFD_CC_CALL(EXIT_OUT_OF_FUNCTION_TAG,13);
  _sfEvent_ = c19_previousEvent;
  sf_debug_check_for_state_inconsistency
    (_adcs_v15_integral_Power_nomMachineNumber_, chartInstance.chartNumber,
     chartInstance.
     instanceNumber);
}
示例#16
0
static void sf_c2_SATest(SFc2_SATestInstanceStruct *chartInstance)
{
  int32_T c2_previousEvent;
  real_T c2_hoistedGlobal;
  real_T c2_b_hoistedGlobal;
  real_T c2_c_hoistedGlobal;
  real_T c2_d_hoistedGlobal;
  real_T c2_d1;
  real_T c2_d2;
  real_T c2_d3;
  real_T c2_d4;
  uint32_T c2_debug_family_var_map[8];
  real_T c2_nargin = 4.0;
  real_T c2_nargout = 1.0;
  real_T c2_i;
  real_T *c2_b_d1;
  real_T *c2_b_i;
  real_T *c2_b_d2;
  real_T *c2_b_d3;
  real_T *c2_b_d4;
  c2_b_d4 = (real_T *)ssGetInputPortSignal(chartInstance->S, 3);
  c2_b_d3 = (real_T *)ssGetInputPortSignal(chartInstance->S, 2);
  c2_b_d2 = (real_T *)ssGetInputPortSignal(chartInstance->S, 1);
  c2_b_i = (real_T *)ssGetOutputPortSignal(chartInstance->S, 1);
  c2_b_d1 = (real_T *)ssGetInputPortSignal(chartInstance->S, 0);
  _sfTime_ = (real_T)ssGetT(chartInstance->S);
  _SFD_CC_CALL(CHART_ENTER_SFUNCTION_TAG, 0);
  _SFD_DATA_RANGE_CHECK(*c2_b_d1, 0U);
  _SFD_DATA_RANGE_CHECK(*c2_b_i, 1U);
  _SFD_DATA_RANGE_CHECK(*c2_b_d2, 2U);
  _SFD_DATA_RANGE_CHECK(*c2_b_d3, 3U);
  _SFD_DATA_RANGE_CHECK(*c2_b_d4, 4U);
  c2_previousEvent = _sfEvent_;
  _sfEvent_ = CALL_EVENT;
  _SFD_CC_CALL(CHART_ENTER_DURING_FUNCTION_TAG, 0);
  c2_hoistedGlobal = *c2_b_d1;
  c2_b_hoistedGlobal = *c2_b_d2;
  c2_c_hoistedGlobal = *c2_b_d3;
  c2_d_hoistedGlobal = *c2_b_d4;
  c2_d1 = c2_hoistedGlobal;
  c2_d2 = c2_b_hoistedGlobal;
  c2_d3 = c2_c_hoistedGlobal;
  c2_d4 = c2_d_hoistedGlobal;
  sf_debug_symbol_scope_push_eml(0U, 8U, 8U, c2_debug_family_names,
    c2_debug_family_var_map);
  sf_debug_symbol_scope_add_eml(&c2_nargin, c2_b_sf_marshall, 0U);
  sf_debug_symbol_scope_add_eml(&c2_nargout, c2_b_sf_marshall, 1U);
  sf_debug_symbol_scope_add_eml(&c2_d1, c2_b_sf_marshall, 2U);
  sf_debug_symbol_scope_add_eml(&c2_d2, c2_b_sf_marshall, 3U);
  sf_debug_symbol_scope_add_eml(&c2_d3, c2_b_sf_marshall, 4U);
  sf_debug_symbol_scope_add_eml(&c2_d4, c2_b_sf_marshall, 5U);
  sf_debug_symbol_scope_add_eml(&c2_i, c2_b_sf_marshall, 6U);
  sf_debug_symbol_scope_add_eml(&chartInstance->c2_j, c2_sf_marshall, 7U);
  CV_EML_FCN(0, 0);
  _SFD_EML_CALL(0, 6);
  if (CV_EML_IF(0, 0, !chartInstance->c2_j_not_empty)) {
    _SFD_EML_CALL(0, 7);
    chartInstance->c2_j = 1.0;
    chartInstance->c2_j_not_empty = TRUE;
  }

  _SFD_EML_CALL(0, 10);
  if (CV_EML_COND(0, 0, chartInstance->c2_j == 1.0)) {
    if (CV_EML_COND(0, 1, c2_d1 < 20.0)) {
      CV_EML_MCDC(0, 0, TRUE);
      CV_EML_IF(0, 1, TRUE);
      _SFD_EML_CALL(0, 11);
      chartInstance->c2_j = chartInstance->c2_j + 1.0;
      goto label_1;
    }
  }

  CV_EML_MCDC(0, 0, FALSE);
  CV_EML_IF(0, 1, FALSE);
 label_1:
  ;
  _SFD_EML_CALL(0, 14);
  if (CV_EML_COND(0, 2, chartInstance->c2_j == 2.0)) {
    if (CV_EML_COND(0, 3, c2_d2 < 20.0)) {
      CV_EML_MCDC(0, 1, TRUE);
      CV_EML_IF(0, 2, TRUE);
      _SFD_EML_CALL(0, 15);
      chartInstance->c2_j = chartInstance->c2_j + 1.0;
      goto label_2;
    }
  }

  CV_EML_MCDC(0, 1, FALSE);
  CV_EML_IF(0, 2, FALSE);
 label_2:
  ;
  _SFD_EML_CALL(0, 18);
  if (CV_EML_COND(0, 4, chartInstance->c2_j == 3.0)) {
    if (CV_EML_COND(0, 5, c2_d3 < 20.0)) {
      CV_EML_MCDC(0, 2, TRUE);
      CV_EML_IF(0, 3, TRUE);
      _SFD_EML_CALL(0, 19);
      chartInstance->c2_j = chartInstance->c2_j + 1.0;
      goto label_3;
    }
  }

  CV_EML_MCDC(0, 2, FALSE);
  CV_EML_IF(0, 3, FALSE);
 label_3:
  ;
  _SFD_EML_CALL(0, 22);
  if (CV_EML_COND(0, 6, chartInstance->c2_j == 4.0)) {
    if (CV_EML_COND(0, 7, c2_d4 < 20.0)) {
      CV_EML_MCDC(0, 3, TRUE);
      CV_EML_IF(0, 4, TRUE);
      _SFD_EML_CALL(0, 23);
      chartInstance->c2_j = 1.0;
      goto label_4;
    }
  }

  CV_EML_MCDC(0, 3, FALSE);
  CV_EML_IF(0, 4, FALSE);
 label_4:
  ;
  _SFD_EML_CALL(0, 26);
  c2_i = chartInstance->c2_j;
  _SFD_EML_CALL(0, -26);
  sf_debug_symbol_scope_pop();
  *c2_b_i = c2_i;
  _SFD_CC_CALL(EXIT_OUT_OF_FUNCTION_TAG, 0);
  _sfEvent_ = c2_previousEvent;
  sf_debug_check_for_state_inconsistency(_SATestMachineNumber_,
    chartInstance->chartNumber, chartInstance->instanceNumber);
}
示例#17
0
static void sf_c1_my_demo_ref(SFc1_my_demo_refInstanceStruct *chartInstance)
{
  int32_T c1_i0;
  real_T c1_hoistedGlobal;
  real_T c1_b_hoistedGlobal;
  real_T c1_x;
  real_T c1_y;
  int32_T c1_i1;
  real_T c1_fpath[170];
  uint32_T c1_debug_family_var_map[13];
  real_T c1_dmin;
  real_T c1_xx[85];
  real_T c1_yy[85];
  real_T c1_d;
  real_T c1_nargin = 3.0;
  real_T c1_nargout = 3.0;
  real_T c1_x_g;
  real_T c1_y_g;
  real_T c1_stop;
  int32_T c1_i2;
  int32_T c1_i3;
  real_T c1_c_hoistedGlobal;
  real_T c1_d_hoistedGlobal;
  real_T c1_b_x;
  real_T c1_c_x;
  real_T *c1_b_x_g;
  real_T *c1_b_y_g;
  real_T *c1_d_x;
  real_T *c1_b_y;
  real_T *c1_b_stop;
  real_T (*c1_b_fpath)[170];
  boolean_T guard1 = FALSE;
  boolean_T guard2 = FALSE;
  c1_b_stop = (real_T *)ssGetOutputPortSignal(chartInstance->S, 3);
  c1_b_fpath = (real_T (*)[170])ssGetInputPortSignal(chartInstance->S, 2);
  c1_b_y = (real_T *)ssGetInputPortSignal(chartInstance->S, 1);
  c1_d_x = (real_T *)ssGetInputPortSignal(chartInstance->S, 0);
  c1_b_y_g = (real_T *)ssGetOutputPortSignal(chartInstance->S, 2);
  c1_b_x_g = (real_T *)ssGetOutputPortSignal(chartInstance->S, 1);
  _sfTime_ = (real_T)ssGetT(chartInstance->S);
  _SFD_CC_CALL(CHART_ENTER_SFUNCTION_TAG, 0U, chartInstance->c1_sfEvent);
  _SFD_DATA_RANGE_CHECK(*c1_b_x_g, 0U);
  _SFD_DATA_RANGE_CHECK(*c1_b_y_g, 1U);
  _SFD_DATA_RANGE_CHECK(*c1_d_x, 2U);
  _SFD_DATA_RANGE_CHECK(*c1_b_y, 3U);
  for (c1_i0 = 0; c1_i0 < 170; c1_i0++) {
    _SFD_DATA_RANGE_CHECK((*c1_b_fpath)[c1_i0], 4U);
  }

  _SFD_DATA_RANGE_CHECK(*c1_b_stop, 5U);
  chartInstance->c1_sfEvent = CALL_EVENT;
  _SFD_CC_CALL(CHART_ENTER_DURING_FUNCTION_TAG, 0U, chartInstance->c1_sfEvent);
  c1_hoistedGlobal = *c1_d_x;
  c1_b_hoistedGlobal = *c1_b_y;
  c1_x = c1_hoistedGlobal;
  c1_y = c1_b_hoistedGlobal;
  for (c1_i1 = 0; c1_i1 < 170; c1_i1++) {
    c1_fpath[c1_i1] = (*c1_b_fpath)[c1_i1];
  }

  sf_debug_symbol_scope_push_eml(0U, 13U, 13U, c1_debug_family_names,
    c1_debug_family_var_map);
  sf_debug_symbol_scope_add_eml_importable(&c1_dmin, 0U, c1_b_sf_marshallOut,
    c1_b_sf_marshallIn);
  sf_debug_symbol_scope_add_eml_importable(c1_xx, 1U, c1_d_sf_marshallOut,
    c1_c_sf_marshallIn);
  sf_debug_symbol_scope_add_eml_importable(c1_yy, 2U, c1_d_sf_marshallOut,
    c1_c_sf_marshallIn);
  sf_debug_symbol_scope_add_eml_importable(&c1_d, 3U, c1_b_sf_marshallOut,
    c1_b_sf_marshallIn);
  sf_debug_symbol_scope_add_eml_importable(&c1_nargin, 4U, c1_b_sf_marshallOut,
    c1_b_sf_marshallIn);
  sf_debug_symbol_scope_add_eml_importable(&c1_nargout, 5U, c1_b_sf_marshallOut,
    c1_b_sf_marshallIn);
  sf_debug_symbol_scope_add_eml(&c1_x, 6U, c1_b_sf_marshallOut);
  sf_debug_symbol_scope_add_eml(&c1_y, 7U, c1_b_sf_marshallOut);
  sf_debug_symbol_scope_add_eml(c1_fpath, 8U, c1_c_sf_marshallOut);
  sf_debug_symbol_scope_add_eml_importable(&c1_x_g, 9U, c1_b_sf_marshallOut,
    c1_b_sf_marshallIn);
  sf_debug_symbol_scope_add_eml_importable(&c1_y_g, 10U, c1_b_sf_marshallOut,
    c1_b_sf_marshallIn);
  sf_debug_symbol_scope_add_eml_importable(&c1_stop, 11U, c1_b_sf_marshallOut,
    c1_b_sf_marshallIn);
  sf_debug_symbol_scope_add_eml_importable(&chartInstance->c1_i, 12U,
    c1_sf_marshallOut, c1_sf_marshallIn);
  CV_EML_FCN(0, 0);
  _SFD_EML_CALL(0U, chartInstance->c1_sfEvent, 6);
  _SFD_EML_CALL(0U, chartInstance->c1_sfEvent, 7);
  if (CV_EML_IF(0, 1, 0, !chartInstance->c1_i_not_empty)) {
    _SFD_EML_CALL(0U, chartInstance->c1_sfEvent, 8);
    chartInstance->c1_i = 1.0;
    chartInstance->c1_i_not_empty = TRUE;
  }

  _SFD_EML_CALL(0U, chartInstance->c1_sfEvent, 12);
  c1_stop = 0.0;
  _SFD_EML_CALL(0U, chartInstance->c1_sfEvent, 13);
  c1_dmin = 0.1;
  _SFD_EML_CALL(0U, chartInstance->c1_sfEvent, 26);
  for (c1_i2 = 0; c1_i2 < 85; c1_i2++) {
    c1_xx[c1_i2] = c1_fpath[c1_i2];
  }

  _SFD_EML_CALL(0U, chartInstance->c1_sfEvent, 27);
  for (c1_i3 = 0; c1_i3 < 85; c1_i3++) {
    c1_yy[c1_i3] = c1_fpath[c1_i3 + 85];
  }

  _SFD_EML_CALL(0U, chartInstance->c1_sfEvent, 29);
  c1_c_hoistedGlobal = chartInstance->c1_i;
  c1_d_hoistedGlobal = chartInstance->c1_i;
  c1_b_x = c1_mpower(chartInstance, c1_x - c1_xx[_SFD_EML_ARRAY_BOUNDS_CHECK(
    "xx", (int32_T)_SFD_INTEGER_CHECK("i", c1_c_hoistedGlobal), 1, 85, 1, 0) - 1])
    + c1_mpower(chartInstance, c1_y - c1_yy[_SFD_EML_ARRAY_BOUNDS_CHECK("yy",
    (int32_T)_SFD_INTEGER_CHECK("i", c1_d_hoistedGlobal), 1, 85, 1, 0) - 1]);
  c1_d = c1_b_x;
  if (c1_d < 0.0) {
    c1_eml_error(chartInstance);
  }

  c1_c_x = c1_d;
  c1_d = c1_c_x;
  c1_d = muDoubleScalarSqrt(c1_d);
  _SFD_EML_CALL(0U, chartInstance->c1_sfEvent, 31);
  guard2 = FALSE;
  if (CV_EML_COND(0, 1, 0, c1_d < c1_dmin)) {
    if (CV_EML_COND(0, 1, 1, chartInstance->c1_i < 85.0)) {
      CV_EML_MCDC(0, 1, 0, TRUE);
      CV_EML_IF(0, 1, 1, TRUE);
      _SFD_EML_CALL(0U, chartInstance->c1_sfEvent, 32);
      chartInstance->c1_i++;
    } else {
      guard2 = TRUE;
    }
  } else {
    guard2 = TRUE;
  }

  if (guard2 == TRUE) {
    CV_EML_MCDC(0, 1, 0, FALSE);
    CV_EML_IF(0, 1, 1, FALSE);
  }

  _SFD_EML_CALL(0U, chartInstance->c1_sfEvent, 36);
  c1_x_g = c1_xx[_SFD_EML_ARRAY_BOUNDS_CHECK("xx", (int32_T)_SFD_INTEGER_CHECK(
    "i", chartInstance->c1_i), 1, 85, 1, 0) - 1];
  _SFD_EML_CALL(0U, chartInstance->c1_sfEvent, 37);
  c1_y_g = c1_yy[_SFD_EML_ARRAY_BOUNDS_CHECK("yy", (int32_T)_SFD_INTEGER_CHECK(
    "i", chartInstance->c1_i), 1, 85, 1, 0) - 1];
  _SFD_EML_CALL(0U, chartInstance->c1_sfEvent, 40);
  guard1 = FALSE;
  if (CV_EML_COND(0, 1, 2, c1_d < c1_dmin)) {
    if (CV_EML_COND(0, 1, 3, chartInstance->c1_i == 85.0)) {
      CV_EML_MCDC(0, 1, 1, TRUE);
      CV_EML_IF(0, 1, 2, TRUE);
      _SFD_EML_CALL(0U, chartInstance->c1_sfEvent, 41);
      c1_stop = 1.0;
    } else {
      guard1 = TRUE;
    }
  } else {
    guard1 = TRUE;
  }

  if (guard1 == TRUE) {
    CV_EML_MCDC(0, 1, 1, FALSE);
    CV_EML_IF(0, 1, 2, FALSE);
  }

  _SFD_EML_CALL(0U, chartInstance->c1_sfEvent, -41);
  sf_debug_symbol_scope_pop();
  *c1_b_x_g = c1_x_g;
  *c1_b_y_g = c1_y_g;
  *c1_b_stop = c1_stop;
  _SFD_CC_CALL(EXIT_OUT_OF_FUNCTION_TAG, 0U, chartInstance->c1_sfEvent);
  sf_debug_check_for_state_inconsistency(_my_demo_refMachineNumber_,
    chartInstance->chartNumber, chartInstance->instanceNumber);
}
示例#18
0
static void sf_c2_kinematics(SFc2_kinematicsInstanceStruct *chartInstance)
{
  int32_T c2_i2;
  int32_T c2_i3;
  int32_T c2_i4;
  real_T c2_q[6];
  uint32_T c2_debug_family_var_map[5];
  real_T c2_newq[6];
  int32_T c2_newq_sizes[2];
  real_T c2_newq_data[6];
  real_T c2_nargin = 1.0;
  real_T c2_nargout = 1.0;
  real_T c2_Jacobian_body[72];
  int32_T c2_i5;
  int32_T c2_i6;
  int32_T c2_b_newq;
  int32_T c2_c_newq;
  int32_T c2_i7;
  int32_T c2_u_sizes[2];
  int32_T c2_u;
  int32_T c2_b_u;
  int32_T c2_loop_ub;
  int32_T c2_i8;
  real_T c2_u_data[6];
  const mxArray *c2_y = NULL;
  real_T c2_dv1[72];
  int32_T c2_i9;
  int32_T c2_i10;
  real_T (*c2_b_Jacobian_body)[72];
  real_T (*c2_b_q)[6];
  c2_b_Jacobian_body = (real_T (*)[72])ssGetOutputPortSignal(chartInstance->S, 1);
  c2_b_q = (real_T (*)[6])ssGetInputPortSignal(chartInstance->S, 0);
  _sfTime_ = (real_T)ssGetT(chartInstance->S);
  _SFD_CC_CALL(CHART_ENTER_SFUNCTION_TAG, 1U, chartInstance->c2_sfEvent);
  for (c2_i2 = 0; c2_i2 < 6; c2_i2++) {
    _SFD_DATA_RANGE_CHECK((*c2_b_q)[c2_i2], 0U);
  }

  for (c2_i3 = 0; c2_i3 < 72; c2_i3++) {
    _SFD_DATA_RANGE_CHECK((*c2_b_Jacobian_body)[c2_i3], 1U);
  }

  chartInstance->c2_sfEvent = CALL_EVENT;
  _SFD_CC_CALL(CHART_ENTER_DURING_FUNCTION_TAG, 1U, chartInstance->c2_sfEvent);
  for (c2_i4 = 0; c2_i4 < 6; c2_i4++) {
    c2_q[c2_i4] = (*c2_b_q)[c2_i4];
  }

  sf_debug_symbol_scope_push_eml(0U, 5U, 6U, c2_debug_family_names,
    c2_debug_family_var_map);
  sf_debug_symbol_scope_add_eml_importable(c2_newq, MAX_uint32_T,
    c2_e_sf_marshallOut, c2_d_sf_marshallIn);
  sf_debug_symbol_scope_add_eml_dyn_importable(c2_newq_data, (const int32_T *)
    &c2_newq_sizes, NULL, 0, -1, (void *)c2_d_sf_marshallOut, (void *)
    c2_c_sf_marshallIn);
  sf_debug_symbol_scope_add_eml_importable(&c2_nargin, 1U, c2_c_sf_marshallOut,
    c2_b_sf_marshallIn);
  sf_debug_symbol_scope_add_eml_importable(&c2_nargout, 2U, c2_c_sf_marshallOut,
    c2_b_sf_marshallIn);
  sf_debug_symbol_scope_add_eml(c2_q, 3U, c2_b_sf_marshallOut);
  sf_debug_symbol_scope_add_eml_importable(c2_Jacobian_body, 4U,
    c2_sf_marshallOut, c2_sf_marshallIn);
  CV_EML_FCN(0, 0);
  _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 4);
  for (c2_i5 = 0; c2_i5 < 72; c2_i5++) {
    c2_Jacobian_body[c2_i5] = 0.0;
  }

  _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 5);
  _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 6);
  for (c2_i6 = 0; c2_i6 < 6; c2_i6++) {
    c2_newq[c2_i6] = 0.0;
  }

  sf_debug_symbol_switch(0U, 0U);
  _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 7);
  c2_newq_sizes[0] = 6;
  c2_newq_sizes[1] = 1;
  c2_b_newq = c2_newq_sizes[0];
  c2_c_newq = c2_newq_sizes[1];
  for (c2_i7 = 0; c2_i7 < 6; c2_i7++) {
    c2_newq_data[c2_i7] = c2_q[c2_i7];
  }

  sf_debug_symbol_switch(0U, 1U);
  _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 8);
  c2_u_sizes[0] = 6;
  c2_u_sizes[1] = 1;
  c2_u = c2_u_sizes[0];
  c2_b_u = c2_u_sizes[1];
  c2_loop_ub = c2_newq_sizes[0] * c2_newq_sizes[1] - 1;
  for (c2_i8 = 0; c2_i8 <= c2_loop_ub; c2_i8++) {
    c2_u_data[c2_i8] = c2_newq_data[c2_i8];
  }

  c2_y = NULL;
  sf_mex_assign(&c2_y, sf_mex_create("y", c2_u_data, 0, 0U, 1U, 0U, 2,
    c2_u_sizes[0], c2_u_sizes[1]), FALSE);
  c2_d_emlrt_marshallIn(chartInstance, sf_mex_call_debug("body_jacobian", 1U, 1U,
    14, c2_y), "body_jacobian", c2_dv1);
  for (c2_i9 = 0; c2_i9 < 72; c2_i9++) {
    c2_Jacobian_body[c2_i9] = c2_dv1[c2_i9];
  }

  _SFD_EML_CALL(0U, chartInstance->c2_sfEvent, -8);
  sf_debug_symbol_scope_pop();
  for (c2_i10 = 0; c2_i10 < 72; c2_i10++) {
    (*c2_b_Jacobian_body)[c2_i10] = c2_Jacobian_body[c2_i10];
  }

  _SFD_CC_CALL(EXIT_OUT_OF_FUNCTION_TAG, 1U, chartInstance->c2_sfEvent);
  sf_debug_check_for_state_inconsistency(_kinematicsMachineNumber_,
    chartInstance->chartNumber, chartInstance->instanceNumber);
}
static void sf_c1_motor_control_with_off_the_shelf_SVPWM
  (SFc1_motor_control_with_off_the_shelf_SVPWMInstanceStruct *chartInstance)
{
  real_T c1_hoistedGlobal;
  real_T c1_b_hoistedGlobal;
  real_T c1_Tdes;
  real_T c1_w;
  uint32_T c1_debug_family_var_map[13];
  real_T c1_L;
  real_T c1_R;
  real_T c1_Ke;
  real_T c1_Kt;
  real_T c1_Ides;
  real_T c1_bemf;
  real_T c1_ZL;
  real_T c1_nargin = 2.0;
  real_T c1_nargout = 2.0;
  real_T c1_Vd;
  real_T c1_Vq;
  real_T c1_A;
  real_T c1_x;
  real_T c1_b_x;
  real_T c1_b;
  real_T c1_b_b;
  real_T c1_a;
  real_T c1_y;
  real_T c1_b_a;
  real_T c1_c_b;
  real_T *c1_b_Vq;
  real_T *c1_b_Vd;
  real_T *c1_b_w;
  real_T *c1_b_Tdes;
  c1_b_Vq = (real_T *)ssGetOutputPortSignal(chartInstance->S, 2);
  c1_b_w = (real_T *)ssGetInputPortSignal(chartInstance->S, 1);
  c1_b_Vd = (real_T *)ssGetOutputPortSignal(chartInstance->S, 1);
  c1_b_Tdes = (real_T *)ssGetInputPortSignal(chartInstance->S, 0);
  _sfTime_ = (real_T)ssGetT(chartInstance->S);
  _SFD_CC_CALL(CHART_ENTER_SFUNCTION_TAG, 0U, chartInstance->c1_sfEvent);
  _SFD_DATA_RANGE_CHECK(*c1_b_Tdes, 0U);
  _SFD_DATA_RANGE_CHECK(*c1_b_Vd, 1U);
  _SFD_DATA_RANGE_CHECK(*c1_b_w, 2U);
  _SFD_DATA_RANGE_CHECK(*c1_b_Vq, 3U);
  chartInstance->c1_sfEvent = CALL_EVENT;
  _SFD_CC_CALL(CHART_ENTER_DURING_FUNCTION_TAG, 0U, chartInstance->c1_sfEvent);
  c1_hoistedGlobal = *c1_b_Tdes;
  c1_b_hoistedGlobal = *c1_b_w;
  c1_Tdes = c1_hoistedGlobal;
  c1_w = c1_b_hoistedGlobal;
  sf_debug_symbol_scope_push_eml(0U, 13U, 13U, c1_debug_family_names,
    c1_debug_family_var_map);
  sf_debug_symbol_scope_add_eml(&c1_L, 0U, c1_sf_marshallOut);
  sf_debug_symbol_scope_add_eml(&c1_R, 1U, c1_sf_marshallOut);
  sf_debug_symbol_scope_add_eml(&c1_Ke, 2U, c1_sf_marshallOut);
  sf_debug_symbol_scope_add_eml(&c1_Kt, 3U, c1_sf_marshallOut);
  sf_debug_symbol_scope_add_eml_importable(&c1_Ides, 4U, c1_sf_marshallOut,
    c1_sf_marshallIn);
  sf_debug_symbol_scope_add_eml_importable(&c1_bemf, 5U, c1_sf_marshallOut,
    c1_sf_marshallIn);
  sf_debug_symbol_scope_add_eml_importable(&c1_ZL, 6U, c1_sf_marshallOut,
    c1_sf_marshallIn);
  sf_debug_symbol_scope_add_eml_importable(&c1_nargin, 7U, c1_sf_marshallOut,
    c1_sf_marshallIn);
  sf_debug_symbol_scope_add_eml_importable(&c1_nargout, 8U, c1_sf_marshallOut,
    c1_sf_marshallIn);
  sf_debug_symbol_scope_add_eml(&c1_Tdes, 9U, c1_sf_marshallOut);
  sf_debug_symbol_scope_add_eml(&c1_w, 10U, c1_sf_marshallOut);
  sf_debug_symbol_scope_add_eml_importable(&c1_Vd, 11U, c1_sf_marshallOut,
    c1_sf_marshallIn);
  sf_debug_symbol_scope_add_eml_importable(&c1_Vq, 12U, c1_sf_marshallOut,
    c1_sf_marshallIn);
  CV_EML_FCN(0, 0);
  _SFD_EML_CALL(0U, chartInstance->c1_sfEvent, 7);
  c1_L = 0.0019399999999999999;
  _SFD_EML_CALL(0U, chartInstance->c1_sfEvent, 8);
  c1_R = 28.2;
  _SFD_EML_CALL(0U, chartInstance->c1_sfEvent, 9);
  c1_Ke = 0.018095917050234851;
  _SFD_EML_CALL(0U, chartInstance->c1_sfEvent, 10);
  c1_Kt = 1810.0;
  _SFD_EML_CALL(0U, chartInstance->c1_sfEvent, 13);
  c1_A = c1_Tdes;
  c1_x = c1_A;
  c1_b_x = c1_x;
  c1_Ides = c1_b_x / 1810.0;
  _SFD_EML_CALL(0U, chartInstance->c1_sfEvent, 16);
  c1_b = c1_w;
  c1_bemf = 0.018095917050234851 * c1_b;
  _SFD_EML_CALL(0U, chartInstance->c1_sfEvent, 19);
  c1_b_b = c1_w;
  c1_ZL = 0.0019399999999999999 * c1_b_b;
  _SFD_EML_CALL(0U, chartInstance->c1_sfEvent, 21);
  c1_a = c1_Ides;
  c1_y = c1_a * 28.2;
  c1_Vq = c1_bemf + c1_y;
  _SFD_EML_CALL(0U, chartInstance->c1_sfEvent, 22);
  c1_b_a = -c1_ZL;
  c1_c_b = c1_Ides;
  c1_Vd = c1_b_a * c1_c_b;
  _SFD_EML_CALL(0U, chartInstance->c1_sfEvent, -22);
  sf_debug_symbol_scope_pop();
  *c1_b_Vd = c1_Vd;
  *c1_b_Vq = c1_Vq;
  _SFD_CC_CALL(EXIT_OUT_OF_FUNCTION_TAG, 0U, chartInstance->c1_sfEvent);
  sf_debug_check_for_state_inconsistency
    (_motor_control_with_off_the_shelf_SVPWMMachineNumber_,
     chartInstance->chartNumber, chartInstance->instanceNumber);
}
static void sf_c10_adcs_v15_integral_Power_nom(void)
{
  int32_T c10_i6;
  int32_T c10_i7;
  int32_T c10_i8;
  int32_T c10_i9;
  int32_T c10_previousEvent;
  int32_T c10_i10;
  real_T c10_B_l[3];
  int32_T c10_i11;
  real_T c10_B_k[3];
  real_T c10_nargout = 2.0;
  real_T c10_nargin = 3.0;
  real_T c10_c_s_FRAME_SIZE = c10_b_s_FRAME_SIZE;
  real_T c10_dB[3];
  real_T c10_B[3];
  int32_T c10_i12;
  real_T c10_A[3];
  int32_T c10_i13;
  real_T c10_x[3];
  int32_T c10_i14;
  real_T c10_b_x[3];
  int32_T c10_i15;
  real_T c10_c_x[3];
  int32_T c10_i16;
  int32_T c10_i17;
  real_T c10_b_A[3];
  int32_T c10_i18;
  real_T c10_d_x[3];
  int32_T c10_i19;
  real_T c10_e_x[3];
  int32_T c10_i20;
  real_T c10_f_x[3];
  int32_T c10_i21;
  int32_T c10_i22;
  int32_T c10_i23;
  real_T (*c10_b_B)[3];
  real_T (*c10_b_dB)[3];
  real_T (*c10_b_B_k)[3];
  real_T (*c10_b_B_l)[3];
  c10_b_B_k = (real_T (*)[3])ssGetInputPortSignal(chartInstance.S, 1);
  c10_b_B = (real_T (*)[3])ssGetOutputPortSignal(chartInstance.S, 1);
  c10_b_B_l = (real_T (*)[3])ssGetInputPortSignal(chartInstance.S, 0);
  c10_b_dB = (real_T (*)[3])ssGetOutputPortSignal(chartInstance.S, 2);
  _sfTime_ = (real_T)ssGetT(chartInstance.S);
  _SFD_CC_CALL(CHART_ENTER_SFUNCTION_TAG,8);
  for (c10_i6 = 0; c10_i6 < 3; c10_i6 = c10_i6 + 1) {
    _SFD_DATA_RANGE_CHECK((*c10_b_B)[c10_i6], 0U);
  }

  for (c10_i7 = 0; c10_i7 < 3; c10_i7 = c10_i7 + 1) {
    _SFD_DATA_RANGE_CHECK((*c10_b_B_l)[c10_i7], 1U);
  }

  for (c10_i8 = 0; c10_i8 < 3; c10_i8 = c10_i8 + 1) {
    _SFD_DATA_RANGE_CHECK((*c10_b_B_k)[c10_i8], 2U);
  }

  for (c10_i9 = 0; c10_i9 < 3; c10_i9 = c10_i9 + 1) {
    _SFD_DATA_RANGE_CHECK((*c10_b_dB)[c10_i9], 3U);
  }

  _SFD_DATA_RANGE_CHECK(chartInstance.c10_s_FRAME_SIZE, 4U);
  c10_previousEvent = _sfEvent_;
  _sfEvent_ = CALL_EVENT;
  _SFD_CC_CALL(CHART_ENTER_DURING_FUNCTION_TAG,8);
  for (c10_i10 = 0; c10_i10 < 3; c10_i10 = c10_i10 + 1) {
    c10_B_l[c10_i10] = (*c10_b_B_l)[c10_i10];
  }

  for (c10_i11 = 0; c10_i11 < 3; c10_i11 = c10_i11 + 1) {
    c10_B_k[c10_i11] = (*c10_b_B_k)[c10_i11];
  }

  sf_debug_symbol_scope_push(7U, 0U);
  sf_debug_symbol_scope_add("nargout", &c10_nargout, c10_b_sf_marshall);
  sf_debug_symbol_scope_add("nargin", &c10_nargin, c10_b_sf_marshall);
  sf_debug_symbol_scope_add("s_FRAME_SIZE", &c10_c_s_FRAME_SIZE,
    c10_b_sf_marshall);
  sf_debug_symbol_scope_add("dB", &c10_dB, c10_sf_marshall);
  sf_debug_symbol_scope_add("B", &c10_B, c10_sf_marshall);
  sf_debug_symbol_scope_add("B_k", &c10_B_k, c10_sf_marshall);
  sf_debug_symbol_scope_add("B_l", &c10_B_l, c10_sf_marshall);
  CV_EML_FCN(0, 0);

  /*  This block supports the Embedded MATLAB subset. */
  /*  See the help menu for details.  */
  _SFD_EML_CALL(0,5);
  for (c10_i12 = 0; c10_i12 < 3; c10_i12 = c10_i12 + 1) {
    c10_A[c10_i12] = c10_B_l[c10_i12] - c10_B_k[c10_i12];
  }

  for (c10_i13 = 0; c10_i13 < 3; c10_i13 = c10_i13 + 1) {
    c10_x[c10_i13] = c10_A[c10_i13];
  }

  for (c10_i14 = 0; c10_i14 < 3; c10_i14 = c10_i14 + 1) {
    c10_b_x[c10_i14] = c10_x[c10_i14];
  }

  for (c10_i15 = 0; c10_i15 < 3; c10_i15 = c10_i15 + 1) {
    c10_c_x[c10_i15] = c10_b_x[c10_i15];
  }

  for (c10_i16 = 0; c10_i16 < 3; c10_i16 = c10_i16 + 1) {
    c10_dB[c10_i16] = c10_c_x[c10_i16] / c10_b_s_FRAME_SIZE;
  }

  _SFD_EML_CALL(0,6);
  for (c10_i17 = 0; c10_i17 < 3; c10_i17 = c10_i17 + 1) {
    c10_b_A[c10_i17] = c10_B_l[c10_i17] + c10_B_k[c10_i17];
  }

  for (c10_i18 = 0; c10_i18 < 3; c10_i18 = c10_i18 + 1) {
    c10_d_x[c10_i18] = c10_b_A[c10_i18];
  }

  for (c10_i19 = 0; c10_i19 < 3; c10_i19 = c10_i19 + 1) {
    c10_e_x[c10_i19] = c10_d_x[c10_i19];
  }

  for (c10_i20 = 0; c10_i20 < 3; c10_i20 = c10_i20 + 1) {
    c10_f_x[c10_i20] = c10_e_x[c10_i20];
  }

  for (c10_i21 = 0; c10_i21 < 3; c10_i21 = c10_i21 + 1) {
    c10_B[c10_i21] = c10_f_x[c10_i21] / 2.0;
  }

  _SFD_EML_CALL(0,-6);
  sf_debug_symbol_scope_pop();
  for (c10_i22 = 0; c10_i22 < 3; c10_i22 = c10_i22 + 1) {
    (*c10_b_B)[c10_i22] = c10_B[c10_i22];
  }

  for (c10_i23 = 0; c10_i23 < 3; c10_i23 = c10_i23 + 1) {
    (*c10_b_dB)[c10_i23] = c10_dB[c10_i23];
  }

  _SFD_CC_CALL(EXIT_OUT_OF_FUNCTION_TAG,8);
  _sfEvent_ = c10_previousEvent;
  sf_debug_check_for_state_inconsistency
    (_adcs_v15_integral_Power_nomMachineNumber_, chartInstance.chartNumber,
     chartInstance.
     instanceNumber);
}
示例#21
0
static void c4_chartstep_c4_iC_3ph_MR2(SFc4_iC_3ph_MR2InstanceStruct
  *chartInstance)
{
  real_T c4_hoistedGlobal;
  real_T c4_b_hoistedGlobal;
  real_T c4_c_hoistedGlobal;
  real_T c4_up_alpha;
  real_T c4_up_beta;
  real_T c4_up_0;
  uint32_T c4_debug_family_var_map[9];
  real_T c4_abc[3];
  real_T c4_nargin = 3.0;
  real_T c4_nargout = 3.0;
  real_T c4_up_a;
  real_T c4_up_b;
  real_T c4_up_c;
  real_T c4_b[3];
  int32_T c4_i0;
  int32_T c4_i1;
  int32_T c4_i2;
  real_T c4_C[3];
  int32_T c4_i3;
  int32_T c4_i4;
  int32_T c4_i5;
  int32_T c4_i6;
  int32_T c4_i7;
  int32_T c4_i8;
  static real_T c4_a[9] = { 1.0, -0.5, -0.5, 0.0, 0.8660254037844386,
    -0.8660254037844386, 1.0, 1.0, 1.0 };

  real_T *c4_b_up_alpha;
  real_T *c4_b_up_beta;
  real_T *c4_b_up_0;
  real_T *c4_b_up_a;
  real_T *c4_b_up_b;
  real_T *c4_b_up_c;
  c4_b_up_0 = (real_T *)ssGetInputPortSignal(chartInstance->S, 2);
  c4_b_up_beta = (real_T *)ssGetInputPortSignal(chartInstance->S, 1);
  c4_b_up_c = (real_T *)ssGetOutputPortSignal(chartInstance->S, 3);
  c4_b_up_b = (real_T *)ssGetOutputPortSignal(chartInstance->S, 2);
  c4_b_up_alpha = (real_T *)ssGetInputPortSignal(chartInstance->S, 0);
  c4_b_up_a = (real_T *)ssGetOutputPortSignal(chartInstance->S, 1);
  _SFD_CC_CALL(CHART_ENTER_DURING_FUNCTION_TAG, 3U, chartInstance->c4_sfEvent);
  c4_hoistedGlobal = *c4_b_up_alpha;
  c4_b_hoistedGlobal = *c4_b_up_beta;
  c4_c_hoistedGlobal = *c4_b_up_0;
  c4_up_alpha = c4_hoistedGlobal;
  c4_up_beta = c4_b_hoistedGlobal;
  c4_up_0 = c4_c_hoistedGlobal;
  sf_debug_symbol_scope_push_eml(0U, 9U, 9U, c4_debug_family_names,
    c4_debug_family_var_map);
  sf_debug_symbol_scope_add_eml_importable(c4_abc, 0U, c4_b_sf_marshallOut,
    c4_b_sf_marshallIn);
  sf_debug_symbol_scope_add_eml_importable(&c4_nargin, 1U, c4_sf_marshallOut,
    c4_sf_marshallIn);
  sf_debug_symbol_scope_add_eml_importable(&c4_nargout, 2U, c4_sf_marshallOut,
    c4_sf_marshallIn);
  sf_debug_symbol_scope_add_eml(&c4_up_alpha, 3U, c4_sf_marshallOut);
  sf_debug_symbol_scope_add_eml(&c4_up_beta, 4U, c4_sf_marshallOut);
  sf_debug_symbol_scope_add_eml(&c4_up_0, 5U, c4_sf_marshallOut);
  sf_debug_symbol_scope_add_eml_importable(&c4_up_a, 6U, c4_sf_marshallOut,
    c4_sf_marshallIn);
  sf_debug_symbol_scope_add_eml_importable(&c4_up_b, 7U, c4_sf_marshallOut,
    c4_sf_marshallIn);
  sf_debug_symbol_scope_add_eml_importable(&c4_up_c, 8U, c4_sf_marshallOut,
    c4_sf_marshallIn);
  CV_EML_FCN(0, 0);
  _SFD_EML_CALL(0U, chartInstance->c4_sfEvent, 4);
  c4_b[0] = c4_up_alpha;
  c4_b[1] = c4_up_beta;
  c4_b[2] = c4_up_0;
  c4_eml_scalar_eg(chartInstance);
  c4_eml_scalar_eg(chartInstance);
  for (c4_i0 = 0; c4_i0 < 3; c4_i0++) {
    c4_abc[c4_i0] = 0.0;
  }

  for (c4_i1 = 0; c4_i1 < 3; c4_i1++) {
    c4_abc[c4_i1] = 0.0;
  }

  for (c4_i2 = 0; c4_i2 < 3; c4_i2++) {
    c4_C[c4_i2] = c4_abc[c4_i2];
  }

  for (c4_i3 = 0; c4_i3 < 3; c4_i3++) {
    c4_abc[c4_i3] = c4_C[c4_i3];
  }

  for (c4_i4 = 0; c4_i4 < 3; c4_i4++) {
    c4_C[c4_i4] = c4_abc[c4_i4];
  }

  for (c4_i5 = 0; c4_i5 < 3; c4_i5++) {
    c4_abc[c4_i5] = c4_C[c4_i5];
  }

  for (c4_i6 = 0; c4_i6 < 3; c4_i6++) {
    c4_abc[c4_i6] = 0.0;
    c4_i7 = 0;
    for (c4_i8 = 0; c4_i8 < 3; c4_i8++) {
      c4_abc[c4_i6] += c4_a[c4_i7 + c4_i6] * c4_b[c4_i8];
      c4_i7 += 3;
    }
  }

  _SFD_EML_CALL(0U, chartInstance->c4_sfEvent, 7);
  c4_up_a = c4_abc[0];
  _SFD_EML_CALL(0U, chartInstance->c4_sfEvent, 8);
  c4_up_b = c4_abc[1];
  _SFD_EML_CALL(0U, chartInstance->c4_sfEvent, 9);
  c4_up_c = c4_abc[2];
  _SFD_EML_CALL(0U, chartInstance->c4_sfEvent, -9);
  sf_debug_symbol_scope_pop();
  *c4_b_up_a = c4_up_a;
  *c4_b_up_b = c4_up_b;
  *c4_b_up_c = c4_up_c;
  _SFD_CC_CALL(EXIT_OUT_OF_FUNCTION_TAG, 3U, chartInstance->c4_sfEvent);
}
static void sf_c2_car_model(SFc2_car_modelInstanceStruct *chartInstance)
{
  int32_T c2_i3;
  int32_T c2_i4;
  int32_T c2_i5;
  int32_T c2_i6;
  int32_T c2_i7;
  int32_T c2_previousEvent;
  int32_T c2_i8;
  real_T c2_hoistedGlobal[4];
  int32_T c2_i9;
  real_T c2_b_hoistedGlobal[3];
  int32_T c2_i10;
  real_T c2_c_hoistedGlobal[2];
  int32_T c2_i11;
  real_T c2_d_hoistedGlobal[2];
  int32_T c2_i12;
  real_T c2_X[4];
  int32_T c2_i13;
  real_T c2_u[3];
  int32_T c2_i14;
  real_T c2_f_F[2];
  int32_T c2_i15;
  real_T c2_f_R[2];
  uint32_T c2_debug_family_var_map[26];
  real_T c2_m;
  real_T c2_Iz;
  real_T c2_l_F;
  real_T c2_l_R;
  real_T c2_Vx;
  real_T c2_Vy;
  real_T c2_r;
  real_T c2_psi;
  real_T c2_f_Fx;
  real_T c2_f_Rx;
  real_T c2_delta;
  real_T c2_f_Fy;
  real_T c2_f_Fz;
  real_T c2_f_Ry;
  real_T c2_f_Rz;
  real_T c2_dVx;
  real_T c2_dVy;
  real_T c2_dr;
  real_T c2_dpsi;
  real_T c2_nargin = 4.0;
  real_T c2_nargout = 1.0;
  real_T c2_dX[4];
  real_T c2_x;
  real_T c2_b_x;
  real_T c2_c_x;
  real_T c2_a;
  real_T c2_b;
  real_T c2_y;
  real_T c2_d_x;
  real_T c2_e_x;
  real_T c2_f_x;
  real_T c2_b_a;
  real_T c2_b_b;
  real_T c2_b_y;
  real_T c2_c_b;
  real_T c2_c_y;
  real_T c2_c_a;
  real_T c2_d_b;
  real_T c2_d_y;
  real_T c2_g_x;
  real_T c2_h_x;
  real_T c2_i_x;
  real_T c2_d_a;
  real_T c2_e_b;
  real_T c2_e_y;
  real_T c2_j_x;
  real_T c2_k_x;
  real_T c2_l_x;
  real_T c2_e_a;
  real_T c2_f_b;
  real_T c2_f_y;
  real_T c2_g_b;
  real_T c2_g_y;
  real_T c2_f_a;
  real_T c2_h_b;
  real_T c2_h_y;
  real_T c2_m_x;
  real_T c2_n_x;
  real_T c2_o_x;
  real_T c2_g_a;
  real_T c2_i_b;
  real_T c2_i_y;
  real_T c2_p_x;
  real_T c2_q_x;
  real_T c2_r_x;
  real_T c2_h_a;
  real_T c2_j_b;
  real_T c2_j_y;
  real_T c2_i_a;
  real_T c2_k_y;
  real_T c2_j_a;
  real_T c2_l_y;
  real_T c2_k_b;
  real_T c2_b_dVx[4];
  int32_T c2_i16;
  int32_T c2_i17;
  real_T (*c2_b_dX)[4];
  real_T (*c2_b_f_R)[2];
  real_T (*c2_b_f_F)[2];
  real_T (*c2_b_u)[3];
  real_T (*c2_b_X)[4];
  c2_b_dX = (real_T (*)[4])ssGetOutputPortSignal(chartInstance->S, 1);
  c2_b_f_R = (real_T (*)[2])ssGetInputPortSignal(chartInstance->S, 3);
  c2_b_f_F = (real_T (*)[2])ssGetInputPortSignal(chartInstance->S, 2);
  c2_b_u = (real_T (*)[3])ssGetInputPortSignal(chartInstance->S, 1);
  c2_b_X = (real_T (*)[4])ssGetInputPortSignal(chartInstance->S, 0);
  _sfTime_ = (real_T)ssGetT(chartInstance->S);
  _SFD_CC_CALL(CHART_ENTER_SFUNCTION_TAG,1);
  for (c2_i3 = 0; c2_i3 < 4; c2_i3 = c2_i3 + 1) {
    _SFD_DATA_RANGE_CHECK((*c2_b_X)[c2_i3], 0U);
  }

  for (c2_i4 = 0; c2_i4 < 3; c2_i4 = c2_i4 + 1) {
    _SFD_DATA_RANGE_CHECK((*c2_b_u)[c2_i4], 1U);
  }

  for (c2_i5 = 0; c2_i5 < 2; c2_i5 = c2_i5 + 1) {
    _SFD_DATA_RANGE_CHECK((*c2_b_f_F)[c2_i5], 2U);
  }

  for (c2_i6 = 0; c2_i6 < 2; c2_i6 = c2_i6 + 1) {
    _SFD_DATA_RANGE_CHECK((*c2_b_f_R)[c2_i6], 3U);
  }

  for (c2_i7 = 0; c2_i7 < 4; c2_i7 = c2_i7 + 1) {
    _SFD_DATA_RANGE_CHECK((*c2_b_dX)[c2_i7], 4U);
  }

  c2_previousEvent = _sfEvent_;
  _sfEvent_ = CALL_EVENT;
  _SFD_CC_CALL(CHART_ENTER_DURING_FUNCTION_TAG,1);
  for (c2_i8 = 0; c2_i8 < 4; c2_i8 = c2_i8 + 1) {
    c2_hoistedGlobal[c2_i8] = (*c2_b_X)[c2_i8];
  }

  for (c2_i9 = 0; c2_i9 < 3; c2_i9 = c2_i9 + 1) {
    c2_b_hoistedGlobal[c2_i9] = (*c2_b_u)[c2_i9];
  }

  for (c2_i10 = 0; c2_i10 < 2; c2_i10 = c2_i10 + 1) {
    c2_c_hoistedGlobal[c2_i10] = (*c2_b_f_F)[c2_i10];
  }

  for (c2_i11 = 0; c2_i11 < 2; c2_i11 = c2_i11 + 1) {
    c2_d_hoistedGlobal[c2_i11] = (*c2_b_f_R)[c2_i11];
  }

  for (c2_i12 = 0; c2_i12 < 4; c2_i12 = c2_i12 + 1) {
    c2_X[c2_i12] = c2_hoistedGlobal[c2_i12];
  }

  for (c2_i13 = 0; c2_i13 < 3; c2_i13 = c2_i13 + 1) {
    c2_u[c2_i13] = c2_b_hoistedGlobal[c2_i13];
  }

  for (c2_i14 = 0; c2_i14 < 2; c2_i14 = c2_i14 + 1) {
    c2_f_F[c2_i14] = c2_c_hoistedGlobal[c2_i14];
  }

  for (c2_i15 = 0; c2_i15 < 2; c2_i15 = c2_i15 + 1) {
    c2_f_R[c2_i15] = c2_d_hoistedGlobal[c2_i15];
  }

  sf_debug_symbol_scope_push_eml(0U, 26U, 26U, c2_debug_family_names,
    c2_debug_family_var_map);
  sf_debug_symbol_scope_add_eml(&c2_m, c2_d_sf_marshall, 0U);
  sf_debug_symbol_scope_add_eml(&c2_Iz, c2_d_sf_marshall, 1U);
  sf_debug_symbol_scope_add_eml(&c2_l_F, c2_d_sf_marshall, 2U);
  sf_debug_symbol_scope_add_eml(&c2_l_R, c2_d_sf_marshall, 3U);
  sf_debug_symbol_scope_add_eml(&c2_Vx, c2_d_sf_marshall, 4U);
  sf_debug_symbol_scope_add_eml(&c2_Vy, c2_d_sf_marshall, 5U);
  sf_debug_symbol_scope_add_eml(&c2_r, c2_d_sf_marshall, 6U);
  sf_debug_symbol_scope_add_eml(&c2_psi, c2_d_sf_marshall, 7U);
  sf_debug_symbol_scope_add_eml(&c2_f_Fx, c2_d_sf_marshall, 8U);
  sf_debug_symbol_scope_add_eml(&c2_f_Rx, c2_d_sf_marshall, 9U);
  sf_debug_symbol_scope_add_eml(&c2_delta, c2_d_sf_marshall, 10U);
  sf_debug_symbol_scope_add_eml(&c2_f_Fy, c2_d_sf_marshall, 11U);
  sf_debug_symbol_scope_add_eml(&c2_f_Fz, c2_d_sf_marshall, 12U);
  sf_debug_symbol_scope_add_eml(&c2_f_Ry, c2_d_sf_marshall, 13U);
  sf_debug_symbol_scope_add_eml(&c2_f_Rz, c2_d_sf_marshall, 14U);
  sf_debug_symbol_scope_add_eml(&c2_dVx, c2_d_sf_marshall, 15U);
  sf_debug_symbol_scope_add_eml(&c2_dVy, c2_d_sf_marshall, 16U);
  sf_debug_symbol_scope_add_eml(&c2_dr, c2_d_sf_marshall, 17U);
  sf_debug_symbol_scope_add_eml(&c2_dpsi, c2_d_sf_marshall, 18U);
  sf_debug_symbol_scope_add_eml(&c2_nargin, c2_d_sf_marshall, 19U);
  sf_debug_symbol_scope_add_eml(&c2_nargout, c2_d_sf_marshall, 20U);
  sf_debug_symbol_scope_add_eml(&c2_X, c2_sf_marshall, 21U);
  sf_debug_symbol_scope_add_eml(&c2_u, c2_c_sf_marshall, 22U);
  sf_debug_symbol_scope_add_eml(&c2_f_F, c2_b_sf_marshall, 23U);
  sf_debug_symbol_scope_add_eml(&c2_f_R, c2_b_sf_marshall, 24U);
  sf_debug_symbol_scope_add_eml(&c2_dX, c2_sf_marshall, 25U);
  CV_EML_FCN(0, 0);

  /*  m = param.m; */
  /*  Iz = param.Iz; */
  /*  l_F = param.l_F; */
  /*  l_R = param.l_R; */
  /*  B = param.B; */
  /*  C = param.C; */
  /*  mu = param.mu; */
  /*  delta_max = param.delta_max; */
  _SFD_EML_CALL(0,13);
  c2_m = 1450.0;
  _SFD_EML_CALL(0,14);
  c2_Iz = 2740.0;
  _SFD_EML_CALL(0,15);
  c2_l_F = 1.1;
  _SFD_EML_CALL(0,16);
  c2_l_R = 1.6;
  _SFD_EML_CALL(0,18);
  c2_Vx = c2_X[0];
  _SFD_EML_CALL(0,19);
  c2_Vy = c2_X[1];
  _SFD_EML_CALL(0,20);
  c2_r = c2_X[2];
  _SFD_EML_CALL(0,21);
  c2_psi = c2_X[3];
  _SFD_EML_CALL(0,23);
  c2_f_Fx = c2_u[0];
  _SFD_EML_CALL(0,24);
  c2_f_Rx = c2_u[1];
  _SFD_EML_CALL(0,25);
  c2_delta = c2_u[2];
  _SFD_EML_CALL(0,27);
  c2_f_Fy = c2_f_F[0];
  _SFD_EML_CALL(0,28);
  c2_f_Fz = c2_f_F[1];
  _SFD_EML_CALL(0,30);
  c2_f_Ry = c2_f_R[0];
  _SFD_EML_CALL(0,31);
  c2_f_Rz = c2_f_R[1];
  _SFD_EML_CALL(0,34);
  c2_x = c2_delta;
  c2_b_x = c2_x;
  c2_c_x = c2_b_x;
  c2_b_x = c2_c_x;
  c2_b_x = muDoubleScalarCos(c2_b_x);
  c2_a = c2_f_Fx;
  c2_b = c2_b_x;
  c2_y = c2_a * c2_b;
  c2_d_x = c2_delta;
  c2_e_x = c2_d_x;
  c2_f_x = c2_e_x;
  c2_e_x = c2_f_x;
  c2_e_x = muDoubleScalarSin(c2_e_x);
  c2_b_a = c2_f_Fy;
  c2_b_b = c2_e_x;
  c2_b_y = c2_b_a * c2_b_b;
  c2_c_b = (c2_y - c2_b_y) + c2_f_Rx;
  c2_c_y = 6.8965517241379305E-004 * c2_c_b;
  c2_c_a = c2_Vy;
  c2_d_b = c2_r;
  c2_d_y = c2_c_a * c2_d_b;
  c2_dVx = c2_c_y + c2_d_y;
  _SFD_EML_CALL(0,35);
  c2_g_x = c2_delta;
  c2_h_x = c2_g_x;
  c2_i_x = c2_h_x;
  c2_h_x = c2_i_x;
  c2_h_x = muDoubleScalarSin(c2_h_x);
  c2_d_a = c2_f_Fx;
  c2_e_b = c2_h_x;
  c2_e_y = c2_d_a * c2_e_b;
  c2_j_x = c2_delta;
  c2_k_x = c2_j_x;
  c2_l_x = c2_k_x;
  c2_k_x = c2_l_x;
  c2_k_x = muDoubleScalarCos(c2_k_x);
  c2_e_a = c2_f_Fy;
  c2_f_b = c2_k_x;
  c2_f_y = c2_e_a * c2_f_b;
  c2_g_b = (c2_e_y + c2_f_y) + c2_f_Ry;
  c2_g_y = 6.8965517241379305E-004 * c2_g_b;
  c2_f_a = c2_Vx;
  c2_h_b = c2_r;
  c2_h_y = c2_f_a * c2_h_b;
  c2_dVy = c2_g_y - c2_h_y;
  _SFD_EML_CALL(0,36);
  c2_m_x = c2_delta;
  c2_n_x = c2_m_x;
  c2_o_x = c2_n_x;
  c2_n_x = c2_o_x;
  c2_n_x = muDoubleScalarCos(c2_n_x);
  c2_g_a = c2_f_Fy;
  c2_i_b = c2_n_x;
  c2_i_y = c2_g_a * c2_i_b;
  c2_p_x = c2_delta;
  c2_q_x = c2_p_x;
  c2_r_x = c2_q_x;
  c2_q_x = c2_r_x;
  c2_q_x = muDoubleScalarSin(c2_q_x);
  c2_h_a = c2_f_Fx;
  c2_j_b = c2_q_x;
  c2_j_y = c2_h_a * c2_j_b;
  c2_i_a = c2_i_y + c2_j_y;
  c2_k_y = c2_i_a * 1.1;
  c2_j_a = c2_f_Ry;
  c2_l_y = c2_j_a * 1.6;
  c2_k_b = c2_k_y - c2_l_y;
  c2_dr = 3.6496350364963501E-004 * c2_k_b;
  _SFD_EML_CALL(0,37);
  c2_dpsi = c2_r;
  _SFD_EML_CALL(0,39);
  c2_b_dVx[0] = c2_dVx;
  c2_b_dVx[1] = c2_dVy;
  c2_b_dVx[2] = c2_dr;
  c2_b_dVx[3] = c2_dpsi;
  for (c2_i16 = 0; c2_i16 < 4; c2_i16 = c2_i16 + 1) {
    c2_dX[c2_i16] = c2_b_dVx[c2_i16];
  }

  _SFD_EML_CALL(0,-39);
  sf_debug_symbol_scope_pop();
  for (c2_i17 = 0; c2_i17 < 4; c2_i17 = c2_i17 + 1) {
    (*c2_b_dX)[c2_i17] = c2_dX[c2_i17];
  }

  _SFD_CC_CALL(EXIT_OUT_OF_FUNCTION_TAG,1);
  _sfEvent_ = c2_previousEvent;
  sf_debug_check_for_state_inconsistency(_car_modelMachineNumber_,
    chartInstance->chartNumber, chartInstance->instanceNumber);
}
static void c6_chartstep_c6_motor_control(SFc6_motor_controlInstanceStruct
  *chartInstance)
{
  real_T c6_hoistedGlobal;
  real_T c6_b_hoistedGlobal;
  real_T c6_c_hoistedGlobal;
  real_T c6_Xd;
  real_T c6_Xq;
  real_T c6_theta;
  uint32_T c6_debug_family_var_map[11];
  real_T c6_c;
  real_T c6_s;
  real_T c6_ipm[4];
  real_T c6_xab[2];
  real_T c6_nargin = 3.0;
  real_T c6_nargout = 2.0;
  real_T c6_Xalpha;
  real_T c6_Xbeta;
  real_T c6_x;
  real_T c6_b_x;
  real_T c6_c_x;
  real_T c6_d_x;
  int32_T c6_i0;
  real_T c6_a[4];
  real_T c6_b_Xd[2];
  int32_T c6_i1;
  real_T c6_b[2];
  int32_T c6_i2;
  int32_T c6_i3;
  int32_T c6_i4;
  real_T c6_C[2];
  int32_T c6_i5;
  int32_T c6_i6;
  int32_T c6_i7;
  int32_T c6_i8;
  int32_T c6_i9;
  int32_T c6_i10;
  real_T *c6_c_Xd;
  real_T *c6_b_Xq;
  real_T *c6_b_theta;
  real_T *c6_b_Xalpha;
  real_T *c6_b_Xbeta;
  c6_b_Xbeta = (real_T *)ssGetOutputPortSignal(chartInstance->S, 2);
  c6_b_theta = (real_T *)ssGetInputPortSignal(chartInstance->S, 2);
  c6_b_Xq = (real_T *)ssGetInputPortSignal(chartInstance->S, 1);
  c6_b_Xalpha = (real_T *)ssGetOutputPortSignal(chartInstance->S, 1);
  c6_c_Xd = (real_T *)ssGetInputPortSignal(chartInstance->S, 0);
  _SFD_CC_CALL(CHART_ENTER_DURING_FUNCTION_TAG, 5U, chartInstance->c6_sfEvent);
  c6_hoistedGlobal = *c6_c_Xd;
  c6_b_hoistedGlobal = *c6_b_Xq;
  c6_c_hoistedGlobal = *c6_b_theta;
  c6_Xd = c6_hoistedGlobal;
  c6_Xq = c6_b_hoistedGlobal;
  c6_theta = c6_c_hoistedGlobal;
  sf_debug_symbol_scope_push_eml(0U, 11U, 11U, c6_debug_family_names,
    c6_debug_family_var_map);
  sf_debug_symbol_scope_add_eml_importable(&c6_c, 0U, c6_sf_marshallOut,
    c6_sf_marshallIn);
  sf_debug_symbol_scope_add_eml_importable(&c6_s, 1U, c6_sf_marshallOut,
    c6_sf_marshallIn);
  sf_debug_symbol_scope_add_eml_importable(c6_ipm, 2U, c6_c_sf_marshallOut,
    c6_c_sf_marshallIn);
  sf_debug_symbol_scope_add_eml_importable(c6_xab, 3U, c6_b_sf_marshallOut,
    c6_b_sf_marshallIn);
  sf_debug_symbol_scope_add_eml_importable(&c6_nargin, 4U, c6_sf_marshallOut,
    c6_sf_marshallIn);
  sf_debug_symbol_scope_add_eml_importable(&c6_nargout, 5U, c6_sf_marshallOut,
    c6_sf_marshallIn);
  sf_debug_symbol_scope_add_eml(&c6_Xd, 6U, c6_sf_marshallOut);
  sf_debug_symbol_scope_add_eml(&c6_Xq, 7U, c6_sf_marshallOut);
  sf_debug_symbol_scope_add_eml(&c6_theta, 8U, c6_sf_marshallOut);
  sf_debug_symbol_scope_add_eml_importable(&c6_Xalpha, 9U, c6_sf_marshallOut,
    c6_sf_marshallIn);
  sf_debug_symbol_scope_add_eml_importable(&c6_Xbeta, 10U, c6_sf_marshallOut,
    c6_sf_marshallIn);
  CV_EML_FCN(0, 0);
  _SFD_EML_CALL(0U, chartInstance->c6_sfEvent, 5);
  c6_x = c6_theta;
  c6_c = c6_x;
  c6_b_x = c6_c;
  c6_c = c6_b_x;
  c6_c = muDoubleScalarCos(c6_c);
  _SFD_EML_CALL(0U, chartInstance->c6_sfEvent, 6);
  c6_c_x = c6_theta;
  c6_s = c6_c_x;
  c6_d_x = c6_s;
  c6_s = c6_d_x;
  c6_s = muDoubleScalarSin(c6_s);
  _SFD_EML_CALL(0U, chartInstance->c6_sfEvent, 8);
  c6_ipm[0] = c6_c;
  c6_ipm[2] = -c6_s;
  c6_ipm[1] = c6_s;
  c6_ipm[3] = c6_c;
  _SFD_EML_CALL(0U, chartInstance->c6_sfEvent, 10);
  for (c6_i0 = 0; c6_i0 < 4; c6_i0++) {
    c6_a[c6_i0] = c6_ipm[c6_i0];
  }

  c6_b_Xd[0] = c6_Xd;
  c6_b_Xd[1] = c6_Xq;
  for (c6_i1 = 0; c6_i1 < 2; c6_i1++) {
    c6_b[c6_i1] = c6_b_Xd[c6_i1];
  }

  c6_eml_scalar_eg(chartInstance);
  c6_eml_scalar_eg(chartInstance);
  for (c6_i2 = 0; c6_i2 < 2; c6_i2++) {
    c6_xab[c6_i2] = 0.0;
  }

  for (c6_i3 = 0; c6_i3 < 2; c6_i3++) {
    c6_xab[c6_i3] = 0.0;
  }

  for (c6_i4 = 0; c6_i4 < 2; c6_i4++) {
    c6_C[c6_i4] = c6_xab[c6_i4];
  }

  for (c6_i5 = 0; c6_i5 < 2; c6_i5++) {
    c6_xab[c6_i5] = c6_C[c6_i5];
  }

  for (c6_i6 = 0; c6_i6 < 2; c6_i6++) {
    c6_C[c6_i6] = c6_xab[c6_i6];
  }

  for (c6_i7 = 0; c6_i7 < 2; c6_i7++) {
    c6_xab[c6_i7] = c6_C[c6_i7];
  }

  for (c6_i8 = 0; c6_i8 < 2; c6_i8++) {
    c6_xab[c6_i8] = 0.0;
    c6_i9 = 0;
    for (c6_i10 = 0; c6_i10 < 2; c6_i10++) {
      c6_xab[c6_i8] += c6_a[c6_i9 + c6_i8] * c6_b[c6_i10];
      c6_i9 += 2;
    }
  }

  _SFD_EML_CALL(0U, chartInstance->c6_sfEvent, 12);
  c6_Xalpha = c6_xab[0];
  _SFD_EML_CALL(0U, chartInstance->c6_sfEvent, 13);
  c6_Xbeta = c6_xab[1];
  _SFD_EML_CALL(0U, chartInstance->c6_sfEvent, -13);
  sf_debug_symbol_scope_pop();
  *c6_b_Xalpha = c6_Xalpha;
  *c6_b_Xbeta = c6_Xbeta;
  _SFD_CC_CALL(EXIT_OUT_OF_FUNCTION_TAG, 5U, chartInstance->c6_sfEvent);
}
static void sf_c7_adcs_v15_integral_Power(void)
{
  int32_T c7_i3;
  int32_T c7_i4;
  int32_T c7_previousEvent;
  int32_T c7_i5;
  real_T c7_x[7];
  real_T c7_nargout = 1.0;
  real_T c7_nargin = 1.0;
  real_T c7_q[4];
  real_T c7_xN[7];
  int32_T c7_i6;
  int32_T c7_i7;
  real_T c7_A[4];
  int32_T c7_i8;
  real_T c7_a[4];
  int32_T c7_i9;
  real_T c7_b[4];
  int32_T c7_i10;
  real_T c7_b_a[4];
  int32_T c7_i11;
  real_T c7_b_b[4];
  int32_T c7_i12;
  real_T c7_b_x[4];
  int32_T c7_i13;
  real_T c7_y[4];
  int32_T c7_i14;
  real_T c7_c_x[4];
  int32_T c7_i15;
  real_T c7_b_y[4];
  int32_T c7_i16;
  real_T c7_d_x[4];
  int32_T c7_i17;
  real_T c7_c_y[4];
  int32_T c7_i18;
  real_T c7_e_x[4];
  int32_T c7_i19;
  real_T c7_d_y[4];
  real_T c7_f_x;
  real_T c7_B;
  real_T c7_g_x;
  int32_T c7_i20;
  real_T c7_h_x[4];
  real_T c7_e_y;
  int32_T c7_i21;
  real_T c7_i_x[4];
  real_T c7_f_y;
  int32_T c7_i22;
  real_T c7_j_x[4];
  real_T c7_g_y;
  int32_T c7_i23;
  int32_T c7_i24;
  int32_T c7_i25;
  int32_T c7_i26;
  real_T (*c7_b_xN)[7];
  real_T (*c7_k_x)[7];
  c7_b_xN = (real_T (*)[7])ssGetOutputPortSignal(chartInstance.S, 1);
  c7_k_x = (real_T (*)[7])ssGetInputPortSignal(chartInstance.S, 0);
  _sfTime_ = (real_T)ssGetT(chartInstance.S);
  _SFD_CC_CALL(CHART_ENTER_SFUNCTION_TAG,5);
  for (c7_i3 = 0; c7_i3 < 7; c7_i3 = c7_i3 + 1) {
    _SFD_DATA_RANGE_CHECK((*c7_k_x)[c7_i3], 0U);
  }

  for (c7_i4 = 0; c7_i4 < 7; c7_i4 = c7_i4 + 1) {
    _SFD_DATA_RANGE_CHECK((*c7_b_xN)[c7_i4], 1U);
  }

  c7_previousEvent = _sfEvent_;
  _sfEvent_ = CALL_EVENT;
  _SFD_CC_CALL(CHART_ENTER_DURING_FUNCTION_TAG,5);
  for (c7_i5 = 0; c7_i5 < 7; c7_i5 = c7_i5 + 1) {
    c7_x[c7_i5] = (*c7_k_x)[c7_i5];
  }

  sf_debug_symbol_scope_push(5U, 0U);
  sf_debug_symbol_scope_add("nargout", &c7_nargout, c7_c_sf_marshall);
  sf_debug_symbol_scope_add("nargin", &c7_nargin, c7_c_sf_marshall);
  sf_debug_symbol_scope_add("q", &c7_q, c7_b_sf_marshall);
  sf_debug_symbol_scope_add("xN", &c7_xN, c7_sf_marshall);
  sf_debug_symbol_scope_add("x", &c7_x, c7_sf_marshall);
  CV_EML_FCN(0, 0);

  /*  This block gives DCM for converting from ECI to ORBIT frames */
  /*  inputs: state vector in ECI */
  /*  output: DCM */
  _SFD_EML_CALL(0,6);
  for (c7_i6 = 0; c7_i6 < 4; c7_i6 = c7_i6 + 1) {
    c7_q[c7_i6] = c7_x[c7_i6];
  }

  _SFD_EML_CALL(0,7);
  for (c7_i7 = 0; c7_i7 < 4; c7_i7 = c7_i7 + 1) {
    c7_A[c7_i7] = c7_q[c7_i7];
  }

  for (c7_i8 = 0; c7_i8 < 4; c7_i8 = c7_i8 + 1) {
    c7_a[c7_i8] = c7_q[c7_i8];
  }

  for (c7_i9 = 0; c7_i9 < 4; c7_i9 = c7_i9 + 1) {
    c7_b[c7_i9] = c7_q[c7_i9];
  }

  c7_eml_scalar_eg();
  for (c7_i10 = 0; c7_i10 < 4; c7_i10 = c7_i10 + 1) {
    c7_b_a[c7_i10] = c7_a[c7_i10];
  }

  for (c7_i11 = 0; c7_i11 < 4; c7_i11 = c7_i11 + 1) {
    c7_b_b[c7_i11] = c7_b[c7_i11];
  }

  for (c7_i12 = 0; c7_i12 < 4; c7_i12 = c7_i12 + 1) {
    c7_b_x[c7_i12] = c7_b_a[c7_i12];
  }

  for (c7_i13 = 0; c7_i13 < 4; c7_i13 = c7_i13 + 1) {
    c7_y[c7_i13] = c7_b_b[c7_i13];
  }

  for (c7_i14 = 0; c7_i14 < 4; c7_i14 = c7_i14 + 1) {
    c7_c_x[c7_i14] = c7_b_x[c7_i14];
  }

  for (c7_i15 = 0; c7_i15 < 4; c7_i15 = c7_i15 + 1) {
    c7_b_y[c7_i15] = c7_y[c7_i15];
  }

  for (c7_i16 = 0; c7_i16 < 4; c7_i16 = c7_i16 + 1) {
    c7_d_x[c7_i16] = c7_c_x[c7_i16];
  }

  for (c7_i17 = 0; c7_i17 < 4; c7_i17 = c7_i17 + 1) {
    c7_c_y[c7_i17] = c7_b_y[c7_i17];
  }

  for (c7_i18 = 0; c7_i18 < 4; c7_i18 = c7_i18 + 1) {
    c7_e_x[c7_i18] = c7_d_x[c7_i18];
  }

  for (c7_i19 = 0; c7_i19 < 4; c7_i19 = c7_i19 + 1) {
    c7_d_y[c7_i19] = c7_c_y[c7_i19];
  }

  c7_f_x = c7_ceval_xdot(4, c7_e_x, 1, 1, c7_d_y, 1, 1);
  c7_B = c7_f_x;
  if (c7_B < 0.0) {
    c7_eml_error();
  }

  c7_g_x = c7_B;
  c7_B = c7_g_x;
  c7_B = muDoubleScalarSqrt(c7_B);
  for (c7_i20 = 0; c7_i20 < 4; c7_i20 = c7_i20 + 1) {
    c7_h_x[c7_i20] = c7_A[c7_i20];
  }

  c7_e_y = c7_B;
  if (c7_e_y == 0.0) {
    c7_eml_warning();
  }

  for (c7_i21 = 0; c7_i21 < 4; c7_i21 = c7_i21 + 1) {
    c7_i_x[c7_i21] = c7_h_x[c7_i21];
  }

  c7_f_y = c7_e_y;
  for (c7_i22 = 0; c7_i22 < 4; c7_i22 = c7_i22 + 1) {
    c7_j_x[c7_i22] = c7_i_x[c7_i22];
  }

  c7_g_y = c7_f_y;
  for (c7_i23 = 0; c7_i23 < 4; c7_i23 = c7_i23 + 1) {
    c7_q[c7_i23] = c7_j_x[c7_i23] / c7_g_y;
  }

  _SFD_EML_CALL(0,8);
  for (c7_i24 = 0; c7_i24 < 4; c7_i24 = c7_i24 + 1) {
    c7_xN[c7_i24] = c7_q[c7_i24];
  }

  for (c7_i25 = 0; c7_i25 < 3; c7_i25 = c7_i25 + 1) {
    c7_xN[c7_i25 + 4] = c7_x[c7_i25 + 4];
  }

  _SFD_EML_CALL(0,-8);
  sf_debug_symbol_scope_pop();
  for (c7_i26 = 0; c7_i26 < 7; c7_i26 = c7_i26 + 1) {
    (*c7_b_xN)[c7_i26] = c7_xN[c7_i26];
  }

  _SFD_CC_CALL(EXIT_OUT_OF_FUNCTION_TAG,5);
  _sfEvent_ = c7_previousEvent;
  sf_debug_check_for_state_inconsistency(_adcs_v15_integral_PowerMachineNumber_,
    chartInstance.chartNumber, chartInstance.
    instanceNumber);
}
示例#25
0
static void sf_c2_controller1(SFc2_controller1InstanceStruct *chartInstance)
{
  int32_T c2_previousEvent;
  real_T c2_hoistedGlobal;
  real_T c2_u;
  uint32_T c2_debug_family_var_map[4];
  real_T c2_nargin = 1.0;
  real_T c2_nargout = 1.0;
  real_T c2_y;
  real_T c2_x;
  real_T c2_b_x;
  real_T c2_b_y;
  real_T c2_c_x;
  real_T c2_xk;
  real_T c2_d_x;
  real_T c2_e_x;
  real_T c2_f_x;
  real_T *c2_b_u;
  real_T *c2_c_y;
  c2_c_y = (real_T *)ssGetOutputPortSignal(chartInstance->S, 1);
  c2_b_u = (real_T *)ssGetInputPortSignal(chartInstance->S, 0);
  _sfTime_ = (real_T)ssGetT(chartInstance->S);
  _SFD_CC_CALL(CHART_ENTER_SFUNCTION_TAG, 1);
  _SFD_DATA_RANGE_CHECK(*c2_b_u, 0U);
  _SFD_DATA_RANGE_CHECK(*c2_c_y, 1U);
  c2_previousEvent = _sfEvent_;
  _sfEvent_ = CALL_EVENT;
  _SFD_CC_CALL(CHART_ENTER_DURING_FUNCTION_TAG, 1);
  c2_hoistedGlobal = *c2_b_u;
  c2_u = c2_hoistedGlobal;
  sf_debug_symbol_scope_push_eml(0U, 4U, 4U, c2_debug_family_names,
    c2_debug_family_var_map);
  sf_debug_symbol_scope_add_eml(&c2_nargin, c2_sf_marshall, 0U);
  sf_debug_symbol_scope_add_eml(&c2_nargout, c2_sf_marshall, 1U);
  sf_debug_symbol_scope_add_eml(&c2_u, c2_sf_marshall, 2U);
  sf_debug_symbol_scope_add_eml(&c2_y, c2_sf_marshall, 3U);
  CV_EML_FCN(0, 0);
  _SFD_EML_CALL(0, 2);
  c2_x = c2_u;
  c2_b_x = c2_x;
  c2_b_y = muDoubleScalarAbs(c2_b_x);
  if (CV_EML_IF(0, 0, c2_b_y > 90.0)) {
    _SFD_EML_CALL(0, 3);
    c2_c_x = c2_u;
    c2_eml_scalar_eg(chartInstance);
    c2_xk = c2_c_x;
    c2_d_x = c2_xk;
    c2_eml_scalar_eg(chartInstance);
    c2_e_x = c2_d_x / 90.0;
    c2_f_x = c2_e_x;
    c2_f_x = muDoubleScalarFloor(c2_f_x);
    c2_u = c2_d_x - c2_f_x * 90.0;
  }

  _SFD_EML_CALL(0, 5);
  c2_y = c2_u;
  _SFD_EML_CALL(0, -5);
  sf_debug_symbol_scope_pop();
  *c2_c_y = c2_y;
  _SFD_CC_CALL(EXIT_OUT_OF_FUNCTION_TAG, 1);
  _sfEvent_ = c2_previousEvent;
  sf_debug_check_for_state_inconsistency(_controller1MachineNumber_,
    chartInstance->chartNumber, chartInstance->instanceNumber);
}
示例#26
0
static void sf_c3_controller1(SFc3_controller1InstanceStruct *chartInstance)
{
  int32_T c3_previousEvent;
  real_T c3_hoistedGlobal;
  real_T c3_u;
  uint32_T c3_debug_family_var_map[5];
  real_T c3_T;
  real_T c3_nargin = 1.0;
  real_T c3_nargout = 1.0;
  real_T c3_y;
  real_T c3_x;
  real_T c3_b_x;
  real_T c3_b_y;
  real_T c3_c_x;
  real_T c3_d_x;
  real_T c3_c_y;
  real_T c3_b;
  real_T c3_d_y;
  real_T c3_A;
  real_T c3_B;
  real_T c3_e_x;
  real_T c3_e_y;
  real_T c3_f_x;
  real_T c3_f_y;
  real_T c3_g_x;
  real_T c3_g_y;
  real_T *c3_b_u;
  real_T *c3_h_y;
  c3_h_y = (real_T *)ssGetOutputPortSignal(chartInstance->S, 1);
  c3_b_u = (real_T *)ssGetInputPortSignal(chartInstance->S, 0);
  _sfTime_ = (real_T)ssGetT(chartInstance->S);
  _SFD_CC_CALL(CHART_ENTER_SFUNCTION_TAG, 2);
  _SFD_DATA_RANGE_CHECK(*c3_b_u, 0U);
  _SFD_DATA_RANGE_CHECK(*c3_h_y, 1U);
  c3_previousEvent = _sfEvent_;
  _sfEvent_ = CALL_EVENT;
  _SFD_CC_CALL(CHART_ENTER_DURING_FUNCTION_TAG, 2);
  c3_hoistedGlobal = *c3_b_u;
  c3_u = c3_hoistedGlobal;
  sf_debug_symbol_scope_push_eml(0U, 5U, 5U, c3_debug_family_names,
    c3_debug_family_var_map);
  sf_debug_symbol_scope_add_eml(&c3_T, c3_sf_marshall, 0U);
  sf_debug_symbol_scope_add_eml(&c3_nargin, c3_sf_marshall, 1U);
  sf_debug_symbol_scope_add_eml(&c3_nargout, c3_sf_marshall, 2U);
  sf_debug_symbol_scope_add_eml(&c3_u, c3_sf_marshall, 3U);
  sf_debug_symbol_scope_add_eml(&c3_y, c3_sf_marshall, 4U);
  CV_EML_FCN(0, 0);

  /*  hard limit cutoff function. */
  _SFD_EML_CALL(0, 4);
  c3_T = 100.0;
  _SFD_EML_CALL(0, 5);
  c3_x = c3_u;
  c3_b_x = c3_x;
  c3_b_y = muDoubleScalarAbs(c3_b_x);
  if (CV_EML_IF(0, 0, c3_b_y > c3_T)) {
    _SFD_EML_CALL(0, 6);
    c3_c_x = c3_u;
    c3_d_x = c3_c_x;
    c3_c_y = muDoubleScalarAbs(c3_d_x);
    c3_b = c3_c_y;
    c3_d_y = 100.0 * c3_b;
    c3_A = c3_d_y;
    c3_B = c3_u;
    c3_e_x = c3_A;
    c3_e_y = c3_B;
    c3_f_x = c3_e_x;
    c3_f_y = c3_e_y;
    c3_g_x = c3_f_x;
    c3_g_y = c3_f_y;
    c3_u = c3_g_x / c3_g_y;
  }

  _SFD_EML_CALL(0, 8);
  c3_y = c3_u;
  _SFD_EML_CALL(0, -8);
  sf_debug_symbol_scope_pop();
  *c3_h_y = c3_y;
  _SFD_CC_CALL(EXIT_OUT_OF_FUNCTION_TAG, 2);
  _sfEvent_ = c3_previousEvent;
  sf_debug_check_for_state_inconsistency(_controller1MachineNumber_,
    chartInstance->chartNumber, chartInstance->instanceNumber);
}
示例#27
0
static void sf_c7_ekffedepre(SFc7_ekffedepreInstanceStruct *chartInstance)
{
  real_T c7_hoistedGlobal;
  real_T c7_b_hoistedGlobal;
  real_T c7_c_hoistedGlobal;
  real_T c7_d_hoistedGlobal;
  real_T c7_e_hoistedGlobal;
  real_T c7_sfasamento;
  real_T c7_ampiezza;
  real_T c7_frequenza;
  real_T c7_noise;
  real_T c7_t;
  uint32_T c7_debug_family_var_map[8];
  real_T c7_nargin = 5.0;
  real_T c7_nargout = 1.0;
  real_T c7_wave;
  real_T c7_b;
  real_T c7_y;
  real_T c7_a;
  real_T c7_b_b;
  real_T c7_b_y;
  real_T c7_x;
  real_T c7_b_x;
  real_T c7_b_a;
  real_T c7_c_b;
  real_T c7_c_y;
  real_T *c7_b_sfasamento;
  real_T *c7_b_wave;
  real_T *c7_b_ampiezza;
  real_T *c7_b_frequenza;
  real_T *c7_b_noise;
  real_T *c7_b_t;
  c7_b_t = (real_T *)ssGetInputPortSignal(chartInstance->S, 4);
  c7_b_noise = (real_T *)ssGetInputPortSignal(chartInstance->S, 3);
  c7_b_frequenza = (real_T *)ssGetInputPortSignal(chartInstance->S, 2);
  c7_b_ampiezza = (real_T *)ssGetInputPortSignal(chartInstance->S, 1);
  c7_b_wave = (real_T *)ssGetOutputPortSignal(chartInstance->S, 1);
  c7_b_sfasamento = (real_T *)ssGetInputPortSignal(chartInstance->S, 0);
  _sfTime_ = (real_T)ssGetT(chartInstance->S);
  _SFD_CC_CALL(CHART_ENTER_SFUNCTION_TAG, 6U, chartInstance->c7_sfEvent);
  _SFD_DATA_RANGE_CHECK(*c7_b_sfasamento, 0U);
  _SFD_DATA_RANGE_CHECK(*c7_b_wave, 1U);
  _SFD_DATA_RANGE_CHECK(*c7_b_ampiezza, 2U);
  _SFD_DATA_RANGE_CHECK(*c7_b_frequenza, 3U);
  _SFD_DATA_RANGE_CHECK(*c7_b_noise, 4U);
  _SFD_DATA_RANGE_CHECK(*c7_b_t, 5U);
  chartInstance->c7_sfEvent = CALL_EVENT;
  _SFD_CC_CALL(CHART_ENTER_DURING_FUNCTION_TAG, 6U, chartInstance->c7_sfEvent);
  c7_hoistedGlobal = *c7_b_sfasamento;
  c7_b_hoistedGlobal = *c7_b_ampiezza;
  c7_c_hoistedGlobal = *c7_b_frequenza;
  c7_d_hoistedGlobal = *c7_b_noise;
  c7_e_hoistedGlobal = *c7_b_t;
  c7_sfasamento = c7_hoistedGlobal;
  c7_ampiezza = c7_b_hoistedGlobal;
  c7_frequenza = c7_c_hoistedGlobal;
  c7_noise = c7_d_hoistedGlobal;
  c7_t = c7_e_hoistedGlobal;
  sf_debug_symbol_scope_push_eml(0U, 8U, 8U, c7_debug_family_names,
    c7_debug_family_var_map);
  sf_debug_symbol_scope_add_eml_importable(&c7_nargin, 0U, c7_sf_marshallOut,
    c7_sf_marshallIn);
  sf_debug_symbol_scope_add_eml_importable(&c7_nargout, 1U, c7_sf_marshallOut,
    c7_sf_marshallIn);
  sf_debug_symbol_scope_add_eml(&c7_sfasamento, 2U, c7_sf_marshallOut);
  sf_debug_symbol_scope_add_eml(&c7_ampiezza, 3U, c7_sf_marshallOut);
  sf_debug_symbol_scope_add_eml(&c7_frequenza, 4U, c7_sf_marshallOut);
  sf_debug_symbol_scope_add_eml(&c7_noise, 5U, c7_sf_marshallOut);
  sf_debug_symbol_scope_add_eml(&c7_t, 6U, c7_sf_marshallOut);
  sf_debug_symbol_scope_add_eml_importable(&c7_wave, 7U, c7_sf_marshallOut,
    c7_sf_marshallIn);
  CV_EML_FCN(0, 0);
  _SFD_EML_CALL(0U, chartInstance->c7_sfEvent, 4);
  c7_b = c7_frequenza;
  c7_y = 6.2831853071795862 * c7_b;
  c7_a = c7_y;
  c7_b_b = c7_t;
  c7_b_y = c7_a * c7_b_b;
  c7_x = c7_sfasamento + c7_b_y;
  c7_b_x = c7_x;
  c7_b_x = muDoubleScalarSin(c7_b_x);
  c7_b_a = c7_ampiezza;
  c7_c_b = c7_b_x;
  c7_c_y = c7_b_a * c7_c_b;
  c7_wave = c7_c_y + c7_noise;
  _SFD_EML_CALL(0U, chartInstance->c7_sfEvent, -4);
  sf_debug_symbol_scope_pop();
  *c7_b_wave = c7_wave;
  _SFD_CC_CALL(EXIT_OUT_OF_FUNCTION_TAG, 6U, chartInstance->c7_sfEvent);
  sf_debug_check_for_state_inconsistency(_ekffedepreMachineNumber_,
    chartInstance->chartNumber, chartInstance->instanceNumber);
}
示例#28
0
static void sf_c12_ekffedepre(SFc12_ekffedepreInstanceStruct *chartInstance)
{
  int32_T c12_i2;
  int32_T c12_i3;
  int32_T c12_i4;
  real_T c12_Q_bias[3];
  uint32_T c12_debug_family_var_map[4];
  real_T c12_nargin = 1.0;
  real_T c12_nargout = 1.0;
  real_T c12_y[9];
  int32_T c12_i5;
  real_T c12_v[3];
  int32_T c12_i6;
  int32_T c12_j;
  int32_T c12_b_j;
  int32_T c12_a;
  int32_T c12_c;
  int32_T c12_i7;
  real_T (*c12_b_y)[9];
  real_T (*c12_b_Q_bias)[3];
  c12_b_y = (real_T (*)[9])ssGetOutputPortSignal(chartInstance->S, 1);
  c12_b_Q_bias = (real_T (*)[3])ssGetInputPortSignal(chartInstance->S, 0);
  _sfTime_ = (real_T)ssGetT(chartInstance->S);
  _SFD_CC_CALL(CHART_ENTER_SFUNCTION_TAG, 11U, chartInstance->c12_sfEvent);
  for (c12_i2 = 0; c12_i2 < 3; c12_i2++) {
    _SFD_DATA_RANGE_CHECK((*c12_b_Q_bias)[c12_i2], 0U);
  }

  for (c12_i3 = 0; c12_i3 < 9; c12_i3++) {
    _SFD_DATA_RANGE_CHECK((*c12_b_y)[c12_i3], 1U);
  }

  chartInstance->c12_sfEvent = CALL_EVENT;
  _SFD_CC_CALL(CHART_ENTER_DURING_FUNCTION_TAG, 11U, chartInstance->c12_sfEvent);
  for (c12_i4 = 0; c12_i4 < 3; c12_i4++) {
    c12_Q_bias[c12_i4] = (*c12_b_Q_bias)[c12_i4];
  }

  sf_debug_symbol_scope_push_eml(0U, 4U, 4U, c12_debug_family_names,
    c12_debug_family_var_map);
  sf_debug_symbol_scope_add_eml_importable(&c12_nargin, 0U, c12_c_sf_marshallOut,
    c12_b_sf_marshallIn);
  sf_debug_symbol_scope_add_eml_importable(&c12_nargout, 1U,
    c12_c_sf_marshallOut, c12_b_sf_marshallIn);
  sf_debug_symbol_scope_add_eml(c12_Q_bias, 2U, c12_b_sf_marshallOut);
  sf_debug_symbol_scope_add_eml_importable(c12_y, 3U, c12_sf_marshallOut,
    c12_sf_marshallIn);
  CV_EML_FCN(0, 0);
  _SFD_EML_CALL(0U, chartInstance->c12_sfEvent, 4);
  for (c12_i5 = 0; c12_i5 < 3; c12_i5++) {
    c12_v[c12_i5] = c12_Q_bias[c12_i5];
  }

  for (c12_i6 = 0; c12_i6 < 9; c12_i6++) {
    c12_y[c12_i6] = 0.0;
  }

  for (c12_j = 1; c12_j < 4; c12_j++) {
    c12_b_j = c12_j;
    c12_a = c12_b_j;
    c12_c = c12_a;
    c12_y[(_SFD_EML_ARRAY_BOUNDS_CHECK("", (int32_T)_SFD_INTEGER_CHECK("",
             (real_T)c12_b_j), 1, 3, 1, 0) + 3 * (_SFD_EML_ARRAY_BOUNDS_CHECK("",
             (int32_T)_SFD_INTEGER_CHECK("", (real_T)c12_c), 1, 3, 2, 0) - 1)) -
      1] = c12_v[_SFD_EML_ARRAY_BOUNDS_CHECK("", (int32_T)_SFD_INTEGER_CHECK("",
      (real_T)c12_b_j), 1, 3, 1, 0) - 1];
  }

  _SFD_EML_CALL(0U, chartInstance->c12_sfEvent, -4);
  sf_debug_symbol_scope_pop();
  for (c12_i7 = 0; c12_i7 < 9; c12_i7++) {
    (*c12_b_y)[c12_i7] = c12_y[c12_i7];
  }

  _SFD_CC_CALL(EXIT_OUT_OF_FUNCTION_TAG, 11U, chartInstance->c12_sfEvent);
  sf_debug_check_for_state_inconsistency(_ekffedepreMachineNumber_,
    chartInstance->chartNumber, chartInstance->instanceNumber);
}
示例#29
0
static void c9_chartstep_c9_Array(SFc9_ArrayInstanceStruct *chartInstance)
{
  real_T c9_hoistedGlobal;
  real_T c9_b_hoistedGlobal;
  real_T c9_c_hoistedGlobal;
  real_T c9_V;
  real_T c9_Radiacion;
  real_T c9_Temp;
  uint32_T c9_debug_family_var_map[23];
  real_T c9_q;
  real_T c9_K;
  real_T c9_n;
  real_T c9_T;
  real_T c9_Rs;
  real_T c9_Rp;
  real_T c9_Vt;
  real_T c9_Ns;
  real_T c9_Vc;
  real_T c9_Isc;
  real_T c9_Alfa;
  real_T c9_Iph;
  real_T c9_Voc_ref;
  real_T c9_Beta;
  real_T c9_Voc;
  real_T c9_Io;
  real_T c9_Ir;
  real_T c9_nargin = 3.0;
  real_T c9_nargout = 1.0;
  real_T c9_I;
  real_T c9_b;
  real_T c9_y;
  real_T c9_A;
  real_T c9_x;
  real_T c9_b_x;
  real_T c9_c_x;
  real_T c9_d_x;
  real_T c9_b_b;
  real_T c9_b_y;
  real_T c9_b_A;
  real_T c9_e_x;
  real_T c9_f_x;
  real_T c9_c_y;
  real_T c9_c_b;
  real_T c9_d_y;
  real_T c9_a;
  real_T c9_d_b;
  real_T c9_e_b;
  real_T c9_e_y;
  real_T c9_f_b;
  real_T c9_c_A;
  real_T c9_B;
  real_T c9_g_x;
  real_T c9_f_y;
  real_T c9_h_x;
  real_T c9_g_y;
  real_T c9_h_y;
  real_T c9_i_x;
  real_T c9_j_x;
  real_T c9_b_B;
  real_T c9_i_y;
  real_T c9_j_y;
  int32_T c9_i;
  real_T c9_k_x;
  real_T c9_k_y;
  real_T c9_l_x;
  real_T c9_l_y;
  real_T c9_z;
  real_T c9_m_x;
  real_T c9_n_x;
  real_T c9_d_A;
  real_T c9_o_x;
  real_T c9_p_x;
  real_T c9_m_y;
  real_T c9_n_y;
  real_T c9_o_y;
  real_T c9_b_z;
  real_T c9_b_a;
  real_T c9_g_b;
  real_T c9_p_y;
  real_T c9_q_x;
  real_T c9_q_y;
  real_T c9_r_x;
  real_T c9_r_y;
  real_T c9_c_z;
  real_T c9_s_x;
  real_T c9_t_x;
  real_T c9_u_x;
  real_T c9_s_y;
  real_T c9_v_x;
  real_T c9_t_y;
  real_T c9_d_z;
  real_T *c9_b_Temp;
  real_T *c9_b_Radiacion;
  real_T *c9_b_V;
  real_T *c9_b_I;
  c9_b_Temp = (real_T *)ssGetInputPortSignal(chartInstance->S, 2);
  c9_b_Radiacion = (real_T *)ssGetInputPortSignal(chartInstance->S, 1);
  c9_b_I = (real_T *)ssGetOutputPortSignal(chartInstance->S, 1);
  c9_b_V = (real_T *)ssGetInputPortSignal(chartInstance->S, 0);
  _SFD_CC_CALL(CHART_ENTER_DURING_FUNCTION_TAG, 8U, chartInstance->c9_sfEvent);
  c9_hoistedGlobal = *c9_b_V;
  c9_b_hoistedGlobal = *c9_b_Radiacion;
  c9_c_hoistedGlobal = *c9_b_Temp;
  c9_V = c9_hoistedGlobal;
  c9_Radiacion = c9_b_hoistedGlobal;
  c9_Temp = c9_c_hoistedGlobal;
  sf_debug_symbol_scope_push_eml(0U, 23U, 23U, c9_debug_family_names,
    c9_debug_family_var_map);
  sf_debug_symbol_scope_add_eml(&c9_q, 0U, c9_sf_marshallOut);
  sf_debug_symbol_scope_add_eml(&c9_K, 1U, c9_sf_marshallOut);
  sf_debug_symbol_scope_add_eml(&c9_n, 2U, c9_sf_marshallOut);
  sf_debug_symbol_scope_add_eml_importable(&c9_T, 3U, c9_sf_marshallOut,
    c9_sf_marshallIn);
  sf_debug_symbol_scope_add_eml(&c9_Rs, 4U, c9_sf_marshallOut);
  sf_debug_symbol_scope_add_eml(&c9_Rp, 5U, c9_sf_marshallOut);
  sf_debug_symbol_scope_add_eml_importable(&c9_Vt, 6U, c9_sf_marshallOut,
    c9_sf_marshallIn);
  sf_debug_symbol_scope_add_eml(&c9_Ns, 7U, c9_sf_marshallOut);
  sf_debug_symbol_scope_add_eml_importable(&c9_Vc, 8U, c9_sf_marshallOut,
    c9_sf_marshallIn);
  sf_debug_symbol_scope_add_eml(&c9_Isc, 9U, c9_sf_marshallOut);
  sf_debug_symbol_scope_add_eml(&c9_Alfa, 10U, c9_sf_marshallOut);
  sf_debug_symbol_scope_add_eml_importable(&c9_Iph, 11U, c9_sf_marshallOut,
    c9_sf_marshallIn);
  sf_debug_symbol_scope_add_eml(&c9_Voc_ref, 12U, c9_sf_marshallOut);
  sf_debug_symbol_scope_add_eml(&c9_Beta, 13U, c9_sf_marshallOut);
  sf_debug_symbol_scope_add_eml_importable(&c9_Voc, 14U, c9_sf_marshallOut,
    c9_sf_marshallIn);
  sf_debug_symbol_scope_add_eml_importable(&c9_Io, 15U, c9_sf_marshallOut,
    c9_sf_marshallIn);
  sf_debug_symbol_scope_add_eml_importable(&c9_Ir, 16U, c9_sf_marshallOut,
    c9_sf_marshallIn);
  sf_debug_symbol_scope_add_eml_importable(&c9_nargin, 17U, c9_sf_marshallOut,
    c9_sf_marshallIn);
  sf_debug_symbol_scope_add_eml_importable(&c9_nargout, 18U, c9_sf_marshallOut,
    c9_sf_marshallIn);
  sf_debug_symbol_scope_add_eml(&c9_V, 19U, c9_sf_marshallOut);
  sf_debug_symbol_scope_add_eml(&c9_Radiacion, 20U, c9_sf_marshallOut);
  sf_debug_symbol_scope_add_eml(&c9_Temp, 21U, c9_sf_marshallOut);
  sf_debug_symbol_scope_add_eml_importable(&c9_I, 22U, c9_sf_marshallOut,
    c9_sf_marshallIn);
  CV_EML_FCN(0, 0);
  _SFD_EML_CALL(0U, chartInstance->c9_sfEvent, 3);
  c9_q = 1.602176E-19;
  _SFD_EML_CALL(0U, chartInstance->c9_sfEvent, 5);
  c9_K = 1.3806488E-23;
  _SFD_EML_CALL(0U, chartInstance->c9_sfEvent, 7);
  c9_n = 1.3;
  _SFD_EML_CALL(0U, chartInstance->c9_sfEvent, 9);
  c9_T = 273.15 + c9_Temp;
  _SFD_EML_CALL(0U, chartInstance->c9_sfEvent, 11);
  c9_Rs = 0.015;
  _SFD_EML_CALL(0U, chartInstance->c9_sfEvent, 13);
  c9_Rp = 100.0;
  _SFD_EML_CALL(0U, chartInstance->c9_sfEvent, 15);
  c9_b = c9_T;
  c9_y = 1.79484344E-23 * c9_b;
  c9_A = c9_y;
  c9_x = c9_A;
  c9_b_x = c9_x;
  c9_Vt = c9_b_x / 1.602176E-19;
  _SFD_EML_CALL(0U, chartInstance->c9_sfEvent, 16);
  c9_Ns = 36.0;
  _SFD_EML_CALL(0U, chartInstance->c9_sfEvent, 17);
  c9_c_x = c9_V;
  c9_d_x = c9_c_x;
  c9_Vc = c9_d_x / 36.0;
  _SFD_EML_CALL(0U, chartInstance->c9_sfEvent, 19);
  c9_Isc = 5.433;
  _SFD_EML_CALL(0U, chartInstance->c9_sfEvent, 20);
  c9_Alfa = 0.00037;
  _SFD_EML_CALL(0U, chartInstance->c9_sfEvent, 22);
  c9_b_b = c9_Radiacion;
  c9_b_y = 5.433 * c9_b_b;
  c9_b_A = c9_b_y;
  c9_e_x = c9_b_A;
  c9_f_x = c9_e_x;
  c9_c_y = c9_f_x / 1000.0;
  c9_c_b = c9_Temp - 25.0;
  c9_d_y = 0.00037 * c9_c_b;
  c9_a = c9_c_y;
  c9_d_b = 1.0 + c9_d_y;
  c9_Iph = c9_a * c9_d_b;
  _SFD_EML_CALL(0U, chartInstance->c9_sfEvent, 24);
  c9_Voc_ref = 0.6166666666666667;
  _SFD_EML_CALL(0U, chartInstance->c9_sfEvent, 25);
  c9_Beta = -0.0034000000000000002;
  _SFD_EML_CALL(0U, chartInstance->c9_sfEvent, 26);
  c9_e_b = c9_Temp - 25.0;
  c9_e_y = -0.0034000000000000002 * c9_e_b;
  c9_f_b = 1.0 + c9_e_y;
  c9_Voc = 0.6166666666666667 * c9_f_b;
  _SFD_EML_CALL(0U, chartInstance->c9_sfEvent, 32);
  c9_c_A = c9_Voc;
  c9_B = c9_Vt;
  c9_g_x = c9_c_A;
  c9_f_y = c9_B;
  c9_h_x = c9_g_x;
  c9_g_y = c9_f_y;
  c9_h_y = c9_h_x / c9_g_y;
  c9_i_x = c9_h_y;
  c9_j_x = c9_i_x;
  c9_j_x = muDoubleScalarExp(c9_j_x);
  c9_b_B = c9_j_x - 1.0;
  c9_i_y = c9_b_B;
  c9_j_y = c9_i_y;
  c9_Io = 5.433 / c9_j_y;
  _SFD_EML_CALL(0U, chartInstance->c9_sfEvent, 33);
  c9_Ir = c9_Io;
  _SFD_EML_CALL(0U, chartInstance->c9_sfEvent, 36);
  c9_I = 0.0;
  c9_i = 0;
  while (c9_i < 50) {
    CV_EML_FOR(0, 1, 0, 1);
    _SFD_EML_CALL(0U, chartInstance->c9_sfEvent, 38);
    c9_k_x = c9_Vc + c9_I * c9_Rs;
    c9_k_y = c9_Vt;
    c9_l_x = c9_k_x;
    c9_l_y = c9_k_y;
    c9_z = c9_l_x / c9_l_y;
    c9_m_x = c9_z;
    c9_n_x = c9_m_x;
    c9_n_x = muDoubleScalarExp(c9_n_x);
    c9_d_A = c9_Vc + c9_I * c9_Rs;
    c9_o_x = c9_d_A;
    c9_p_x = c9_o_x;
    c9_m_y = c9_p_x / 100.0;
    c9_n_y = c9_Vt;
    c9_o_y = c9_n_y;
    c9_b_z = 0.015 / c9_o_y;
    c9_b_a = c9_Ir;
    c9_g_b = c9_b_z;
    c9_p_y = c9_b_a * c9_g_b;
    c9_q_x = c9_Vc + c9_I * c9_Rs;
    c9_q_y = c9_Vt;
    c9_r_x = c9_q_x;
    c9_r_y = c9_q_y;
    c9_c_z = c9_r_x / c9_r_y;
    c9_s_x = c9_c_z;
    c9_t_x = c9_s_x;
    c9_t_x = muDoubleScalarExp(c9_t_x);
    c9_u_x = ((c9_Iph - c9_I) - c9_Ir * (c9_n_x - 1.0)) + c9_m_y;
    c9_s_y = (-1.0 - c9_p_y * c9_t_x) - 0.00015;
    c9_v_x = c9_u_x;
    c9_t_y = c9_s_y;
    c9_d_z = c9_v_x / c9_t_y;
    c9_I -= c9_d_z;
    c9_i++;
    sf_mex_listen_for_ctrl_c(chartInstance->S);
  }

  CV_EML_FOR(0, 1, 0, 0);
  _SFD_EML_CALL(0U, chartInstance->c9_sfEvent, -38);
  sf_debug_symbol_scope_pop();
  *c9_b_I = c9_I;
  _SFD_CC_CALL(EXIT_OUT_OF_FUNCTION_TAG, 8U, chartInstance->c9_sfEvent);
}
示例#30
0
static void sf_c2_chooseTapB(SFc2_chooseTapBInstanceStruct *chartInstance)
{
  int32_T c2_previousEvent;
  real_T c2_hoistedGlobal;
  real_T c2_ave;
  uint32_T c2_debug_family_var_map[4];
  real_T c2_nargin = 1.0;
  real_T c2_nargout = 1.0;
  real_T c2_tap;
  real_T *c2_b_ave;
  real_T *c2_b_tap;
  c2_b_tap = (real_T *)ssGetOutputPortSignal(chartInstance->S, 1);
  c2_b_ave = (real_T *)ssGetInputPortSignal(chartInstance->S, 0);
  _sfTime_ = (real_T)ssGetT(chartInstance->S);
  _SFD_CC_CALL(CHART_ENTER_SFUNCTION_TAG, 0);
  _SFD_DATA_RANGE_CHECK(*c2_b_ave, 0U);
  _SFD_DATA_RANGE_CHECK(*c2_b_tap, 1U);
  c2_previousEvent = _sfEvent_;
  _sfEvent_ = CALL_EVENT;
  _SFD_CC_CALL(CHART_ENTER_DURING_FUNCTION_TAG, 0);
  c2_hoistedGlobal = *c2_b_ave;
  c2_ave = c2_hoistedGlobal;
  sf_debug_symbol_scope_push_eml(0U, 4U, 4U, c2_debug_family_names,
    c2_debug_family_var_map);
  sf_debug_symbol_scope_add_eml(&c2_nargin, c2_sf_marshall, 0U);
  sf_debug_symbol_scope_add_eml(&c2_nargout, c2_sf_marshall, 1U);
  sf_debug_symbol_scope_add_eml(&c2_ave, c2_sf_marshall, 2U);
  sf_debug_symbol_scope_add_eml(&c2_tap, c2_sf_marshall, 3U);
  CV_EML_FCN(0, 0);
  _SFD_EML_CALL(0, 4);
  if (CV_EML_IF(0, 0, c2_ave >= 60.0)) {
    _SFD_EML_CALL(0, 5);
    c2_tap = 4.0;
  } else {
    _SFD_EML_CALL(0, 6);
    if (CV_EML_COND(0, 0, c2_ave < 60.0)) {
      if (CV_EML_COND(0, 1, c2_ave > 20.0)) {
        CV_EML_MCDC(0, 0, TRUE);
        CV_EML_IF(0, 1, TRUE);
        _SFD_EML_CALL(0, 7);
        c2_tap = 3.0;
        goto label_1;
      }
    }

    CV_EML_MCDC(0, 0, FALSE);
    CV_EML_IF(0, 1, FALSE);
    _SFD_EML_CALL(0, 8);
    if (CV_EML_COND(0, 2, c2_ave <= 20.0)) {
      if (CV_EML_COND(0, 3, c2_ave >= -20.0)) {
        CV_EML_MCDC(0, 1, TRUE);
        CV_EML_IF(0, 2, TRUE);
        _SFD_EML_CALL(0, 9);
        c2_tap = 2.0;
        goto label_2;
      }
    }

    CV_EML_MCDC(0, 1, FALSE);
    CV_EML_IF(0, 2, FALSE);
    _SFD_EML_CALL(0, 10);
    if (CV_EML_COND(0, 4, c2_ave < -20.0)) {
      if (CV_EML_COND(0, 5, c2_ave > -60.0)) {
        CV_EML_MCDC(0, 2, TRUE);
        CV_EML_IF(0, 3, TRUE);
        _SFD_EML_CALL(0, 11);
        c2_tap = 1.0;
        goto label_3;
      }
    }

    CV_EML_MCDC(0, 2, FALSE);
    CV_EML_IF(0, 3, FALSE);
    _SFD_EML_CALL(0, 13);
    c2_tap = 0.0;
   label_3:
    ;
   label_2:
    ;
   label_1:
    ;
  }

  _SFD_EML_CALL(0, -13);
  sf_debug_symbol_scope_pop();
  *c2_b_tap = c2_tap;
  _SFD_CC_CALL(EXIT_OUT_OF_FUNCTION_TAG, 0);
  _sfEvent_ = c2_previousEvent;
  sf_debug_check_for_state_inconsistency(_chooseTapBMachineNumber_,
    chartInstance->chartNumber, chartInstance->instanceNumber);
}