综合管理平台数据库数据模拟程序
whyclxw
2021-03-25 230b4029e603c22c6160063cb109001080123670
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
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() {
        
        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();
        
        
    }
}