/********************************************************
*                                                                                                            
* 文 件 名： InitialProcess.h   
* 版权说明： 北京交控科技有限公司 
* 创建时间： 2012-06-29
* 作    者： 联锁组
* 功能描述： 数据初始化文件
* 函数包括：
* 使用注意：
* 修改记录：   
*
********************************************************/ 

#include "InitialProcess.h"
#include "CutoffPointDataManage.h"
#include "AxisSort_api.h"
#include "SectionStateProcess_api.h"
#include "HLHTHeadContexManage.h"
#include "WLBrakeDataManage.h"
#include "NonAutoReturnConfigDataManage.h"
#include "../Deployment/DeploymentExtern.h"
#include "NonAutoReturnDataManage.h"

/****************************初始化动态数据队列********************************************/
extern TransmitRelationDataStruct TransmitRelaDataStru[TRANSMIT_OBJECT_SUM_MAX];								   /*引用已定义通信关系数据结构体*/
extern TransmitStateDataStruct TransmitStateDataStru[TRANSMIT_OBJECT_SUM_MAX * TRANSMIT_OBJECT_DEVICE_SUM_MAX];  /*引用已定义通信状态结构体*/
extern UINT16 TransmitRelaDataCurSum; /*通信关系配置数据当前总数*/
extern UINT16 TransmitStateDataCurSum; /*通信关系状态数据当前总数*/

extern DSU_DATA_LEN_STRU dsuDataLenStru;            /*记录读取的DSU数据中的各类型数据的数量*/
extern DSU_STATIC_HEAD_STRU dsuStaticHeadStru;		/*记录读取的DSU数据库中每种结构的头指针*/

/*--------------------------- */
 /* 内部函数*/
UINT8 SetAutoSignalId(void);


/*
* 功能描述： 初始化信号机包含的进路所处区域标志
* 参数说明： UINT16 signalId	输入信号机ID
* 返回值  ： void
*
*/
void SetSignalLeadRouteCbtcFlag(UINT16 signalId);
/*--------------------------- */
/*
* 功能描述： 初始化逻辑
* 参数说明： void  
* 返回值  ： 0: 初始化失败
*			 1; 初始化成功
*/
UINT8 InitialProcess(void)
{
	UINT8 ret = CI_SUCCESS;
	UINT8 sheBeiInit = 0u;
	UINT8 chSwitch = 0u;
	UINT8 cRcWorkMode = 0U;
	UINT32 rccycleTime = 0U;
	UINT8 cCheckFlag = CI_ERROR;

    /*平台初始化*/
	if (0U == Initial2oo2Interface())
	{
		ret = CI_ERROR;
	}

	/*读取联锁配置数据*/
    if (0u != ReadConfigureData())
    {
#ifdef PLATFORM_2OO2

        (void)printf("ReadConfigureData Error\n");
		debug_infor_printf((const)"ReadConfigureData Error\n");
#endif

        ret = CI_ERROR;


    }

	cRcWorkMode = GetLocalRcWorkMode();


	if (CI_SUCCESS == ret)
	{
		SystemParaTimeToCycleCount();
	}


	/*初始化进路数据*/
	if (CI_SUCCESS == ret)
	{
		if (CI_ERROR == InitialRouteData())
		{            
			ret = CI_ERROR;	    
		}
	}

    /*初始化长调进路数据*/
	if (CI_SUCCESS == ret)	
	{
		InitialLongRouteData();
	}    

    /*初始化信号机数据*/
	if(CI_SUCCESS == ret)
	{
	    if (CI_ERROR == InitialSignalData())
	    {
	        ret = CI_ERROR;
		}
	}
	/*初始化洗车机数据*/
	if(CI_SUCCESS == ret)
	{
		if(CI_ERROR == InitialWashMachineData())
		{
			ret = CI_ERROR;
		}
	}
	/*初始化道岔数据*/
	if(CI_SUCCESS == ret)
	{
		if (CI_ERROR == InitialSwitchData())
		{
			ret = CI_ERROR;
		}
	}

	/*初始化物理区段数据*/
	if(CI_SUCCESS == ret)
	{
		if (CI_ERROR == InitialPhySectionData())
		{
			ret = CI_ERROR;
		}
	}
	/*初始化计轴区段数据*/
	if(CI_SUCCESS == ret)
	{
		if (CI_ERROR == InitialAxisSectionData())
		{
			ret = CI_ERROR;
		}
	}
	/*初始化逻辑区段数据*/
	if(CI_SUCCESS == ret)
	{
		if (CI_ERROR == InitialLogicSectionData())
		{
			ret = CI_ERROR;
		}
	}
	/*初始化紧急停车按钮数据*/
	if(CI_SUCCESS == ret)
	{
		if (CI_ERROR == InitialEsbData())
		{
			ret = CI_ERROR;
		}
	}
	/*初始化屏蔽门数据*/
	if(CI_SUCCESS == ret)
	{
		if (CI_ERROR == InitialPsdData())
		{
			ret = CI_ERROR;
		}
	}
	/*初始化站台数据*/
	if(CI_SUCCESS == ret)
	{
		if(CI_ERROR == InitialPlatformData())
		{
			ret = CI_ERROR;
		}
	}
	/*初始化站台门控制器数据*/
	if(CI_SUCCESS == ret)
	{
		if(CI_ERROR == InitialPscToCiData())
		{
			ret = CI_ERROR;
		}
	}
	/*初始化继电器数据*/
	if(CI_SUCCESS == ret)
	{
		if (CI_ERROR == InitialRelayData())
		{
			ret = CI_ERROR;
		}
	}

	/*初始化保护区段组数据*/
	if(CI_SUCCESS == ret)
	{
		if (CI_ERROR == InitialOverlapData())
		{
			ret = CI_ERROR;
		}
	}
	/*初始化自动折返数据*/
	if(CI_SUCCESS == ret)
	{
		if (CI_ERROR == InitialAutoReturnRouteData())
		{
			ret = CI_ERROR;
		}
	}

    /*初始化自动通过数据*/
	if(CI_SUCCESS == ret)
	{
	    if (CI_ERROR == InitialAutoRouteRouteData())
	    {
	        ret = CI_ERROR;
		}
	}
    /*初始化非进路调车数据*/
    InitialNonRouteData();

    /*初始化指示灯数据*/
	if(CI_SUCCESS == ret)
	{
	    if (CI_ERROR == InitialIndicatorStateData())
	    {
	        ret = CI_ERROR;
		}
	}
	/*初始化通信状态数据*/
	if(CI_SUCCESS == ret)
	{
		if (CI_ERROR == InitialTransmitStateData())
		{
			ret = CI_ERROR;
		}
	}
	/*初始化本联锁具有锁闭状态管理权的物理区段ID数组*/
	if(CI_SUCCESS == ret)
	{
#if 0
		if (CI_ERROR == InitialPhySecIdBufOfOtherCi())
		{
			ret = CI_ERROR;
		}
#else
		if (CI_ERROR == InitPhySecIdBufOfOtherCiByConf())
		{
			ret = CI_ERROR;
		}
#endif
		
	}

	/*初始化本联锁需发送的离去逻辑区段所属进路ID数组*/
	if (CI_SUCCESS == ret)
	{
		if (CI_ERROR == InitLeaveLogIdBufOfOtherCiByConf())
		{
			ret = CI_ERROR;
		}

	}

	/*初始化本联锁需发送的需要检查道岔状态的进路*/
	if (CI_SUCCESS == ret)
	{
		cCheckFlag = InitNeedCheckSwitchStaRoute();
		if (CI_SUCCESS == cCheckFlag)
		{

			ret = CI_SUCCESS;
		}
		else
		{
			ret = CI_ERROR;
			debug_infor_printf((const)"InitNeedCheckSwitchStaRoute Error\n");
		}
	}

	/*初始化需要由本控区检查防护道岔状态的其它控区的保护区段*/
	if (CI_SUCCESS == ret)
	{
		cCheckFlag = InitNeedCheckProSwtStaOverlap();
		if (CI_SUCCESS == cCheckFlag)
		{
			/*继续初始化*/
		}
		else
		{
			ret = CI_ERROR;
			debug_infor_printf((const)"InitNeedCheckProSwtStaOverlap Error\n");
		}
	}
	else
	{
		/*不处理*/
	}

	/*初始化需要本控区保护区段征用的其他控区的防护道岔信息*/
	if (CI_SUCCESS == ret)
	{
		cCheckFlag = InitNeedOlapUsingOtherCiProSw();
		if (CI_SUCCESS == cCheckFlag)
		{
			/*继续初始化*/
		}
		else
		{
			ret = CI_ERROR;
			debug_infor_printf((const)"InitNeedOlapUsingOtherCiProSw Error\n");
		}
	}
	else
	{
		/*不处理*/
	}

	/*初始化全自动折返数据*/
	if(CI_SUCCESS == ret)
	{
		if (CI_ERROR == InitialAllAutoReturnRouteData())
		{
			ret = CI_ERROR;
		}
	}
	/*初始化车库门数据*/
	if(CI_SUCCESS == ret)
	{
		if (CI_ERROR == InitialGaragedoorData())
		{
			ret = CI_ERROR;
		}
	}
	/*初始化SPKS数据*/
	if(CI_SUCCESS == ret)
	{
		sheBeiInit = SpksDataManageInit();
		if (CI_ERROR == sheBeiInit)
		{
			ret = CI_ERROR;
		}
	}

	/*初始化ESB数据*/
	if (CI_SUCCESS == ret)
	{
		if (CI_ERROR == EsbDataManageInit())
		{
			ret = CI_ERROR;
		}
	}

	/*初始化防淹门数据*/
	if(CI_SUCCESS == ret)
	{
		if (CI_ERROR == InitialFloodGateData())
		{
			ret = CI_ERROR;
		}
	}
	

	/*初始化列车管理模块*/
	if (CI_SUCCESS == ret)
	{
		ret = TrainDataModuleInit();
	}


	/* 初始化分界点数据 */
	if (CI_SUCCESS == ret)
	{
		ret = CutoffPointDataManageInit();
	}

	/* 初始化倒切设备数据 */
	if (CI_SUCCESS == ret)
	{
		ret = ReverseCutDataManageInit();
	}
	

	/* 初始化无人折返数据 */
	if (CI_SUCCESS == ret)
	{
		ret = NonReturnConfigDataManage();
	}
	if (RC_WORK_MODE_TIOC == cRcWorkMode)
	{
		/*初始化动态进路数据 仅在TIOC模式下初始化*/
		InitialDynamicRouteData();
		/*初始化逻辑进路数据 仅在TIOC模式下初始化*/
		InitialLogicalRouteData();

		if (CI_SUCCESS == ret)
		{
			chSwitch = GetCiFunctionSwitchConfig(FUNC_TOA_SWITCH);
			if (FUNC_SWITCH_ON == chSwitch)
			{
				ret = ToaInit();
			}
			else
			{
				;
			}
		}
		else
		{
			;
		}

		/*初始化包络数据*/
		if (CI_SUCCESS == ret)
		{
			as_Init();
			ret = elm_Init();
			ssp_Init();

		}
	}
	else
	{
		; /* 无处理 */
	}

	/*初始化全线免筛数据*/
	if (CI_SUCCESS == ret)
	{
		ret = wls_Init();
	}

	/*初始化区间疏散数据*/
	if (CI_SUCCESS == ret)
	{
		ret = EaConfigInit();
		WlbInit();
	}

	if (CI_SUCCESS == ret)
	{
		/*初始化OC数据*/
		InitOcData();

		/*初始化oc设备*/
		InitOcDevices();

		ret = InitAxleToCiDataStru();
	}
	if (CI_SUCCESS == ret)
	{/*cgh-合并CID-3037-3：*/
		/*初始化中央联锁结构体*/
		InitCtrlPowerStru();
		/*初始化OC站指示灯*/
		ret = InitialOCStationIndicStaData();
	}

	if (CI_SUCCESS == ret)
	{
		/*初始化无人折返指示灯状态数据*/
		ret = InitialRtnIndicStaData();
	}


	if (CI_SUCCESS == ret)
	{/*初始化平台发送的通控、扩展板数据*/
		InitPlatDataStru();
	}

	if (CI_SUCCESS == ret)
	{/*初始化LEU数据*/
		(void)InitLEUDataStru();
	}
    /*初始化设备打印数据*/
    (void)RecordDeviceDataLog(CI_ERROR);

#ifdef SCADE_MODE
    InitScadeCiConfigData();
#endif
	
/*退出运营处理*/
#if (kPLATFORM==kVXWORKS)
	rccycleTime = GetSystemParaAppCycleTime();
	/*初始化退出运营*/
	Deploy_Init((UINT16)rccycleTime,debug_infor_printf);
#endif

	TiocTransCtInit();

	return ret;
}

/*
* 功能描述： 初始化信号机数据
* 参数说明： void  
* 返回值  ： 0: 初始化失败
*			 1; 初始化成功
*/
UINT8 InitialSignalData(void)
{
	UINT16 signalDataSum = 0u;					/*信号机总数*/
	UINT16 signalId = 0u;						/*信号机ID*/
	UINT16 ii = 0u;								/*游标*/
	UINT16 jj = 0u;								/*游标*/
	UINT16 routeSum = 0u;						/*进路总数*/
	UINT16 routeId = 0u;							/*进路ID*/
	UINT8 belongCiId = 0u;                         /*信号机所属CI的id*/
	UINT16	ciToLeuMaskSum = 0u;					/*CI-LEU码位总数*/	
	UINT16 startSignalId = 0u;					/*始端信号机ID*/
	UINT8 ret = CI_SUCCESS;
	
	UINT8 localCi = 0u;/*本CI编号*/
	UINT8 sameLine = SAME_LINE_ERR;/*信号机与本CI是否属于同一线路*/
	UINT16 outSecId = 0u;/*信号机外方物理区段*/
	UINT8 outSecCiId = 0u;/*信号机外方物理区段所属CI临时变量*/
	UINT8 outSecSameLine = SAME_LINE_ERR;/*信号机外方物理区段与本CI是否属于同一线路*/
	UINT16 detainBtnRelayId = 0U;    /*扣车按钮采集继电器1ID*/
	UINT8 wRouteLeadProperty = 0U;
	
	localCi = GetSystemParaLocalCiId();

	signalDataSum = GetTotalSignalCurNum();		/*本联锁和相邻联锁发送给本联锁的信号机总数目*/
	ciToLeuMaskSum = GetSendMaskSum(CI_SYSTEM_TYPE_LEU);	

	if (signalDataSum >= SIGNAL_SUM_MAX)
	{/*配置数据总数错误*/
		ret = CI_ERROR;
	}
	else
	{
		for (ii = 0u; ii < signalDataSum; ii++)
		{
			signalId = GetSignalId(ii);                                                  /*获取配置文件中该索引下的信号机ID*/
			belongCiId = GetSignalBelongCiId(signalId);                                  /*获取信号机所属联锁*/
			detainBtnRelayId = GetSignalDetainRelayId(signalId);
			SignalDataStru[signalId].SignalId = signalId;
			SignalDataStru[signalId].FLockState = SIGNAL_FENGSUO_NO;                     /*信号机封锁状态(未封锁/封锁) */
			SignalDataStru[signalId].LightExtinctState = SIGNAL_LIGHT_EXTICT_STATE_YES;  /*信号机亮灭状态(亮灯/灭灯) */
			SignalDataStru[signalId].PreColor = SIGNAL_SHOWCOLOUR_REDBREAK;              /*信号机之前显示颜色  */
			SignalDataStru[signalId].CurColor = SIGNAL_SHOWCOLOUR_REDBREAK;              /*信号机当前显示颜色  */
			SignalDataStru[signalId].OldDriveColor = SIGNAL_DRIVECOLOUR_NULL;			/*驱动信号机颜色变化之前,驱动信号机显示颜色*/
			SignalDataStru[signalId].PreDriveColor = SIGNAL_DRIVECOLOUR_NULL;            /*之前(上周期)驱动信号机显示颜色  */
			SignalDataStru[signalId].CurDriveColor = SIGNAL_DRIVECOLOUR_NULL;            /*当前(本周期)驱动信号机显示颜色  */
			SignalDataStru[signalId].DriveNewSigStartCycNum = 0u;					/*信号机驱动新显示色开始周期*/
			SignalDataStru[signalId].DsBreakFlag = SIGNAL_DS_BREAK_NO;                   /*红灯灯丝断丝标志  */
			SignalDataStru[signalId].GreenDsBreakFlag = SIGNAL_DS_BREAK_NO;               /*绿灯灯丝断丝标志  */
			SignalDataStru[signalId].YellowDsBreakFlag = SIGNAL_DS_BREAK_NO;               /*黄灯灯丝断丝标志  */
			SignalDataStru[signalId].WhiteDsBreakFlag = SIGNAL_DS_BREAK_NO;               /*白灯灯丝断丝标志  */
			SignalDataStru[signalId].RedYellowDsBreakFlag = SIGNAL_DS_BREAK_NO;               /*红黄灯灯丝断丝标志  */
			SignalDataStru[signalId].RedWhiteDsBreakFlag = SIGNAL_DS_BREAK_NO;               /*红白灯灯丝断丝标志  */
			SignalDataStru[signalId].GreenYellowDsBreakFlag = SIGNAL_DS_BREAK_NO;             /*绿黄灯灯丝断丝标志  */
			SignalDataStru[signalId].DoubleGreenDsBreakFlag = SIGNAL_DS_BREAK_NO;              /*双绿灯灯丝断丝标志  */
			SignalDataStru[signalId].DoubleYellowDsBreakFlag = SIGNAL_DS_BREAK_NO;             /*双黄灯灯丝断丝标志  */
			SignalDataStru[signalId].BlueDsBreakFlag = SIGNAL_DS_BREAK_NO;             /*蓝灯丝断丝标志  */
			SignalDataStru[signalId].DriveSigOpenStartCycNum = 0u;                        /*驱动信号机开放起始周期 */
			SignalDataStru[signalId].DriveSigCloseStartCycNum = 0u;                       /*驱动信号机关闭起始周期 */
			SignalDataStru[signalId].CollSigOpenStartCycNum = 0u;                         /*采集信号机开放起始周期 */
			SignalDataStru[signalId].SignalCrossState = SIGNAL_CROSS_STATE_NO;           /*通信车跨压通过信号机状态*/
			SignalDataStru[signalId].SignalLeadProperty = SIGNAL_LEAD_PROPERTY_NO;       /*信号机不可引导*/
			SignalDataStru[signalId].SignalLeadRouteCbtcFlag = 0U;						/*信号机包含引导进路在CBTC还是非CBTC区域的标志，每个信号机先初始化为0U*/
			SignalDataStru[signalId].SignalYLockOpenState = SIGNAL_CLOSE;                /*引导总锁信号关闭*/
			SignalDataStru[signalId].AtsDetainFlag = SIGNAL_DETAIN_NO;                   /*Ats未人工扣车*/
			SignalDataStru[signalId].AtsDetainFlagAuto = SIGNAL_DETAIN_NO;               /*Ats未自动扣车*/
			SignalDataStru[signalId].XiandiDetainFlag = SIGNAL_DETAIN_NO;                /*现地未扣车*/
			SignalDataStru[signalId].RealyDetainFlag = SIGNAL_RELAY_DETAIN_NO;           /*信号机硬线未扣车*/
			SignalDataStru[signalId].RelayActaionStartCycNum = 0u;                        /*信号机继电器动作开始周期*/
			SignalDataStru[signalId].AutoRouteId = 0u;	                                 /* 初始化为非自动信号 */
			SignalDataStru[signalId].PLockCommand = SIGNAL_PLOCK_CMD_NONE;				/*不锁也不解保护区段*/
			SignalDataStru[signalId].DiffColorOpenStartCycNum = 0u;						/*信号机当前开放颜色不等于目标开放颜色起始周期*/
			SignalDataStru[signalId].SignalLightOnStateCycCount = SIGNAL_LIGHTON_MID_COUNT;      /*信号机收到强制点灯强制灭灯状态持续计数值*/
			SignalDataStru[signalId].RelayDetainCmd = SIGNAL_DETAIN_CI_RELAY_NO;/*初始设成不扣车*/
			SignalDataStru[signalId].NeighbourSignalDetainDrive = NEIGHBOUR_SIGNAL_DETAIN_DRIVE_NO;/*邻站信号机扣车无驱动*/
			SignalDataStru[signalId].MaintainLightState = MAINTAIN_STATE_NO;/*信号机不处于维修点灯状态*/
			SignalDataStru[signalId].wSignalLightUpLinkIdSum = 0U;
			(void)CommonMemSet(SignalDataStru[signalId].szSignalLightUpLinkIdBuf, (UINT32)sizeof(SignalDataStru[signalId].szSignalLightUpLinkIdBuf),0U, (UINT32)sizeof(SignalDataStru[signalId].szSignalLightUpLinkIdBuf));
			SignalDataStru[signalId].wSignalLightUpTrainId = 0U;
			if ((0U == detainBtnRelayId) || (UINT16_MAX == detainBtnRelayId))
			{
				SignalDataStru[signalId].DetainBtnActivateFlag = SIGNAL_ZFS_BTN_ACT_FLAG_NO;     /*自复式未配置扣车按钮继电器，初始化扣车按钮未激活*/
			}
			else
			{
				SignalDataStru[signalId].DetainBtnActivateFlag = SIGNAL_ZFS_BTN_ACT_FLAG_YES;     /*扣车按钮1激活标志*/
			}
			SignalDataStru[signalId].DetainBtnErrFlag = SIGNAL_ZFS_BTN_ERR_FLAG_NO;     /*扣车按钮故障标志*/
			SignalDataStru[signalId].CancelDetainBtnErrFlag = SIGNAL_ZFS_BTN_ERR_FLAG_NO;     /*取消扣车按钮故障标志*/
			SignalDataStru[signalId].DetainBtnPressCycNum = 0U;     /*扣车按钮1按下周期*/
			SignalDataStru[signalId].DetainSndBtnPressCycNum = 0U;     /*扣车按钮2按下周期*/
			SignalDataStru[signalId].CancelDetainBtnPressCycNum = 0U;   /*取消扣车按钮正常按下周期*/
			SignalDataStru[signalId].CancelDetainErrTrigPressCycNum = 0U;   /*取消扣车按钮误触发按下周期*/
			SignalDataStru[signalId].CancelDetainBtnValidFlag = SIGNAL_CANCEL_DETAIN_VALID_NO;   /*取消扣车按钮有效标志*/
			SignalDataStru[signalId].CancelDetainRelayDownState = SIGNAL_RELAY_ERROR_DOWN_YES;   /*取消扣车按钮采集继电器落下状态初始化为异常落下*/
			SignalDataStru[signalId].LogRouteSignalErrCloseFlag = LOG_ROUTE_SIGNAL_CLOSE_NOERR;		/*初始化为未异常关闭标志(逻辑进路异常关闭使用)*/
			SignalDataStru[signalId].VobcCroSigInPhyOccSta = SECTION_OCCUPY_NO;		/*初始化信号机内方第一区段为空闲，当占压后再给ZC组确认信息*/
			SignalDataStru[signalId].cSleepTrainLightUpFlag = SIGNAL_SLEEP_TRAIN_LIGHTUP_NO;	/*初始化休眠车点亮信号机标志无效*/
			SignalDataStru[signalId].cInHumidRailFlag = SIGNAL_IN_HUMID_RAIL_NO;
			SignalDataStru[signalId].cDetCutBtnState = SIGNAL_DETAIN_CUT_VALID_NO;   /*扣车旁路按钮状态*/
			SignalDataStru[signalId].DetCutBtnPressCycNum = 0U;   /*扣车旁路按钮正常按下周期*/
			SignalDataStru[signalId].DetCutBtnErrTrigPressCycNum = 0U;   /*扣车旁路按钮误触发按下周期*/
			SignalDataStru[signalId].cDetCutBtnErrFlag = SIGNAL_ZFS_BTN_ERR_FLAG_NO;     /*扣车旁路按钮故障标志*/
			SignalDataStru[signalId].cDetCutBtnRelayDownState = SIGNAL_RELAY_ERROR_DOWN_YES;   /*扣车旁路按钮采集继电器落下状态初始化为异常落下*/
			/*初始化信号机临时限速状态有效*/
			SignalDataStru[signalId].LinShiXianSuSetFlag = SIGNAL_LINSHIXIANSUSET_STATE_YES;/*临时限速有效*/
			
			
			routeSum = GetRouteCurSum();
			for (jj = 0u; jj < routeSum; jj++)
			{
				routeId = GetRouteId(jj);/*routeId下文中会用到*/
				startSignalId = GetRouteStartSignalId(routeId);
				if (signalId == startSignalId)
				{
					wRouteLeadProperty = GetRouteLeadProperty(routeId);
					if ((SignalDataStru[signalId].SignalLeadProperty == SIGNAL_LEAD_PROPERTY_NO)
						&& ((ROUTE_LEAD_PROPERTY_YES == wRouteLeadProperty) || (ROUTE_LEAD_PROPERTY_CBTC_YES == wRouteLeadProperty)))
					{
						/*设置信号机引导属性*/
						SignalDataStru[signalId].SignalLeadProperty = SIGNAL_LEAD_PROPERTY_YES;
					}
					else
					{
						/*不处理*/
					}		
				}
				else
			    {
			        ;
			    }
			}

			SetSignalLeadRouteCbtcFlag(signalId);

			sameLine = IsSameLineCI(localCi, belongCiId);/*判断是否是互联互通线的信号机*/

			if (SAME_LINE_YES == sameLine)
			{
				outSecId = GetSignalOutFirstPhySecId(signalId);
				/*如果以该信号机为终端信号机的进路属于互联互通线路，设置成无效。如果属于自己线路，则设置成有效。原因在于，自家联锁的接口并不判断保护区段的有效性*/
				if (0u < outSecId)
				{
					outSecCiId = GetPhySecBelongCiId(outSecId);

					if (0u < outSecCiId)
					{
						outSecSameLine = IsSameLineCI(localCi, outSecCiId);/*进路与本CI是否属于同一线路*/

						if (SAME_LINE_YES == outSecSameLine)
						{
							SignalDataStru[signalId].ProSecValid = SIGNAL_PRO_SEC_VALID;/*设置成有效*/
						}
						else
						{
							SignalDataStru[signalId].ProSecValid = SIGNAL_PRO_SEC_INVALID;/*设置成无效导向安全*/
						}
					}
					else
					{
						SignalDataStru[signalId].ProSecValid = SIGNAL_PRO_SEC_INVALID;/*设置成无效导向安全*/
					}
				}
				else
				{
					SignalDataStru[signalId].ProSecValid = SIGNAL_PRO_SEC_INVALID;/*设置成无效导向安全*/
				}
			}
			else if (SAME_LINE_NO == sameLine)
			{
				SignalDataStru[signalId].ProSecValid = SIGNAL_PRO_SEC_INVALID;/*信号机归互联互通CI管，默认设置保护区段无效*/
			}
			else
			{
				SignalDataStru[signalId].ProSecValid = SIGNAL_PRO_SEC_INVALID;/*设置成无效导向安全*/
			}
		}

		/* 设置自动信号属性 */
		if (CI_SUCCESS != SetAutoSignalId())
		{
			ret = CI_ERROR;
		}
		else
		{
		    ;
		}
	}

	

	return ret;
}


