/* TA_MA_Request::op_3_8_2_3_a */
void op_3_8_2_3_a_TA_MA_Request(
  /* TA_MA_Request::op_3_8_2_3_a::t_mar */ T_MAR t_mar,
  /* TA_MA_Request::op_3_8_2_3_a::trainPosition */ trainPosition_T_TrainPosition_Types_Pck *trainPosition,
  /* TA_MA_Request::op_3_8_2_3_a::odometry */ odometry_T_Obu_BasicTypes_Pkg *odometry,
  /* TA_MA_Request::op_3_8_2_3_a::preindicationLoc */ L_internal_Type_Obu_BasicTypes_Pkg preindicationLoc,
  outC_op_3_8_2_3_a_TA_MA_Request *outC)
{
  /* TA_MA_Request::op_3_8_2_3_a */ L_internal_Type_Obu_BasicTypes_Pkg tmp;
  /* TA_MA_Request::op_3_8_2_3_a::_L20 */ kcg_real _L20;
  
  /* 1 */
  DIV_real_XCP_numeric(
    (kcg_real)
      (preindicationLoc - ((*trainPosition).trainPosition.d_max +
          (*trainPosition).trainPosition.nominal)),
    (kcg_real) (*odometry).speed.v_upper,
    - 1.0,
    &_L20,
    &outC->exception);
  /* last_init_ck_preindicationLoc */ if (outC->init) {
    outC->init = kcg_false;
    tmp = cLocation_TA_MA_Request;
  }
  else {
    tmp = outC->rem_preindicationLoc;
  }
  /* 1 */
  RisingEdge_digital((kcg_bool) (tmp != preindicationLoc), &outC->Context_1);
  outC->triggerMA = !outC->Context_1.RE_Output & ((kcg_real) t_mar >= _L20);
  outC->rem_preindicationLoc = preindicationLoc;
}
/* BasicLocationFunctions_Pkg::locReachedOrPassed */
void locReachedOrPassed_BasicLocationFunctions_Pkg(
  /* BasicLocationFunctions_Pkg::locReachedOrPassed::loc_2 */ LocWithInAcc_T_Obu_BasicTypes_Pkg *loc_2,
  /* BasicLocationFunctions_Pkg::locReachedOrPassed::loc_1 */ LocWithInAcc_T_Obu_BasicTypes_Pkg *loc_1,
  outC_locReachedOrPassed_BasicLocationFunctions_Pkg *outC)
{
  /* BasicLocationFunctions_Pkg::locReachedOrPassed::_L35 */
  static kcg_bool _L35;
  /* BasicLocationFunctions_Pkg::locReachedOrPassed::_L40 */
  static LocWithInAcc_T_Obu_BasicTypes_Pkg _L40;
  
  /* 1 */
  overlapOf_2_Locations_BasicLocationFunctions_Pkg(loc_2, loc_1, &_L40, &_L35);
  /* 1 */ sub_2_distances_BasicLocationFunctions_Pkg(loc_2, loc_1, &_L40);
  /* 1 */
  signChanged_BasicLocationFunctions_Pkg(
    _L40.nominal + _L40.d_min,
    &outC->Context_1);
  /* 2 */
  signChanged_BasicLocationFunctions_Pkg(
    _L40.nominal + _L40.d_max,
    &outC->Context_2);
  /* 1 */
  RisingEdge_digital(
    (kcg_bool) (_L35 | (outC->Context_1.change & outC->Context_2.change)),
    &outC->_1_Context_1);
  outC->hit = outC->_1_Context_1.RE_Output;
}
/* DMI_Control_Pkg::Sub_func::HourGlassAnimation */
void HourGlassAnimation_DMI_Control_Pkg_Sub_func(
  /* DMI_Control_Pkg::Sub_func::HourGlassAnimation::start */ kcg_bool start,
  /* DMI_Control_Pkg::Sub_func::HourGlassAnimation::stop */ kcg_bool stop,
  /* DMI_Control_Pkg::Sub_func::HourGlassAnimation::actualtime */ time_Type_MoRC_Pck actualtime,
  outC_HourGlassAnimation_DMI_Control_Pkg_Sub_func *outC)
{
  kcg_int tmp;
  
  /* 1 */
  countDownTimer_MoRC_Pck_Utils(
    start,
    stop,
    actualtime,
    kcg_true,
    20,
    &outC->Context_1);
  /* 1 */ RisingEdge_digital(outC->Context_1.expired, &outC->_1_Context_1);
  if (outC->_1_Context_1.RE_Output) {
    tmp = 10;
  }
  else {
    tmp = 0;
  }
  /* 1 */ Counter_pwlinear_int(tmp, kcg_false, &outC->_2_Context_1);
  outC->Output1 = outC->_2_Context_1.Count % 40;
}
/* CalculateTrainPosition_Pkg::prevPassedLinkedBG */
void prevPassedLinkedBG_CalculateTrainPosition_Pkg(
  /* CalculateTrainPosition_Pkg::prevPassedLinkedBG::passedBG */ passedBG_T_BG_Types_Pkg *passedBG,
  /* CalculateTrainPosition_Pkg::prevPassedLinkedBG::lastPassedLinkedBG */ positionedBG_T_TrainPosition_Types_Pck *lastPassedLinkedBG,
  /* CalculateTrainPosition_Pkg::prevPassedLinkedBG::reset */ kcg_bool reset,
  outC_prevPassedLinkedBG_CalculateTrainPosition_Pkg *outC)
{
  /* 1 */
  RisingEdge_digital(
    (kcg_bool)
      ((*lastPassedLinkedBG).valid & (Q_LINK_Linked ==
          (*lastPassedLinkedBG).q_link) & !/* 1 */
        nidBG_nidc_equal_CalculateTrainPosition_Pkg(
          (*lastPassedLinkedBG).nid_c,
          (*lastPassedLinkedBG).nid_bg,
          (*passedBG).BG_Header.nid_c,
          (*passedBG).BG_Header.nid_bg) & ((*passedBG).BG_Header.q_link ==
          Q_LINK_Linked) & (*passedBG).valid),
    &outC->Context_1);
  if (reset) {
    kcg_copy_positionedBG_T_TrainPosition_Types_Pck(
      &outC->previouslyPassedBG,
      (positionedBG_T_TrainPosition_Types_Pck *)
        &cNoPositionedBG_CalculateTrainPosition_Pkg);
  }
  else if (outC->Context_1.RE_Output) {
    kcg_copy_positionedBG_T_TrainPosition_Types_Pck(
      &outC->previouslyPassedBG,
      lastPassedLinkedBG);
  }
  else if (outC->init) {
    kcg_copy_positionedBG_T_TrainPosition_Types_Pck(
      &outC->previouslyPassedBG,
      (positionedBG_T_TrainPosition_Types_Pck *)
        &cNoPositionedBG_CalculateTrainPosition_Pkg);
  }
  outC->init = kcg_false;
}
/* TA_MA_Request::MA_Request_Supervision */
void MA_Request_Supervision_TA_MA_Request(
  /* TA_MA_Request::MA_Request_Supervision::ma_RequestParams */P57_MovementAuthorityRequestParameters_T_Packet_Types_Pkg *ma_RequestParams,
  /* TA_MA_Request::MA_Request_Supervision::ma_received */kcg_bool ma_received,
  /* TA_MA_Request::MA_Request_Supervision::in_triggerMA */kcg_bool in_triggerMA,
  /* TA_MA_Request::MA_Request_Supervision::trainPosition */trainPosition_T_TrainPosition_Types_Pck *trainPosition,
  /* TA_MA_Request::MA_Request_Supervision::systemTime */T_internal_Type_Obu_BasicTypes_Pkg systemTime,
  /* TA_MA_Request::MA_Request_Supervision::preindicationLocation */L_internal_Type_Obu_BasicTypes_Pkg preindicationLocation,
  /* TA_MA_Request::MA_Request_Supervision::odometry */odometry_T_Obu_BasicTypes_Pkg *odometry,
  /* TA_MA_Request::MA_Request_Supervision::MAs */MovementAuthority_t_TrackAtlasTypes *MAs,
  /* TA_MA_Request::MA_Request_Supervision::fromDriver */Driver2MAR_T_TA_MA_Request *fromDriver,
  /* TA_MA_Request::MA_Request_Supervision::trackDescrDeleted */kcg_bool trackDescrDeleted,
  /* TA_MA_Request::MA_Request_Supervision::modeLevel */T_Mode_Level_Level_And_Mode_Types_Pkg *modeLevel,
  outC_MA_Request_Supervision_TA_MA_Request *outC)
{
  static kcg_bool tmp1;
  static kcg_bool tmp;
  static kcg_bool tmp2;
  /* TA_MA_Request::MA_Request_Supervision::SM1 */
  static _27_SSM_ST_SM1 SM1_state_sel;
  /* TA_MA_Request::MA_Request_Supervision::SM1 */
  static _27_SSM_ST_SM1 SM1_state_act;
  /* TA_MA_Request::MA_Request_Supervision::_L80 */
  static kcg_bool _L80;
  /* TA_MA_Request::MA_Request_Supervision::_L81 */
  static kcg_bool _L81;
  
  _L80 = 255 != (*ma_RequestParams).t_mar;
  _L81 = 1023 != (*ma_RequestParams).t_timeoutrqst;
  if (outC->init) {
    SM1_state_sel = SSM_st_init_SM1;
  }
  else {
    SM1_state_sel = outC->SM1_state_nxt;
  }
  switch (SM1_state_sel) {
    case SSM_st_init_SM1 :
      SM1_state_act = SSM_st_NoReqPending_SM1;
      break;
    case SSM_st_NoReqPending_SM1 :
      if (in_triggerMA) {
        SM1_state_act = SSM_st_ReqPending_SM1;
      }
      else {
        SM1_state_act = SSM_st_NoReqPending_SM1;
      }
      break;
    case SSM_st_ReqPending_SM1 :
      if (ma_received) {
        SM1_state_act = SSM_st_NoReqPending_SM1;
      }
      else {
        SM1_state_act = SSM_st_ReqPending_SM1;
      }
      break;
    
  }
  switch (SM1_state_act) {
    case SSM_st_ReqPending_SM1 :
      outC->pendingReq = kcg_true;
      outC->SM1_state_nxt = SSM_st_ReqPending_SM1;
      break;
    case SSM_st_NoReqPending_SM1 :
      outC->pendingReq = kcg_false;
      outC->SM1_state_nxt = SSM_st_NoReqPending_SM1;
      break;
    case SSM_st_init_SM1 :
      if (outC->init) {
        outC->pendingReq = kcg_false;
      }
      outC->SM1_state_nxt = SSM_st_init_SM1;
      break;
    
  }
  outC->init = kcg_false;
  /* 1 */
  op_RepeatReq_TA_MA_Request(
    (*ma_RequestParams).t_cycrqst,
    in_triggerMA,
    systemTime,
    &outC->_1_Context_1);
  if (_L80) {
    /* op_3_8_2_3_a */
    op_3_8_2_3_a_TA_MA_Request(
      (*ma_RequestParams).t_mar,
      trainPosition,
      odometry,
      preindicationLocation,
      &outC->Context_op_3_8_2_3_a);
    tmp2 = outC->Context_op_3_8_2_3_a.exception;
    tmp = outC->Context_op_3_8_2_3_a.triggerMA;
  }
  else {
    tmp = kcg_false;
  }
  /* 1 */ RisingEdge_digital(tmp, &outC->Context_1);
  if (_L81) {
    tmp1 = /* op_3_8_2_3_b */
      op_3_8_2_3_b_TA_MA_Request((*ma_RequestParams).t_timeoutrqst, MAs);
  }
  else {
    tmp1 = kcg_false;
  }
  /* 2 */ RisingEdge_digital(tmp1, &outC->Context_2);
  outC->triggerMA = (((*modeLevel).level == M_LEVEL_Level_2) |
      ((*modeLevel).level == M_LEVEL_Level_3)) & (outC->Context_1.RE_Output |
      outC->Context_2.RE_Output | (outC->pendingReq & (255 !=
          (*ma_RequestParams).t_cycrqst) & ((*ma_RequestParams).t_cycrqst !=
          0) & outC->_1_Context_1.trigger) | trackDescrDeleted |
      (*fromDriver).trackAheadFree | (*fromDriver).driverSelectsStart);
  if (_L80) {
    tmp = tmp2;
  }
  else {
    tmp = kcg_false;
  }
  outC->exception = tmp | outC->_1_Context_1.exception;
}
/* MoRC_Pck::Subfunc_Pkg::requestRadioConnectionSetupFromOBU_v2 */
void requestRadioConnectionSetupFromOBU_v2_MoRC_Pck_Subfunc_Pkg(
  /* MoRC_Pck::Subfunc_Pkg::requestRadioConnectionSetupFromOBU_v2::mode */ M_MODE mode,
  /* MoRC_Pck::Subfunc_Pkg::requestRadioConnectionSetupFromOBU_v2::eventsPhases */ obuEventsAndPhases_T_RCM_Session_Types_Pkg *eventsPhases,
  /* MoRC_Pck::Subfunc_Pkg::requestRadioConnectionSetupFromOBU_v2::p42_sessionManagement */ p42_sessionManagement_T_RCM_MsgTypes_Pkg *p42_sessionManagement,
  /* MoRC_Pck::Subfunc_Pkg::requestRadioConnectionSetupFromOBU_v2::sessionStatus */ sessionStatus_T_RCM_Session_Types_Pkg *sessionStatus,
  /* MoRC_Pck::Subfunc_Pkg::requestRadioConnectionSetupFromOBU_v2::registrationStatus */ mobileRegistrationContext_T_RCM_Types_Pkg *registrationStatus,
  /* MoRC_Pck::Subfunc_Pkg::requestRadioConnectionSetupFromOBU_v2::connectionStatus */ mobileConnectionContext_T_RCM_Types_Pkg *connectionStatus,
  /* MoRC_Pck::Subfunc_Pkg::requestRadioConnectionSetupFromOBU_v2::connect */ kcg_bool connect,
  /* MoRC_Pck::Subfunc_Pkg::requestRadioConnectionSetupFromOBU_v2::disconnect */ kcg_bool disconnect,
  /* MoRC_Pck::Subfunc_Pkg::requestRadioConnectionSetupFromOBU_v2::currentTime */ T_internal_Type_Obu_BasicTypes_Pkg currentTime,
  /* MoRC_Pck::Subfunc_Pkg::requestRadioConnectionSetupFromOBU_v2::reset */ kcg_bool reset,
  /* MoRC_Pck::Subfunc_Pkg::requestRadioConnectionSetupFromOBU_v2::maxTimeToMaintainCommSession */ T_internal_Type_Obu_BasicTypes_Pkg maxTimeToMaintainCommSession,
  /* MoRC_Pck::Subfunc_Pkg::requestRadioConnectionSetupFromOBU_v2::noOfRetriesToEstablishASafeRadioConnection */ kcg_int noOfRetriesToEstablishASafeRadioConnection,
  outC_requestRadioConnectionSetupFromOBU_v2_MoRC_Pck_Subfunc_Pkg *outC)
{
  /* MoRC_Pck::Subfunc_Pkg::requestRadioConnectionSetupFromOBU_v2::IfBlock1::else */
  static kcg_bool else_clock_IfBlock1;
  /* MoRC_Pck::Subfunc_Pkg::requestRadioConnectionSetupFromOBU_v2::repeat_SM::rep_inactive */
  static kcg_bool br_1_guard_repeat_SM_rep_inactive;
  /* MoRC_Pck::Subfunc_Pkg::requestRadioConnectionSetupFromOBU_v2::repeat_SM::rep_inactive */
  static kcg_bool br_2_clock_repeat_SM_rep_inactive;
  /* MoRC_Pck::Subfunc_Pkg::requestRadioConnectionSetupFromOBU_v2::repeat_SM::rep_repeatUntilSuccessfulOrADefinedNumberOfTimes */
  static kcg_bool br_1_guard_repeat_SM_rep_repeatUntilSuccessfulOrADefinedNumberOfTimes;
  /* MoRC_Pck::Subfunc_Pkg::requestRadioConnectionSetupFromOBU_v2::repeat_SM::rep_repeatUntilSuccessfulOrADefinedNumberOfTimes */
  static kcg_bool br_2_clock_repeat_SM_rep_repeatUntilSuccessfulOrADefinedNumberOfTimes;
  /* MoRC_Pck::Subfunc_Pkg::requestRadioConnectionSetupFromOBU_v2::repeat_SM::rep_repeatUntilStopConditionMet */
  static kcg_bool br_1_guard_repeat_SM_rep_repeatUntilStopConditionMet;
  /* MoRC_Pck::Subfunc_Pkg::requestRadioConnectionSetupFromOBU_v2::repeat_SM::rep_repeatUntilStopConditionMet */
  static kcg_bool br_2_clock_repeat_SM_rep_repeatUntilStopConditionMet;
  /* MoRC_Pck::Subfunc_Pkg::requestRadioConnectionSetupFromOBU_v2::repeat_SM */
  static SSM_ST_repeat_SM repeat_SM_state_sel;
  /* MoRC_Pck::Subfunc_Pkg::requestRadioConnectionSetupFromOBU_v2::repeat_SM */
  static SSM_ST_repeat_SM repeat_SM_state_act;
  /* MoRC_Pck::Subfunc_Pkg::requestRadioConnectionSetupFromOBU_v2::repeatUntilStopConditionMet */
  static kcg_bool repeatUntilStopConditionMet;
  /* MoRC_Pck::Subfunc_Pkg::requestRadioConnectionSetupFromOBU_v2::successfullyConnected */
  static kcg_bool successfullyConnected;
  /* MoRC_Pck::Subfunc_Pkg::requestRadioConnectionSetupFromOBU_v2::_L336 */
  static kcg_bool _L336;
  /* MoRC_Pck::Subfunc_Pkg::requestRadioConnectionSetupFromOBU_v2::_L334 */
  static kcg_bool _L334;
  /* MoRC_Pck::Subfunc_Pkg::requestRadioConnectionSetupFromOBU_v2::_L321 */
  static kcg_bool _L321;
  /* MoRC_Pck::Subfunc_Pkg::requestRadioConnectionSetupFromOBU_v2::_L318 */
  static kcg_bool _L318;
  
  else_clock_IfBlock1 = (*registrationStatus).valid &
    ((*registrationStatus).status == mrs_registered_RCM_Types_Pkg);
  repeatUntilStopConditionMet = connect &
    !(*eventsPhases).isPartOfAnOngoingStartOfMissionProcedure &
    else_clock_IfBlock1;
  successfullyConnected = (*connectionStatus).valid &
    ((*connectionStatus).status == mcs_connected_RCM_Types_Pkg);
  _L318 = ((*p42_sessionManagement).msgSrc == msrc_Euroradio_Common_Types_Pkg) |
    ((*p42_sessionManagement).msgSrc == msrc_Eurobalise_Common_Types_Pkg) |
    ((*p42_sessionManagement).msgSrc == msrc_RadioInfillUnit_Common_Types_Pkg) |
    ((*p42_sessionManagement).msgSrc == msrc_OBU_Common_Types_Pkg);
  _L321 = (*p42_sessionManagement).q_rbc ==
    Q_RBC_Establish_communication_session;
  _L334 = /* 2 */
    validate_q_sleepsession_v2_MoRC_Pck_Subfunc_Pkg(
      p42_sessionManagement,
      mode);
  _L336 = !(((*p42_sessionManagement).nid_c == (*sessionStatus).nid_c) &
      ((*sessionStatus).nid_rbc == (*p42_sessionManagement).nid_RBC)) &
    (*sessionStatus).valid & ((*sessionStatus).phase !=
      sp_terminated_RCM_Session_Types_Pkg);
  /* init_repeat_SM */ if (outC->init) {
    repeat_SM_state_sel = SSM_st_rep_inactive_repeat_SM;
  }
  else {
    repeat_SM_state_sel = outC->repeat_SM_state_nxt;
  }
  /* 2 */
  RisingEdge_digital(
    (kcg_bool) ((*connectionStatus).valid & (*connectionStatus).connectionLost),
    &outC->Context_2);
  /* 1 */
  countDownTimer_MoRC_Pck_Utils(
    outC->Context_2.RE_Output,
    (kcg_bool)
      ((*connectionStatus).valid & !(*connectionStatus).connectionLost),
    currentTime,
    kcg_false,
    maxTimeToMaintainCommSession,
    &outC->Context_1);
  /* 1 */
  RisingEdge_digital(
    (kcg_bool)
      ((*connectionStatus).settingUpConnectionHasFailed &
        (*connectionStatus).valid),
    &outC->_1_Context_1);
  /* sel_repeat_SM */ switch (repeat_SM_state_sel) {
    case SSM_st_rep_repeatUntilStopConditionMet_repeat_SM :
      br_1_guard_repeat_SM_rep_repeatUntilStopConditionMet =
        successfullyConnected | (*eventsPhases).endOfMissionIsExecuted |
        (*eventsPhases).trainFrontPassesALevelTransitionBorder |
        (*eventsPhases).trainFrontPassesA_RBC_RBC_border |
        (*eventsPhases).trainFrontPassesStartOfAnnouncedRadioHole |
        ((*p42_sessionManagement).valid & ((*p42_sessionManagement).q_rbc ==
            Q_RBC_Terminate_communication_session) & _L334 & _L318) |
        ((*p42_sessionManagement).valid & _L321 & _L334 & _L318 & _L336) |
        outC->Context_1.expired | reset;
      /* guard_rep_repeatUntilStopConditionMet */ if (br_1_guard_repeat_SM_rep_repeatUntilStopConditionMet) {
        repeat_SM_state_act = SSM_st_rep_inactive_repeat_SM;
      }
      else {
        repeat_SM_state_act = SSM_st_rep_repeatUntilStopConditionMet_repeat_SM;
        br_2_clock_repeat_SM_rep_repeatUntilStopConditionMet =
          outC->_1_Context_1.RE_Output;
      }
      break;
    case SSM_st_rep_repeatUntilSuccessfulOrADefinedNumberOfTimes_repeat_SM :
      br_1_guard_repeat_SM_rep_repeatUntilSuccessfulOrADefinedNumberOfTimes =
        successfullyConnected | reset;
      /* guard_rep_repeatUntilSuccessfulOrADefinedNumberOfTimes */ if (br_1_guard_repeat_SM_rep_repeatUntilSuccessfulOrADefinedNumberOfTimes) {
        repeat_SM_state_act = SSM_st_rep_inactive_repeat_SM;
      }
      else {
        repeat_SM_state_act =
          SSM_st_rep_repeatUntilSuccessfulOrADefinedNumberOfTimes_repeat_SM;
        br_2_clock_repeat_SM_rep_repeatUntilSuccessfulOrADefinedNumberOfTimes =
          outC->_1_Context_1.RE_Output;
      }
      break;
    case SSM_st_rep_inactive_repeat_SM :
      br_1_guard_repeat_SM_rep_inactive = connect &
        (*eventsPhases).isPartOfAnOngoingStartOfMissionProcedure &
        else_clock_IfBlock1;
      /* guard_rep_inactive */ if (br_1_guard_repeat_SM_rep_inactive) {
        repeat_SM_state_act =
          SSM_st_rep_repeatUntilSuccessfulOrADefinedNumberOfTimes_repeat_SM;
      }
      else {
        if (repeatUntilStopConditionMet) {
          repeat_SM_state_act =
            SSM_st_rep_repeatUntilStopConditionMet_repeat_SM;
        }
        else {
          repeat_SM_state_act = SSM_st_rep_inactive_repeat_SM;
        }
        br_2_clock_repeat_SM_rep_inactive = repeatUntilStopConditionMet;
      }
      break;
    
  }
  /* act_repeat_SM */ switch (repeat_SM_state_act) {
    case SSM_st_rep_inactive_repeat_SM :
      outC->repeat_SM_state_nxt = SSM_st_rep_inactive_repeat_SM;
      break;
    case SSM_st_rep_repeatUntilSuccessfulOrADefinedNumberOfTimes_repeat_SM :
      outC->repeat_SM_state_nxt =
        SSM_st_rep_repeatUntilSuccessfulOrADefinedNumberOfTimes_repeat_SM;
      break;
    case SSM_st_rep_repeatUntilStopConditionMet_repeat_SM :
      outC->repeat_SM_state_nxt =
        SSM_st_rep_repeatUntilStopConditionMet_repeat_SM;
      break;
    
  }
  /* 1 */ if (reset) {
    kcg_copy_p42_sessionManagement_T_RCM_MsgTypes_Pkg(
      &outC->p42_sessionManagement_mem,
      (p42_sessionManagement_T_RCM_MsgTypes_Pkg *)
        &cNo_p42_SessionManagement_RCM_MsgTypes_Pkg);
  }
  else /* 4 */ if ((*p42_sessionManagement).valid) {
    kcg_copy_p42_sessionManagement_T_RCM_MsgTypes_Pkg(
      &outC->p42_sessionManagement_mem,
      p42_sessionManagement);
  }
  else /* 1_fby_1_init_7 */ if (outC->init) {
    kcg_copy_p42_sessionManagement_T_RCM_MsgTypes_Pkg(
      &outC->p42_sessionManagement_mem,
      (p42_sessionManagement_T_RCM_MsgTypes_Pkg *)
        &cNo_p42_SessionManagement_RCM_MsgTypes_Pkg);
  }
  outC->init = kcg_false;
  /* ck_disconnect */ if (disconnect) {
    outC->connectionCmd.valid = kcg_true;
    outC->connectionCmd.mobileDeviceNo = (*connectionStatus).mobileDeviceNo;
    outC->connectionCmd.action = mca_disconnect_RCM_Types_Pkg;
    outC->connectionCmd.nid_radio = (*connectionStatus).nid_radio;
  }
  else {
    /* sel_repeat_SM */ switch (repeat_SM_state_sel) {
      case SSM_st_rep_inactive_repeat_SM :
        /* guard_rep_inactive */ if (br_1_guard_repeat_SM_rep_inactive) {
          else_clock_IfBlock1 = kcg_true;
        }
        else /* cb_anon_sm */ if (br_2_clock_repeat_SM_rep_inactive) {
          else_clock_IfBlock1 = kcg_true;
        }
        else {
          else_clock_IfBlock1 = kcg_false;
        }
        break;
      case SSM_st_rep_repeatUntilSuccessfulOrADefinedNumberOfTimes_repeat_SM :
        /* guard_rep_repeatUntilSuccessfulOrADefinedNumberOfTimes */ if (br_1_guard_repeat_SM_rep_repeatUntilSuccessfulOrADefinedNumberOfTimes) {
          else_clock_IfBlock1 = kcg_false;
        }
        else /* cb_anon_sm */ if (br_2_clock_repeat_SM_rep_repeatUntilSuccessfulOrADefinedNumberOfTimes) {
          else_clock_IfBlock1 = kcg_true;
        }
        else {
          else_clock_IfBlock1 = kcg_false;
        }
        break;
      case SSM_st_rep_repeatUntilStopConditionMet_repeat_SM :
        /* guard_rep_repeatUntilStopConditionMet */ if (br_1_guard_repeat_SM_rep_repeatUntilStopConditionMet) {
          else_clock_IfBlock1 = kcg_false;
        }
        else /* cb_anon_sm */ if (br_2_clock_repeat_SM_rep_repeatUntilStopConditionMet) {
          else_clock_IfBlock1 = kcg_true;
        }
        else {
          else_clock_IfBlock1 = kcg_false;
        }
        break;
      
    }
    /* ck_anon_activ */ if (else_clock_IfBlock1) {
      outC->connectionCmd.valid = kcg_true;
      outC->connectionCmd.mobileDeviceNo = (*connectionStatus).mobileDeviceNo;
      outC->connectionCmd.action = mca_connect_RCM_Types_Pkg;
      /* 5 */ if ((*p42_sessionManagement).valid & _L321 & _L334 & _L318 &
        (((((*sessionStatus).phase == sp_terminated_RCM_Session_Types_Pkg) |
              ((*sessionStatus).phase ==
                sp_establishing_RCM_Session_Types_Pkg)) &
            (*sessionStatus).valid) | _L336)) {
        outC->connectionCmd.nid_radio =
          outC->p42_sessionManagement_mem.nid_radio;
      }
      else {
        outC->connectionCmd.nid_radio = (*connectionStatus).nid_radio;
      }
    }
    else /* ck_anon_activ */ if ((*eventsPhases).trainFrontPassesStartOfAnnouncedRadioHole) {
      outC->connectionCmd.valid = kcg_true;
      outC->connectionCmd.mobileDeviceNo = (*connectionStatus).mobileDeviceNo;
      outC->connectionCmd.action = mca_expectRadioHole_RCM_Types_Pkg;
      outC->connectionCmd.nid_radio = (*connectionStatus).nid_radio;
    }
    else /* ck_anon_activ */ if ((*eventsPhases).trainFrontReachesEndOfAnnouncedRadioHole) {
      outC->connectionCmd.valid = kcg_true;
      outC->connectionCmd.mobileDeviceNo = (*connectionStatus).mobileDeviceNo;
      outC->connectionCmd.action = mca_unexpectRadioHole_RCM_Types_Pkg;
      outC->connectionCmd.nid_radio = (*connectionStatus).nid_radio;
    }
    else {
      outC->connectionCmd.valid = kcg_false;
      outC->connectionCmd.mobileDeviceNo = (*connectionStatus).mobileDeviceNo;
      outC->connectionCmd.action = mca_nop_RCM_Types_Pkg;
      outC->connectionCmd.nid_radio = (*connectionStatus).nid_radio;
    }
  }
}