package com.data.Comm;
|
|
import java.sql.SQLException;
|
|
import com.sql.MysqlConnPool;
|
import com.sql.Sql_Mysql;
|
|
public class AFE_Inverter_Task_SQL {
|
|
public static void init(MysqlConnPool pool) {
|
CreateDB_MW_Motor(pool);
|
|
CreateDB_MW_Motor_History(pool);
|
|
//CreateTb_Central_Monitor_Sys_StTable(pool);
|
|
//CreateTb_Central_Monitor_Sys_RtTable(pool);
|
|
//CreateTb_Central_Monitor_Sys_ControlTable(pool);
|
|
CreateAfe_Inverter_State_Table(pool);
|
|
CreateAfe_Rectifier_State_Table(pool);
|
|
}
|
|
/**
|
* ¹¹Ôì3.5mwÊý¾Ý¿â
|
* @param pool
|
*/
|
public static void CreateDB_MW_Motor(MysqlConnPool pool) {
|
Sql_Mysql sql = new Sql_Mysql(pool.getConn());
|
try {
|
sql.sqlMysqlExecute(" CREATE DATABASE IF NOT EXISTS " + Sql_Mysql.DB_MW_Motor);
|
} catch (SQLException e) {
|
sql.logger.error(e.toString(),e);
|
}
|
}
|
|
/**
|
* ¹¹Ôì3.5mwÀúʷʵʱÊý¾Ý¿â
|
* @param pool
|
*/
|
public static void CreateDB_MW_Motor_History(MysqlConnPool pool) {
|
Sql_Mysql sql = new Sql_Mysql(pool.getConn());
|
try {
|
sql.sqlMysqlExecute(" CREATE DATABASE IF NOT EXISTS " + Sql_Mysql.DB_MW_Motor_History);
|
} catch (SQLException e) {
|
sql.logger.error(e.toString(),e);
|
}
|
}
|
|
/**
|
* ´´½¨tb_central_monitor_sys_st±í
|
* @param pool
|
*/
|
public static void CreateTb_Central_Monitor_Sys_StTable(MysqlConnPool pool) {
|
String sql_str = "CREATE TABLE IF NOT EXISTS "+Sql_Mysql.Tb_Central_Monitor_Sys_St+" (" +
|
" num bigint(20) NOT NULL AUTO_INCREMENT," +
|
" dev_id int(11) NOT NULL DEFAULT '0' COMMENT 'É豸id'," +
|
" record_time datetime NOT NULL DEFAULT '2000-01-01 00:00:00' COMMENT '¸üÐÂʱ¼ä'," +
|
" switch_close_1st_2500A int(11) NOT NULL DEFAULT '0' COMMENT '1ºÅ2500A½øÏ߯Á¿ª¹ØºÏբ״̬'," +
|
" switch_open_1st_2500A int(11) NOT NULL DEFAULT '0' COMMENT '1ºÅ2500A½øÏ߯Á¿ª¹Ø·Öբ״̬'," +
|
" switch_fault_1st_2500A int(11) NOT NULL DEFAULT '0' COMMENT '1ºÅ2500A½øÏ߯Á¿ª¹Ø¹ÊÕÏ״̬'," +
|
" switch_close_2st_2500A int(11) NOT NULL DEFAULT '0' COMMENT '2ºÅ2500A½øÏ߯Á¿ª¹ØºÏբ״̬'," +
|
" switch_open_2st_2500A int(11) NOT NULL DEFAULT '0' COMMENT '2ºÅ2500A½øÏ߯Á¿ª¹Ø·Öբ״̬'," +
|
" switch_fault_2st_2500A int(11) NOT NULL DEFAULT '0' COMMENT '2ºÅ2500A½øÏ߯Á¿ª¹Ø¹ÊÕÏ״̬'," +
|
" switch_close_bus_screen int(11) NOT NULL DEFAULT '0' COMMENT 'ĸÁªÆÁºÏբ״̬'," +
|
" switch_open_bus_screen int(11) NOT NULL DEFAULT '0' COMMENT 'ĸÁªÆÁ·Öբ״̬'," +
|
" switch_fault_bus_screen int(11) NOT NULL DEFAULT '0' COMMENT 'ĸÁªÆÁ¿ª¹Ø¹ÊÕÏ'," +
|
" switch_close_1st_2500A_load int(11) NOT NULL DEFAULT '0' COMMENT '1ºÅ2500A¸ºÔØÆÁ¿ª¹ØºÏբ״̬'," +
|
" switch_open_1st_2500A_load int(11) NOT NULL DEFAULT '0' COMMENT '1ºÅ2500A¸ºÔØÆÁ¿ª¹Ø·Öբ״̬'," +
|
" switch_fault_1st_2500A_load int(11) NOT NULL DEFAULT '0' COMMENT '1ºÅ2500A¸ºÔØÆÁ¿ª¹Ø¹ÊÕÏ״̬'," +
|
" switch_close_2st_2500A_load int(11) NOT NULL DEFAULT '0' COMMENT '2ºÅ2500A¸ºÔØÆÁ¿ª¹ØºÏբ״̬'," +
|
" switch_open_2st_2500A_load int(11) NOT NULL DEFAULT '0' COMMENT '2ºÅ2500A¸ºÔØÆÁ¿ª¹Ø·Öբ״̬'," +
|
" switch_fault_2st_2500A_load int(11) NOT NULL DEFAULT '0' COMMENT '2ºÅ2500A¸ºÔØÆÁ¿ª¹Ø¹ÊÕÏ״̬'," +
|
" curr_a float NOT NULL DEFAULT '0' COMMENT 'AÅŵçÁ÷'," +
|
" vol_a float NOT NULL DEFAULT '0' COMMENT 'AÅŵçѹ'," +
|
" curr_b float NOT NULL DEFAULT '0' COMMENT 'BÅŵçÁ÷'," +
|
" vol_b float NOT NULL DEFAULT '0' COMMENT 'BÅŵçѹ'," +
|
" note varchar(255) NOT NULL DEFAULT '' COMMENT '±¸ÓÃ'," +
|
" PRIMARY KEY (num)," +
|
" KEY index_dev_id (dev_id) USING BTREE" +
|
") ENGINE=InnoDB DEFAULT CHARSET=utf8;";
|
Sql_Mysql sql = new Sql_Mysql(pool.getConn());
|
try {
|
sql.sqlMysqlExecute(sql_str);
|
} catch (SQLException e) {
|
sql.logger.error(e.toString(), e);
|
}
|
}
|
|
/**
|
* ´´½¨tb_central_monitor_sys_rt±í
|
* @param pool
|
*/
|
public static void CreateTb_Central_Monitor_Sys_RtTable(MysqlConnPool pool) {
|
String sql_str = "CREATE TABLE IF NOT EXISTS "+Sql_Mysql.Tb_Central_Monitor_Sys_Rt+" (" +
|
" num bigint(20) NOT NULL AUTO_INCREMENT," +
|
" dev_id int(11) NOT NULL DEFAULT '0' COMMENT 'É豸id'," +
|
" record_time datetime NOT NULL DEFAULT '2000-01-01 00:00:00' COMMENT '¸üÐÂʱ¼ä'," +
|
" switch_close int(11) NOT NULL DEFAULT '0' COMMENT '¿ª¹ØºÏբ״̬'," +
|
" switch_open int(11) NOT NULL DEFAULT '0' COMMENT '¿ª¹Ø·Öբ״̬'," +
|
" switch_fault int(11) NOT NULL DEFAULT '0' COMMENT '¿ª¹Ø¹ÊÕÏ״̬'," +
|
" panel_vol float(11,0) NOT NULL DEFAULT '0' COMMENT '½øÏ߯Áµçѹ'," +
|
" panel_curr float(11,0) NOT NULL DEFAULT '0' COMMENT '½øÏ߯ÁµçÁ÷'," +
|
" note varchar(255) NOT NULL DEFAULT '0' COMMENT '±¸ÓÃ'," +
|
" PRIMARY KEY (num)," +
|
" KEY index_dev_id (dev_id) USING BTREE" +
|
") ENGINE=InnoDB DEFAULT CHARSET=utf8;";
|
Sql_Mysql sql = new Sql_Mysql(pool.getConn());
|
try {
|
sql.sqlMysqlExecute(sql_str);
|
} catch (SQLException e) {
|
sql.logger.error(e.toString(), e);
|
}
|
}
|
|
/**
|
* ´´½¨tb_central_monitor_sys_control±í
|
* @param pool
|
*/
|
public static void CreateTb_Central_Monitor_Sys_ControlTable(MysqlConnPool pool) {
|
String sql_str = "CREATE TABLE IF NOT EXISTS "+Sql_Mysql.Tb_Central_Monitor_Sys_Control+" (" +
|
" num bigint(20) NOT NULL," +
|
" dev_id int(11) NOT NULL DEFAULT '0' COMMENT 'É豸id'," +
|
" op_cmd int(11) NOT NULL DEFAULT '0' COMMENT 'ÃüÁî¿ØÖÆ'," +
|
" switch_close_1st_2500A int(11) NOT NULL DEFAULT '0' COMMENT '1ºÅ2500A½øÏ߯Á¿ª¹ØºÏÕ¢'," +
|
" switch_open_1st_2500A int(11) NOT NULL DEFAULT '0' COMMENT '1ºÅ2500A½øÏ߯Á¿ª¹Ø·ÖÕ¢'," +
|
" switch_close_2st_2500A int(11) NOT NULL DEFAULT '0' COMMENT '2ºÅ2500A½øÏ߯Á¿ª¹ØºÏÕ¢'," +
|
" switch_open_2st_2500A int(11) NOT NULL DEFAULT '0' COMMENT '2ºÅ2500A½øÏ߯Á¿ª¹Ø·ÖÕ¢'," +
|
" switch_close_bus_screen int(11) NOT NULL DEFAULT '0' COMMENT 'ĸÁªÆÁ¿ª¹ØºÏÕ¢'," +
|
" switch_open_bus_screen int(11) NOT NULL DEFAULT '0' COMMENT 'ĸÁªÆÁ¿ª¹Ø·ÖÕ¢'," +
|
" switch_close_1st_2500A_load int(11) NOT NULL DEFAULT '0' COMMENT '1ºÅ2500A¸ºÔØÆÁ¿ª¹ØºÏÕ¢'," +
|
" switch_open_1st_2500A_load int(11) NOT NULL DEFAULT '0' COMMENT '1ºÅ2500A¸ºÔØÆÁ¿ª¹Ø·ÖÕ¢'," +
|
" switch_close_2st_2500A_load int(11) NOT NULL DEFAULT '0' COMMENT '2ºÅ2500A¸ºÔØÆÁ¿ª¹ØºÏÕ¢'," +
|
" switch_open_2st_2500A_load int(11) NOT NULL DEFAULT '0' COMMENT '2ºÅ2500A¸ºÔØÆÁ¿ª¹Ø·ÖÕ¢'," +
|
" PRIMARY KEY (num)," +
|
" KEY index_dev_id (dev_id) USING BTREE" +
|
") ENGINE=InnoDB DEFAULT CHARSET=utf8;";
|
Sql_Mysql sql = new Sql_Mysql(pool.getConn());
|
try {
|
sql.sqlMysqlExecute(sql_str);
|
} catch (SQLException e) {
|
sql.logger.error(e.toString(), e);
|
}
|
}
|
|
|
/**
|
* ´´½¨tb_afe_inverter_rt±í
|
* @param pool
|
*/
|
public static void CreateTb_AFE_Inverter_RTTable(MysqlConnPool pool) {
|
String sql_str = "CREATE TABLE IF NOT EXISTS "+Sql_Mysql.Tb_AFE_Inverter_RT+" (" +
|
" num bigint(20) NOT NULL AUTO_INCREMENT," +
|
" dev_id int(11) NOT NULL DEFAULT '0' COMMENT 'É豸id'," +
|
" record_time datetime NOT NULL DEFAULT '2000-01-01 00:00:00' COMMENT '¼Ç¼ʱ¼ä'," +
|
" rectifier_run int(11) NOT NULL DEFAULT '0' COMMENT 'ÕûÁ÷ÔËÐÐ'," +
|
" inverter_run int(11) NOT NULL DEFAULT '0' COMMENT 'Äæ±äÔËÐÐ'," +
|
" report_alm int(11) NOT NULL DEFAULT '0' COMMENT '×ۺϱ¨¾¯'," +
|
" report_fault int(11) NOT NULL DEFAULT '0' COMMENT '×ۺϹÊÕÏ'," +
|
" motor_speed float NOT NULL DEFAULT '0' COMMENT 'µç»úתËÙ'," +
|
" output_power float NOT NULL DEFAULT '0' COMMENT 'Êä³öÓй¦¹¦ÂÊ'," +
|
" output_curr float NOT NULL DEFAULT '0' COMMENT 'Êä³öµçÁ÷'," +
|
" output_vol float NOT NULL DEFAULT '0' COMMENT 'Êä³öµçѹ'," +
|
" model_tmp float NOT NULL DEFAULT '0' COMMENT 'Ä£¿éζÈ'," +
|
" note varchar(255) NOT NULL DEFAULT '' COMMENT '±¸ÓÃ'," +
|
" PRIMARY KEY (num)" +
|
") ENGINE=InnoDB DEFAULT CHARSET=utf8;";
|
Sql_Mysql sql = new Sql_Mysql(pool.getConn());
|
try {
|
sql.sqlMysqlExecute(sql_str);
|
} catch (SQLException e) {
|
sql.logger.error(e.toString(), e);
|
}
|
}
|
|
/**
|
* ´´½¨tb_afe_inverter_control±í
|
* @param pool
|
*/
|
public static void CreateTb_AFE_Inverter_ControlTable(MysqlConnPool pool) {
|
String sql_str = "CREATE TABLE IF NOT EXISTS "+Sql_Mysql.Tb_AFE_Inverter_Control+" (" +
|
" num bigint(20) NOT NULL," +
|
" dev_id int(11) NOT NULL DEFAULT '0' COMMENT 'É豸id'," +
|
" op_cmd int(11) NOT NULL DEFAULT '0' COMMENT '¿ØÖÆÃüÁî'," +
|
" rectifier_start int(11) NOT NULL DEFAULT '0' COMMENT 'ÕûÁ÷Æô¶¯'," +
|
" rectifier_stop int(11) NOT NULL DEFAULT '0' COMMENT 'ÕûÁ÷Í£Ö¹'," +
|
" inverter_start int(11) NOT NULL DEFAULT '0' COMMENT 'Äæ±äÆô¶¯'," +
|
" inverter_stop int(11) NOT NULL DEFAULT '0' COMMENT 'Äæ±äÍ£Ö¹'," +
|
" speed_torque_change int(11) NOT NULL DEFAULT '0' COMMENT 'ËÙ¶È/ת¾ØÄ£Ê½'," +
|
" reset int(11) NOT NULL DEFAULT '0' COMMENT '¸´Î»'," +
|
" torque_set float NOT NULL DEFAULT '0' COMMENT 'ת¾Ø¸ø¶¨'," +
|
" speed_set float NOT NULL DEFAULT '0' COMMENT 'Ëٶȸø¶¨'," +
|
" positive_speed_limit float NOT NULL DEFAULT '0' COMMENT 'ÕýÏòתËÙÏÞ·ù'," +
|
" reverse_speed_limit float NOT NULL DEFAULT '0' COMMENT '·´ÏòתËÙÏÞ·ù'," +
|
" PRIMARY KEY (num)" +
|
") ENGINE=InnoDB DEFAULT CHARSET=utf8;";
|
Sql_Mysql sql = new Sql_Mysql(pool.getConn());
|
try {
|
sql.sqlMysqlExecute(sql_str);
|
} catch (SQLException e) {
|
sql.logger.error(e.toString(), e);
|
}
|
}
|
|
/**
|
* ´´½¨ tb_afe_inverter_state ±í
|
* @param pool
|
*/
|
public static void CreateAfe_Inverter_State_Table(MysqlConnPool pool) {
|
String sql_str = "CREATE TABLE IF NOT EXISTS "+Sql_Mysql.Afe_Inverter_State_Table+" (" +
|
" `num` bigint(20) NOT NULL AUTO_INCREMENT," +
|
" `dev_id` int(11) NOT NULL DEFAULT '0' COMMENT 'É豸id'," +
|
" `record_time` datetime NOT NULL DEFAULT '2000-01-01 00:00:00' COMMENT '¼Ç¼ʱ¼ä'," +
|
" `torque_set` float NOT NULL DEFAULT '0' COMMENT 'ת¾Ø¸ø¶¨'," +
|
" `speed_set` float NOT NULL DEFAULT '0' COMMENT 'Ëٶȸø¶¨'," +
|
" `positive_speed_limit` float NOT NULL DEFAULT '0' COMMENT 'ÕýÏòתËÙÏÞ·ù'," +
|
" `reverse_speed_limit` float NOT NULL DEFAULT '0' COMMENT '¸ºÏòתËÙÏÞ·ù'," +
|
" `motor_speed` float NOT NULL DEFAULT '0' COMMENT 'µç»úתËÙ'," +
|
" `output_power` float NOT NULL DEFAULT '0' COMMENT 'Êä³öÓй¦¹¦ÂÊ'," +
|
" `output_curr` float NOT NULL DEFAULT '0' COMMENT 'Êä³öµçÁ÷'," +
|
" `output_vol` float NOT NULL DEFAULT '0' COMMENT 'Êä³öµçѹ'," +
|
" `model_tmp` float NOT NULL DEFAULT '0' COMMENT 'Ä£¿éζÈ'," +
|
" `note` varchar(255) NOT NULL DEFAULT '' COMMENT '±¸ÓÃ'," +
|
" PRIMARY KEY (`num`)," +
|
" UNIQUE KEY `index_dev_id` (`dev_id`) USING BTREE," +
|
" KEY `index_record_time` (`record_time`) USING BTREE" +
|
") ENGINE=InnoDB DEFAULT CHARSET=utf8;";
|
Sql_Mysql sql = new Sql_Mysql(pool.getConn());
|
try {
|
sql.sqlMysqlExecute(sql_str);
|
} catch (SQLException e) {
|
sql.logger.error(e.toString(), e);
|
}
|
}
|
|
/**
|
* ´´½¨ tb_afe_rectifier_state ±í
|
* @param pool
|
*/
|
public static void CreateAfe_Rectifier_State_Table(MysqlConnPool pool) {
|
String sql_str = "CREATE TABLE IF NOT EXISTS " + Sql_Mysql.Afe_Rectifier_State_Table + " (" +
|
" `num` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'Ö÷¼ü'," +
|
" `dev_id` int(11) NOT NULL DEFAULT '0' COMMENT 'É豸id'," +
|
" `record_time` datetime NOT NULL DEFAULT '2000-01-01 00:00:00' COMMENT '¼Ç¼ʱ¼ä'," +
|
" `rectifier_start` int(11) NOT NULL DEFAULT '0' COMMENT 'ÕûÁ÷Æô¶¯'," +
|
" `rectifier_stop` int(11) NOT NULL DEFAULT '0' COMMENT 'ÕûÁ÷Í£Ö¹'," +
|
" `inverter_start` int(11) NOT NULL DEFAULT '0' COMMENT 'Äæ±äÆô¶¯'," +
|
" `inverter_stop` int(11) NOT NULL DEFAULT '0' COMMENT 'Äæ±äÍ£Ö¹'," +
|
" `speed_torque_change` int(11) NOT NULL DEFAULT '0' COMMENT 'ËÙ¶È/ת¾ØÄ£Ê½'," +
|
" `reset` int(11) NOT NULL DEFAULT '0' COMMENT '¸´Î»'," +
|
" `rectifier_run` int(11) NOT NULL DEFAULT '0' COMMENT 'ÕûÁ÷ÔËÐÐ'," +
|
" `inverter_run` int(11) NOT NULL DEFAULT '0' COMMENT 'Äæ±äÔËÐÐ'," +
|
" `report_alm` int(11) NOT NULL DEFAULT '0' COMMENT '×ۺϱ¨¾¯'," +
|
" `report_fault` int(11) NOT NULL DEFAULT '0' COMMENT '×ۺϹÊÕÏ'," +
|
" `note` varchar(255) NOT NULL DEFAULT '' COMMENT '±¸ÓÃ'," +
|
" PRIMARY KEY (`num`)," +
|
" UNIQUE KEY `index_dev_id` (`dev_id`) USING BTREE," +
|
" KEY `index_record_time` (`record_time`) USING BTREE" +
|
") ENGINE=InnoDB DEFAULT CHARSET=utf8;";
|
Sql_Mysql sql = new Sql_Mysql(pool.getConn());
|
try {
|
sql.sqlMysqlExecute(sql_str);
|
} catch (SQLException e) {
|
sql.logger.error(e.toString(), e);
|
}
|
}
|
}
|