package com.thread.devs;
|
|
import java.util.Date;
|
|
import com.mode.Device_Inf;
|
import com.mode.Dynamicload_State_rt;
|
import com.mode.Electric_State_2kw;
|
import com.mode.Manage_Util;
|
import com.sql.MysqlConnPool;
|
import com.thread.Manage_Simul_SQL;
|
|
public class Manage_Simul_2MWPower_thread implements Runnable{
|
|
public MysqlConnPool pool;
|
public Device_Inf device;
|
public Electric_State_2kw e2state;
|
|
public Manage_Simul_2MWPower_thread(MysqlConnPool pool,Device_Inf device){
|
this.device = device;
|
this.pool = pool;
|
e2state = new Electric_State_2kw(device.getDevice_id());
|
}
|
|
@Override
|
public void run() {
|
Manage_Simul_SQL.insert2MWPower(pool, e2state);
|
while(true) {
|
try {
|
//¹¹ÔìËæ»úÊý
|
createRandomData(e2state);
|
//ÍùÊý¾Ý¿â²åÈëÊý¾Ý
|
Manage_Simul_SQL.update2MWPower(pool, e2state);
|
|
|
Thread.sleep(1000);
|
} catch (InterruptedException e) {
|
e.printStackTrace();
|
}
|
}
|
}
|
|
public void createRandomData(Electric_State_2kw e2state) {
|
e2state.record_time=new Date();//'¼Ç¼ʱ¼ä',
|
|
e2state.brachdcvol = e2state.brachdcvol + Manage_Util.CreateIntRandom()*Manage_Util.CreateFloat0To1();
|
e2state.brachdccurr = e2state.brachdccurr + Manage_Util.CreateIntRandom()*Manage_Util.CreateFloat0To1();
|
e2state.alldcvol = e2state.alldcvol + Manage_Util.CreateIntRandom()*Manage_Util.CreateFloat0To1();
|
e2state.alldccurr = e2state.alldccurr + Manage_Util.CreateIntRandom()*2;
|
e2state.stopchargevol_one = e2state.stopchargevol_one + Manage_Util.CreateIntRandom()*Manage_Util.CreateFloat0To1();
|
e2state.stopchargevol_two = e2state.stopchargevol_two + Manage_Util.CreateIntRandom()*Manage_Util.CreateFloat0To1();
|
e2state.stopchargevol_three = e2state.stopchargevol_three + Manage_Util.CreateIntRandom()*Manage_Util.CreateFloat0To1();
|
e2state.stopchargevol_four = e2state.stopchargevol_four + Manage_Util.CreateIntRandom()*Manage_Util.CreateFloat0To1();
|
e2state.stopchargevol_five = e2state.stopchargevol_five + Manage_Util.CreateIntRandom()*Manage_Util.CreateFloat0To1();
|
e2state.controlangle = e2state.controlangle + Manage_Util.CreateIntRandom()*2;
|
e2state.localgivevol = e2state.localgivevol + Manage_Util.CreateIntRandom()*Manage_Util.CreateFloat0To1();
|
e2state.stopchargevol_two = e2state.stopchargevol_two + Manage_Util.CreateIntRandom()*Manage_Util.CreateFloat0To1();
|
e2state.volset = e2state.volset + Manage_Util.CreateIntRandom()*Manage_Util.CreateFloat0To1();
|
e2state.localgivecurr = e2state.localgivecurr + Manage_Util.CreateIntRandom()*Manage_Util.CreateFloat0To1();
|
e2state.currset = e2state.currset + Manage_Util.CreateIntRandom()*Manage_Util.CreateFloat0To1();
|
e2state.chargecurr_one = e2state.chargecurr_one + Manage_Util.CreateIntRandom()*2;
|
e2state.chargecurr_two = e2state.chargecurr_two + Manage_Util.CreateIntRandom()*Manage_Util.CreateFloat0To1();
|
e2state.chargecurr_three = e2state.chargecurr_three + Manage_Util.CreateIntRandom()*Manage_Util.CreateFloat0To1();
|
e2state.chargecurr_four = e2state.chargecurr_four + Manage_Util.CreateIntRandom()*2;
|
e2state.chargecurr_five = e2state.chargecurr_five + Manage_Util.CreateIntRandom()*Manage_Util.CreateFloat0To1();
|
e2state.consvolmode_chargecurr = e2state.consvolmode_chargecurr + Manage_Util.CreateIntRandom()*Manage_Util.CreateFloat0To1();
|
|
|
}
|
}
|