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);
}
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);
}
Пример #3
0
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);
}
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);
}
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_Puncture_Through_Wall(void)
{
  int32_T c3_i0;
  int32_T c3_i1;
  uint8_T c3_previousEvent;
  int32_T c3_i2;
  real_T c3_u[3];
  real_T c3_total;
  real_T c3_MAX_CURRENT;
  real_T c3_y[3];
  int32_T c3_i3;
  int32_T c3_i4;
  real_T c3_x[3];
  int32_T c3_i5;
  real_T c3_b_x[3];
  real_T c3_d0;
  real_T c3_k;
  real_T c3_b_k;
  int32_T c3_i6;
  real_T c3_c_x[3];
  real_T c3_d_x;
  int32_T c3_i7;
  int32_T c3_c_k;
  int32_T c3_d_k;
  real_T c3_e_x;
  real_T c3_r;
  real_T c3_A;
  real_T c3_B;
  real_T c3_f_x;
  real_T c3_b_y;
  real_T c3_c_y;
  int32_T c3_i8;
  int32_T c3_i9;
  int32_T c3_i10;
  real_T (*c3_d_y)[3];
  real_T (*c3_b_u)[3];
  c3_d_y = (real_T (*)[3])ssGetOutputPortSignal(chartInstance.S, 1);
  c3_b_u = (real_T (*)[3])ssGetInputPortSignal(chartInstance.S, 0);
  _sfTime_ = (real_T)ssGetT(chartInstance.S);
  for(c3_i0 = 0; c3_i0 < 3; c3_i0 = c3_i0 + 1) {
    _SFD_DATA_RANGE_CHECK((*c3_b_u)[c3_i0], 1U);
  }
  for(c3_i1 = 0; c3_i1 < 3; c3_i1 = c3_i1 + 1) {
    _SFD_DATA_RANGE_CHECK((*c3_d_y)[c3_i1], 0U);
  }
  c3_previousEvent = _sfEvent_;
  _sfEvent_ = CALL_EVENT;
  _SFD_CC_CALL(CHART_ENTER_DURING_FUNCTION_TAG,1);
  for(c3_i2 = 0; c3_i2 < 3; c3_i2 = c3_i2 + 1) {
    c3_u[c3_i2] = (*c3_b_u)[c3_i2];
  }
  sf_debug_symbol_scope_push(4U, 0U);
  sf_debug_symbol_scope_add("total", &c3_total, c3_d_sf_marshall);
  sf_debug_symbol_scope_add("MAX_CURRENT", &c3_MAX_CURRENT, c3_c_sf_marshall);
  sf_debug_symbol_scope_add("y", &c3_y, c3_b_sf_marshall);
  sf_debug_symbol_scope_add("u", &c3_u, c3_sf_marshall);
  CV_EML_FCN(0, 0);
  /*  Smart Saturation: allows channels to go up to 1.6A  */
  /*  unless the total exceeds 2.2A in which case all channels */
  /*  are scaled so that the cumulative current is equal to 2.2A. */
  _SFD_EML_CALL(STATE_DURING_DURING_ACTION_TAG,0,6);
  for(c3_i3 = 0; c3_i3 < 3; c3_i3 = c3_i3 + 1) {
    c3_y[c3_i3] = 0.0;
  }
  _SFD_EML_CALL(STATE_DURING_DURING_ACTION_TAG,0,7);
  c3_MAX_CURRENT = 2.2;
  /*  Define the maximum cumulative current here */
  _SFD_EML_CALL(STATE_DURING_DURING_ACTION_TAG,0,9);
  for(c3_i4 = 0; c3_i4 < 3; c3_i4 = c3_i4 + 1) {
    c3_x[c3_i4] = c3_u[c3_i4];
  }
  for(c3_i5 = 0; c3_i5 < 3; c3_i5 = c3_i5 + 1) {
    c3_b_x[c3_i5] = 0.0;
  }
  c3_d0 = 1.0;
  for(c3_k = c3_d0; c3_k <= 3.0; c3_k = c3_k + 1.0) {
    c3_b_k = c3_k;
    c3_b_x[(int32_T)_SFD_EML_ARRAY_BOUNDS_CHECK("y",
     (int32_T)_SFD_INTEGER_CHECK("k", c3_b_k), 1, 3, 1, 0) - 1] =
      fabs(c3_x[(int32_T)
      _SFD_EML_ARRAY_BOUNDS_CHECK("x", (int32_T)_SFD_INTEGER_CHECK("k", c3_b_k),
      1, 3, 1, 0) - 1]);
  }
  for(c3_i6 = 0; c3_i6 < 3; c3_i6 = c3_i6 + 1) {
    c3_c_x[c3_i6] = c3_b_x[c3_i6];
  }
  c3_d_x = c3_c_x[0];
  c3_total = c3_d_x;
  c3_i7 = 2;
  for(c3_c_k = c3_i7; c3_c_k < 4; c3_c_k = c3_c_k + 1) {
    c3_d_k = c3_c_k;
    c3_e_x = c3_c_x[(int32_T)_SFD_EML_ARRAY_BOUNDS_CHECK("x",
     _SFD_INTEGER_CHECK("k", (real_T)c3_d_k), 1, 3, 1, 0) - 1];
    c3_r = c3_e_x;
    c3_total = c3_total + c3_r;
  }
  _SFD_EML_CALL(STATE_DURING_DURING_ACTION_TAG,0,10);
  if(CV_EML_IF(0, 0, c3_total > c3_MAX_CURRENT)) {
    _SFD_EML_CALL(STATE_DURING_DURING_ACTION_TAG,0,11);
    c3_A = 2.2;
    c3_B = c3_total;
    c3_f_x = c3_A;
    c3_b_y = c3_B;
    c3_c_y = c3_f_x / c3_b_y;
    for(c3_i8 = 0; c3_i8 < 3; c3_i8 = c3_i8 + 1) {
      c3_y[c3_i8] = c3_c_y * c3_u[c3_i8];
    }
  } else {
    _SFD_EML_CALL(STATE_DURING_DURING_ACTION_TAG,0,13);
    for(c3_i9 = 0; c3_i9 < 3; c3_i9 = c3_i9 + 1) {
      c3_y[c3_i9] = c3_u[c3_i9];
    }
  }
  _SFD_EML_CALL(STATE_DURING_DURING_ACTION_TAG,0,-13);
  sf_debug_symbol_scope_pop();
  for(c3_i10 = 0; c3_i10 < 3; c3_i10 = c3_i10 + 1) {
    (*c3_d_y)[c3_i10] = c3_y[c3_i10];
  }
  _SFD_CC_CALL(EXIT_OUT_OF_FUNCTION_TAG,1);
  _sfEvent_ = c3_previousEvent;
  sf_debug_check_for_state_inconsistency(_Puncture_Through_WallMachineNumber_,
   chartInstance.chartNumber, chartInstance.instanceNumber
   );
}
static void c20_c20_adcs_v15_integral_Power_nom(void)
{
  int32_T c20_i6;
  real_T c20_v_I[3];
  int32_T c20_i7;
  real_T c20_x[7];
  real_T c20_nargout = 1.0;
  real_T c20_nargin = 2.0;
  real_T c20_TBI[9];
  real_T c20_q3;
  real_T c20_q2;
  real_T c20_q1;
  real_T c20_q0;
  real_T c20_q[4];
  real_T c20_v_B[3];
  int32_T c20_i8;
  real_T c20_b;
  real_T c20_a;
  real_T c20_b_b;
  real_T c20_y;
  real_T c20_c_b;
  real_T c20_b_a;
  real_T c20_d_b;
  real_T c20_b_y;
  real_T c20_e_b;
  real_T c20_c_a;
  real_T c20_f_b;
  real_T c20_c_y;
  real_T c20_g_b;
  real_T c20_d_a;
  real_T c20_h_b;
  real_T c20_d_y;
  real_T c20_i_b;
  real_T c20_e_a;
  real_T c20_j_b;
  real_T c20_e_y;
  real_T c20_k_b;
  real_T c20_f_a;
  real_T c20_l_b;
  real_T c20_f_y;
  real_T c20_m_b;
  real_T c20_g_a;
  real_T c20_n_b;
  real_T c20_g_y;
  real_T c20_o_b;
  real_T c20_h_a;
  real_T c20_p_b;
  real_T c20_h_y;
  real_T c20_q_b;
  real_T c20_i_a;
  real_T c20_r_b;
  real_T c20_i_y;
  real_T c20_s_b;
  real_T c20_j_a;
  real_T c20_t_b;
  real_T c20_j_y;
  real_T c20_u_b;
  real_T c20_k_a;
  real_T c20_v_b;
  real_T c20_k_y;
  real_T c20_w_b;
  real_T c20_l_a;
  real_T c20_x_b;
  real_T c20_l_y;
  real_T c20_d0;
  real_T c20_d1;
  real_T c20_d2;
  int32_T c20_i9;
  real_T c20_m_a[9];
  int32_T c20_i10;
  real_T c20_y_b[3];
  int32_T c20_i11;
  real_T c20_A[9];
  int32_T c20_i12;
  real_T c20_B[3];
  int32_T c20_i13;
  int32_T c20_i14;
  real_T c20_b_A[9];
  int32_T c20_i15;
  real_T c20_b_B[3];
  int32_T c20_i16;
  real_T c20_c_A[9];
  int32_T c20_i17;
  real_T c20_c_B[3];
  int32_T c20_i18;
  int32_T c20_i19;
  int32_T c20_i20;
  int32_T c20_i21;
  real_T (*c20_b_v_B)[3];
  real_T (*c20_b_x)[7];
  real_T (*c20_b_v_I)[3];
  c20_b_v_I = (real_T (*)[3])ssGetInputPortSignal(chartInstance.S, 0);
  c20_b_v_B = (real_T (*)[3])ssGetOutputPortSignal(chartInstance.S, 1);
  c20_b_x = (real_T (*)[7])ssGetInputPortSignal(chartInstance.S, 1);
  _SFD_CC_CALL(CHART_ENTER_DURING_FUNCTION_TAG,14);
  for (c20_i6 = 0; c20_i6 < 3; c20_i6 = c20_i6 + 1) {
    c20_v_I[c20_i6] = (*c20_b_v_I)[c20_i6];
  }

  for (c20_i7 = 0; c20_i7 < 7; c20_i7 = c20_i7 + 1) {
    c20_x[c20_i7] = (*c20_b_x)[c20_i7];
  }

  sf_debug_symbol_scope_push(11U, 0U);
  sf_debug_symbol_scope_add("nargout", &c20_nargout, c20_d_sf_marshall);
  sf_debug_symbol_scope_add("nargin", &c20_nargin, c20_d_sf_marshall);
  sf_debug_symbol_scope_add("TBI", &c20_TBI, c20_e_sf_marshall);
  sf_debug_symbol_scope_add("q3", &c20_q3, c20_d_sf_marshall);
  sf_debug_symbol_scope_add("q2", &c20_q2, c20_d_sf_marshall);
  sf_debug_symbol_scope_add("q1", &c20_q1, c20_d_sf_marshall);
  sf_debug_symbol_scope_add("q0", &c20_q0, c20_d_sf_marshall);
  sf_debug_symbol_scope_add("q", &c20_q, c20_c_sf_marshall);
  sf_debug_symbol_scope_add("v_B", &c20_v_B, c20_sf_marshall);
  sf_debug_symbol_scope_add("x", &c20_x, c20_b_sf_marshall);
  sf_debug_symbol_scope_add("v_I", &c20_v_I, c20_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 (c20_i8 = 0; c20_i8 < 4; c20_i8 = c20_i8 + 1) {
    c20_q[c20_i8] = c20_x[c20_i8];
  }

  _SFD_EML_CALL(0,7);
  c20_q0 = c20_q[3];
  _SFD_EML_CALL(0,7);
  c20_q1 = c20_q[0];
  _SFD_EML_CALL(0,7);
  c20_q2 = c20_q[1];
  _SFD_EML_CALL(0,7);
  c20_q3 = c20_q[2];
  _SFD_EML_CALL(0,9);
  c20_b = c20_q0;
  c20_a = 2.0 * c20_b;
  c20_b_b = c20_q1;
  c20_y = c20_a * c20_b_b;
  c20_c_b = c20_q2;
  c20_b_a = 2.0 * c20_c_b;
  c20_d_b = c20_q3;
  c20_b_y = c20_b_a * c20_d_b;
  c20_e_b = c20_q1;
  c20_c_a = 2.0 * c20_e_b;
  c20_f_b = c20_q3;
  c20_c_y = c20_c_a * c20_f_b;
  c20_g_b = c20_q0;
  c20_d_a = 2.0 * c20_g_b;
  c20_h_b = c20_q2;
  c20_d_y = c20_d_a * c20_h_b;
  c20_i_b = c20_q2;
  c20_e_a = 2.0 * c20_i_b;
  c20_j_b = c20_q3;
  c20_e_y = c20_e_a * c20_j_b;
  c20_k_b = c20_q0;
  c20_f_a = 2.0 * c20_k_b;
  c20_l_b = c20_q1;
  c20_f_y = c20_f_a * c20_l_b;
  c20_m_b = c20_q0;
  c20_g_a = 2.0 * c20_m_b;
  c20_n_b = c20_q3;
  c20_g_y = c20_g_a * c20_n_b;
  c20_o_b = c20_q1;
  c20_h_a = 2.0 * c20_o_b;
  c20_p_b = c20_q2;
  c20_h_y = c20_h_a * c20_p_b;
  c20_q_b = c20_q0;
  c20_i_a = 2.0 * c20_q_b;
  c20_r_b = c20_q2;
  c20_i_y = c20_i_a * c20_r_b;
  c20_s_b = c20_q1;
  c20_j_a = 2.0 * c20_s_b;
  c20_t_b = c20_q3;
  c20_j_y = c20_j_a * c20_t_b;
  c20_u_b = c20_q1;
  c20_k_a = 2.0 * c20_u_b;
  c20_v_b = c20_q2;
  c20_k_y = c20_k_a * c20_v_b;
  c20_w_b = c20_q0;
  c20_l_a = 2.0 * c20_w_b;
  c20_x_b = c20_q3;
  c20_l_y = c20_l_a * c20_x_b;
  c20_d0 = ((c20_mpower(c20_q0) + c20_mpower(c20_q1)) - c20_mpower(c20_q2)) -
    c20_mpower(c20_q3);
  c20_d1 = ((c20_mpower(c20_q0) - c20_mpower(c20_q1)) + c20_mpower(c20_q2)) -
    c20_mpower(c20_q3);
  c20_d2 = ((c20_mpower(c20_q0) - c20_mpower(c20_q1)) - c20_mpower(c20_q2)) +
    c20_mpower(c20_q3);
  c20_TBI[0] = c20_d0;
  c20_TBI[3] = c20_l_y + c20_k_y;
  c20_TBI[6] = c20_j_y - c20_i_y;
  c20_TBI[1] = c20_h_y - c20_g_y;
  c20_TBI[4] = c20_d1;
  c20_TBI[7] = c20_f_y + c20_e_y;
  c20_TBI[2] = c20_d_y + c20_c_y;
  c20_TBI[5] = c20_b_y - c20_y;
  c20_TBI[8] = c20_d2;
  _SFD_EML_CALL(0,13);
  for (c20_i9 = 0; c20_i9 < 9; c20_i9 = c20_i9 + 1) {
    c20_m_a[c20_i9] = c20_TBI[c20_i9];
  }

  for (c20_i10 = 0; c20_i10 < 3; c20_i10 = c20_i10 + 1) {
    c20_y_b[c20_i10] = c20_v_I[c20_i10];
  }

  c20_b_eml_scalar_eg();
  c20_b_eml_scalar_eg();
  for (c20_i11 = 0; c20_i11 < 9; c20_i11 = c20_i11 + 1) {
    c20_A[c20_i11] = c20_m_a[c20_i11];
  }

  for (c20_i12 = 0; c20_i12 < 3; c20_i12 = c20_i12 + 1) {
    c20_B[c20_i12] = c20_y_b[c20_i12];
  }

  for (c20_i13 = 0; c20_i13 < 3; c20_i13 = c20_i13 + 1) {
    c20_v_B[c20_i13] = 0.0;
  }

  for (c20_i14 = 0; c20_i14 < 9; c20_i14 = c20_i14 + 1) {
    c20_b_A[c20_i14] = c20_A[c20_i14];
  }

  for (c20_i15 = 0; c20_i15 < 3; c20_i15 = c20_i15 + 1) {
    c20_b_B[c20_i15] = c20_B[c20_i15];
  }

  for (c20_i16 = 0; c20_i16 < 9; c20_i16 = c20_i16 + 1) {
    c20_c_A[c20_i16] = c20_b_A[c20_i16];
  }

  for (c20_i17 = 0; c20_i17 < 3; c20_i17 = c20_i17 + 1) {
    c20_c_B[c20_i17] = c20_b_B[c20_i17];
  }

  for (c20_i18 = 0; c20_i18 < 3; c20_i18 = c20_i18 + 1) {
    c20_v_B[c20_i18] = 0.0;
    c20_i19 = 0;
    for (c20_i20 = 0; c20_i20 < 3; c20_i20 = c20_i20 + 1) {
      c20_v_B[c20_i18] = c20_v_B[c20_i18] + c20_c_A[c20_i19 + c20_i18] *
        c20_c_B[c20_i20];
      c20_i19 = c20_i19 + 3;
    }
  }

  _SFD_EML_CALL(0,-13);
  sf_debug_symbol_scope_pop();
  for (c20_i21 = 0; c20_i21 < 3; c20_i21 = c20_i21 + 1) {
    (*c20_b_v_B)[c20_i21] = c20_v_B[c20_i21];
  }

  _SFD_CC_CALL(EXIT_OUT_OF_FUNCTION_TAG,14);
}
static void c30_c30_adcs_v15_integral_Power(void)
{
  int32_T c30_i5;
  real_T c30_r_I[3];
  real_T c30_t;
  real_T c30_nargout = 1.0;
  real_T c30_nargin = 4.0;
  real_T c30_c_equinox = c30_b_equinox;
  real_T c30_c_today = c30_b_today;
  real_T c30_TEI[9];
  real_T c30_phi;
  real_T c30_st_sec;
  real_T c30_ut_sec;
  real_T c30_W_EARTH_ROT;
  real_T c30_stperut;
  real_T c30_r_ECEF[3];
  real_T c30_b;
  real_T c30_a;
  real_T c30_x;
  real_T c30_b_x;
  real_T c30_c_x;
  real_T c30_d_x;
  real_T c30_e_x;
  real_T c30_f_x;
  real_T c30_g_x;
  real_T c30_h_x;
  real_T c30_i_x;
  real_T c30_j_x;
  real_T c30_k_x;
  real_T c30_l_x;
  int32_T c30_i6;
  int32_T c30_i7;
  static real_T c30_dv1[3] = { 0.0, 0.0, 1.0 };

  int32_T c30_i8;
  real_T c30_b_a[9];
  int32_T c30_i9;
  real_T c30_b_b[3];
  int32_T c30_i10;
  real_T c30_A[9];
  int32_T c30_i11;
  real_T c30_B[3];
  int32_T c30_i12;
  int32_T c30_i13;
  real_T c30_b_A[9];
  int32_T c30_i14;
  real_T c30_b_B[3];
  int32_T c30_i15;
  real_T c30_c_A[9];
  int32_T c30_i16;
  real_T c30_c_B[3];
  int32_T c30_i17;
  int32_T c30_i18;
  int32_T c30_i19;
  int32_T c30_i20;
  real_T *c30_b_t;
  real_T (*c30_b_r_ECEF)[3];
  real_T (*c30_b_r_I)[3];
  c30_b_r_ECEF = (real_T (*)[3])ssGetOutputPortSignal(chartInstance.S, 1);
  c30_b_t = (real_T *)ssGetInputPortSignal(chartInstance.S, 1);
  c30_b_r_I = (real_T (*)[3])ssGetInputPortSignal(chartInstance.S, 0);
  _SFD_CC_CALL(CHART_ENTER_DURING_FUNCTION_TAG,23);
  for (c30_i5 = 0; c30_i5 < 3; c30_i5 = c30_i5 + 1) {
    c30_r_I[c30_i5] = (*c30_b_r_I)[c30_i5];
  }

  c30_t = *c30_b_t;
  sf_debug_symbol_scope_push(13U, 0U);
  sf_debug_symbol_scope_add("nargout", &c30_nargout, c30_b_sf_marshall);
  sf_debug_symbol_scope_add("nargin", &c30_nargin, c30_b_sf_marshall);
  sf_debug_symbol_scope_add("equinox", &c30_c_equinox, c30_b_sf_marshall);
  sf_debug_symbol_scope_add("today", &c30_c_today, c30_b_sf_marshall);
  sf_debug_symbol_scope_add("TEI", &c30_TEI, c30_c_sf_marshall);
  sf_debug_symbol_scope_add("phi", &c30_phi, c30_b_sf_marshall);
  sf_debug_symbol_scope_add("st_sec", &c30_st_sec, c30_b_sf_marshall);
  sf_debug_symbol_scope_add("ut_sec", &c30_ut_sec, c30_b_sf_marshall);
  sf_debug_symbol_scope_add("W_EARTH_ROT", &c30_W_EARTH_ROT, c30_b_sf_marshall);
  sf_debug_symbol_scope_add("stperut", &c30_stperut, c30_b_sf_marshall);
  sf_debug_symbol_scope_add("r_ECEF", &c30_r_ECEF, c30_sf_marshall);
  sf_debug_symbol_scope_add("t", &c30_t, c30_b_sf_marshall);
  sf_debug_symbol_scope_add("r_I", &c30_r_I, c30_sf_marshall);
  CV_EML_FCN(0, 0);

  /* u: position vector in ECI (in m) */
  /* y: position vector in ECEF (in m) */
  _SFD_EML_CALL(0,5);
  c30_stperut = 1.0027379093500000E+000;

  /*  siderial time = stperut * universal time */
  _SFD_EML_CALL(0,6);
  c30_W_EARTH_ROT = 7.2940705438520400E-005;

  /*  sidereal rotation angular velocity of earth, SI */
  _SFD_EML_CALL(0,8);
  c30_ut_sec = 1.8225E+007 + c30_t;

  /*  universal time vector in sec */
  _SFD_EML_CALL(0,9);
  c30_b = c30_ut_sec;
  c30_st_sec = 1.0027379093500000E+000 * c30_b;

  /*  sidereal time vector in sec */
  _SFD_EML_CALL(0,11);
  c30_a = c30_st_sec;
  c30_phi = c30_a * 7.2940705438520400E-005;

  /*  sidereal time vector in rad */
  _SFD_EML_CALL(0,13);
  c30_x = c30_phi;
  c30_b_x = c30_x;
  c30_c_x = c30_b_x;
  c30_b_x = c30_c_x;
  c30_b_x = muDoubleScalarCos(c30_b_x);
  c30_d_x = c30_phi;
  c30_e_x = c30_d_x;
  c30_f_x = c30_e_x;
  c30_e_x = c30_f_x;
  c30_e_x = muDoubleScalarSin(c30_e_x);
  c30_g_x = c30_phi;
  c30_h_x = c30_g_x;
  c30_i_x = c30_h_x;
  c30_h_x = c30_i_x;
  c30_h_x = muDoubleScalarSin(c30_h_x);
  c30_j_x = c30_phi;
  c30_k_x = c30_j_x;
  c30_l_x = c30_k_x;
  c30_k_x = c30_l_x;
  c30_k_x = muDoubleScalarCos(c30_k_x);
  c30_TEI[0] = c30_k_x;
  c30_TEI[3] = c30_h_x;
  c30_TEI[6] = 0.0;
  c30_TEI[1] = -c30_e_x;
  c30_TEI[4] = c30_b_x;
  c30_TEI[7] = 0.0;
  c30_i6 = 0;
  for (c30_i7 = 0; c30_i7 < 3; c30_i7 = c30_i7 + 1) {
    c30_TEI[c30_i6 + 2] = c30_dv1[c30_i7];
    c30_i6 = c30_i6 + 3;
  }

  _SFD_EML_CALL(0,17);
  for (c30_i8 = 0; c30_i8 < 9; c30_i8 = c30_i8 + 1) {
    c30_b_a[c30_i8] = c30_TEI[c30_i8];
  }

  for (c30_i9 = 0; c30_i9 < 3; c30_i9 = c30_i9 + 1) {
    c30_b_b[c30_i9] = c30_r_I[c30_i9];
  }

  c30_eml_scalar_eg();
  c30_eml_scalar_eg();
  for (c30_i10 = 0; c30_i10 < 9; c30_i10 = c30_i10 + 1) {
    c30_A[c30_i10] = c30_b_a[c30_i10];
  }

  for (c30_i11 = 0; c30_i11 < 3; c30_i11 = c30_i11 + 1) {
    c30_B[c30_i11] = c30_b_b[c30_i11];
  }

  for (c30_i12 = 0; c30_i12 < 3; c30_i12 = c30_i12 + 1) {
    c30_r_ECEF[c30_i12] = 0.0;
  }

  for (c30_i13 = 0; c30_i13 < 9; c30_i13 = c30_i13 + 1) {
    c30_b_A[c30_i13] = c30_A[c30_i13];
  }

  for (c30_i14 = 0; c30_i14 < 3; c30_i14 = c30_i14 + 1) {
    c30_b_B[c30_i14] = c30_B[c30_i14];
  }

  for (c30_i15 = 0; c30_i15 < 9; c30_i15 = c30_i15 + 1) {
    c30_c_A[c30_i15] = c30_b_A[c30_i15];
  }

  for (c30_i16 = 0; c30_i16 < 3; c30_i16 = c30_i16 + 1) {
    c30_c_B[c30_i16] = c30_b_B[c30_i16];
  }

  for (c30_i17 = 0; c30_i17 < 3; c30_i17 = c30_i17 + 1) {
    c30_r_ECEF[c30_i17] = 0.0;
    c30_i18 = 0;
    for (c30_i19 = 0; c30_i19 < 3; c30_i19 = c30_i19 + 1) {
      c30_r_ECEF[c30_i17] = c30_r_ECEF[c30_i17] + c30_c_A[c30_i18 + c30_i17] *
        c30_c_B[c30_i19];
      c30_i18 = c30_i18 + 3;
    }
  }

  _SFD_EML_CALL(0,-17);
  sf_debug_symbol_scope_pop();
  for (c30_i20 = 0; c30_i20 < 3; c30_i20 = c30_i20 + 1) {
    (*c30_b_r_ECEF)[c30_i20] = c30_r_ECEF[c30_i20];
  }

  _SFD_CC_CALL(EXIT_OUT_OF_FUNCTION_TAG,23);
}