/*
* 功能描述： 初始化洗车机数据
* 参数说明： void  
* 返回值  ： 0: 初始化失败
*			 1; 初始化成功
*/
UINT8 InitialWashMachineData(void)
{
	UINT16 washMachineDataSum = 0u;					/*洗车机总数*/
	UINT16 washMachinelId = 0u;						/*洗车机ID*/
	UINT16 ii = 0u;								    /*游标*/
	
	UINT8 ret = CI_ERROR;

	washMachineDataSum = GetWashMachineSum();/*数值大于 WASHMACHINE_SUM_MAX会返回0*/

	for (ii = 0u; ii < washMachineDataSum; ii++)
	{
		washMachinelId = GetWashMachineId(ii);
		WashMachineDataStru[washMachinelId].CurVobcId = 0u;
		WashMachineDataStru[washMachinelId].WashMachineId = washMachinelId;
		WashMachineDataStru[washMachinelId].WashMachineReadyState = WASHMACHINE_COL_READY_NO;
		WashMachineDataStru[washMachinelId].WashMachineRequestVerifyState = WASHMACHINE_COL_REQUEST_INVALID;
		WashMachineDataStru[washMachinelId].TrainEmergencyStopState = WASHMACHINE_COL_FALUT_YES;
		WashMachineDataStru[washMachinelId].HeadWashAllowState = WASHMACHINE_COL_HEADWASH_NO;
		WashMachineDataStru[washMachinelId].TailWashAllowState = WASHMACHINE_COL_TAILWASH_NO;
		WashMachineDataStru[washMachinelId].WashTrainRequestDrvState = WASHMACHINE_DRVSTATE_REQ_FALSE;
		WashMachineDataStru[washMachinelId].TrainHeadStopSteadyDrvState = WASHMACHINE_HEAD_STEADY_NO;
		WashMachineDataStru[washMachinelId].TrainTailStopSteadyDrvState = WASHMACHINE_TAIL_STEADY_NO;
		WashMachineDataStru[washMachinelId].TrainOutWashTrainPortAllowState = WASHMACHINE_COL_OUT_NO;
		WashMachineDataStru[washMachinelId].PauseTrainWashRequestDrvState = WASHMACHINE_PAUSE_DRVREQ_FALSE;
		WashMachineDataStru[washMachinelId].PaseWashMachineRequesDrvtState = PASS_WASHMACHINE_DRVREQ_FALSE;
		WashMachineDataStru[washMachinelId].WashMachineWorkModeDrvtState = WASHMACHINE_WORKMODE_INVALID_DRV;
		WashMachineDataStru[washMachinelId].WashWorkModeRelayDrvCycle = 0U;
		WashMachineDataStru[washMachinelId].WashmachineXTACurState = XTA_STATE_RAISE_UP;/*洗车同意按钮当前状态：初始化为抬起*/
		WashMachineDataStru[washMachinelId].WashmachineXTAPreState = XTA_STATE_RAISE_UP;/*洗车同意按钮之前状态：初始化为抬起*/
		WashMachineDataStru[washMachinelId].WashmachineXTALogicState = XTA_STATE_RAISE_UP;/*洗车同意按钮逻辑状态：初始化为抬起*/
		WashMachineDataStru[washMachinelId].WashmachineXTAPressDownCycle = 0u;/*洗车同意按钮按下周期：初始化为0*/
		WashMachineDataStru[washMachinelId].WashModeState = XTA_MODE_STATE_NO;/*洗车模式，初始化为OXFF*/
		WashMachineDataStru[washMachinelId].chSetWashWorkModeBack = WASH_WORKMODE_BACK_DEFAULT;/*洗车机工作模式反馈，初始化为OX00*/
		WashMachineDataStru[washMachinelId].chDownWashAllowState = WASH_COL_STATE_ALLOW_NO;/*降级模式洗车同意状态*/
		WashMachineDataStru[washMachinelId].chDownWashAllowPassState = WASH_COL_STATE_ALLOW_PASS_NO;/*降级模式洗车同意通过状态*/

	}
	ret = CI_SUCCESS;
	return ret;
}


/*
* 功能描述： 初始化道岔数据
* 参数说明： void  
* 返回值  ： 0: 初始化失败
*			 1; 初始化成功
*/
UINT8 InitialSwitchData(void)
{
	UINT16 switchDataSum = 0u;					/*道岔总数*/
	UINT16 switchId = 0u;						/*道岔ID*/
	UINT16 ii = 0u;								/*游标*/
	UINT16 jj = 0u;		/*游标*/
	UINT8 reVal = CI_ERROR;

	switchDataSum = GetTotalSwitchCurNum();		/*本联锁和相邻联锁发送给本联锁的道岔总数目*/
																				/*数值大于SWITCH_SUM_MAX会返回0*/
	for (ii = 0u; ii < switchDataSum; ii++)
		{
			switchId = GetSwitchId(ii);/*获取配置文件中该索引下的道岔ID*/

			SwitchDataStru[switchId].SwitchId = switchId;
			SwitchDataStru[switchId].YLockState = SWITCH_LOCK_YINZONG_NO;
			SwitchDataStru[switchId].LockStatus = SWITCH_LOCK_STATUS_NO;
			SwitchDataStru[switchId].FLockState = SWITCH_LOCK_FENGSUO_NO;
			SwitchDataStru[switchId].SwitchPrePosition = SWITCH_POSITION_SIKAI;
			SwitchDataStru[switchId].SwitchCurPosition = SWITCH_POSITION_SIKAI;
			SwitchDataStru[switchId].SingleSwitchCurPosition = SWITCH_POSITION_SIKAI;
			SwitchDataStru[switchId].SwitchDrivePos = SWITCH_DRIVE_POS_INVALID;
			SwitchDataStru[switchId].SwitchExpDrvPos = SWITCH_DRIVE_POS_INVALID;
			SwitchDataStru[switchId].switchPreExpDrvPos = SWITCH_DRIVE_POS_INVALID;
			SwitchDataStru[switchId].SwitMoveStartCycNum = 0u;
			SwitchDataStru[switchId].SwitDriveStartCycNum = 0u;
			SwitchDataStru[switchId].chSwitchDrivedFlag = SWITCH_DRIVED_FLAG_NO;
			SwitchDataStru[switchId].SwitchDanCaoPostition = SWITCH_POSITION_INVALID;
			SwitchDataStru[switchId].switchDrivingState = SWIT_DRIV_IDLE_TIME;
			SwitchDataStru[switchId].switchDrivOvtmDrvPos = SWITCH_DRIVE_POS_INVALID;
			SwitchDataStru[switchId].switchFaultState = SWITCH_FAULT_STATE_YES;
			/* zt 删除单轨相关代码 2022-02-15 */
			SwitchDataStru[switchId].switchKRState = SWITCH_KERAO_STATE_YES;
			SwitchDataStru[switchId].switchLastValidDrvPosCycleNum = 0u;
			SwitchDataStru[switchId].switchLastValidDrvPos = SWITCH_DRIVE_POS_INVALID;
			SwitchDataStru[switchId].UsingBelongOverlapId = 0u;
			SwitchDataStru[switchId].DFHRelayValidCycNum = 0u;
			SwitchDataStru[switchId].SigleDFHRelayValidCycNum = 0u;
			SwitchDataStru[switchId].PLockedRouteNum = 0u;
			SwitchDataStru[switchId].PLockedLogRouteNum = 0u;
			SwitchDataStru[switchId].PLockedOverlapNum = 0u;
			SwitchDataStru[switchId].PLockedNonRouteNum = 0u;
			SwitchDataStru[switchId].YCRelayValidCycNum = 0u;
			SwitchDataStru[switchId].SigleYCRelayValidCycNum = 0u;
			SwitchDataStru[switchId].ConnetSwitchDsState = CONNECT_SWITCH_DANSUO_NO;
			SwitchDataStru[switchId].SwitchByPassState = SWITCH_BYPASS_NO;
			SwitchDataStru[switchId].SwitchBypassStartCycNum = 0u;
			SwitchDataStru[switchId].chSwitchJichaState = 0U;
			SwitchDataStru[switchId].cSwitchUsingState = SWITCH_USING_NO;
			SwitchDataStru[switchId].SwitchCollTolerateCycNum = 0U;
			SwitchDataStru[switchId].SwitchColPosition = SWITCH_POSITION_SIKAI;
			SwitchDataStru[switchId].switchFaultState = SWITCH_FAULT_STATE_YES; /*置为板卡故障*/
			/*初始化被防护锁闭的进路、保护区段、非进路数量及数组*/
			for (jj=0; jj<SWITCH_MAX_PROTECT_LOCKED_NUM;jj++)
			{
				SwitchDataStru[switchId].PLockedRouteIdArr[jj] = 0u;
				SwitchDataStru[switchId].PLockedLogRouteIdArr[jj] = 0u;
				SwitchDataStru[switchId].PLockedOverlapIdArr[jj] = 0u;
				SwitchDataStru[switchId].PLockedNonRouteIdArr[jj] = 0u;
			}
		}
	reVal = CI_SUCCESS;
	return reVal;
}

/*
* 功能描述： 初始化物理区段数据
* 参数说明： void  
* 返回值  ： 0: 初始化失败
*			 1; 初始化成功
*/
UINT8 InitialPhySectionData(void)
{
	UINT16 phySectionDataSum = 0u;					/*物理区段总数*/
	UINT16 phySectionId = 0u;						/*物理区段ID*/
	UINT16 ii = 0u;									/*游标*/
	UINT8 reVal = CI_ERROR;

	phySectionDataSum = GetTotalPhySecCurNum();/*本联锁和相邻联锁发送给本联锁的物理区段总数目*/
	 /*数值大于等于PHYSICAL_SECTION_SUM_MAX会返回0*/

	for (ii = 0u; ii < PHYSICAL_SECTION_SUM_MAX; ii++)
	{
		PhysicalSectionDataStru[ii].SecUseState = PHYSICAL_SECTION_USING_NO;
		PhysicalSectionDataStru[ii].SecUseBelongRouteId = 0u;
		PhysicalSectionDataStru[ii].SecProUseBelongRouteId = 0u;
		PhysicalSectionDataStru[ii].LockState = PHYSICAL_SECTION_LOCK_START;
		PhysicalSectionDataStru[ii].FLockState = PHYSICAL_SECTION_FLOCK_YES;
		PhysicalSectionDataStru[ii].RLockBelongRouteId = 0u;
		PhysicalSectionDataStru[ii].PLockBelongRouteId = 0u;
		PhysicalSectionDataStru[ii].OtherCiPLockBelongRouteId = 0U;
		PhysicalSectionDataStru[ii].LockDirection = 0u;
		PhysicalSectionDataStru[ii].PreOccupyState = SECTION_OCCUPY_YES;
		PhysicalSectionDataStru[ii].CurOccupyState = SECTION_OCCUPY_YES;
		PhysicalSectionDataStru[ii].PreMergeOccupyState = SECTION_OCCUPY_YES;
		PhysicalSectionDataStru[ii].CurMergeOccupyState = SECTION_OCCUPY_YES;
		PhysicalSectionDataStru[ii].PreAndMergeOccupyState = SECTION_OCCUPY_YES;
		PhysicalSectionDataStru[ii].CurAndMergeOccupyState = SECTION_OCCUPY_YES;

		PhysicalSectionDataStru[ii].CurAxleGdOccupyState = SECTION_OCCUPY_FAULT;
		PhysicalSectionDataStru[ii].CurOcGdOccupyState = SECTION_OCCUPY_FAULT;

		PhysicalSectionDataStru[ii].StopSteadyFlag = PHYSICAL_SECTION_STOPSTEADY_NO;
		PhysicalSectionDataStru[ii].SecColOccupyStartCycNum = 0u;
		PhysicalSectionDataStru[ii].SecCurOccupyStartCycNum = 0u;
		PhysicalSectionDataStru[ii].SecOccuToClearStartCycNum = 0u;
		PhysicalSectionDataStru[ii].AutoUnlockStartCycNum = 0u;
		PhysicalSectionDataStru[ii].ProtectSecLockDelayTimeFlag = PROTECTSECLOCKDELAY_NO;
		PhysicalSectionDataStru[ii].ArbState = AXIS_SECTION_ARB_NO;
		PhysicalSectionDataStru[ii].StopCheckFlag = PHYSICAL_STOPCHECK_SET_NO;
		PhysicalSectionDataStru[ii].JumpLockState = PHYSICAL_SECTION_JUMP_LOCK_NO;
		PhysicalSectionDataStru[ii].SecJumpDelayUnlockStartCycNum = 0u;
		PhysicalSectionDataStru[ii].JumpLockDelayUnlockFlag = PHYSICAL_JUMPUNLOCK_DELAY_SET_NO;
		PhysicalSectionDataStru[ii].FLockType = PHY_SEC_FLOCK_TYPE_NONE;
		PhysicalSectionDataStru[ii].UtOrCtOccFlag = SECTION_OCCUPY_YES;
		PhysicalSectionDataStru[ii].UtOrCtOccuStartCycNum = 0u;
		PhysicalSectionDataStru[ii].PhySecPreResetState = PHYSICAL_SECTION_PRE_RESET_NO;
		PhysicalSectionDataStru[ii].chPreResetBack = PHY_RESET_BACK_RECIVE_YES;
		PhysicalSectionDataStru[ii].chDirectResetRst = PHYSICAL_DIRECT_RESET_NO;
		PhysicalSectionDataStru[ii].chDirectResetBack = PHY_RESET_BACK_RECIVE_YES;
		PhysicalSectionDataStru[ii].JumpLockStateToZC = PHYSICAL_SECTION_JUMP_LOCK_NO;
		PhysicalSectionDataStru[ii].wPhyErrUnlockTime = 0U;
		PhysicalSectionDataStru[ii].cAreaUrgentBrakeState = PHYSEC_AREA_URGENT_NO;
		PhysicalSectionDataStru[ii].StopSteadyTrainId = 0U;
		PhysicalSectionDataStru[ii].chABLTrainFlag = PHYSICAL_SECTION_ABLOCCUPY_DEFAULT;
		PhysicalSectionDataStru[ii].chPreABLTrainFlag = PHYSICAL_SECTION_ABLOCCUPY_DEFAULT;
		PhysicalSectionDataStru[ii].dwAblTagSetCyc = 0U;
		PhysicalSectionDataStru[ii].cPhySecInHumidRailFlag = PHYSEC_IN_HUMID_RAIL_NO;
	}

	for (ii = 0u; ii < phySectionDataSum; ii++)
	{
		phySectionId = GetPhySecId(ii);/*获取配置文件中该索引下的物理区段ID*/

		PhysicalSectionDataStru[phySectionId].PhysicalSectionId = phySectionId;

		reVal = SetPhySecIncludeSwitch(phySectionId);
		if (CI_ERROR == reVal)
		{
			break;
		}

	}

#if 0


	/*初始化物理区段包含计轴区段数据*/

	axisSectionSum = GetAxisSecCurSum();

	for (ii = 0u; ii < axisSectionSum; ii++)
	{
		axisSectionId = GetAxisSecId(ii);	/*获取计轴区段ID*/
		phySectionId = GetAxisSecRelativePhySecId(axisSectionId);	/*获取计轴区段相关物理区段ID*/
		phySecIndex = GetPhySecConfigBufIndex(phySectionId);		/*获取相关物理区段在物理区段数据中的位置*/

		if (phySecIndex < PHYSICAL_SECTION_SUM_MAX)
		{
			/*对物理区段包含计轴区段数据进行修改*/
			if (PhysicalSectionDataStru[phySecIndex].AxisSectionSum < PHYSICAL_INCLUDE_AXIS_SUM_MAX)
			{
				jj = PhysicalSectionDataStru[phySecIndex].AxisSectionSum;
				PhysicalSectionDataStru[phySecIndex].AxisSectionIdBuf[jj] = axisSectionId;
				PhysicalSectionDataStru[phySecIndex].AxisSectionSum = jj + 1;
			}
			else
			{
				reVal = CI_ERROR;
				break;
			}
		}
	}
#endif
	reVal = CI_SUCCESS;
	return reVal;
}

/*
* 功能描述： 初始化计轴区段数据
* 参数说明： void  
* 返回值  ： 0: 初始化失败
*			 1; 初始化成功
*/
UINT8 InitialAxisSectionData(void)
{
	UINT16 axisSectionDataSum = 0u;					/*计轴区段总数*/
	UINT16 axisSectionId = 0u;						/*计轴区段ID*/
	UINT16 belongPhySecId = 0u;						/*所属物理区段ID*/
	UINT16 ii = 0u;									/*游标*/
	UINT8 reVal = CI_ERROR;

	axisSectionDataSum = GetTotalAxisCurNum();
	/*数值大于等于AXIS_SECTION_SUM_MAX会返回0*/

	for (ii = 0u; ii < axisSectionDataSum; ii++)
	{
		axisSectionId = GetAxisSecId(ii);/*获取配置文件中该索引下的计轴区段ID*/
		belongPhySecId = GetAxisSecRelativePhySecId(axisSectionId);/*获取相关物理区段ID*/

		AxisSectionDataStru[axisSectionId].AxisSectionId = axisSectionId;
		AxisSectionDataStru[axisSectionId].AxisArbState = AXIS_SECTION_ARB_NO;
		AxisSectionDataStru[axisSectionId].BelongCiId = GetPhySecBelongCiId(belongPhySecId);
		AxisSectionDataStru[axisSectionId].BelongVirCIid = GetPhySecBelongVirCiId(belongPhySecId);

		AxisSectionDataStru[axisSectionId].AxisJumpLockApplyFlag = AXIS_SECTION_JUMPLOCK_APPLY_NO;
		AxisSectionDataStru[axisSectionId].AxisJumpLockCancelApplyFlag = AXSEC_CANCEL_JUMPLOCK_APPLY_NO;
		AxisSectionDataStru[axisSectionId].AxisJumpLockApplyCylce = 0u;
		AxisSectionDataStru[axisSectionId].AxisJumpLockState = AXIS_SECTION_JUMPLOCK_STATE_IDLE;
		AxisSectionDataStru[axisSectionId].AxisOccStatus = AXIS_SECTION_OCCUPY_YES;
		AxisSectionDataStru[axisSectionId].dwAxisOccCycNum = 0U;
		AxisSectionDataStru[axisSectionId].wPosMonitorTrainId = 0U;
		AxisSectionDataStru[axisSectionId].dwUtOccupyCycNum = 0U;
		AxisSectionDataStru[axisSectionId].cAxisTXSafeLocFlag = AXIS_SECTION_SAFELOC_NO;  /*初始化计轴区段无通信车安全位置覆盖*/
	}
	reVal = CI_SUCCESS;
	return reVal;
}

/*
* 功能描述： 初始化逻辑区段数据
* 参数说明： void  
* 返回值  ： 0: 初始化失败
*			 1; 初始化成功
* mod by qw.liu 2022-03-04 增加其他成员初始化
*/
UINT8 InitialLogicSectionData(void)
{
	UINT16 logicSectionDataSum = 0u;					/*逻辑区段总数*/
	UINT16 logicSectionId = 0u;						/*逻辑区段ID*/
	UINT16 axisSectionId = 0u;						/*计轴区段ID*/
	UINT16 axisSectionDataSum = 0u;					/*计轴区段数目*/
	UINT8 axisSection_LogicSecSum = 0u;				/*计轴包含逻辑区段数目*/
	UINT16* axisSection_LogicSecIdBuf = NULL;				/*计轴包含逻辑区段ID数组*/
	UINT16 ii = 0u;									/*游标*/
	UINT16 jj = 0u;									/*游标*/
	UINT8 kk = 0u;									/*游标*/
	UINT16 zcToCiMaskSum = 0u;                     /*ZC-CI码位总数*/
	UINT8 reVal = CI_ERROR;
	UINT8 chTmcSwitch = 0u;
	UINT8 RcWorkMode = 0u;
	UINT8 dianshiLingshixiansu = 0u;
	UINT8 belongCiId = 0u;

	RcWorkMode = GetLocalRcWorkMode();		/*RC工作模式获取*/
	chTmcSwitch = GetCiFunctionSwitchConfig(FUNC_TMC_SWITCH);
	dianshiLingshixiansu = GetCiFunctionSwitchConfig(FUNC_DIANSHI_LINSHIXIANSU_FLAG);
	logicSectionDataSum = GetTotalLogSecCurNum();/*本联锁和相邻联锁发送给本联锁的逻辑区段总数目*/
	axisSectionDataSum = GetTotalAxisCurNum();
	
	if (LOGIC_SECTION_SUM_MAX <=logicSectionDataSum)
	{/*配置数据总数错误*/
		reVal = CI_ERROR;
	}
	else
	{
		reVal = CI_SUCCESS;
		for (ii = 0u; ii < logicSectionDataSum; ii++)
		{
			logicSectionId = GetLogicSecId(ii);/*获取配置文件中该索引下的逻辑区段ID*/

			LogicSectionDataStru[logicSectionId].LogicSectionId = logicSectionId;
			LogicSectionDataStru[logicSectionId].CurOccupyState = LOGICSECTION_OCCUPY_UT;
			LogicSectionDataStru[logicSectionId].PreOccupyState = LOGICSECTION_OCCUPY_UT;
			LogicSectionDataStru[logicSectionId].BelongAxisSecId = 0u;
			LogicSectionDataStru[logicSectionId].zcMaskData = 0u;
			LogicSectionDataStru[logicSectionId].maskCount = 0u;
            LogicSectionDataStru[logicSectionId].OccupyState = LOGICSECTION_OCCUPY_UT;
			LogicSectionDataStru[logicSectionId].TXOccupyState = LOGICSECTION_OCCUPY_NO_TX;		/*非通信车占用状态，m by yt 2022年5月19日*/ /*TSCI合并添加*/
			LogicSectionDataStru[logicSectionId].LogLockState = LOG_SECTION_LOCK_START;
			LogicSectionDataStru[logicSectionId].LogLockDir = 0u;
			LogicSectionDataStru[logicSectionId].LogLockBelongRoute = 0u;
			LogicSectionDataStru[logicSectionId].LogUnlockStartCycNum = 0u;
			LogicSectionDataStru[logicSectionId].wPLockBelongRouteId = 0u;
			LogicSectionDataStru[logicSectionId].OtherCiPLockBelongRouteId = 0U;
			LogicSectionDataStru[logicSectionId].chResShareFlag = LOGIC_SECTION_RES_SHARE_NO;
			LogicSectionDataStru[logicSectionId].JumpLockTrainId = 0u;
			LogicSectionDataStru[logicSectionId].LogJumpLockState = LOGIC_SECTION_JUMP_LOCK_NO;
			LogicSectionDataStru[logicSectionId].LogJumpLockDelayUnlockFlag = LOGIC_JUMPUNLOCK_DELAY_SET_NO;
			LogicSectionDataStru[logicSectionId].LogSecJumpDelayUnlockStartCyc = 0u;
			LogicSectionDataStru[logicSectionId].LogSecJumpLockPermFlag = LOGIC_JUMPUNLOCK_PERMISSIVE_NO;
			LogicSectionDataStru[logicSectionId].chXianSuRemoveState = LOGIC_XIANSU_REMOVE_NO;
			LogicSectionDataStru[logicSectionId].chTrainInfoSum = 0u;
			LogicSectionDataStru[logicSectionId].chArbState = LGC_SECTION_ARB_NO;
			LogicSectionDataStru[logicSectionId].LogErrlockStartCycNum = 0U;
			LogicSectionDataStru[logicSectionId].chLogicProResUsable = LOGIC_SECTION_PRO_RES_UNUSABLE;
			LogicSectionDataStru[logicSectionId].chLogicSpksFLockState = LOGIC_SECTION_SPKS_FLOCK_NO;/*仅用于ATS显示；逻辑区段不一定关联SPKS，如果初始化成封锁，无法获取SPKS状态，此逻辑区段会一直为封锁状态*/
			LogicSectionDataStru[logicSectionId].chAblRelLogSecUsableFlag = LOGIC_ABLNEAR_USE_FLAG_NO;		/*初始化ABL接近逻辑区段可用标志*/
			LogicSectionDataStru[logicSectionId].cRouteLeaveLogFlag = LOGSEC_LEAVE_LOGSEC_REPLY_NO;   /*离去区段ABL列车检查不通过*/
			LogicSectionDataStru[logicSectionId].chLinShiXianSuSetSpeed = 0U;		/*逻辑区段临时限速设置速度值*/
			for (jj = 0U; jj < LOGIC_SECTION_RES_SUM_MAX; jj++)
			{
				LogicSectionDataStru[logicSectionId].szTrainResData[jj].wTrainId = 0U;
				LogicSectionDataStru[logicSectionId].szTrainResData[jj].chLogicResUsable = LOGIC_SECTION_RES_UNUSABLE;
				LogicSectionDataStru[logicSectionId].szTrainResData[jj].chLogicReturnState = LOGIC_SECTION_TRAIN_RETURN_NO ;
				LogicSectionDataStru[logicSectionId].szTrainResData[jj].chTrainApplyState = LOGIC_SECTION_TRAIN_APPLY_NO;
				LogicSectionDataStru[logicSectionId].szTrainResData[jj].chLogicUnlockState = LOGIC_SECTION_TRAIN_UNLOCK_NO;
				LogicSectionDataStru[logicSectionId].szTrainResData[jj].dwRcvUnlockCmdCyc = 0U;
			}
			LogicSectionDataStru[logicSectionId].chLogSecLockBelLogRouteSum = 0U;
			for (jj = 0U; jj < LOGSEC_RELATE_ROUTE_SUM_MAX; jj++)
			{
				LogicSectionDataStru[logicSectionId].szLogSecLockBelLogRouteData[jj].wLogSecLockBelLogRouteId = 0U;
				LogicSectionDataStru[logicSectionId].szLogSecLockBelLogRouteData[jj].chLogSecLockBelLogRouteState = ROUTE_LOGICAL_STATE_IDLE;
				LogicSectionDataStru[logicSectionId].szLogSecLockBelLogRouteData[jj].wLogSecLockBelLogRouteDir = CI_SYSTEM_DIRECTION_NONE;
			}

			LogicSectionDataStru[logicSectionId].LogSecLogLockState = LOG_SECTION_LOGLOCK_NO;
		}


		if (RC_WORK_MODE_TIOC == RcWorkMode)		/*RC工作模式为TIOC工作模式*/
		{
			/* 初始化逻辑区段未设置临时限速 */
			for (ii = 0u; ii < logicSectionDataSum; ii++)
			{
				logicSectionId = GetLogicSecId(ii);
				if (FUNC_SWITCH_OFF == chTmcSwitch)
				{
					LogicSectionDataStru[logicSectionId].LinShiXianSuSetFlag = LOGSEC_LSXS_SET_STATE_NO;
				}
				else
				{
					LogicSectionDataStru[logicSectionId].LinShiXianSuSetFlag = LOGSEC_LSXS_SET_STATE_YES;
				}

			}
			/* 初始化临时限速信息 */
			SetTsrSum(0u);
			if (FUNC_SWITCH_OFF == chTmcSwitch)
			{
				SetTsrSureFlag(CI_TSR_SURE_YES);
			}
			else
			{
				SetTsrSureFlag(CI_TSR_SURE_NO);
			}
		}
		else if (RC_WORK_MODE_CI == RcWorkMode)
		{
			/*RC工作模式为联锁工作模式*/

			for (jj = 0u; jj < axisSectionDataSum; jj++)
			{
				axisSectionId = GetAxisSecId(jj);
				axisSection_LogicSecSum = GetAxisSecLogSectionSum(axisSectionId);
				axisSection_LogicSecIdBuf = GetAxisSecLogSectionIdBuf(axisSectionId);
				for (kk = 0u; kk < axisSection_LogicSecSum; kk++)
				{
					for (ii = 0u; ii < logicSectionDataSum; ii++)
					{
						logicSectionId = GetLogicSecId(ii);

						/*逻辑区段ID相等*/
						if (axisSection_LogicSecIdBuf[kk] == LogicSectionDataStru[logicSectionId].LogicSectionId)
						{
							logicSectionId = GetLogicSecId(ii);/*获取配置文件中该索引下的逻辑区段ID*/
							LogicSectionDataStru[logicSectionId].BelongAxisSecId = axisSectionId;
							break;
						}
						else
						{
							;
						}
					}
				}
			}

			/*初始化临时限速字段*/
			zcToCiMaskSum = GetReceiveMaskSum(CI_SYSTEM_TYPE_ZC);
			for (ii = 0u; ii < logicSectionDataSum; ii++)
			{
				logicSectionId = GetLogicSecId(ii);
				belongCiId = GetLogSecBelongCiId(logicSectionId);
				for (jj = 1u; jj <= zcToCiMaskSum; jj++)
				{
					if (jj < ZC_TO_CI_MASK_SUM_MAX)
					{
						if ((CI_DEVICE_TYPE_LOGICSEC == ConfigZcToCiMaskConfigDataStru[belongCiId][jj].DeviceType)
							&& (ConfigZcToCiMaskConfigDataStru[belongCiId][jj].DeviceId == logicSectionId)
							&& (MASK_TYPE_LOGICSECTION_LINSHIXIANSU_SET == ConfigZcToCiMaskConfigDataStru[belongCiId][jj].MaskType))
						{
							if (HAVE_DIANSHILINSHIXIANSU == dianshiLingshixiansu)
							{
								LogicSectionDataStru[logicSectionId].LinShiXianSuSetFlag = LOGSEC_LSXS_SET_STATE_YES;
								SetWholeLineLinShiXianSuFlag(WHOLE_LINE_LINSHIXIANSUSET_YES);/*本集中区有逻辑区段:有临时限速属性*/
							}
							else
							{
								LogicSectionDataStru[logicSectionId].LinShiXianSuSetFlag = LOGSEC_LSXS_SET_STATE_NO;
							}
							break;
						}
						else
						{
							;
						}
					}
					else
					{
						;
					}
				}
				if (jj > zcToCiMaskSum)
				{
					LogicSectionDataStru[logicSectionId].LinShiXianSuSetFlag = LOGSEC_LSXS_SET_STATE_INVALID;
				}
				else
				{
					;
				}
			}

		}
		else
		{
			reVal = CI_ERROR;
		}
	}

	return reVal;
}



/*
* 功能描述： 初始化紧急停车按钮数据
* 参数说明： void  
* 返回值  ： 0: 初始化失败
*			 1; 初始化成功
*/
UINT8 InitialEsbData(void)
{
	UINT16 esbDataSum = 0u;					/*紧急停车按钮总数*/
	UINT16 esbId = 0u;						/*紧急停车按钮ID*/
	UINT16 ii = 0u;							/*游标*/
	UINT8 reVal = CI_ERROR;

	esbDataSum = GetTotalEsbCurNum();		/*本联锁和相邻联锁发送给本联锁的ESB总数目*/
	/*数值大于等于ESB_SUM_MAX会返回0*/

	/*紧急停车按钮所属联锁ID?待处理?*/


	for (ii = 0u; ii < esbDataSum; ii++)
	{
		esbId = GetEsbId(ii);/*获取配置文件中该索引下的紧急停车按钮ID*/

		EsbDataStru[esbId].EsbId = esbId;
		EsbDataStru[esbId].EsbState = ESB_STATE_VALID_NO;
	}

	reVal = CI_SUCCESS;
	return reVal;
}

/*
* 功能描述： 初始化防淹门数据
* 参数说明： void  
* 返回值  ： 0: 初始化失败
*			 1; 初始化成功
*/
UINT8 InitialFloodGateData(void)
{
	UINT16 floodGateDataSum = 0u;					/*防淹门总数*/
	UINT16 floodGateId = 0u;						/*防淹门ID*/
	UINT16 ii = 0u;							/*游标*/
	UINT8 jj = 0U;
	UINT8 reVal = CI_ERROR;

	floodGateDataSum = GetTotalFloodGateCurSum();/*本联锁和相邻联锁发送给本联锁的防淹门总数目*/
	/*数值大于等于FLOOD_GATE_SUM_MAX会返回0*/

	for (ii = 0u; ii < floodGateDataSum; ii++)
	{
		floodGateId = GetFloodGateId(ii);

		if ((0u < floodGateId) && (FLOOD_GATE_SUM_MAX> floodGateId))
		{
			FloodGateDataStru[floodGateId].FloodGateId = floodGateId;
			FloodGateDataStru[floodGateId].CurAgreeCloseAckFromZC = FLOOD_GATE_NOT_ALLOWCLOSE_ZC;
			FloodGateDataStru[floodGateId].CurAgreeCloseStateIn = FLOOD_GATE_NOT_AGREE_CLOSE;
			FloodGateDataStru[floodGateId].CurAgreeCloseStateOut = FLOOD_GATE_NOT_AGREE_CLOSE;
			FloodGateDataStru[floodGateId].CurCloseRequestStateFromFYM = FLOOD_GATE_NOT_CLOSEREQ;
			FloodGateDataStru[floodGateId].CurOpenLockStateFromFYM = FLOOD_GATE_NOT_OPENLOCK;
			FloodGateDataStru[floodGateId].CurYGJCrossLineStartCount = 0u;/*混线开始时间置为0*/
			FloodGateDataStru[floodGateId].CurFloodGateDelayCloseStartCyc = 0u;/*防淹门接近区段占压延时关门开始时间置为0*/
			FloodGateDataStru[floodGateId].FloodGateCloseApplyIvocSum = 0u;/*防淹门关门申请列车数量置为0*/
			for (jj = 0U; jj < FLOOD_GATE_APPLY_TRAIN_SUM_MAX; jj++)
			{
				FloodGateDataStru[floodGateId].FloodGateCloseApplyIvocId[jj] = 0u;/*防淹门关门申请列车ID置为0*/
				FloodGateDataStru[floodGateId].FloodGateCloseFromIvocStru[jj].wTrainId = 0u;	/*防淹门关门回复列车ID置为0*/
				FloodGateDataStru[floodGateId].FloodGateCloseFromIvocStru[jj].wFloodGateCloseIvocFlag = FLOOD_GATE_NOT_ALLOWCLOSE_IVOC;	/*防淹门关门回复标志置为不允许*/
			}
			FloodGateDataStru[floodGateId].FloodGateAccessUTFlag = FLOOD_GATE_ACCESS_UT_YES;/*防淹门接近区段占压是否有UT占压标志*/
			FloodGateDataStru[floodGateId].FloodGateCloseAnsIvocSum = 0u;/*防淹门关门回复列车数量置为0*/
		}
		else
		{
			;
		}
	}
	reVal = CI_SUCCESS;
	return reVal;
}

/*
* 功能描述： 初始化屏蔽门数据
* 参数说明： void  
* 返回值  ： 0: 初始化失败
*			 1; 初始化成功
*/
UINT8 InitialPsdData(void)
{
	UINT16 psdDataSum = 0u;					/*屏蔽门总数*/
	UINT16 psdId = 0u;						/*屏蔽门ID*/
	UINT16 ii = 0u;							/*游标*/
	UINT8 reVal = CI_ERROR;
	UINT8 psdVirtual = 0u;
	UINT16 wPsdButtenRelayId = 0u;
	UINT16 wCleFarePCBButRelayId = 0U;/*清客确认箱关门按钮继电器ID*/

	psdDataSum = GetTotalPsdCurNum();/*本联锁和相邻联锁发送给本联锁的Psd总数目*/
	 /*数值大于等于PSD_SUM_MAX会返回0*/

	 /*屏蔽门所属联锁ID?待处理?*/

	for (ii = 0u; ii < psdDataSum; ii++)
	{
		psdId = (UINT8)GetPsdId((UINT8)ii);/*获取配置文件中该索引下的屏蔽门ID*/

		psdVirtual = GetPsdVirtualAttribute(psdId);

		PsdDataStru[psdId].PsdId = psdId;
		PsdDataStru[psdId].psdEditGroupInfo = 0u;/*psd编组信息初始化为0*/
		PsdDataStru[psdId].PsdState = PSD_STATE_OPEN;

		wPsdButtenRelayId = GetDoorButtonRelayId(psdId);
		if ((0u == wPsdButtenRelayId) || (UINT16_MAX == wPsdButtenRelayId))
		{
			PsdDataStru[psdId].DoorButtonState = PSD_BUTTON_STATE_UP;
		}
		else
		{
			PsdDataStru[psdId].DoorButtonState = PSD_RELATED_BUTTON_STATE_DEFAULT;
		}

		wPsdButtenRelayId = GetPsdReOpenRelayId(psdId);
		if ((0u == wPsdButtenRelayId) || (UINT16_MAX == wPsdButtenRelayId))
		{
			PsdDataStru[psdId].doorOpenButtonState = PSD_OPEN_BUTTON_STATE_INVALID;
		}
		else
		{
			PsdDataStru[psdId].doorOpenButtonState = PSD_RELATED_BUTTON_STATE_DEFAULT;
		}

		wPsdButtenRelayId = GetPsdDeparConfmRelayId(psdId);
		if ((0u == wPsdButtenRelayId) || (UINT16_MAX == wPsdButtenRelayId))
		{
			PsdDataStru[psdId].doorDepartButtonState = PLATFORM_DEPAR_BUTTON_STATE_INVALID;
		}
		else
		{
			PsdDataStru[psdId].doorDepartButtonState = PSD_RELATED_BUTTON_STATE_DEFAULT;
		}

		PsdDataStru[psdId].PsdDriveState = PSD_DRIVE_STATE_INVALID;
		PsdDataStru[psdId].PsdPreDriveState = PSD_DRIVE_STATE_INVALID;
		PsdDataStru[psdId].MutualLockRemoveState = PSD_MUTUALLOCK_REMOVE_NO;
		PsdDataStru[psdId].PsdButtonPangluState = PSD_RELATED_BUTTON_STATE_DEFAULT;
		/*虚拟站台门初始化关闭*/
		if (PSD_VIRTUAL_ATTR_YES == psdVirtual)
		{
			PsdDataStru[psdId].PsdState = PSD_STATE_CLOSE;
		}
		else
		{
			;
		}

		PsdDataStru[psdId].SrcVobcId = 0u;
		PsdDataStru[psdId].PsdCmd = PSD_DEFAULT_CONTROL_CMD;
		PsdDataStru[psdId].CmdSetCycle = 0u;
		PsdDataStru[psdId].CmdSetCyclePsc = 0u;

		PsdDataStru[psdId].PsdRemoraState = PSD_REMORA_NO;
		PsdDataStru[psdId].JXTCMutualLockState = JXTC_MUTUALLOCK_REMOVE_YES;
		PsdDataStru[psdId].StartDetectionCycNum = 0u;
		PsdDataStru[psdId].StartDetectionState = JXTC_START_DETECTION_NO;
		PsdDataStru[psdId].StopDetectionState = JXTC_STOP_DETECTION_YES;
		PsdDataStru[psdId].VOBCDoorState = PSD_DOOR_CLOSEDANDLOCKED_INVALID;
		PsdDataStru[psdId].PCBPressCycNum = 0u;
		PsdDataStru[psdId].POBPressCycNum = 0u;
		PsdDataStru[psdId].PSBPressCycNum = 0u;
		PsdDataStru[psdId].PscPlConfirmFlag = CI_PSC_PL_CONFIRM_NO;
		PsdDataStru[psdId].JXTCStartState = JXTC_NO_DRIVE_STATE;
		PsdDataStru[psdId].JXTCStartCycNum = 0u;
		PsdDataStru[psdId].JXTCStopState = JXTC_NO_DRIVE_STATE;
		PsdDataStru[psdId].JXTCStopCycNum = 0u;
		PsdDataStru[psdId].JXTCStartFlag = JXTC_DRIVE_START_STOP_NO;
		PsdDataStru[psdId].JXTCStopFlag = JXTC_DRIVE_START_STOP_NO;
		PsdDataStru[psdId].psdDriveOpenStartNum = 0u;
		PsdDataStru[psdId].psdDriveCloseStartNum = 0u;
		PsdDataStru[psdId].clearPassengerFlag = ATS_TO_CI_PLATFORM_QK_NO;
		PsdDataStru[psdId].steadyLightFlag = QK_BUTTON_STEADY_LIGHT_NO;

		PsdDataStru[psdId].dwCleFarePCBPressCycNum = 0U;
		/*清客确认箱PCB按钮状态初始化处理*/
		wCleFarePCBButRelayId = GetCleFarePCBButRelayId(psdId);
		if ((0u == wCleFarePCBButRelayId) || (UINT16_MAX == wCleFarePCBButRelayId))
		{
			PsdDataStru[psdId].chCleFarePCBButtonState = QK_PSD_BUTTON_STATE_UP;
			PsdDataStru[psdId].chCleFarePCBButKeepState = QK_PSD_BUTTON_STATE_UP;
		}
		else
		{
			PsdDataStru[psdId].chCleFarePCBButtonState = PSD_RELATED_BUTTON_STATE_DEFAULT;
			PsdDataStru[psdId].chCleFarePCBButKeepState = PSD_RELATED_BUTTON_STATE_DEFAULT;
		}
		/*清客确认箱PDB按钮指示灯闪灯状态初始化处理*/
		PsdDataStru[psdId].chCleFarePDBFlaLigFlag = QK_BUTTON_FLASH_LIGHT_NO;

		/*视频清客驱动状态初始化为无效。关联列车ID清0*/
		PsdDataStru[psdId].chVideoQkDriveState = VIDEO_QK_DRIVE_STATE_INVALID;
		PsdDataStru[psdId].wVideoQkRelateVobcId = 0U;

		/*屏蔽门故障隔离、被隔离、开关状态、开关门故障状态信息初始化*/
		PsdDataStru[psdId].psdFaultQStataOne = UINT32_MAX;
		PsdDataStru[psdId].psdFaultQStataTwo = UINT32_MAX;
		PsdDataStru[psdId].psdDoorIStateOne = UINT32_MAX;
		PsdDataStru[psdId].psdDoorIStateTwo = UINT32_MAX;
		PsdDataStru[psdId].psdDoorsStateOne = UINT32_MAX;
		PsdDataStru[psdId].psdDoorsStateTwo = UINT32_MAX;
		PsdDataStru[psdId].psdOpenErrState = PSD_OPEN_CLOSE_ERROR;
		PsdDataStru[psdId].psdCloseErrState = PSD_OPEN_CLOSE_ERROR;
		
		PsdDataStru[psdId].cPsdExceptOpenState = PSD_EXCEPT_OPEN_YES;  /*初始化为PSD异常打开*/
		PsdDataStru[psdId].dwPsdRelayDownCycNum = 0U;  /*PSD门关继电器落下起始周期*/
	}
	reVal = CI_SUCCESS;
	return reVal;
}

/*
* 功能描述： 初始化继电器数据
* 参数说明： void  
* 返回值  ： 0: 初始化失败
*			 1; 初始化成功
*/
UINT8 InitialRelayData(void)
{
	UINT16 relaySum = 0u;						/*继电器总数*/
	UINT16 relayId = 0u;							/*继电器ID*/
	UINT16 ii = 0u;								/*游标*/
	UINT8 belongCiId = 0u;						/*所属联锁ID*/
	UINT8 reVal = CI_SUCCESS;

	relaySum = GetRelayCurSum();
	belongCiId = GetSystemParaLocalCiId();			/*获取本地联锁ID*/
	
	if (relaySum >= RELAY_SUM_MAX)
	{/*配置数据总数错误*/
		reVal = CI_ERROR;
	}
	else
	{
		/*由于互联互通照查接口的实现，采用了虚拟继电器的方式，所以RelayDataStru数组中会存有其它联锁的继电器。类似于本CI的处理方式，其它CI继电器的ID就为RelayDataStru数组的下标。
		对于其它CI的继电器，默认初始化为DOWN是安全的。所以，目前RelayDataStru数组中包含的继电器有三种，属于本CI的真实继电器，属于本CI的虚拟继电器，属于互联互通相邻CI的虚拟继电器*/
		for (ii = 0u;ii<RELAY_SUM_MAX;ii++)
		{
			RelayDataStru[ii].RelayCollState = RELAY_STATE_DOWN;
		}

		for (ii = 0u; ii < relaySum; ii++)
		{
			relayId = GetRelayId(ii);/*获取配置文件中该索引下的继电器ID*/

			if (GetRelayBelongCiId(relayId) == belongCiId)
			{/*不负责非本联锁站的数据初始化*/
				RelayDataStru[relayId].RelayId = relayId;
				RelayDataStru[relayId].ForeNodeACollState = 0u;
				RelayDataStru[relayId].BackNodeACollState = 0u;
				RelayDataStru[relayId].ForeNodeBCollState = 0u;
				RelayDataStru[relayId].BackNodeBCollState = 0u;
				RelayDataStru[relayId].RelayCollState = RELAY_STATE_DOWN;
				RelayDataStru[relayId].RelayDriveState = RELAY_DRIVE_STATE_NULL;
				RelayDataStru[relayId].StateUpdateCycNum = 0u;
				RelayDataStru[relayId].RelayHunXianState = RELAY_HUNXIAN_STATE_NO;
				RelayDataStru[relayId].HunXianStarCycNum = 0u;
				RelayDataStru[relayId].ACollBoardState = RELAY_BOARD_FAULT_YES;
				RelayDataStru[relayId].BCollBoardState = RELAY_BOARD_FAULT_YES;
			}
		}

		/*初始化继电器采集驱动板数据*/
		reVal = ConvertRelayConfigToBoardConfig();
	}

	return reVal;
}

/*
* 功能描述： 初始化保护区段组数据
* 参数说明： void  
* 返回值  ： 0: 初始化失败
*			 1; 初始化成功
*/
UINT8 InitialOverlapData(void)
{
	UINT16 overlapSum = 0u;						/*保护区段总数*/
	UINT16 overlapId = 0u;						/*保护区段ID*/
	UINT16 ii = 0u;								/*游标*/
	UINT8 reVal = CI_SUCCESS;

	overlapSum = GetOverlapCurSum();
	
	if (overlapSum >= OVERLAP_SUM_MAX)
	{/*配置数据总数错误*/
		reVal = CI_ERROR;
	}
	else
	{
		for (ii = 0u; ii < overlapSum; ii++)
		{
			overlapId = GetOverlapId(ii);/*获取配置文件中该索引下的保护区段ID*/

			OverlapDataStru[overlapId].OverlapId = overlapId;
			OverlapDataStru[overlapId].BelongRouteId = 0u;
			OverlapDataStru[overlapId].UnlockStartCycNum = 0u;
			OverlapDataStru[overlapId].XuanPaiStartCycNum = 0u;
			OverlapDataStru[overlapId].OverlapUnlockApplyFlag = UNLOCK_OVERLAP_APPLY_NO;
			OverlapDataStru[overlapId].wOverlapUnlockApplyTrainId = 0U;
			OverlapDataStru[overlapId].dwReqIvocUnLockStartCycNum = 0U;
			OverlapDataStru[overlapId].cIvocAllowUnlockFlag = IVOC_ALLOW_UNLOCK_OVERLAP_NO;
			OverlapDataStru[overlapId].OverlapCanLaborUnlockFlag = CANNOT_LABOR_UNLOCK_OVERLAP;
			OverlapDataStru[overlapId].OverlapLaborUnlockSetState = LABOR_UNLOCK_OVERLAP_NO;
			OverlapDataStru[overlapId].laborUnlockStartCycNum = 0u;
			OverlapDataStru[overlapId].atsOrlaborLockFlag = LOCK_OVERLAP_CMD_NO;
			OverlapDataStru[overlapId].lockStartCycNum = 0u;
			OverlapDataStru[overlapId].overlapUnlockTime = 0u;
			OverlapDataStru[overlapId].laborLockOverlapCmd = LOCK_OVERLAP_CMD_NO;
			OverlapDataStru[overlapId].cProSwitchCheckResultFlag = PROSWITCH_CHECK_RESULT_DEFAULT;
			OverlapDataStru[overlapId].cProSwitchCheckStartFlag = PROSWITCH_CHECK_START_INVALID;
		}
	}
	
	return reVal;
}

/*
* 功能描述： 初始化进路数据
* 参数说明： void  
* 返回值  ： 0: 初始化失败
*			 1; 初始化成功
*/
UINT8 InitialRouteData(void)
{
	UINT16 routeSum = 0u;						/*进路总数*/
	UINT16 throughRouteId = 0u;					/*折返转通过进路ID*/
    UINT16 routeId = 0u;							/*进路ID*/
	UINT16 ii = 0u;								/*游标*/
    UINT16 jj = 0u;								/*游标*/
	UINT8 reVal = CI_SUCCESS;
	UINT8 k = 0u; /*索引*/

	routeSum = GetRouteCurSum();/*本联锁和相邻联锁发送给本联锁的进路总数目*/
    if (routeSum >= ROUTE_SUM_MAX)
    {/*配置数据总数错误*/
        reVal = CI_ERROR;
	}
	else
	{
		(void)memset(RouteDataStru,0,sizeof(RouteDataStru));
		for (ii = 0u; ii < routeSum; ii++)
		{
			routeId = GetRouteId(ii);/*获取索引下的进路ID*/

			if (routeId != 0u)
			{
				RouteDataStru[routeId].RouteId = routeId;
				RouteDataStru[routeId].RouteState = ROUTE_STATE_IDLE;/*进路空闲*/
				RouteDataStru[routeId].RoutePreLevel = ROUTE_LEVEL_BLOC;
				RouteDataStru[routeId].RouteLevel = ROUTE_LEVEL_BLOC;
				RouteDataStru[routeId].RouteLevelChangeCyc = 0U;
				RouteDataStru[routeId].AutoRouteId = 0u;
				RouteDataStru[routeId].AutoReturnId = 0u;

				RouteDataStru[routeId].XuanPaiStartCycNum = 0u;
				RouteDataStru[routeId].RouteLockStartCycNum = 0u;
				RouteDataStru[routeId].OverlapLockStartCycNum = 0u;
				RouteDataStru[routeId].RouteOpenSigStatrtCycNum = 0u;
				RouteDataStru[routeId].DelayUnlockStartCycNum = 0u;
				RouteDataStru[routeId].LeadFaultOpenStartCycNum = 0u;
				RouteDataStru[routeId].OverlapLockedId = 0u;
				RouteDataStru[routeId].ZongQuXiaoFlag = ROUTE_ZONGQUXIAO_SET_NO;
				RouteDataStru[routeId].ZongRenJieFlag = ROUTE_ZONGRENJIE_SET_NO;
				RouteDataStru[routeId].RepeatOpenFlag = ROUTE_REPEATOPEN_SET_NO;
				RouteDataStru[routeId].StopCheckFlag = ROUTE_STOPCHECK_SET_NO;
				RouteDataStru[routeId].StopKeepCheckFlag = ROUTE_STOPCHECK_SET_NO;
				RouteDataStru[routeId].BelongLongRouteId = 0u;
				RouteDataStru[routeId].ThroughRouteId = 0u;
				RouteDataStru[routeId].AllAutoReturnId = 0u;
				RouteDataStru[routeId].StopensureFlag = ROUTE_STOPENSURE_NO;
                RouteDataStru[routeId].RouteAssoSwitSingOperStat = SWITCH_SINGLE_OPERATED_FALSE;
				RouteDataStru[routeId].RouteInnerSwitDrivState = SWITCH_IN_DRIVING_FALSE;
				RouteDataStru[routeId].RouteAssocSwitDrivState = SWITCH_IN_DRIVING_FALSE;
				RouteDataStru[routeId].RouteStateFlag = ROUTE_STATE_FLAG_NO;
				RouteDataStru[routeId].TrainEnterFlag = ROUTE_TRAIN_ENTER_FLAG_NO;
				RouteDataStru[routeId].ZongRenJieDelayType = ROUTE_ZRJ_DELAY_TYPE_INVALID;
				RouteDataStru[routeId].RecoverOpenState = ROUTE_RECOVER_STA_INIT;
				RouteDataStru[routeId].TrainEnterRouteFlag = TRAIN_ENTER_ROUTE_FLAG_NO;
				RouteDataStru[routeId].atsExptLkOverlapId = 0u;
				RouteDataStru[routeId].NeedOpenNotTrueRepeatFlag = ROUTE_NEEDOPEN_REOPEN_NO;/*初始化为不重开*/
				RouteDataStru[routeId].NeedOpenNotTrueRepeatStartCount = 0u;/*需开放不满足时重开起始周期*/
				RouteDataStru[routeId].DCQState = ROUTE_DCQ_NOT_REQUEST;/*无调车请求*/
				RouteDataStru[routeId].DCTYState = ROUTE_DCT_NOT_AGREE;	/*无调车同意*/
				RouteDataStru[routeId].dwDcAgreeBtnPressCycNum = 0U; /*调车同意按钮按下起始周期*/
				RouteDataStru[routeId].chDcAgreeButtonErrState = ROUTE_DC_AGREE_BUTTON_OK; /*调车同意按钮未故障*/
				RouteDataStru[routeId].CancleDelayflag = ROUTE_ZQX_DELAY_NO;	/*取消进路无延时解锁*/
				RouteDataStru[routeId].AutoSigCancleState = AUTO_ROUTE_CANCLE_NO;	/*自动信号取消状态为无效*/
				RouteDataStru[routeId].CancleAutoSigCmd = AUTO_ROUTE_CANCLE_CMD_NO;	/*设置自动信号取消命令无效*/
				RouteDataStru[routeId].wStopEnsureTrainId = 0u;
				RouteDataStru[routeId].dwStopEnsureCyc = 0u;
				RouteDataStru[routeId].cResReqOtherCIId = 0u;
				for (k = 0u; k < ROUTE_APPLY_RECD_TRAIN_SUM_MAX; k++)
				{
					RouteDataStru[routeId].wszResReqTrainId[k] = 0u;
				}
				RouteDataStru[routeId].ITSRouteApplyTrainIdSum = 0u;
				for (k = 0u; k < ROUTE_APPLY_RECD_TRAIN_SUM_MAX; k++)
				{
					RouteDataStru[routeId].ITSRouteApplyTrainIdBuf[k] = 0u;
				}
				/*cgh-合并CID-2539-10：*/
				RouteDataStru[routeId].OverlapNeedCIlockFlag = OVERLAPCILOCK_NO;	/*保护区段联锁锁闭标志无效*/
				RouteDataStru[routeId].OverlapLockProcFlag = OVERLAP_LOCK_PROC_NO;	/*保护区段不在锁闭过程中*/
				RouteDataStru[routeId].GroupRouteCmdFlag = ROUTE_GROUPROUTE_CMD_NO;	/*进路不存在组合进路命令标志*/
				RouteDataStru[routeId].AutoTriggerFlag = AUTO_TRIGGER_SET_NO;       /*进路没有设置自动触发标志*/
				RouteDataStru[routeId].dwFirstElockStartCycNum = 0U;       /*进路第一个锁闭的逻辑区段延时设置区段故障起始周期号*/
				RouteDataStru[routeId].cRelZuHeRouteSGBJDelayFlag = ROUTE_SGBJ_DELAY_OPEN_VALID;      /*关联组合进路声光报警延时标志有效*/
				RouteDataStru[routeId].dwDelayOpenStartCycNum = 0U;        /*声光报警进路延时开放延时起始周期*/
				RouteDataStru[routeId].cRouteNeedDriveSGBJFlag = ROUTE_DRIVE_SGBJ_INVALID;      /*进路驱动声光报警标志无效*/
				RouteDataStru[routeId].cRouteDrivedSGBJFlag = ROUTE_HAS_DRIVED_SGBJ_INVALID;      /*初始化进路未驱动过声光报警*/
				RouteDataStru[routeId].chRouteNearSecSearchState = ROUTE_NEAR_SEC_HAVE_UT;      /*初始化进路接近区段查询状态为有故障车*/
				RouteDataStru[routeId].chRouteApplySwitchCheckFlag = ROUTE_APPLY_SWITCH_CHECK_DEF;      /*初始化进路办理相邻控区道岔检查标志*/
				RouteDataStru[routeId].OtherCiRecordDevID = 0U;
				RouteDataStru[routeId].OtherCiRecordDevState = 0U;
				RouteDataStru[routeId].OtherCiRecordDevType = 0U;
				RouteDataStru[routeId].OtherCiRecordErrorType = 0U;
				RouteDataStru[routeId].cRouteToLeadFlag = ROUTE_TO_LEAD_FLAG_NO;      /*初始化普通进路转引导进路标志为无效*/
			}
		}

		/*添加折返转通过进路ID*/
		for (ii = 0u; ii < routeSum; ii++)
		{
			routeId = GetRouteId(ii);/*获取配置文件中该索引下的进路ID*/

			if (routeId != 0u)
			{

				/*检查配置结构中进路的离去物理区段ID*/
				if (RouteConfigDataStru[routeId].RouteLeavePhySecId == 0u)
				{
					RouteConfigDataStru[routeId].RouteLeavePhySecId = (UINT16)0xFFFF;
				}
				/*计算进路自动信号属性生效标志*/
				if(ROUTE_AUTOSIG_PROPERTY_NO == RouteConfigDataStru[routeId].AutoSigProperty)
				{/*进路不具备自动信号属性，则自动信号属性生失效标志对其不起作用*/
					RouteDataStru[routeId].AutoSigPropertyLoseEfficacyFlag = ROUTE_AUTOSIG_LOSE_SET_INVALID;
				}
				else if(ROUTE_AUTOSIG_PROPERTY_YES == RouteConfigDataStru[routeId].AutoSigProperty)
				{/*进路具备自动信号属性，则初始化为自动信号属性生效*/
					RouteDataStru[routeId].AutoSigPropertyLoseEfficacyFlag = ROUTE_AUTOSIG_LOSE_SET_NO;
				}
				else
				{/*其他情况设置为自动信号属性生失效标志对其不起作用*/
					RouteDataStru[routeId].AutoSigPropertyLoseEfficacyFlag = ROUTE_AUTOSIG_LOSE_SET_INVALID;
				}

				/*非折返进路跳过*/
				if (ROUTE_TYPE_RETURN == GetConfigRouteType(routeId))
				{
					for (jj = 0u; jj < routeSum; jj++)
					{
						throughRouteId = GetRouteId(jj);/*获取配置文件中该索引下的进路ID*/

						/*和折返进路始终端信号机相同的通过进路*/
						if ((GetRouteStartSignalId(routeId) == GetRouteStartSignalId(throughRouteId))
							&& (GetRouteEndSignalId(routeId) == GetRouteEndSignalId(throughRouteId))
							&& (ROUTE_TYPE_LIECHE == GetConfigRouteType(throughRouteId)))
						{
							RouteDataStru[routeId].ThroughRouteId = throughRouteId;
							break;
						}
					}
				}
			}

		}
	}
	
	return reVal;
}

