⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 creatroutine.c

📁 电力系统中的保护装置全部代码
💻 C
字号:
/////////////////////////////////////////////////////////////////////////////////////
//      程序名: CreatRoutine.c                                                      //
//      包含系统运行前进行的初始化函数                                             //
/////////////////////////////////////////////////////////////////////////////////////
#include "Propro.h"
#include "Chkchk.h"

PROTECT	*PRO_Execute_Protect;
PROTECT	*PRO_Created_Protect_List;
UNSIGNED	PRO_Total_Protect;

CHECK	*CHK_Execute_Check;
CHECK	*CHK_Created_Check_List;
UNSIGNED	CHK_Total_Check;

/********************************************************************************/
/*                                                                       	*/
/* FUNCTION                                                             	*/
/*                                                                      	*/
/*      PCOM_Initialize                                                  	*/
/*                                                                       	*/
/********************************************************************************/
VOID PCOM_Initialize(VOID)
{
 	/* Initialize the total number of created protect to 0. */
	PRO_Total_Protect = 0;
	/* Initialize the created protect list to NU_NULL.  	*/
	PRO_Created_Protect_List = NU_NULL;    
	/* Initialize pointers to the protect to execute.	*/ 
	PRO_Execute_Protect = NU_NULL;
}

/********************************************************************************/
/*                                                                       	*/
/* FUNCTION                                                              	*/
/*                                                                       	*/
/*      PCOM_Create_Protect                                                  	*/
/*                                                                       	*/
/********************************************************************************/
VOID	PCOM_Create_Protect(VOID *protect_ptr,VOID (*protect_initialize)(PROTECT *),
			VOID (*protect_routine)(PROTECT *)) 				

{
PROTECT	*protect;					/* protect control block ptr    */
INT	i;                                              /* Working index variable    	*/

    	/* Move input protect pointer into internal pointer.  */
    	protect =  (PROTECT *)protect_ptr ;
 	/* Link the task into the list of created protect and increment the
       	total number of protect in the system.  */
    	if (PRO_Created_Protect_List)		/* Determine if the list in non-empty.  */
    	{
        	/* The list is not empty.  Add the new node to the end of the list.  */
         	protect -> pro_link_previous 	=   PRO_Created_Protect_List -> pro_link_previous;
        	(protect -> pro_link_previous) -> pro_link_next =  protect;
        	protect -> pro_link_next 	=   PRO_Created_Protect_List;
        	(protect -> pro_link_next) -> pro_link_previous =  protect;
    	}
    	else
    	{
        	/* The list is empty, setup the head and the new node.  */
        	PRO_Created_Protect_List 	= 	protect; 
        	protect -> pro_link_next 	=  	protect;
        	protect -> pro_link_previous 	= 	protect;
    	}
    	PRO_Total_Protect++;
	/* protect initialize routine entry */ 
	(*protect_initialize)(protect);
	          
 	/* protect routine entry 	    */          
	protect -> pro_routine_handler 		=	protect_routine;	
}
 
/********************************************************************************/
/*                                                                       	*/
/* FUNCTION                                                             	*/
/*                                                                      	*/
/*      CCOM_Initialize                                                  	*/
/*                                                                       	*/
/********************************************************************************/
VOID	CCOM_Initialize(VOID)
{
	/* Initialize the total number of created check to 0. */
	CHK_Total_Check = 0;
	/* Initialize the created check list to NU_NULL.  	*/
	CHK_Created_Check_List = NU_NULL;    
	/* Initialize pointers to the check to execute.	*/ 
	CHK_Execute_Check = NU_NULL;
}

/********************************************************************************/
/*                                                                       	*/
/* FUNCTION                                                              	*/
/*                                                                       	*/
/*      CCOM_Create_check                                                  	*/
/*                                                                       	*/
/*                                                                       	*/
/********************************************************************************/
VOID	CCOM_Create_Check(VOID *Check_ptr,VOID (*Check_initialize)(CHECK *),
		VOID (*Check_routine)(CHECK *))
{
CHECK	*Check;					/* check control block ptr    */
INT	i;                                              /* Working index variable    	*/

    	/* Move input check pointer into internal pointer.  */
    	Check = (CHECK *)Check_ptr;
 	/* Link the task into the list of created check and increment the
       	total number of check in the system.  */
    	if (CHK_Created_Check_List)		/* Determine if the list in non-empty.  */
    	{
        	/* The list is not empty.  Add the new node to the end of the list.  */
         	Check -> chk_link_previous 	=   CHK_Created_Check_List -> chk_link_previous;
        	(Check -> chk_link_previous) -> chk_link_next =  Check;
        	Check -> chk_link_next 	=   CHK_Created_Check_List;
        	(Check -> chk_link_next) -> chk_link_previous =  Check;
    	}
    	else
    	{
        	/* The list is empty, setup the head and the new node.  */
        	CHK_Created_Check_List 	= 	Check; 
        	Check -> chk_link_next 	=  	Check;
        	Check -> chk_link_previous 	= 	Check;
    	}
    	CHK_Total_Check++;
	/* check initialize routine entry */ 
	(*Check_initialize)(Check);
	          
 	/* CHECK routine entry 	    */          
	Check -> chk_routine_handler 		=	Check_routine;	
}

/********************************************************************************/
/*                                                                       	*/
/* FUNCTION                                                              	*/
/*                                                                       	*/
/*      ProtectCreat                                                     	*/
/*                                                                       	*/
/*                                                                       	*/
/********************************************************************************/
VOID	ProtectCreat(VOID)
{
	PCOM_Initialize();       //Pcom.c : protect link table initialize
	PCOM_Create_Protect(&protect_OC_I_Direction,OC_I_Direction_Initialize,OC_I_Direction_Routine);//lht.2001.10.23
	PCOM_Create_Protect(&protect_OC_II_Direction,OC_II_Direction_Initialize,OC_II_Direction_Routine);//lht.2001.10.25
	PCOM_Create_Protect(&protect_OC_ACC,OC_ACC_Initialize,OC_ACC_Routine);//lht.2001.10.25
	PCOM_Create_Protect(&protect_Reclose,Once_Reclose_Initialize,Once_Reclose_Routine);//lht.2001.10.25
	PCOM_Create_Protect(&protect_Low_Frequence,LFLSH_Initialize,LFLSH_Routine);//lht.2001.11.08
	PCOM_Create_Protect(&protect_Zero_I,Zero_I_Initialize,Zero_I_Routine);//lht.2001.11.08
	PCOM_Create_Protect(&protect_Over_Load,OVER_LOAD_Initialize,OVER_LOAD_Routine);
	PCOM_Create_Protect(&protect_PT,PT_Initialize,PT_Routine);
	PCOM_Create_Protect(&protect_Mea,Measure_Initialize,Measure_Routine);
}

/********************************************************************************/
/*                                                                       	*/
/* FUNCTION                                                              	*/
/*                                                                       	*/
/*      CheckCreat                                                      	*/
/*                                                                       	*/
/*                                                                       	*/
/********************************************************************************/
VOID CheckCreat(VOID)
{
	CCOM_Initialize();
	CCOM_Create_Check(&AD_Check,AD_Check_Initialize,AD_Check_Routine);
	CCOM_Create_Check(&DO_Check,DO_Check_Initialize,DO_Check_Routine);
	CCOM_Create_Check(&SET_ZONE_Check,SET_ZONE_Initialize,SET_ZONE_Routine);
	CCOM_Create_Check(&PARA_SET_Check,PARA_SET_Initialize,PARA_SET_Routine);
	CCOM_Create_Check(&PRO_SET_Check,PRO_SET_Initialize,PRO_SET_Routine);
	CCOM_Create_Check(&ControlTest_Check,ControlCircuitTest_Initialize,ControlCircuitTest_Routine);
	CCOM_Create_Check(&Spring_Test_Check,Spring_Test_Initialize,Spring_Test_Routine);
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -