package com.dec.fbs9100; import java.util.TimeZone; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import com.base.AppConfig; import com.battdata_rt.BattData_RT_Array; import com.dec.fbs9100.AppParam; import com.iedscout.BTS61850_IEDScout_Task_Thread; /** * ·ðɽ°æ±¾61850 * @author LiJun * */ public class main_BTS_APP_IEC61850 { /**************************************************************************/ /**************************************************************************/ /**************************************************************************/ public final static boolean is_app_for_cmcc_only = false; public final static boolean is_app_for_fbo_data_only = false; public final static boolean is_app_for_fbs_free_only = false; public final static boolean is_app_for_bpm7100_only = false; public final static boolean is_app_for_FBS9100S_only = true; /************************************************** * ************************/ /**************************************************************************/ /**************************************************************************/ /**************************************************************************/ public final static boolean app_debug = false; public final static double m_VersionNum = 2.103; public final static String m_Version = "Welcome To Use BattMonitor_BTS_IEC61850 V" + m_VersionNum + " RC_20201003"; /**************************************************************************/ /**************************************************************************/ public static final int DEF_MysqlServerFBS9100S_Port = 3360; public static final int DEF_MysqlServer_Port = 5306; public static final int DEF_MysqlServerFBS_Port = 5307; public static final int DEF_MysqlServerFBO_Port = 5308; public static final int DEF_MysqlServerBPM7100_Port = 5309; public static final int DEF_Socket_Server_Port = 1982; public static final int DEF_Socket_ServerFBS_Port = 1992; public static final int DEF_Socket_ServerFBO_Port = 2002; public static final int DEF_Socket_ServerBPM7100_Port = 2001; public static final int DEF_Socket_Server_FBI_Port = 1983; public static final int DEF_Socket_Server_FBIFBS_Port = 1993; public static final int DEF_Socket_Server_FBIFBO_Port = 2003; public static final int DEF_Socket_Server_IDCE8200_Port = 8200; public static final int DEF_Socket_Server_IDCE8200FBS_Port = 8210; public static final int DEF_Socket_Server_IDCE8200FBO_Port = 8220; public static final int DEF_Socket_Server_MOBILE_Port = 2016; public static final int DEF_Socket_Server_MOBILEFBS_Port = 2026; public static final int DEF_Socket_Server_MOBILEFBO_Port = 2036; public static final int DEF_Socket_Server_MOBILEBPM7100_Port = 2037; public static final int DEF_FTP_Server_Port = 2110; public static final int DEF_FTP_ServerFBS_Port = 2116; public static final int DEF_FTP_ServerFBO_Port = 2122; public static final int DEF_FTP_ServerBPM7100_Port = 2123; public static int MysqlServer_Port = DEF_MysqlServer_Port; public static int Socket_Server_Port = DEF_Socket_Server_Port; public static int Socket_Server_FBI_Port = DEF_Socket_Server_FBI_Port; public static int Socket_Server_IDCE8200_Port = DEF_Socket_Server_IDCE8200_Port; public static int Socket_Server_Mobile_Port = DEF_Socket_Server_MOBILE_Port; public static int FTP_Server_Port = DEF_FTP_Server_Port; private static AppConfig m_AppConfig; private static MysqlConnPool GB_MysqlConnPool; private static BattData_RT_Array GB_DataArray; public static AppParam GB_App_Param; private static BTS61850_Task_Thread GB_task_61850; public static Logger logger; /*********************************************************************************************/ /*********************************************************************************************/ static { System.setProperty("log4j.configurationFile", "log4j2_batt_61850_dev_x64.xml"); // System.setProperty("contextSelector", "org.apache.logging.log4j.core.async.AsyncLoggerContextSelector"); } /*********************************************************************************************/ /*********************************************************************************************/ public static void main(String[] args) { String ver = m_Version; TimeZone.setDefault(TimeZone.getTimeZone("GMT+8")); logger = LogManager.getLogger(main_BTS_APP_IEC61850.class); logger.info("/****************************************************************"); logger.info("*****************************************************************"); logger.info("****************************************************************/"); logger.info(ver); logger.info("Server Started ..."); /* logger.debug("This is debug."); logger.info("This is an info."); logger.warn("This is a warning."); logger.error("This is an error."); logger.fatal("This is a fatal error."); */ m_AppConfig = new AppConfig(); do { GB_MysqlConnPool = new MysqlConnPool(m_AppConfig.getMysqlServerIp(), DEF_MysqlServerFBS9100S_Port, m_AppConfig.getMysqlConnCountMax()); if(null == GB_MysqlConnPool) { logger.info("GB_MysqlConnPool connect to sql server timeout, continue..."); try { Thread.sleep(3000); } catch (InterruptedException e) { logger.error(e.toString(), e); } } else { break; } } while (true); GB_App_Param = new AppParam(GB_MysqlConnPool); //GB_App_Param.checkAndCreateLog4jTable(); GB_DataArray = new BattData_RT_Array(m_AppConfig, GB_App_Param, GB_MysqlConnPool); GB_DataArray.initBattDataRT_Inf(m_VersionNum); //¸üÐÂÏß³Ì¼à¿ØÖÐµÄÆô¶¯Ê±¼äÒÔ¼°Èí¼þ°æ±¾ºÅ FBS9100_Task_Thread_SQL.updateAppStartTime(GB_MysqlConnPool,m_VersionNum); { GB_task_61850 = new BTS61850_Task_Thread(GB_MysqlConnPool, GB_DataArray, m_AppConfig); GB_task_61850.start(); } { BattDataTestPro_Thread batt_test = new BattDataTestPro_Thread(GB_App_Param, m_AppConfig, GB_DataArray); batt_test.start(); } /************************************ µç³Ø×éÀúʷʵʱÊý¾Ý¼Ç¼Ïß³Ì ***************************************************************/ { BattRealDataPro_Thread batt_realdata = new BattRealDataPro_Thread(GB_MysqlConnPool, m_AppConfig, GB_DataArray); batt_realdata.start(); } /*********************************************************************************/ /************************************ iedScout µ÷ÊÔ¹¤¾ß *********************************************/ { BTS61850_IEDScout_Task_Thread ied_thread = new BTS61850_IEDScout_Task_Thread(GB_MysqlConnPool); ied_thread.start(); } /*********************************************************************************/ while(true) { try { Thread.sleep(1000); FBS9100_Task_Thread_SQL.runinsertime(GB_MysqlConnPool); Thread.sleep(2000); if(true == GB_DataArray.checkAndReinitBattGroupData()) { GB_task_61850.reInitClient(); logger.warn("GB_task_61850.reInitClient()"); } Thread.sleep(2000); /****************************************** GB_App_Param.checkAndDeleteLog4jOldData(); ******************************************/ } catch (Exception e) { logger.error(e.toString(), e); } } /*********************************************************************************/ } }