/*
* 功能描述： 初始化长调进路数据
* 参数说明： void  
* 返回值  ： 0: 初始化失败
*			 1; 初始化成功
*/
void InitialLongRouteData(void)
{
    UINT16 longRouteSum = 0u;					/*长调进路总数*/
    UINT16 ii = 0u;								/*游标*/
    UINT16 longRouteId = 0u;
    longRouteSum = GetLongRouteCurSum();
    
    for (ii = 0u; ii <= longRouteSum; ii++)
    {
		longRouteId = GetLongRouteId(ii);
        LongRouteDataStru[longRouteId].LongRouteId = longRouteId;
        LongRouteDataStru[longRouteId].LongRouteState = ROUTE_LONG_STATE_IDLE;/*长调进路空闲*/
        LongRouteDataStru[longRouteId].LongXuanPaiStartCycNum = 0u;
    }
 
}

/*
* 功能描述： 初始化非进路调车数据
* 参数说明： void  
* 返回值  ： 0: 初始化失败
*			 1; 初始化成功
*/
void InitialNonRouteData(void)
{
	/*NonRouteDataStru.CancelFlag = NONROUTE_CANCEL_FLAG_NO;
	NonRouteDataStru.DelayUnlockStartCycleNum = 0;
	NonRouteDataStru.HaveCancelFlag = NONROUTE_CANCEL_FLAG_NO;
	NonRouteDataStru.NonRouteState = NONROUTE_STATE_IDLE;
	NonRouteDataStru.RunMode = NONROUTE_RUN_MODE_APPLY;
	NonRouteDataStru.SigOpenStartCycleNum = 0;
	NonRouteDataStru.XuanPaiStartCycleNum = 0;*/
	UINT8 i=0u;

	NonRouteConfigDataStruct *pNonRouteCfgPtr  = NULL;

    pNonRouteCfgPtr= GetNonRouteConfigDataPtr();/*不会返回NULL*/

	for (; i<NONROUTE_ID_NUM_MAX; i++)
	{
		NonRouteConfigDataStruct *pConfig = pNonRouteCfgPtr + i;

		NonRouteDataStruArr[pConfig->NonRouteId].NonRouteId = pConfig->NonRouteId;
		NonRouteDataStruArr[pConfig->NonRouteId].CancelFlag = NONROUTE_CANCEL_FLAG_NO;
		NonRouteDataStruArr[pConfig->NonRouteId].DelayUnlockStartCycleNum = 0u;
		NonRouteDataStruArr[pConfig->NonRouteId].HaveCancelFlag = NONROUTE_CANCEL_FLAG_NO;
		NonRouteDataStruArr[pConfig->NonRouteId].NonRouteState = NONROUTE_STATE_IDLE;
		NonRouteDataStruArr[pConfig->NonRouteId].RunMode = NONROUTE_RUN_MODE_APPLY;
		NonRouteDataStruArr[pConfig->NonRouteId].SigOpenStartCycleNum = 0u;
		NonRouteDataStruArr[pConfig->NonRouteId].XuanPaiStartCycleNum = 0u;


	}
}

/*
* 功能描述： 初始化自动折返进路数据
* 参数说明： void  
* 返回值  ： 0: 初始化失败
*			 1; 初始化成功
*/
UINT8 InitialAutoReturnRouteData(void)
{
	UINT16 autoReturnRouteSum = 0u;							/*自动折返进路总数*/
	UINT16 autoReturnRouteId = 0u;							/*自动折返进路ID*/
	UINT16 ii = 0u;											/*游标*/
	UINT8 reVal = CI_ERROR;

	autoReturnRouteSum = GetAutoReturnRouteCurSum();
	
	if (autoReturnRouteSum >= AUTO_RETURN_SUM_MAX)
	{/*配置数据总数错误*/
		reVal = CI_ERROR;
	}
	else
	{
		reVal = CI_SUCCESS;
		for (ii = 0u; ii < autoReturnRouteSum; ii++)
		{
			autoReturnRouteId = GetAutoReturnRouteId(ii);/*获取配置文件中该索引下的自动折返进路ID*/

			AutoReturnDataStru[autoReturnRouteId].AutoReturnId = autoReturnRouteId;
			AutoReturnDataStru[autoReturnRouteId].AutoReturnSetFlag = AUTO_RETURN_SET_NO;
			reVal &= SetautoRouteOpposedRoute(autoReturnRouteId,ROUTE_AUTOROUTE_RETURN);
		}
	}

	return reVal;
}

/*
* 功能描述： 初始化自动通过进路数据
* 参数说明： void  
* 返回值  ： 0: 初始化失败
*			 1; 初始化成功
*/
UINT8 InitialAutoRouteRouteData(void)
{
	UINT16 autoRouteRouteSum = 0u;							/*自动通过进路总数*/
	UINT16 autoRouteRouteId = 0u;							/*自动通过进路ID*/
	UINT16 ii = 0u;											/*游标*/
	UINT8 reVal = CI_ERROR;

	autoRouteRouteSum = GetAutoRouteRouteCurSum();
	
	if (autoRouteRouteSum >= AUTO_ROUTE_SUM_MAX)
	{/*配置数据总数错误*/
		reVal = CI_ERROR;
	}
	else
	{
		reVal = CI_SUCCESS;
		for (ii = 0u; ii < autoRouteRouteSum; ii++)
		{
			autoRouteRouteId = GetAutoRouteRouteId(ii);/*获取配置文件中该索引下的自动通过进路ID*/

			AutoRouteDataStru[autoRouteRouteId].AutoRouteId = autoRouteRouteId;
			AutoRouteDataStru[autoRouteRouteId].AutoRouteSetFlag = AUTO_ROUTE_SET_NO;
			reVal &= SetautoRouteOpposedRoute(autoRouteRouteId,ROUTE_AUTOROUTE_NORMAL);
		}
	}

	return reVal;
}

/*
* 功能描述： 初始化表示灯报警灯数据
* 参数说明： void  
* 返回值  ： 0: 初始化失败
*			 1; 初始化成功
*/
UINT8 InitialIndicatorStateData(void)
{
    UINT16 configStruSum = 0u;	/*配置数据总数*/
    UINT16 indicatorId = 0u;
    UINT16 ii = 0u;
	UINT8 kk = 0u;/*游标*/
    UINT8 reVal = CI_SUCCESS;
	UINT8 j = 0u;
	UINT8 virCINum = 0u;
	UINT8 virCIid = 0u;
	UINT8 includeVirFlag= GetCiFunctionSwitchConfig(FUNC_INCLUDEVIRCI_FLAG);

 
	if(FUNC_SWITCH_ON == includeVirFlag)
	{
		/*虚拟联锁兼容*/		
		virCINum = GetVirtualCINum();
		for(j=0u;(j < virCINum)&&(j<VIRTUAL_CI_MAX);j++)
		{
			virCIid = GetVirtualCIid(j);
			configStruSum = (UINT8)GetVirCIIndicatorConfigDataNum(virCIid);
			for(kk = 0u;kk<configStruSum;kk++)
			{
				indicatorId = (UINT8)GetVirCIlocalCiIndicatorId(virCIid,kk);
				if((VIRTUAL_CI_INDICATOR_SUM_MAX > indicatorId))
				{
					g_VirtualCIStructData.virtualCi[j].IndicatorData[indicatorId].IndicatorId = indicatorId;		
					g_VirtualCIStructData.virtualCi[j].IndicatorData[indicatorId].IndicatorState = 0u;
				}	
			}	
		}	
	}
	else
	{
		configStruSum = GetIndicatorCurSum();
		if (configStruSum >= INDICATOR_SUM_MAX)
		{/*配置数据总数错误*/
			reVal = CI_ERROR;
		}
		else
		{
			for (ii = 0u; ii < configStruSum; ii++)
			{
				indicatorId = GetIndicatorId(ii);

				IndicatorDataStru[indicatorId].IndicatorId = indicatorId;
				IndicatorDataStru[indicatorId].IndicatorState = 0u;
			}
		}
	}

      
	return reVal;
}

/*
* 功能描述： 初始化通信状态数据
* 参数说明： void  
* 返回值  ： 0: 初始化失败
*			 1; 初始化成功
*/
UINT8 InitialTransmitStateData(void)
{
	UINT16 ii = 0u;													/*游标*/
    UINT16 jj = 0u;                                                  /*游标*/
    UINT8 reVal = CI_SUCCESS;

    if (TransmitRelaDataCurSum >= TRANSMIT_OBJECT_SUM_MAX)
    {/*配置数据总数错误*/
        reVal = CI_ERROR;
	}
	else
	{
		/*初始化通信状态总数*/
		TransmitStateDataCurSum = 0u;
		for (ii = 0u; ii < TransmitRelaDataCurSum; ii++)
		{
			for (jj = 0u; jj < TransmitRelaDataStru[ii].DeviceSum; jj++)
			{
				TransmitStateDataStru[TransmitStateDataCurSum].chLocalCiId = TransmitRelaDataStru[ii].CiId;
				TransmitStateDataStru[TransmitStateDataCurSum].DeviceType = TransmitRelaDataStru[ii].SystemType;
				TransmitStateDataStru[TransmitStateDataCurSum].DeviceId = TransmitRelaDataStru[ii].DeviceIdBuf[jj];
				TransmitStateDataStru[TransmitStateDataCurSum].RecvDataCycNum = 0u;
				TransmitStateDataStru[TransmitStateDataCurSum].transmitState = TRANSMIT_STATE_BAD;
				TransmitStateDataStru[TransmitStateDataCurSum].RecvDataRedCycNum = 0u;
				TransmitStateDataStru[TransmitStateDataCurSum].RecvDataBlueCycNum = 0u;
				TransmitStateDataStru[TransmitStateDataCurSum].redundantTransmitState = TRANSMIT_2OO2_STATE_BAD;
				TransmitStateDataCurSum++;
			}		
		}

		InitHlhtHeadCtx(CI_SYSTEM_TYPE_TMC);
		InitHlhtHeadCtx(CI_SYSTEM_TYPE_AXIS);
	}
	
	return reVal;
}

/*
* 功能描述： 初始化本联锁具有锁闭状态管理权的物理区段ID数组
* 参数说明： void  
* 返回值  ： 0: 初始化失败
*			 1; 初始化成功
*/
UINT8 InitialPhySecIdBufOfOtherCi(void)
{
	UINT16 routeSum = 0u;						/*进路总数*/
	UINT16 routeId = 0u;							/*进路ID*/
	UINT16 overlapSum = 0u;						/*保护区段总数*/
	UINT16 overlapId = 0u;						/*保护区段ID*/
	UINT16 ii = 0u;								/*游标*/
	UINT16 jj = 0u;
	UINT16 kk = 0u;
	UINT8 belongCiId = 0u;						/*所属联锁ID*/
	RoutePhysicalSectionStruct* routePhySecData = NULL;	/*进路包含物理区段数据*/
	UINT8 routePhySecSum = 0u;							/*进路包含物理区段数目*/
	UINT16* overlapPhySecIdBuf = NULL;					/*保护进路包含物理区段ID数组*/
	UINT8 overlapPhySecSum = 0u;							/*保护进路包含物理区段数目*/
	UINT8 phySecSum = 0u;								/*发锁闭状态的物理区段总数*/
	UINT8 reVal = CI_SUCCESS;
	UINT8 chOverlapCiId = 0U;
	routeSum = GetRouteCurSum();
	
	if (routeSum >= ROUTE_SUM_MAX)
	{/*配置数据总数错误*/
		reVal = CI_ERROR;
	}
	else
	{
		belongCiId = GetSystemParaLocalCiId();
			
		for (ii = 0u; ii < routeSum; ii++)
		{
			routeId = GetRouteId(ii);/*获取配置文件中该索引下的进路ID*/
			
			if (GetRouteBelongCiId(routeId) == belongCiId)
			{							
				routePhySecSum = GetRoutePhysicalSectionSum(routeId);/*进路包含物理区段数目*/
				routePhySecData = GetRouteSectionData(routeId);		/*进路包含物理区段数据*/

				if ((routePhySecSum == 0u) || (routePhySecData == NULL))
				{
					/*进路物理区段无数据*/
				}
				else
				{
					for (jj = 0u; jj < ((UINT16)routePhySecSum); jj++)
					{/*本联锁进路中包含其他联锁下的物理区段*/
		                
						PhySecIdBufOfOtherCi[PhySecIdBufSumhOfOtherCi] = routePhySecData[jj].PhysicalSectionId;
						PhySecIdBufSumhOfOtherCi++;	
					}
				}									
			}		
			

		}

		overlapSum = GetOverlapCurSum();
		
		if (overlapSum >= OVERLAP_SUM_MAX)
		{/*配置数据总数错误*/
			reVal = CI_ERROR;
		}
		else
		{
			for (ii = 0u; ii < overlapSum; ii++)
			{
				overlapId = GetOverlapId(ii);/*获取配置文件中该索引下的OverlapID*/
				chOverlapCiId = GetOverlapBelongCiId(overlapId);
				if (chOverlapCiId == belongCiId)
				{							

					overlapPhySecSum = GetOverlapPhySecSum(overlapId);			/*保护进路包含物理区段数目*/
					overlapPhySecIdBuf = GetOverlapPhySecIdBuf(overlapId);		/*保护进路包含物理区段ID数组*/
					for (jj = 0u; jj < ((UINT16)overlapPhySecSum); jj++)
					{/*本联锁进路中包含其他联锁下的物理区段*/

						PhySecIdBufOfOtherCi[PhySecIdBufSumhOfOtherCi] = overlapPhySecIdBuf[jj];
						PhySecIdBufSumhOfOtherCi++;	
					}									
				}		
			}

			/*清除重复的物理区段*/
			phySecSum = PhySecIdBufSumhOfOtherCi;
			for (ii = 0u; ii < ((UINT16)PhySecIdBufSumhOfOtherCi); ii++)
			{
				for (jj = ii + 1u; jj < ((UINT16)PhySecIdBufSumhOfOtherCi); jj++)
				{
					if (PhySecIdBufOfOtherCi[ii] == PhySecIdBufOfOtherCi[jj])
					{/*存在重复物理区段*/

						/*清除重复物理区段*/
						for (kk = jj; kk < ((UINT16)PhySecIdBufSumhOfOtherCi); kk++)
						{
							PhySecIdBufOfOtherCi[kk] = PhySecIdBufOfOtherCi[kk + 1U];
						}

						PhySecIdBufSumhOfOtherCi = PhySecIdBufSumhOfOtherCi - 1U;/*修改物理区段总数*/
					}
				}
			}
		}	
	}
	
	
	return reVal;
}

/*
* 功能描述：重置联锁设备动态数据
* 参数说明：const UINT8 ciId, 重置联锁ID
* 返回值  ： void
*/
void ResetDynamicState(const UINT8 ciId)
{
	UINT16 ii = 0u;
	UINT16 devId = 0u;/*不对Id进行清除，清除Id后则设备Id为其他设备属性还存在，Id为静态属性，一旦设置为0后就不能更改*/
	UINT16 devLen = 0u;
	UINT8 devState = 0u;
	UINT16 throughRtId = 0u;
	UINT16 OverlapLockedId = 0u;
	UINT16 logicSectionDataSum = 0u;					/*逻辑区段总数*/
	UINT16 logicSectionId = 0u;						/*逻辑区段ID*/
	UINT8 belongCiId = 0u;
	UINT16 phyId = 0u;
	UINT8 neighbourSignalDetainDrive = 0u;/*邻站信号机扣车驱动命令*/

	UINT16 floodGateId = 0u;/*防淹门Id*/
	UINT16 floodGateSum = 0u;/*防淹门数量*/

	UINT8 phyBelongCi = 0u;
	UINT16 phySecRepGj = 0u;/*物理区段复视轨道继电器*/
	UINT16 phySecRepGjBelongCi = 0u;/*物理区段复视GJ所属联锁*/
	UINT16 routeBelongCi = 0u;
	UINT8 commState = 0u;/*通信状态*/
	UINT8 psdVirtual = 0u;
	/*相邻联锁是否支持继电接口*/
	UINT8 funcSwitchSupportRelayInterface = GetCiFunctionSwitchConfig(FUNC_SWITCH_USE_RELAY_INTERFACE_BETWEEN_NEIGHBOURCI);
	UINT8 localCi = GetSystemParaLocalCiId();/*本机联锁*/
	UINT8 confirmRelayInterfaceFlag = GetCiCiRelayInterfConfirmFlag();/*继电接口确认状态*/
	UINT16 wCfpSum = 0u;
	UINT16 wCfpId = 0u;
	UINT16 wCfpOtherCiid = 0U; /*分界点关联的相邻联锁ID*/
	UINT8 chOverlapCiId = 0u;
	UINT32 dwCurCyc = Get2oo2CurCycleNum();
	UINT8 chSearchCiId = 0U;/*查询到的联锁ID*/
	UINT8 chRouteSwitchBelCiCheck = 0U;/*进路道岔是否全部属于进路所在联锁检查*/
	UINT8 chRouteStateFlag = 0U;
	UINT8 chOthCiRouteExistLocalCiSw = 0U;/*其他控区进路是否存在本控区道岔*/
	UINT8 cOverlapRelProSwNum = 0U;  /*保护区段关联的防护道岔数量*/
	OverlapProtectSwitchStruct* pOverlapRelProSwStru = NULL;  /*保护区段关联的防护道岔信息*/
	UINT8 jj = 0U;


    /*重置非本联锁道岔动态数据*/
	for(ii = 1u; ii < SWITCH_SUM_MAX; ii++)
	{
      
		devId = (ii);
	    devLen = (UINT16)sizeof(SwitchDataStruct);
	    if(GetSwitchBelongCiId(devId) == ciId)
   	    {
   	        /*非本联锁*/
			SwitchDataStru[devId].SwitchId = devId;
			
			SwitchDataStru[devId].YLockState = SWITCH_LOCK_YINZONG_NO;
			SwitchDataStru[devId].LockStatus = SWITCH_LOCK_STATUS_NO;
			SwitchDataStru[devId].FLockState = SWITCH_LOCK_FENGSUO_NO;
			SwitchDataStru[devId].SwitchPrePosition = SWITCH_POSITION_SIKAI;
			SwitchDataStru[devId].SwitMoveStartCycNum = 0u;
			SwitchDataStru[devId].chSwitchDrivedFlag = SWITCH_DRIVED_FLAG_NO;
			SwitchDataStru[devId].ConnetSwitchDsState = CONNECT_SWITCH_DANSUO_NO;
			SwitchDataStru[devId].SwitchByPassState = SWITCH_BYPASS_NO;
			SwitchDataStru[devId].chSwitchJichaState = 0U;

			SwitchDataStru[devId].SwitchCurPosition = SWITCH_POSITION_JICHA;		/*道岔当前位置*/
			SwitchDataStru[devId].SingleSwitchCurPosition = SWITCH_POSITION_JICHA;	/*单独道岔当前位置*/
			SwitchDataStru[devId].SwitchDanCaoPostition = SWITCH_POSITION_INVALID; /*单操位置置为无效*/
			SwitchDataStru[devId].cSwitchUsingState = SWITCH_USING_NO;  /*征用状态重置为未征用*/
			SwitchDataStru[devId].UsingBelongOverlapId = 0U;  /*征用所属保护区段ID重置为0*/
			SwitchDataStru[devId].SwitchCollTolerateCycNum = 0U; /*不使用容忍*/
			SwitchDataStru[devId].SwitchColPosition = SWITCH_POSITION_SIKAI;
			SwitchDataStru[devId].switchFaultState = SWITCH_FAULT_STATE_YES; /*置为板卡故障*/
   	    }
	}

	/*重置非本联锁物理区段动态数据*/
	for(ii = 1u; ii < PHYSICAL_SECTION_SUM_MAX; ii++)
	{
	   
	    devId = (ii);
		devLen = (UINT16)sizeof(PhysicalSectionDataStruct);
	    if(GetPhySecBelongCiId(devId) == LocalCiId)
   	    {
			if((0u !=PhysicalSectionDataStru[ii].RLockBelongRouteId) &&(ciId == GetRouteBelongCiId(PhysicalSectionDataStru[ii].RLockBelongRouteId)) )
			{
				PhysicalSectionDataStru[ii].LockState = PHYSICAL_SECTION_LOCK_EXCEPT;
			}
   	    }
	    else if(GetPhySecBelongCiId(devId) == ciId)
   	    {
			/*非本联锁*/
			phyBelongCi = GetPhySecBelongCiId(PhysicalSectionDataStru[ii].PhysicalSectionId);
			phySecRepGj = GetPhySecRepGdRelayId(PhysicalSectionDataStru[ii].PhysicalSectionId);
			phySecRepGjBelongCi = GetRelayBelongCiId(phySecRepGj);/*获取复视轨道继电器所属联锁*/
			commState = GetLocalCiAndOtherCiTransSta(phyBelongCi);/*本联锁与其它联锁通信通信状态*/


			/* 如果物理区段锁闭或者防护锁闭或者延时解锁或者区段故障时，如果锁闭的是本联锁，则不变，其他联锁异常锁闭
			 */
			if((0u !=PhysicalSectionDataStru[ii].RLockBelongRouteId) &&(LocalCiId != GetRouteBelongCiId(PhysicalSectionDataStru[ii].RLockBelongRouteId)) )
			{
				PhysicalSectionDataStru[ii].LockState = PHYSICAL_SECTION_LOCK_EXCEPT;
			}
						
		   	PhysicalSectionDataStru[ii].FLockState = PHYSICAL_SECTION_FLOCK_YES;
			PhysicalSectionDataStru[ii].SecUseBelongRouteId = 0u;
			PhysicalSectionDataStru[ii].SecProUseBelongRouteId = 0u;
			PhysicalSectionDataStru[ii].SecUseState = PHYSICAL_SECTION_USING_NO;
			PhysicalSectionDataStru[ii].StopSteadyFlag = PHYSICAL_SECTION_STOPSTEADY_NO;
			PhysicalSectionDataStru[ii].chABLTrainFlag = PHYSICAL_SECTION_ABLOCCUPY_YES;
			PhysicalSectionDataStru[ii].chPreABLTrainFlag = PHYSICAL_SECTION_ABLOCCUPY_NO;
			PhysicalSectionDataStru[ii].dwAblTagSetCyc = dwCurCyc;
			SetPhySecUTTrainFlag(PhysicalSectionDataStru[ii].PhysicalSectionId, PHYSICAL_AXIS_UT_YES); /*物理区段坏车占用标志设置*/

			if ((localCi !=phyBelongCi) && (TRANSMIT_STATE_BAD == commState) && 
				(localCi ==phySecRepGjBelongCi)&&
				(CICI_RELAY_INTERFACE_CONFIRM_YES == confirmRelayInterfaceFlag)&&
				(FUNC_SWITCH_ON == funcSwitchSupportRelayInterface))
			{
				/*如果物理区段所属联锁与本联锁不同，但物理区段复视轨道继电器所属联锁为本联锁，
					且本联锁与该联锁通信中断，且运营人员已下发确认继电接口命令，
					且已配置支持继电接口，则可以不设置占用*/
			}
			else
			{
				PhysicalSectionDataStru[ii].PreMergeOccupyState = SECTION_OCCUPY_YES;
				PhysicalSectionDataStru[ii].CurMergeOccupyState = SECTION_OCCUPY_YES;
				PhysicalSectionDataStru[ii].PreAndMergeOccupyState = SECTION_OCCUPY_YES;
				PhysicalSectionDataStru[ii].CurAndMergeOccupyState = SECTION_OCCUPY_YES;
				PhysicalSectionDataStru[ii].PreOccupyState = SECTION_OCCUPY_YES;
				PhysicalSectionDataStru[ii].CurOccupyState = SECTION_OCCUPY_YES;
			}

			PhysicalSectionDataStru[ii].ArbState = AXIS_SECTION_ARB_NO;
			PhysicalSectionDataStru[ii].JumpLockState = PHYSICAL_SECTION_JUMP_LOCK_NO;
			PhysicalSectionDataStru[ii].FLockType = PHY_SEC_FLOCK_TYPE_NONE;
			PhysicalSectionDataStru[ii].JumpLockStateToZC = PHYSICAL_SECTION_JUMP_LOCK_NO;
			PhysicalSectionDataStru[ii].wPhyErrUnlockTime = 0U;

			PhysicalSectionDataStru[ii].PhySecPreResetState = PHYSICAL_SECTION_PRE_RESET_NO;
			PhysicalSectionDataStru[ii].chPreResetBack = PHY_RESET_BACK_RECIVE_YES;
			PhysicalSectionDataStru[ii].chDirectResetRst = PHYSICAL_DIRECT_RESET_NO;
			PhysicalSectionDataStru[ii].chDirectResetBack = PHY_RESET_BACK_RECIVE_YES;
   	    }
		else
		{
			/* 不是指定联锁，则不处理 */
		}

	}

	logicSectionDataSum = GetTotalLogSecCurNum();/*本联锁和相邻联锁发送给本联锁的逻辑区段总数目*/
	/*重置非本联锁逻辑区段动态数据*/
	for(ii = 0u; ii < logicSectionDataSum; ii++)
	{	    
		logicSectionId = GetLogicSecId(ii);/*获取配置文件中该索引下的逻辑区段ID*/
		belongCiId = GetLogSecBelongCiId(logicSectionId);
		
		phyId = GetLgcSecRelativePhySecId(logicSectionId);
		
		/*非本联锁*/
		phyBelongCi = GetPhySecBelongCiId(phyId);
		phySecRepGj = GetPhySecRepGdRelayId(phyId);
		phySecRepGjBelongCi = GetRelayBelongCiId(phySecRepGj);/*获取复视轨道继电器所属联锁*/
		commState = GetLocalCiAndOtherCiTransSta(phyBelongCi);/*本联锁与其它联锁通信通信状态*/

		/*逻辑区段属于本联锁*/
		if(belongCiId == LocalCiId)
		{
			/*锁闭所属进路非0*/
			if(0u != LogicSectionDataStru[logicSectionId].LogLockBelongRoute)
			{
				routeBelongCi = GetRouteBelongCiId(LogicSectionDataStru[logicSectionId].LogLockBelongRoute);
				/*进路属于相邻联锁*/
				if(routeBelongCi == ciId)
				{
					LogicSectionDataStru[logicSectionId].LogLockState = LOG_SECTION_LOCK_EXCEPT;
				}
			}

		}
		else if(belongCiId == ciId)
   	    {
			
			/*锁闭所属进路非0*/
			if(0u != LogicSectionDataStru[logicSectionId].LogLockBelongRoute)
			{
				routeBelongCi = GetRouteBelongCiId(LogicSectionDataStru[logicSectionId].LogLockBelongRoute);
				/*进路属于相邻联锁*/
				if(routeBelongCi != LocalCiId)
				{
					LogicSectionDataStru[logicSectionId].LogLockState = LOG_SECTION_LOCK_EXCEPT;
				}
			}

			if (LOG_SECTION_LOGLOCK_NORMAL == LogicSectionDataStru[logicSectionId].LogSecLogLockState)
			{
				LogicSectionDataStru[logicSectionId].LogSecLogLockState = LOG_SECTION_LOGLOCK_EXCEPT;  /*与相邻联锁断通信，将相邻联锁逻辑正常锁闭的逻辑区段置为逻辑异常锁闭*/
			}

			if ((localCi !=phyBelongCi) && (TRANSMIT_STATE_BAD == commState) && 
				(localCi ==phySecRepGjBelongCi)&&
				(CICI_RELAY_INTERFACE_CONFIRM_YES == confirmRelayInterfaceFlag)&&
				(FUNC_SWITCH_ON == funcSwitchSupportRelayInterface))
			{
				/*如果物理区段所属联锁与本联锁不同，但物理区段复视轨道继电器所属联锁为本联锁，
					且本联锁与该联锁通信中断，且运营人员已下发确认继电接口命令，
					且已配置支持继电接口，则可以不设置占用*/
			}
			else
			{
   				/*非本联锁*/
				/* 内部优化 20220421 wqm 修改宏值SECTION_OCCUPY_YES为LOGICSECTION_OCCUPY_UT */
				LogicSectionDataStru[logicSectionId].PreOccupyState = LOGICSECTION_OCCUPY_UT;
				LogicSectionDataStru[logicSectionId].CurOccupyState = LOGICSECTION_OCCUPY_UT;
				LogicSectionDataStru[logicSectionId].OccupyState = LOGICSECTION_OCCUPY_UT;					/*占用状态*/
				LogicSectionDataStru[logicSectionId].TXOccupyState = LOGICSECTION_OCCUPY_NO_TX;    /*TSCI合并添加 20221208-lc*/
			}
			/*逻辑区段：占用、设置临时限速、未ARB*/
			LogicSectionDataStru[logicSectionId].LinShiXianSuSetFlag= LOGSEC_LSXS_SET_STATE_YES;  /*逻辑区段临时限速设置状态*/
			LogicSectionDataStru[logicSectionId].chLinShiXianSuSetSpeed = 0U;  /*逻辑区段临时限速设置速度值*/
			LogicSectionDataStru[logicSectionId].chXianSuRemoveState = LOGIC_XIANSU_REMOVE_NO;
			LogicSectionDataStru[logicSectionId].chArbState = LGC_SECTION_ARB_NO;		/* 设置未ARB */
			LogicSectionDataStru[logicSectionId].chAblRelLogSecUsableFlag = LOGIC_ABLNEAR_USE_FLAG_NO;
			LogicSectionDataStru[logicSectionId].cRouteLeaveLogFlag = LOGSEC_LEAVE_LOGSEC_REPLY_NO;   /*离去区段ABL列车检查不通过*/
			LogicSectionDataStru[logicSectionId].chLogicProResUsable = LOGIC_SECTION_PRO_RES_UNUSABLE;
   	    }
		else
		{
			/*不做处理*/
		}
	}

	/*重置非本联锁信号机动态数据*/
	for(ii = 1u; ii < SIGNAL_SUM_MAX; ii++)
	{
		devId = (ii);
	    devLen = (UINT16)sizeof(SignalDataStruct);
	    if(GetSignalBelongCiId(devId) == ciId)
   	    {
			neighbourSignalDetainDrive = GetSignalNeighbourDetainDrive(devId);/*这个不能清*/
   	        /*非本联锁*/
		    (void)memset(&SignalDataStru[ii], 0 ,devLen);

			SignalDataStru[devId].SignalId = devId;
			SignalDataStru[devId].NeighbourSignalDetainDrive = neighbourSignalDetainDrive;
			/*信号机状态：红闪+封锁+信号机临时限速  扣车：车站和中心同时扣车*/
			SetSignalFLockState(devId, SIGNAL_FENGSUO_YES);						/*设置信号机封锁状态*/
			SignalDataStru[devId].CurColor = SIGNAL_SHOWCOLOUR_REDBREAK;		/*设置信号机红断 红闪*/
			SetSignalLinShiXianSuSetFlag(devId, SIGNAL_LINSHIXIANSUSET_STATE_YES);	/*设置信号机临时限速*/
			SetSignalDetainState(devId, SIGNAL_DETAIN_YES);							/*设置信号机扣车*/
			SetSignalRelayDetainFlag(devId, SIGNAL_RELAY_DETAIN_YES);				/*设置信号机硬线扣车状态*/
			SetSignalDetainBtnActFlag(devId, SIGNAL_ZFS_BTN_ACT_FLAG_YES);          /*设置信号机扣车按钮有效状态*/
			/*由于互联互通需判断保护区段的有效性，而自家CI的相邻CI不会判断。为了保证改动量最小，所以对于非互联互通信号机，其保护区段有效性一直设置为有效，不影响逻辑*/
			SetSignalProSecValid(devId,SIGNAL_PRO_SEC_VALID);
			SetDetCutBtnState(devId, SIGNAL_DETAIN_CUT_VALID_NO);
   	    }
	}

	/*重置非本联锁屏蔽门动态数据*/
	for(ii = 1u; ii < PSD_SUM_MAX; ii++)
	{
	   
		devId = (ii);
	    devLen = (UINT16)sizeof(PsdDataStruct);
	    if(GetPsdBelongCiId(devId) == ciId)
   	    {
   	        /*非本联锁*/
		    (void)memset(&PsdDataStru[ii], 0 ,devLen);
			PsdDataStru[devId].PsdId = devId;
			/*屏蔽门状态：门开+未互锁解除*/
			PsdDataStru[devId].PsdState = PSD_STATE_OPEN;
			psdVirtual = GetPsdVirtualAttribute(devId);
			if (PSD_VIRTUAL_ATTR_YES == psdVirtual)
			{
				PsdDataStru[devId].PsdState = PSD_STATE_CLOSE;
			}
			PsdDataStru[devId].MutualLockRemoveState = PSD_MUTUALLOCK_REMOVE_NO;
			PsdDataStru[devId].cPsdExceptOpenState = PSD_EXCEPT_OPEN_YES;  /*重置为PSD异常打开*/
   	    }
	}

	/*重置非本联锁紧急停车按钮动态数据*/
	for(ii = 1u; ii < ESB_SUM_MAX; ii++)
	{
	    
		devId = (ii);
	    devLen = (UINT16)sizeof(EsbDataStruct);
	    if(GetEsbBelongCiId(devId) == ciId)
   	    {
   	        /*非本联锁*/
		 (void)memset(&EsbDataStru[ii], 0 ,devLen);
		 EsbDataStru[devId].EsbId = devId;
		 /*ESB状态：按下*/
		 (void)SetEsbState(devId,ESB_STATE_VALID_YES);	/*紧急有效*/
   	    }
	}

	/*重置非本联锁进路动态数据*/
	for (ii = 1u; ii < ROUTE_SUM_MAX; ii++)
	{

		devId = (ii);
		devLen = (UINT16)sizeof(RouteDataStruct);
		belongCiId = GetRouteBelongCiId(devId);
		devState = RouteDataStru[ii].RouteState;
	
		if (ciId == belongCiId)
		{
			/*非本联锁
			保护区段的锁闭与解锁是由保护区段所属联锁来办理(办理依据:对方联锁传来的进路状态，前提
			为对方联锁办理的进路防护区段在本联锁)
			保留相邻联锁进路状态信息是为了在双方通信中断后，保护区段的处理策略和以前一致。
			防止通信中断后误解保护区段。

			* 修改：在进路空闲等状态下。通信中断需要进路置成安全状态
			* 修改20160511：增加自动解锁正常、自动解锁异常两种进路状态不置安全态，
			当进路状态为自动解锁正常、自动解锁异常置安全态后，进路的保护区段无法解锁
			* 修改：保留进路状态，避免空闲进路清零后，本联锁始端信号机为终端信号机的折返进路状态非法
			*/
			throughRtId = GetRouteThroughRouteId(devId);
			OverlapLockedId = GetRouteOverlapLockedId(devId);
			if ((devState != ROUTE_STATE_XUANPAI) &&
				(devState != ROUTE_STATE_LEAD_XUANPAI) &&
				(devState != ROUTE_STATE_FIRST_LOCK) &&
				(devState != ROUTE_STATE_FIRST_LOCKERR) &&
				(devState != ROUTE_STATE_YUXIAN_OPEN) &&
				(devState != ROUTE_STATE_YUXIAN_LOCK) &&
				(devState != ROUTE_STATE_NEAR_OPEN) &&
				(devState != ROUTE_STATE_NEAR_LOCK) &&
				(devState != ROUTE_STATE_NEAR_LOCKERR) &&
				(devState != ROUTE_STATE_AUTO_UNLOCK) &&
				(devState != ROUTE_STATE_AUTO_UNLOCKERR) &&
				(devState != ROUTE_STATE_DELAY_UNLOCK))
			{
				(void)memset(&RouteDataStru[ii], 0, devLen);
				RouteDataStru[devId].RouteId = devId;
				RouteDataStru[devId].RouteState = devState;
				RouteDataStru[devId].ThroughRouteId = throughRtId;
				RouteDataStru[devId].OverlapLockedId = OverlapLockedId;
			}
			else
			{
				;
			}
		}
		else
		{
			; /*其他控区不处理*/
		}

		/*以下状态追踪办理标志都不会清除，所以可以获取使用*/
		chRouteStateFlag = RouteDataStru[ii].RouteStateFlag;

		if ((ROUTE_STATE_XUANPAI == devState)
			|| (((ROUTE_STATE_AUTO_UNLOCK == devState) || (ROUTE_STATE_AUTO_UNLOCKERR == devState)) && (ROUTE_STATE_FLAG_YES == chRouteStateFlag))
			|| (ROUTE_STATE_LEAD_XUANPAI == devState))
		{
			if (ciId == belongCiId)
			{
				chOthCiRouteExistLocalCiSw = GetOthCiRouteExistLocalCiSw(devId);
				if (0U != chOthCiRouteExistLocalCiSw)
				{
					/*和进路所在联锁通信中断，设置进路办理道岔检查标志不通过*/
					SetRouteApplySwitchCheckFlag(devId, ROUTE_APPLY_SWITCH_CHECK_NO);
				}
				else
				{
					/*无道岔不处理*/
					;
				}
				
			}
			else if (localCi == belongCiId)
			{
				chRouteSwitchBelCiCheck = CheckRouteSwitchBelCi(devId, &chSearchCiId);
				if (CI_SUCCESS == chRouteSwitchBelCiCheck)
				{
					/*道岔完全本控区，检查防护道岔*/
					chRouteSwitchBelCiCheck = CheckRouteProSwitchBelCi(devId, &chSearchCiId);
					if (CI_SUCCESS == chRouteSwitchBelCiCheck)
					{
						/*防护道岔完全本控区*/
						;
					}
					else
					{
						/*有防护道岔在其它对应控区*/
						if ((ciId == chSearchCiId) && (0U != chSearchCiId))
						{
							SetRouteApplySwitchCheckFlag(devId, ROUTE_APPLY_SWITCH_CHECK_NO);
						}
						else
						{
							; /*不是和防护道岔所在联锁中断，不处理*/
						}
					}
				}
				else
				{
					/*有道岔在其它对应控区*/
					if ((ciId == chSearchCiId) && (0U != chSearchCiId))
					{
						SetRouteApplySwitchCheckFlag(devId, ROUTE_APPLY_SWITCH_CHECK_NO);
					}
					else
					{
						; /*不是和道岔所在联锁中断，不处理*/
					}
				}
			}
			else
			{
				; /*其他控区不处理*/
			}
		}
		else
		{
			; /*不处理*/
		}

	}
	for (ii = 1u; ii < SPKS_SUM_MAX; ii ++)
	{
		devId = (ii);
		devLen = (UINT16)sizeof(SpksDataStruct);
		if(GetSpksBelongCiId(devId) == ciId)
		{
			/*非本联锁*/
			spksDataBuff[devId].status = SPKS_STATUS_YES;	/*SPKS状态：按下*/
			spksDataBuff[devId].cutStatus = SPKS_CUT_NO;	/*SPKS旁路状态：未按下*/
		}
	}
	/*重置相邻联锁继电器状态*/
	for (ii = 0u; ii < RELAY_SUM_MAX; ii ++)
	{
		devId = (ii);
		devLen = (UINT16)sizeof(RelayDataStruct);
		if(ciId == dquCICfgDtStr.RelayCfgDtStr[devId].BelongCiId)
		{
			/*非本联锁*/
			SetRelayCollState(dquCICfgDtStr.RelayCfgDtStr[devId].RelayId,RELAY_STATE_DOWN);/*虚拟照查继电器采集状态：落下。*/
		}
	}

	/*重置相邻联锁防淹门状态*/
	floodGateSum = GetTotalFloodGateCurSum();
	for (ii=0u;ii<floodGateSum;ii++)
	{
		floodGateId = GetFloodGateId(ii);
		belongCiId = GetFloodGateBelongCiId(floodGateId);
		if ((belongCiId == ciId) && (floodGateId > 0u) && (floodGateId < FLOOD_GATE_SUM_MAX))
		{
			FloodGateDataStru[floodGateId].CurAgreeCloseAckFromZC = FLOOD_GATE_NOT_ALLOWCLOSE_ZC;
			FloodGateDataStru[floodGateId].CurAgreeCloseStateIn = FLOOD_GATE_NOT_AGREE_CLOSE;
			FloodGateDataStru[floodGateId].CurAgreeCloseStateOut = FLOOD_GATE_NOT_AGREE_CLOSE;
			FloodGateDataStru[floodGateId].CurCloseRequestStateFromFYM = FLOOD_GATE_NOT_CLOSEREQ;
			FloodGateDataStru[floodGateId].CurOpenLockStateFromFYM = FLOOD_GATE_NOT_OPENLOCK;
			FloodGateDataStru[floodGateId].CurYGJCrossLineStartCount = 0u;/*混线开始时间置为0*/
		}
	}

	/*重置非本联锁保护区段动态数据*/
	for(ii = 1u; ii < OVERLAP_SUM_MAX; ii++)
	{
		devId = (ii);
		devLen = (UINT16)sizeof(OverlapDataStruct);
		chOverlapCiId = GetOverlapBelongCiId(devId);
		if((chOverlapCiId == ciId) && (devId > 0u) && (devId < OVERLAP_SUM_MAX))
		{
			OverlapDataStru[devId].BelongRouteId = 0u;
			OverlapDataStru[devId].UnlockStartCycNum = 0u;
			OverlapDataStru[devId].XuanPaiStartCycNum = 0u;
			OverlapDataStru[devId].OverlapUnlockApplyFlag = UNLOCK_OVERLAP_APPLY_NO;
			OverlapDataStru[devId].wOverlapUnlockApplyTrainId = 0U;
			OverlapDataStru[devId].dwReqIvocUnLockStartCycNum = 0U;
			OverlapDataStru[devId].cIvocAllowUnlockFlag = IVOC_ALLOW_UNLOCK_OVERLAP_NO;
			OverlapDataStru[devId].OverlapCanLaborUnlockFlag = CANNOT_LABOR_UNLOCK_OVERLAP;
			OverlapDataStru[devId].OverlapLaborUnlockSetState = LABOR_UNLOCK_OVERLAP_NO;
			OverlapDataStru[devId].laborUnlockStartCycNum = 0u;
			OverlapDataStru[devId].atsOrlaborLockFlag = LOCK_OVERLAP_CMD_NO;
			OverlapDataStru[devId].lockStartCycNum = 0u;
			OverlapDataStru[devId].overlapUnlockTime = 0u;
			OverlapDataStru[devId].laborLockOverlapCmd = LOCK_OVERLAP_CMD_NO;
			OverlapDataStru[devId].cProSwitchCheckResultFlag = PROSWITCH_CHECK_RESULT_INVALID;
			OverlapDataStru[devId].cProSwitchCheckStartFlag = PROSWITCH_CHECK_START_INVALID;
		}
		else if ((chOverlapCiId == localCi) && (devId > 0U) && (devId < OVERLAP_SUM_MAX))
		{
			cOverlapRelProSwNum = GetOverlapRelatedProtSwitSum(devId);  /*获取保护区段关联的防护道岔信息*/
			pOverlapRelProSwStru = GetOverlapRelatedProtSwitStru(devId);

			if ((0U != cOverlapRelProSwNum) && (NULL != pOverlapRelProSwStru))
			{
				for (jj = 0U; jj < cOverlapRelProSwNum; jj++)
				{
					belongCiId = GetSwitchBelongCiId(pOverlapRelProSwStru[jj].ProtectSwitchId);
					if (ciId == belongCiId)
					{
						if (PROSWITCH_CHECK_START_VALID == OverlapDataStru[devId].cProSwitchCheckStartFlag)
						{
							/*保护区段处于锁闭中，则清除防护道岔检查结果标志为0x55失败，在保护区段锁闭检查时，将因为条件不满足又会把该标志转为0xFF默认值*/
							OverlapDataStru[devId].cProSwitchCheckResultFlag = PROSWITCH_CHECK_RESULT_INVALID;
						}
						else
						{
							/*保护区段不在锁闭中，不能清除防护道岔检查结果标志，否则防护道岔检查结果标志无法回到0xFF状态*/
						}
						break;
					}
					else
					{
						/*非对方控区道岔，不重置防护道岔检查结果标志*/
					}
				}
			}
			else
			{
				/*无防护道岔，不重置防护道岔检查结果标志*/
			}
		}
		else
		{

		}
	}

	/* 重置相邻联锁发来的包络信息 */
	wCfpSum = GetCfpSum();
	for (ii = 0u; ii < wCfpSum; ii++)
	{
		wCfpId = GetCfpId(ii);
		wCfpOtherCiid = GetCfpOtherTioc(wCfpId);
		if (wCfpOtherCiid == ciId)
		{
			SetCfpOtherOcENum(wCfpId, 0u);
		}
		else
		{
			;
		}
	}
	/*重置自动通过进路数据*/
	/*cgh-合并CID-2539-7：*/
	for (ii = 1u; ii < AUTO_ROUTE_SUM_MAX; ii++)
	{
		devId = ii;
		belongCiId = GetAutoRouteBelongCiId(devId);
		if (belongCiId == ciId)
		{
			/*非本联锁重置状态*/
			AutoRouteDataStru[devId].AutoRouteSetFlag = AUTO_ROUTE_SET_NO; /*自动进路未办理*/
		}
	}
}

/*
* 功能描述： 将自动进路和对应的自动信号ID关联
* 参数说明： void   
* 返回值  ： 0: 获处理失败
*			 1: 处理成功      
*/
UINT8 SetAutoSignalId(void)
{
	UINT16 routeCurSum = 0u;	     /*进路总数目*/	
	UINT16 routeId = 0u;
	UINT8 result = CI_SUCCESS;
	UINT8 routeAutoSigProperty = 0u; /*进路自动信号属性*/
	UINT16 startSignalId = 0u; /*进路始端信号机ID*/
	UINT16 ii = 0u;
	
	routeCurSum = GetRouteCurSum();		        /*获取进路总数*/		
	/*
	* 目的将信号机和自动信号进路ID关联: 遍历进路表，根据进路属性进行判断，如果进路属于自动信号，则取出始端信号机ID
	* 设置该信号机为自动信号机，并将进路ID设置到其对应属性中。
	* 
	*/
	for (ii = 0u; ii < routeCurSum; ii++)
	{
		routeId = GetRouteId(ii);               /* 获取进路ID */		
		routeAutoSigProperty = GetRouteAutoSigProperty(routeId); /* 获取进路自动信号属性*/
		if (ROUTE_AUTOSIG_PROPERTY_YES == routeAutoSigProperty)	/*自动信号 */
		{	
			startSignalId = GetRouteStartSignalId(routeId);   /*获取进路始端信号机ID*/
			if(CI_ERROR == SetSignalAutoRouteId(startSignalId,routeId))
			{
				result = CI_ERROR;
				break;
			}
		}
		else
		{
			/* 非自动信号，什么不处理 */
		}
	}
	return result;
}


/*
* 功能描述： 初始化全自动折返进路数据
* 参数说明： void  
* 返回值  ： 0: 初始化失败
*			 1; 初始化成功
*/
UINT8 InitialAllAutoReturnRouteData(void)
{
	UINT16 allAutoReturnRouteSum = 0u;							/*自动折返进路总数*/
	UINT16 allAutoReturnRouteId = 0u;							/*自动折返进路ID*/
	UINT16 ii = 0u;											/*游标*/
	UINT8 returnValue = CI_SUCCESS;
	
	allAutoReturnRouteSum = GetAllAutoReturnRouteCurSum();
	
	if (allAutoReturnRouteSum >= ALL_AUTO_RETURN_SUM_MAX)
	{/*配置数据总数错误*/
		returnValue = CI_ERROR;
	}
	else
	{
		for (ii = 0u; ii < allAutoReturnRouteSum; ii++)
		{
			allAutoReturnRouteId = GetAllAutoReturnRouteId(ii);/*获取配置文件中该索引下的自动折返进路ID*/

			AllAutoReturnDataStru[allAutoReturnRouteId].AllAutoReturnId = allAutoReturnRouteId;
			AllAutoReturnDataStru[allAutoReturnRouteId].AllAutoReturnSetFlag = ALL_AUTO_RETURN_SET_NO;
			returnValue &= SetautoRouteOpposedRoute(allAutoReturnRouteId,ROUTE_ALLAUTOROUTE_RETURN);
		}
	}

	return returnValue;
}


/*
* 功能描述： 初始化车库门数据
* 参数说明： void  
* 返回值  ： 0: 初始化失败
*			 1; 初始化成功
*/
UINT8 InitialGaragedoorData(void)
{
	UINT16 garagedoorDataSum = 0u;					/*车库门总数*/
	UINT16 garagedoorId = 0u;						/*车库门ID*/
	UINT16 ii = 0u;							/*游标*/
	UINT8 returnValue = CI_SUCCESS;

	garagedoorDataSum = GetGaragedoorSum();
	
	if (garagedoorDataSum >= GARAGE_DOOR_SUM_MAX)
	{/*配置数据总数错误*/
		returnValue = CI_ERROR;
	}
	else
	{
		for (ii = 0u; ii < garagedoorDataSum; ii++)
		{
			garagedoorId = GetGaragedoorId(ii);/*获取配置文件中该索引下的车库门ID*/

			GaragedoorDataStru[garagedoorId].GaragedoorId = garagedoorId;                                 /*车库门ID (初始化字段)*/
			GaragedoorDataStru[garagedoorId].GaragedoorState = GARAGE_DOOR_STATE_CLOSE;					  /*车库门状态 (动态字段)*/
            GaragedoorDataStru[garagedoorId].GaragedoorModeState = GARAGE_DOOR_STATE_MODE_LOCAL;          /*车库门模式状态*/
			GaragedoorDataStru[garagedoorId].GaragedoorFaultState = GARAGE_DOOR_FAULT_TRUE;	 			  /*车库门故障状态*/
			GaragedoorDataStru[garagedoorId].GDAkuNearestTrainId = NAME_FAILUREAREA;                      /*A库轨最接近车库门的列车ID*/
            GaragedoorDataStru[garagedoorId].GaragedoorAllowCloseFlag = GARAGE_DOOR_ALLOW_CLOSE_NO;       /*车库门允许关门标志ZC*/
			GaragedoorDataStru[garagedoorId].GDAllowCloseFlagIVOC = GARAGE_DOOR_ALLOW_CLOSE_NO;           /*车库门允许关门标志IVOC*/
            GaragedoorDataStru[garagedoorId].drvDoorState = GARAGE_DOOR_DRV_NULL;	                      /* 驱动车库门状态*/
            GaragedoorDataStru[garagedoorId].cmdProcessState = GARAGE_DOOR_CMD_NULL;                      /* 命令处理状态 */
            GaragedoorDataStru[garagedoorId].drvDoorStartCycle = 0u;                                       /* 驱动开始时间,预留 */
            GaragedoorDataStru[garagedoorId].waiteZCResponseStartCycNum = 0u;                              /*等待ZC反馈开始时间*/
			GaragedoorDataStru[garagedoorId].waiteIVOCResponseStartCycNum = 0u;                              /*等待IVOC反馈开始时间*/
			GaragedoorDataStru[garagedoorId].GaragedoorOpenStartCycNum = 0u;                              /*车库门打开开始周期*/
			GaragedoorDataStru[garagedoorId].GaragedoorCloseStartCycNum = 0u;                              /*车库门关闭开始周期*/
			GaragedoorDataStru[garagedoorId].GaragedoorPangLuState = GARAGE_DOOR_PANGLU_FALSE;             /*车库门旁路状态*/
		}

	}

	return returnValue;
}

/*
* 功能描述：重置互联互通相邻联锁设备动态数据
* 参数说明：const UINT8 ciId, 重置联锁ID
* 返回值  ： void
*/
void ResetDynamicStateHlht(const UINT8 ciId)
{
	UINT16 ii = 0u;
	UINT16 devId = 0u;/*不对Id进行清除，清除Id后则设备Id为其他设备属性还存在，Id为静态属性，一旦设置为0后就不能更改*/
	UINT16 devLen = 0u;
	UINT8 belongCiId = 0U;

	/*重置非本联锁道岔动态数据*/
	for (ii = 1u; ii < SWITCH_SUM_MAX; ii++)
	{

		devId = (ii);
		devLen = (UINT16)sizeof(SwitchDataStruct);
		if (GetSwitchBelongCiId(devId) == ciId)
		{
			/*非本联锁*/
			(void)memset(&SwitchDataStru[ii], 0, devLen);
			SwitchDataStru[devId].SwitchId = devId;

			/*设置道岔当前位置 【挤岔】*/
			SwitchDataStru[devId].SwitchCurPosition = SWITCH_POSITION_JICHA;		/*道岔当前位置*/
			SwitchDataStru[devId].SingleSwitchCurPosition = SWITCH_POSITION_JICHA;	/*单独道岔当前位置*/
			SwitchDataStru[devId].LockStatus = SWITCH_LOCK_STATUS_NO;
		}
	}

	/*重置非本联锁物理区段动态数据*/
	for (ii = 1u; ii < PHYSICAL_SECTION_SUM_MAX; ii++)
	{
		devId = (ii);
		devLen = (UINT16)sizeof(PhysicalSectionDataStruct);
		if (GetPhySecBelongCiId(devId) == ciId)
		{
			PhysicalSectionDataStru[ii].FLockState = PHYSICAL_SECTION_FLOCK_YES;
			PhysicalSectionDataStru[ii].SecUseBelongRouteId = 0u;
			PhysicalSectionDataStru[ii].SecProUseBelongRouteId = 0u;
			PhysicalSectionDataStru[ii].SecUseState = PHYSICAL_SECTION_USING_NO;
			PhysicalSectionDataStru[ii].StopSteadyFlag = PHYSICAL_SECTION_STOPSTEADY_NO;
			PhysicalSectionDataStru[ii].PreMergeOccupyState = SECTION_OCCUPY_YES;
			PhysicalSectionDataStru[ii].CurMergeOccupyState = SECTION_OCCUPY_YES;
			PhysicalSectionDataStru[ii].PreAndMergeOccupyState = SECTION_OCCUPY_YES;
			PhysicalSectionDataStru[ii].CurAndMergeOccupyState = SECTION_OCCUPY_YES;
			PhysicalSectionDataStru[ii].PreOccupyState = SECTION_OCCUPY_YES;
			PhysicalSectionDataStru[ii].CurOccupyState = SECTION_OCCUPY_YES;
			PhysicalSectionDataStru[ii].PhySecPreResetState = PHYSICAL_SECTION_PRE_RESET_NO;
		}
	}

	/*重置非本联锁逻辑区段动态数据*/
	for (ii = 1u; ii < LOGIC_SECTION_SUM_MAX; ii++)
	{
		devId = (ii);
		devLen = (UINT16)sizeof(LogicSectionDataStruct);
		if (GetLogSecBelongCiId(devId) == ciId)
		{
			/*非本联锁*/
			/* 内部优化 20220421 wqm 修改宏值SECTION_OCCUPY_YES为LOGICSECTION_OCCUPY_UT */
			LogicSectionDataStru[ii].PreOccupyState = LOGICSECTION_OCCUPY_UT;
			LogicSectionDataStru[ii].CurOccupyState = LOGICSECTION_OCCUPY_UT;
			LogicSectionDataStru[ii].OccupyState = LOGICSECTION_OCCUPY_UT;					/*占用状态*/
																						/*逻辑区段：占用+设置临时限速*/
			LogicSectionDataStru[ii].LinShiXianSuSetFlag = LOGSEC_LSXS_SET_STATE_YES;  /*逻辑区段临时限速设置状态*/
		}
	}

	/*重置非本联锁信号机动态数据*/
	for (ii = 1u; ii < SIGNAL_SUM_MAX; ii++)
	{
		devId = (ii);
		devLen = (UINT16)sizeof(SignalDataStruct);
		if (GetSignalBelongCiId(devId) == ciId)
		{
			/*非本联锁*/
			(void)memset(&SignalDataStru[ii], 0, devLen);
			SignalDataStru[devId].SignalId = devId;
			/*信号机状态：红闪+封锁+信号机临时限速  扣车：车站和中心同时扣车*/
			SetSignalFLockState(devId, SIGNAL_FENGSUO_YES);						/*设置信号机封锁状态*/
			SignalDataStru[devId].CurColor = SIGNAL_SHOWCOLOUR_REDBREAK;		/*设置信号机红断 红闪*/
			SetSignalLinShiXianSuSetFlag(devId, SIGNAL_LINSHIXIANSUSET_STATE_YES);	/*设置信号机临时限速*/
			SetSignalDetainState(devId, SIGNAL_DETAIN_YES);							/*设置信号机扣车*/
			SetSignalProSecValid(devId,SIGNAL_PRO_SEC_INVALID);/*保护区段无效*/
		}
	}

	/*重置非本联锁屏蔽门动态数据*/
	for (ii = 1u; ii < PSD_SUM_MAX; ii++)
	{

		devId = (ii);
		devLen = (UINT16)sizeof(PsdDataStruct);
		if (GetPsdBelongCiId(devId) == ciId)
		{
			/*非本联锁*/
			(void)memset(&PsdDataStru[ii], 0, devLen);
			PsdDataStru[devId].PsdId = devId;
			/*屏蔽门状态：门开+未互锁解除*/
			PsdDataStru[devId].PsdState = PSD_STATE_OPEN;
			PsdDataStru[devId].MutualLockRemoveState = PSD_MUTUALLOCK_REMOVE_NO;
		}
	}

	/*重置非本联锁紧急停车按钮动态数据*/
	for (ii = 1u; ii < ESB_SUM_MAX; ii++)
	{

		devId = (ii);
		devLen = (UINT16)sizeof(EsbDataStruct);
		if (GetEsbBelongCiId(devId) == ciId)
		{
			/*非本联锁*/
			(void)memset(&EsbDataStru[ii], 0, devLen);
			EsbDataStru[devId].EsbId = devId;
			/*ESB状态：按下*/
			(void)SetEsbState(devId, ESB_STATE_VALID_YES);	/*紧急有效*/
		}
	}

	for (ii = 1u; ii < SPKS_SUM_MAX; ii++)
	{
		devId = (ii);
		devLen = (UINT16)sizeof(SpksDataStruct);
		if (GetSpksBelongCiId(devId) == ciId)
		{
			/*非本联锁*/
			spksDataBuff[devId].status = SPKS_STATUS_YES;	/*SPKS状态：按下*/
			spksDataBuff[devId].cutStatus = SPKS_CUT_NO;	/*SPKS旁路状态：未按下*/
		}
	}

	for (ii = 1u; ii < AUTO_ROUTE_SUM_MAX; ii++)
	{
		devId = ii;
		belongCiId = GetAutoRouteBelongCiId(devId);
		if (belongCiId == ciId)
		{
			/*非本联锁重置状态*/
			AutoRouteDataStru[devId].AutoRouteSetFlag = AUTO_ROUTE_SET_NO; /*自动进路未办理*/
		}
	}
}

/*
* 功能描述：初始化Oc数据
* 参数说明：void
* 返回值  ： void
*/
void InitOcData(void)
{
	UINT16 i = 0U;
	UINT16 j = 0U;
	UINT16 k = 0U;
	/*初始化m_OcConvertedPtDataArr*/
	for (i = 0U; i < OC_SUM_MAX; i++)
	{
		m_OcConvertedPtDataArr[i].OcBoardNum = 0u;
		m_OcConvertedPtDataArr[i].OcId = 0u;
		for (j = 0U; j < Oc_Max_Board_Num; j++)
		{
			m_OcConvertedPtDataArr[i].BoardDatas[j].BoardAddress = 0u;
			m_OcConvertedPtDataArr[i].BoardDatas[j].BoardState = RELAY_BOARD_FAULT_YES;  /*初始化板卡故障*/
			for (k = 0U; k < OC_COLL_BOARD_POS_NUM; k++)
			{
				m_OcConvertedPtDataArr[i].BoardDatas[j].PosValueBuf[k] = 0u;
				m_OcConvertedPtDataArr[i].BoardDatas[j].TolerateCycNum[k] = 0u;
			}

		}
	}
	/*初始化m_OcToCiOrginDataArr*/
	for (i = 0U; i < OC_SUM_MAX; i++)
	{
		m_OcToCiOrginDataNum = 0u;
		m_OcToCiOrginDataArr[i].ComStartCycle = 0u;
		m_OcToCiOrginDataArr[i].OcId = 0u;
		m_OcToCiOrginDataArr[i].OcDeviceNum = 0u;
		m_OcToCiOrginDataArr[i].OcDIBoardDataNum = 0u;
		m_OcToCiOrginDataArr[i].OcDOBoardNum = 0u;
		m_OcToCiOrginDataArr[i].OcSORBoardNum = 0u;
		m_OcToCiOrginDataArr[i].OcGdNum = 0u;
		m_OcToCiOrginDataArr[i].RecvErrorDevTypeCycle = 0u;

		m_OcToCiOrginDataArr[i].PowerAState = (UINT8)0xFF;
		m_OcToCiOrginDataArr[i].PowerBState = (UINT8)0xFF;
		m_OcToCiOrginDataArr[i].OCDevFaultState = (UINT8)0xFF;
		m_OcToCiOrginDataArr[i].FanState = (UINT8)0xFF;/*风扇状态，初始化为正常*/
		m_OcToCiOrginDataArr[i].OCBoardSwapSysNum = 0U;  /*OC切系板卡数初始化为零*/
		for (j = 0U; j < MAX_OC_DEVICE_NUM; j++)
		{
			m_OcToCiOrginDataArr[i].SwapSysBoardId[j] = 0U;
		}

	}
}
/*
* 功能描述：初始化本机包含的虚拟联锁相关数据
* 参数说明：void
* 返回值  ： void
*/
void InitLocalCIHaveVirCI_UseVirCI(void)
{
	UINT8 localCIid = 0u;
	UINT16 i= 0u;
	UINT8 j = 0u;
	UINT8 virCINum = 0u;
	localCIid = GetSystemParaLocalCiId();

	for(i=0u;i<dsuDataLenStru.wLinkLen;i++)
	{
		/*属于本联锁，且配置了有效的虚拟联锁id*/
		if((localCIid == dsuStaticHeadStru.pLinkStru[i].wManagePhysicalCI)
			&&(0u != dsuStaticHeadStru.pLinkStru[i].wBelongVirtualCI)
			&&(UINT16_MAX != dsuStaticHeadStru.pLinkStru[i].wBelongVirtualCI))
		{
			g_VirtualCIStructData.LocalCiID = localCIid;
			for(j=0u;j<VIRTUAL_CI_MAX;j++)
			{
				if(g_VirtualCIStructData.virtualCi[j].virtualCiId==dsuStaticHeadStru.pLinkStru[i].wBelongVirtualCI)
				{
					break;
				}
			}
			if((VIRTUAL_CI_MAX == j)&&(VIRTUAL_CI_MAX > virCINum))
			{
				g_VirtualCIStructData.virtualCi[virCINum++].virtualCiId= (UINT8)dsuStaticHeadStru.pLinkStru[i].wBelongVirtualCI;
			}
		}
	}
	g_VirtualCIStructData.virtualCiNum = virCINum;

	for(j=0u;j<g_VirtualCIStructData.virtualCiNum;j++)
	{
		g_VirtualCIStructData.virtualCi[j].chAllSignalBrightFlag= CI_ALL_SIGNAL_BRIGHT_NO;
		g_VirtualCIStructData.virtualCi[j].chAllSwitchYLockFlag= CI_ALL_SWITCH_YLOCK_NO;
		g_VirtualCIStructData.virtualCi[j].chLabourCancelLinShiXianState= LINSHIXIANSU_COMM_BAD_STATE;
		g_VirtualCIStructData.virtualCi[j].cimode = CI_MODE_CI_LOCAL;
		g_VirtualCIStructData.virtualCi[j].autoTriggerflag = AUTO_TRIGGER_SET_NO;
		g_VirtualCIStructData.virtualCi[j].ZfwFlag = CI_PHYSEC_GENERAL_RESET_NO;
		g_VirtualCIStructData.virtualCi[j].ZfwStartCycNum = 0u;
		g_VirtualCIStructData.virtualCi[j].ZfwValidCycNum = 0u;
		g_VirtualCIStructData.virtualCi[j].ZfwjHunXianFLag = ZFWJ_HUN_XIAN_NO;
	}
}

/*
* 功能描述： 初始化中央联锁数据结构体
* 参数说明：void
* 返回值  ：void
*/
void InitCtrlPowerStru(void)
{
	UINT8 ii = 0U;
	UINT8 virCiNum = 0U;
	UINT8 chXiandiHavePower = 0U;/*上电初始化现地是否具备联锁控制权*/

	chXiandiHavePower = GetCiFunctionSwitchConfig(FUNC_INIT_XIANDI_HAVE_POWER);
	virCiNum = GetVirtualCINum();

	for (ii = 0U; ii < virCiNum; ii++)
	{
		ctrlpowerFlag[ii].virCiId = g_VirtualCIStructData.virtualCi[ii].virtualCiId;
		ctrlpowerFlag[ii].ctrlDeviceId = 0U;
		if (FUNC_SWITCH_ON == chXiandiHavePower)
		{	
			ctrlpowerFlag[ii].ctrlDeviceType = CI_SYSTEM_TYPE_XIANDI;
			ctrlpowerFlag[ii].ctrlPowerState = CONTRAL_POWER_YES;
		}
		else
		{
			ctrlpowerFlag[ii].ctrlDeviceType = 0U;
			ctrlpowerFlag[ii].ctrlPowerState = CONTRAL_POWER_NO;
		}
	}
}
/*
* 功能描述： 初始化OC站表示灯报警灯数据
* 参数说明： void
* 返回值  ： 0: 初始化失败
*			 1; 初始化成功
* 
* cgh-合并CID-3037-3：
*/
UINT8 InitialOCStationIndicStaData(void)
{
	UINT16 configStruSum = 0u;	/*配置数据总数*/
	UINT16 ii = 0u;
	UINT8 reVal = CI_ERROR;

	configStruSum = GetOCStationIndicCurSum();
	if (configStruSum >= INDICATOR_SUM_MAX)
	{/*配置数据总数错误*/
		reVal = CI_ERROR;
	}
	else
	{
		reVal = CI_SUCCESS;
		for (ii = 0; ii < configStruSum; ii++)
		{
			g_OCStationIndicDataStru[ii].ocid = g_OCStationIndicConfigDataStru[ii].OcId;
			g_OCStationIndicDataStru[ii].IndicatorId = g_OCStationIndicConfigDataStru[ii].IndicatorId;
			g_OCStationIndicDataStru[ii].IndicatorState = INDICATOR_SHOW_NO;
		}
	}
	return reVal;
}

/*
* 功能描述： 初始化信号机包含的进路所处区域标志
* 参数说明： UINT16 signalId	输入信号机ID
* 返回值  ： void
*
*/
void SetSignalLeadRouteCbtcFlag(UINT16 signalId)
{
	UINT16 jj = 0u;								/*游标*/
	UINT16 routeSum = 0u;						/*进路总数*/
	UINT16 routeId = 0u;							/*进路ID*/
	UINT16 startSignalId = 0u;					/*始端信号机ID*/
	UINT8 wRouteLeadProperty = 0U;				/*进路引导属性*/

	routeSum = GetRouteCurSum();
	for (jj = 0u; jj < routeSum; jj++)
	{
		routeId = GetRouteId(jj);/*routeId下文中会用到*/
		startSignalId = GetRouteStartSignalId(routeId);
		if (signalId == startSignalId)
		{
			wRouteLeadProperty = GetRouteLeadProperty(routeId);

			if ((ROUTE_LEAD_PROPERTY_YES == wRouteLeadProperty) || (ROUTE_LEAD_PROPERTY_CBTC_YES == wRouteLeadProperty))			
			{
				if (((0U == SignalDataStru[signalId].SignalLeadRouteCbtcFlag) || (SIGNAL_LEADROUTE_ALLCBTC == SignalDataStru[signalId].SignalLeadRouteCbtcFlag))
					&& (ROUTE_LEAD_PROPERTY_CBTC_YES == wRouteLeadProperty))
				{
					SignalDataStru[signalId].SignalLeadRouteCbtcFlag = SIGNAL_LEADROUTE_ALLCBTC;
				}
				else if (((0U == SignalDataStru[signalId].SignalLeadRouteCbtcFlag) || (SIGNAL_LEADROUTE_ALL_NO_CBTC == SignalDataStru[signalId].SignalLeadRouteCbtcFlag))
					&& (ROUTE_LEAD_PROPERTY_YES == wRouteLeadProperty))
				{
					SignalDataStru[signalId].SignalLeadRouteCbtcFlag = SIGNAL_LEADROUTE_ALL_NO_CBTC;
				}
				else
				{
					SignalDataStru[signalId].SignalLeadRouteCbtcFlag = SIGNAL_LEADROUTE_CBTC_ANDNO;		/*其余情况则是信号机包含的进路既有CBTC场段区域的，也有非CBEC场段区域的*/
				}
			}
			else
			{
				;	/*只有引导属性的进路才需要去设置此标志，若非引导进路，此标志用不着，无需处理*/
			}
		}
		else
		{
			;
		}
	}
}


/*
* 功能描述：初始化平台发送的通控、扩展板数据
* 参数说明：void
* 返回值  ：void
*/
void InitPlatDataStru(void)
{
	/*CCUA*/
	RecvHeartDataStru.voltageA_CCA = 0U;  /*24VA电源_电压*1000*/
	RecvHeartDataStru.voltageB_CCA = 0U;  /*24VB电源_电压*1000*/
	RecvHeartDataStru.currentA_CCA = 0U;  /*24VA电源_电流*1000*/
	RecvHeartDataStru.currentB_CCA = 0U;  /*24VV电源_电流*1000*/
	RecvHeartDataStru.voltageCoup_CCA = 0U;  /*24V电源_电压*1000*/
	RecvHeartDataStru.currentCoup_CCA = 0U;  /*24V电源_电流*1000*/
	RecvHeartDataStru.temperature_CCA = 0U;  /*温度值*1000*/
	RecvHeartDataStru.check_EEPROM_CCA = 0U;  /*EEPROM存储检验*/
	RecvHeartDataStru.commStartCycle_CCA = 0U; /*通信周期*/
	/*CCUB*/
	RecvHeartDataStru.voltageA_CCB = 0U;  /*24VA电源_电压*1000*/
	RecvHeartDataStru.voltageB_CCB = 0U;  /*24VB电源_电压*1000*/
	RecvHeartDataStru.currentA_CCB = 0U;  /*24VA电源_电流*1000*/
	RecvHeartDataStru.currentB_CCB = 0U;  /*24VV电源_电流*1000*/
	RecvHeartDataStru.voltageCoup_CCB = 0U;  /*24V电源_电压*1000*/
	RecvHeartDataStru.currentCoup_CCB = 0U;  /*24V电源_电流*1000*/
	RecvHeartDataStru.temperature_CCB = 0U;  /*温度值*1000*/
	RecvHeartDataStru.check_EEPROM_CCB = 0U;  /*EEPROM存储检验*/
	RecvHeartDataStru.commStartCycle_CCB = 0U; /*通信周期*/
	/*SEBA*/
	RecvHeartDataStru.commStartCycle_SEBA = 0U; /*通信周期*/
	/*SEBB*/
	RecvHeartDataStru.commStartCycle_SEBB = 0U; /*通信周期*/
}


/*
* 功能描述：初始化LEU发送CI数据
* 参数说明：void
* 返回值  ：返回初始化结果
*/
UINT8 InitLEUDataStru(void)
{
	UINT8 tranCiNum = 0u;
	UINT8* tranCiIdBuf = NULL;
	UINT8 reVal = CI_ERROR;
	UINT8 jj = 0U;
	UINT8 ii = 0U;

	tranCiNum = GetCiTransmitSpecifySysDevSum(CI_SYSTEM_TYPE_LEU);
	tranCiIdBuf = GetCiTransmitSpecifySysDevBuf(CI_SYSTEM_TYPE_LEU);

	if (LEU_TO_CI_SUM_MAX < tranCiNum)
	{
		reVal = CI_ERROR;		/*数量超限，返回失败*/
	}
	else
	{
		reVal = CI_SUCCESS;
		for (jj = 0u; jj < tranCiNum; jj++)
		{
			LeuToCiDataStru[jj].allState = 0U;			/*初始化整机状态*/

			/*初始化ID标示符*/
			for (ii = 0U; ii < 3U; ii++)
			{
				LeuToCiDataStru[jj].idInfo[ii] = 0U;
			}
			/*初始化LEU状态*/
			LeuToCiDataStru[jj].leuType = 0U;
			LeuToCiDataStru[jj].toQianjiComState = 0U;
			LeuToCiDataStru[jj].boardState = 0U;

			/*初始化输出口状态*/
			for (ii = 0U; ii < 4U; ii++)
			{
				LeuToCiDataStru[jj].outState[ii] = 0U;
			}
			/*初始化码位信息*/
			for (ii = 0U; ii < 12U; ii++)
			{
				LeuToCiDataStru[jj].maskInfo[ii] = 0U;
			}
			/*初始化向ATS报警标志*/
			LeuToCiDataStru[jj].errorToAtsFlag = LEU_TO_ATS_ERRORFLAG_NO;
		}
	}

	return reVal;
}

/*
* 功能描述： 初始化无人折返指示灯状态数据
* 参数说明： void
* 返回值  ：  0: 初始化失败
*			  1; 初始化成功
* by cgh 20240904
*/
UINT8 InitialRtnIndicStaData(void)
{
	UINT16 wNonAutoReturnCurSum = 0U;/*无人折返当前数目*/
	UINT16 wNonAutoReturnId = 0U;/*无人折返ID*/
	UINT16 ii = 0U;
	UINT8 chReval = CI_ERROR;
	UINT8 jj = 0u;
	UINT8 kk = 0U;
	UINT8 rtnIndicatorSum = 0U;
	UINT16 indicatorType = 0U;
	UINT16 wNonRtnIndicatorId = 0U;/*无人折返表示报警灯ID*/
	UINT8 chRelaySum = 0U;                 /*继电器数量*/
	UINT16* pRelayIdBuf = NULL;          /*继电器数据*/

	wNonAutoReturnCurSum = GetNonAutoReturnCurSum();

	if (NON_AUTO_RETURN_SUM_MAX > wNonAutoReturnCurSum)
	{
		chReval = CI_SUCCESS;

		for (ii = 0U; ii < wNonAutoReturnCurSum; ii++)
		{
			wNonAutoReturnId = GetNonReturnId(ii);
			NonReturnDataStru[wNonAutoReturnId].IndicatorDevID = wNonAutoReturnId;
			NonReturnDataStru[wNonAutoReturnId].cmdSetTrainId = 0U;
			NonReturnDataStru[wNonAutoReturnId].VobcToCIAutoRtnIndicFlashState = VOBCTOCIAUTORTN_INDICT_MASK_INVALID;
			NonReturnDataStru[wNonAutoReturnId].VobcToCIAutoRtnIndicSteadyState = VOBCTOCIAUTORTN_INDICT_MASK_INVALID;

			wNonRtnIndicatorId = GetNonRtnRlyId(wNonAutoReturnId);

			/*是无人折返指示灯则将无人折返按钮填入*/
			chRelaySum = GetIndicatorRelaySum(wNonRtnIndicatorId);
			pRelayIdBuf = GetIndicatorRelayIdBuf(wNonRtnIndicatorId);
			if ((3U != chRelaySum) || (NULL == pRelayIdBuf) || (RELAY_SUM_MAX < pRelayIdBuf[2]))
			{
				/*未配置无人折返继电器*/
			}
			else
			{
				NonReturnDataStru[wNonAutoReturnId].RtnRelayAdhesionState.AdhesionRealyId = pRelayIdBuf[2];
				NonReturnDataStru[wNonAutoReturnId].RtnRelayAdhesionState.AdhesionState = RTN_RELAY_ADHESION_NO;
				NonReturnDataStru[wNonAutoReturnId].RtnRelayAdhesionState.RelayUpCycNum = 0U;

			}
		}
	}
	else
	{
		; /*返回失败*/
	}

	if (CI_SUCCESS == chReval)
	{
		for (jj = 0; jj < g_VirtualCIStructData.virtualCiNum; jj++)
		{
			/*给虚拟联锁的指示灯设备ID赋值*/
			for (kk = 0U; kk < g_VirtualCIStructData.virtualCi[jj].IndicatorConfigDataNum; kk++)
			{
				indicatorType = g_VirtualCIStructData.virtualCi[jj].IndicatorConfigData[kk].IndicatorType;
				if ((INDICATOR_TYPE_EXPRESS_RETURN == indicatorType) && (RTNINDICATOR_SUM_MAX > rtnIndicatorSum))
				{
					g_VirtualCIStructData.virtualCi[jj].VirCIRtnIndicatorStaData[rtnIndicatorSum].VirCiIndicatorDevId = g_VirtualCIStructData.virtualCi[jj].IndicatorConfigData[kk].BjdDeviceId;
					rtnIndicatorSum++;
				}
				else
				{
					; 
				}

				if (RTNINDICATOR_SUM_MAX <= rtnIndicatorSum)
				{
					/*一个虚拟联锁集中区最大只有两个无人折返指示灯ID*/
					break; 
				}
				else
				{
					; 
				}
			}
			/*将每个虚拟联锁包含的无人折返指示灯状态初始化为无效*/
			for (kk = 0U; kk < RTNINDICATOR_SUM_MAX; kk++)
			{
				if (RTNINDICATOR_SUM_MAX > rtnIndicatorSum)
				{/*当本集中区没有无人折返指示灯设备只有一个时，其余数据初始化为0*/
					g_VirtualCIStructData.virtualCi[jj].VirCIRtnIndicatorStaData[rtnIndicatorSum].VirCiIndicatorDevId = 0U;
					rtnIndicatorSum++;
				}
				else
				{
					; 
				}

				g_VirtualCIStructData.virtualCi[jj].VirCIRtnIndicatorStaData[kk].VirCiFlashState = VOBCTOCIAUTORTN_INDICT_MASK_INVALID;
				g_VirtualCIStructData.virtualCi[jj].VirCIRtnIndicatorStaData[kk].VirCiSteadyState = VOBCTOCIAUTORTN_INDICT_MASK_INVALID;
			}
		}
	}
	else
	{
		; 
	}

	return chReval;
}
