package com.thread.devs;
|
|
import java.util.Date;
|
|
import com.mode.Device_Inf;
|
import com.mode.Dynamicload_State_rt;
|
import com.mode.Electric_state;
|
import com.mode.Manage_Util;
|
import com.sql.MysqlConnPool;
|
import com.thread.Manage_Simul_SQL;
|
|
public class Manage_Simul_4MWPower_thread implements Runnable{
|
|
public MysqlConnPool pool;
|
public Device_Inf device;
|
public Electric_state estate;
|
|
public Manage_Simul_4MWPower_thread(MysqlConnPool pool,Device_Inf device){
|
this.device = device;
|
this.pool = pool;
|
estate = new Electric_state(device.getDevice_id());
|
}
|
|
@Override
|
public void run() {
|
|
while(true) {
|
try {
|
//¹¹ÔìËæ»úÊý
|
createRandomData(estate);
|
//ÍùÊý¾Ý¿â²åÈëÊý¾Ý
|
Manage_Simul_SQL.update4MWPower(pool, estate);
|
|
|
Thread.sleep(1000);
|
} catch (InterruptedException e) {
|
e.printStackTrace();
|
}
|
}
|
}
|
|
public void createRandomData(Electric_state estate) {
|
estate.record_time=new Date();//'¼Ç¼ʱ¼ä',
|
estate.case_trip_output = Manage_Util.CreateSwitchRanDom();
|
estate.fault_reset_signal = Manage_Util.CreateSwitchRanDom();
|
estate.high_vol_switch_status = Manage_Util.CreateSwitchRanDom();
|
estate.stop_button = Manage_Util.CreateSwitchRanDom();
|
|
estate.alldcvol = estate.alldcvol + Manage_Util.CreateIntRandom()*Manage_Util.CreateFloat0To1();
|
estate.alldccurr = estate.alldccurr + Manage_Util.CreateIntRandom()*Manage_Util.CreateFloat0To1();
|
|
estate.main_cabinet_fan_status = Manage_Util.CreateSwitchRanDom();
|
estate.trans_cabinet_door_lock = Manage_Util.CreateSwitchRanDom();
|
estate.trans_cabinet_overtem_alarm = Manage_Util.CreateSwitchRanDom();
|
estate.trans_cabinet_overtem_trip = Manage_Util.CreateSwitchRanDom();
|
estate.qs1_state = Manage_Util.CreateSwitchRanDom();
|
estate.qs2_state = Manage_Util.CreateSwitchRanDom();
|
estate.switch_cabinet_door_status = Manage_Util.CreateSwitchRanDom();
|
estate.conn_flag = Manage_Util.CreateSwitchRanDom();
|
|
}
|
|
}
|