| | |
| | | public int conn_start ;// '并联运行启动', |
| | | public int conn_stop ;// '并联运行停止', |
| | | |
| | | public float groupgivevol; //并联给定电压 |
| | | public float groupgivecurr; //并联给定电流 |
| | | |
| | | public boolean control_en = false; |
| | | |
| | |
| | | this.switchoff2=0; |
| | | this.conn_start=0; |
| | | this.conn_stop=0; |
| | | this.groupgivevol = 0; |
| | | this.groupgivecurr = 0; |
| | | } |
| | | public int getNum() { |
| | | return num; |
| | |
| | | } |
| | | this.conn_stop = conn_stop; |
| | | } |
| | | |
| | | |
| | | public float getGroupgivevol() { |
| | | return groupgivevol; |
| | | } |
| | | public float getGroupgivecurr() { |
| | | return groupgivecurr; |
| | | } |
| | | public void setGroupgivevol(float groupgivevol) { |
| | | if(groupgivevol > 0) { |
| | | control_en = true; |
| | | } |
| | | this.groupgivevol = groupgivevol; |
| | | } |
| | | public void setGroupgivecurr(float groupgivecurr) { |
| | | if(groupgivecurr > 0) { |
| | | control_en = true; |
| | | } |
| | | this.groupgivecurr = groupgivecurr; |
| | | } |
| | | public boolean isControl_en() { |
| | | return control_en; |
| | | } |
| | |
| | | */ |
| | | if(econn.volset >0) { |
| | | try { |
| | | boolean flag = MyModbusUtils.writeHoldingRegister(Electric_4KW_ModbusAddress.getConnAddress(econn.getElectric_id(), "givevol"), econn.givevol, DataType.TWO_BYTE_INT_UNSIGNED, master); |
| | | flag = flag&&MyModbusUtils.writeHoldingRegister(Electric_4KW_ModbusAddress.getAddress(econn.getElectric_id(), "upsetvol"),econn.givevol, DataType.TWO_BYTE_INT_UNSIGNED, master); |
| | | //boolean flag = MyModbusUtils.writeHoldingRegister(Electric_4KW_ModbusAddress.getConnAddress(econn.getElectric_id(), "givevol"), econn.givevol, DataType.TWO_BYTE_INT_UNSIGNED, master); |
| | | boolean flag = MyModbusUtils.writeHoldingRegister(Electric_4KW_ModbusAddress.getAddress(econn.getElectric_id(), "upsetvol"),econn.givevol, DataType.TWO_BYTE_INT_UNSIGNED, master); |
| | | flag = flag&&MyModbusUtils.writeCoil(Electric_4KW_ModbusAddress.getAddress(econn.getElectric_id(), "othermodes"),true, master); |
| | | |
| | | flag = flag&&MyModbusUtils.writeHoldingRegister(Electric_4KW_ModbusAddress.getAddress(econn.getElectric_id()+1, "upsetvol"),econn.givevol, DataType.TWO_BYTE_INT_UNSIGNED, master); |
| | |
| | | //电压电流给定确认 |
| | | if(econn.currset >0) { |
| | | try { |
| | | boolean flag = MyModbusUtils.writeHoldingRegister(Electric_4KW_ModbusAddress.getConnAddress(econn.getElectric_id(), "givecurr"), econn.givecurr, DataType.TWO_BYTE_INT_UNSIGNED, master); |
| | | flag = flag&&MyModbusUtils.writeHoldingRegister(Electric_4KW_ModbusAddress.getAddress(econn.getElectric_id(), "upsetcurr"),econn.givecurr, DataType.TWO_BYTE_INT_UNSIGNED, master); |
| | | //boolean flag = MyModbusUtils.writeHoldingRegister(Electric_4KW_ModbusAddress.getConnAddress(econn.getElectric_id(), "givecurr"), econn.givecurr, DataType.TWO_BYTE_INT_UNSIGNED, master); |
| | | boolean flag = MyModbusUtils.writeHoldingRegister(Electric_4KW_ModbusAddress.getAddress(econn.getElectric_id(), "upsetcurr"),econn.givecurr, DataType.TWO_BYTE_INT_UNSIGNED, master); |
| | | flag = flag&&MyModbusUtils.writeCoil(Electric_4KW_ModbusAddress.getAddress(econn.getElectric_id(), "othermodes"),true, master); |
| | | |
| | | flag = flag&&MyModbusUtils.writeHoldingRegister(Electric_4KW_ModbusAddress.getAddress(econn.getElectric_id()+1, "upsetcurr"),econn.givecurr, DataType.TWO_BYTE_INT_UNSIGNED, master); |
| | |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | //设置并联给定电压 |
| | | if(econn.groupgivecurr > 0) { |
| | | boolean flag = MyModbusUtils.writeHoldingRegister(Electric_4KW_ModbusAddress.getConnAddress(econn.getElectric_id(), "givevol"), econn.groupgivevol, DataType.TWO_BYTE_INT_UNSIGNED, master); |
| | | logs.add(new User_Log(User_Log.Alter,User_Log.electricsystem,getGroupName(econn.electric_id)+"电压给定设置为:"+econn.groupgivevol,flag)); |
| | | } |
| | | |
| | | //设置并联给定电流 |
| | | if(econn.groupgivevol > 0) { |
| | | boolean flag = MyModbusUtils.writeHoldingRegister(Electric_4KW_ModbusAddress.getConnAddress(econn.getElectric_id(), "givecurr"), econn.groupgivecurr, DataType.TWO_BYTE_INT_UNSIGNED, master); |
| | | logs.add(new User_Log(User_Log.Alter,User_Log.electricsystem,getGroupName(econn.electric_id)+"电流给定设置为:"+econn.groupgivecurr,flag)); |
| | | } |
| | | |
| | | //并联运行启动 |
| | | if(econn.conn_start >0) { |
| | | try { |
| | |
| | | " switchoff2 int(11) NOT NULL DEFAULT '0' COMMENT '输出分闸2'," + |
| | | " conn_start int(11) NOT NULL DEFAULT '0' COMMENT '并联运行启动'," + |
| | | " conn_stop int(11) NOT NULL DEFAULT '0' COMMENT '并联运行停止'," + |
| | | " groupgivevol float NOT NULL DEFAULT '0' COMMENT '并联给定电压'," + |
| | | " groupgivecurr float NOT NULL DEFAULT '0' COMMENT '并联给定电流'," + |
| | | " PRIMARY KEY (num),"+ |
| | | " UNIQUE KEY electric_id_key (electric_id) USING BTREE " + |
| | | ") ENGINE=InnoDB DEFAULT CHARSET=utf8;"; |
| | | Sql_Mysql sql = new Sql_Mysql(pool.getConn()); |
| | | ResultSet res = null; |
| | | try { |
| | | sql.sqlMysqlExecute(sql_str); |
| | | sql.sqlMysqlExecute(sql_str); |
| | | //添加'并联给定电压'字段 |
| | | res = sql.sqlMysqlQuery("SELECT * FROM information_schema.columns" |
| | | + " WHERE table_schema='db_electricsystem'" |
| | | + " AND table_name='tb_electric_control_conn'" |
| | | + " AND column_name='groupgivevol'"); |
| | | if(false == res.next()) { |
| | | sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.Tb_Electric_Control_Conn |
| | | + " ADD COLUMN groupgivevol float NOT NULL DEFAULT '0' COMMENT '并联给定电压';"); |
| | | } |
| | | |
| | | //添加'并联给定电流'字段 |
| | | res = sql.sqlMysqlQuery("SELECT * FROM information_schema.columns" |
| | | + " WHERE table_schema='db_electricsystem'" |
| | | + " AND table_name='tb_electric_control_conn'" |
| | | + " AND column_name='groupgivecurr'"); |
| | | if(false == res.next()) { |
| | | sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.Tb_Electric_Control_Conn |
| | | + " ADD COLUMN groupgivecurr float NOT NULL DEFAULT '0' COMMENT '并联给定电流';"); |
| | | } |
| | | } catch (SQLException e) { |
| | | e.printStackTrace(); |
| | | } finally { |
| | |
| | | econn.setSwitchoff2(res.getInt("switchoff2")); |
| | | econn.setConn_start(res.getInt("conn_start")); |
| | | econn.setConn_stop(res.getInt("conn_stop")); |
| | | econn.setGroupgivevol(res.getFloat("groupgivevol")); |
| | | econn.setGroupgivecurr(res.getFloat("groupgivecurr")); |
| | | } |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |