| | |
| | | |
| | | public float groupgivevol; //并联给定电压 |
| | | public float groupgivecurr; //并联给定电流 |
| | | public int conn_div_flag;//当前处于的串联/并联模式模式(0并联,1串联) |
| | | |
| | | public boolean control_en = false; |
| | | |
| | |
| | | public void setControl_en(boolean control_en) { |
| | | this.control_en = control_en; |
| | | } |
| | | public int getConn_div_flag() { |
| | | return conn_div_flag; |
| | | } |
| | | public void setConn_div_flag(int conn_div_flag) { |
| | | this.conn_div_flag = conn_div_flag; |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | try { |
| | | //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); |
| | | flag = flag&&MyModbusUtils.writeCoil(Electric_4KW_ModbusAddress.getAddress(econn.getElectric_id()+1, "othermodes"),true, master); |
| | | |
| | | //300毫秒后复原 |
| | | Thread.sleep(300); |
| | | flag = flag&&MyModbusUtils.writeCoil(Electric_4KW_ModbusAddress.getAddress(econn.getElectric_id(), "othermodes"),false, master); |
| | | flag = flag&&MyModbusUtils.writeCoil(Electric_4KW_ModbusAddress.getAddress(econn.getElectric_id()+1, "othermodes"),false, master); |
| | | //判断当前是串联模式还是并联模式 |
| | | if(econn.getConn_div_flag()==0) {//当前处于的串联/并联模式模式(0并联,1串联) |
| | | flag = flag&&MyModbusUtils.writeCoil(Electric_4KW_ModbusAddress.getAddress(econn.getElectric_id(), "parallelmodes"),true, master); |
| | | flag = flag&&MyModbusUtils.writeCoil(Electric_4KW_ModbusAddress.getAddress(econn.getElectric_id()+1, "parallelmodes"),true, master); |
| | | //300毫秒后复原 |
| | | Thread.sleep(300); |
| | | flag = flag&&MyModbusUtils.writeCoil(Electric_4KW_ModbusAddress.getAddress(econn.getElectric_id(), "parallelmodes"),false, master); |
| | | flag = flag&&MyModbusUtils.writeCoil(Electric_4KW_ModbusAddress.getAddress(econn.getElectric_id()+1, "parallelmodes"),false, master); |
| | | }else { |
| | | flag = flag&&MyModbusUtils.writeCoil(Electric_4KW_ModbusAddress.getAddress(econn.getElectric_id(), "othermodes"),true, master); |
| | | flag = flag&&MyModbusUtils.writeCoil(Electric_4KW_ModbusAddress.getAddress(econn.getElectric_id()+1, "othermodes"),true, master); |
| | | //300毫秒后复原 |
| | | Thread.sleep(300); |
| | | flag = flag&&MyModbusUtils.writeCoil(Electric_4KW_ModbusAddress.getAddress(econn.getElectric_id(), "othermodes"),false, master); |
| | | flag = flag&&MyModbusUtils.writeCoil(Electric_4KW_ModbusAddress.getAddress(econn.getElectric_id()+1, "othermodes"),false, master); |
| | | |
| | | } |
| | | |
| | | logs.add(new User_Log(User_Log.Alter,User_Log.electricsystem,getGroupName(econn.electric_id)+"电压给定确认:"+econn.givevol,flag)); |
| | | } catch (InterruptedException e) { |
| | |
| | | sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.Tb_Electric_Control_Conn |
| | | + " ADD COLUMN groupgivecurr 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='conn_div_flag'"); |
| | | if(false == res.next()) { |
| | | sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.Tb_Electric_Control_Conn |
| | | + " ADD COLUMN conn_div_flag int NOT NULL DEFAULT '0' COMMENT '当前处于的串联/并联模式模式(0并联,1串联)';"); |
| | | } |
| | | } catch (SQLException e) { |
| | | e.printStackTrace(); |
| | | } finally { |
| | |
| | | econn.setConn_stop(res.getInt("conn_stop")); |
| | | econn.setGroupgivevol(res.getFloat("groupgivevol")); |
| | | econn.setGroupgivecurr(res.getFloat("groupgivecurr")); |
| | | econn.setConn_div_flag(res.getInt("conn_div_flag")); |
| | | } |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |