Initial commit
This commit is contained in:
commit
b7d90b9afe
16245 files changed
+3396666
No files matched your search
@@ -0,0 +1,179 @@
|
||||
#!/usr/bin/python
|
||||
|
||||
from test_scenario_definitions import *
|
||||
import time
|
||||
import json
|
||||
|
||||
def generate_participant_state():
|
||||
|
||||
start_time = int(time.time()) * 1000
|
||||
|
||||
stmts = []
|
||||
|
||||
# sanitation material
|
||||
#start_time += 100
|
||||
|
||||
stock = []
|
||||
for i in range(1, 5):
|
||||
tmp1 = dict()
|
||||
tmp1['materialId'] = i;
|
||||
tmp1['materialCount'] = i*10;
|
||||
stock.append(tmp1)
|
||||
|
||||
json_str_stock = json.dumps(stock)
|
||||
#stmt = 'INSERT INTO ex_42.rec_dynamic_participant_data (sanitation_material_stock, participant_id, sample_time, sanitation_unique_id, qualification ) VALUES (\'%s\', %s, %s, %s, %s )' % (json_str, PPM1_participant_id[i], start_time, 123, 0 )
|
||||
|
||||
#stmt += ';'
|
||||
#stmts.append(stmt)
|
||||
|
||||
# firings
|
||||
for i in range(0, 9):
|
||||
start_time += 100
|
||||
|
||||
tmp = dict()
|
||||
if ((i%2) == 0):
|
||||
tmp['originatorChargeTypeId'] = 38;
|
||||
else:
|
||||
tmp['originatorChargeTypeId'] = 39;
|
||||
tmp['stateTime'] = start_time;
|
||||
tmp['vulnerabilityState'] = i;
|
||||
tmp['originatorId'] = 0;
|
||||
tmp['originatorType'] = 1; #participant
|
||||
tmp['vulnerabilityKindId'] = 0;
|
||||
tmp['vulnerabilityBits'] = 2**i;
|
||||
|
||||
data = []
|
||||
data.append(tmp)
|
||||
json_str = json.dumps(data)
|
||||
stmt = 'INSERT INTO ex_42.rec_dynamic_participant_data ( state_history, sanitation_material_stock, sanitation_unique_id, qualification, has_nbc_protection_active, has_nbc_protection_configured, participant_id, sample_time ) VALUES (\'%s\', \'%s\', \'%s\', \'%s\', false, false, %s, %s )' % (json_str, json_str_stock, 123, 2, PPM1_participant_id[i], start_time )
|
||||
|
||||
stmt += ';'
|
||||
stmts.append(stmt)
|
||||
|
||||
# nbc
|
||||
for i in range(13, 15):
|
||||
start_time += 100
|
||||
|
||||
tmp = dict()
|
||||
tmp['originatorChargeTypeId'] = 341; #chemical agent
|
||||
tmp['stateTime'] = start_time;
|
||||
tmp['vulnerabilityState'] = 5;
|
||||
tmp['originatorId'] = 3; #nbc
|
||||
tmp['originatorType'] = 2; #area effect simulation
|
||||
tmp['vulnerabilityKindId'] = 0;
|
||||
tmp['vulnerabilityBits'] = 2**5;
|
||||
|
||||
data = dict()
|
||||
data['ParticipantManagement::StateInformation'] = []
|
||||
data['ParticipantManagement::StateInformation'].append(tmp)
|
||||
json_str = json.dumps(data)
|
||||
stmt = 'INSERT INTO ex_42.rec_dynamic_participant_data ( state_history, has_nbc_protection_active, has_nbc_protection_configured, participant_id, sample_time ) VALUES (\'%s\', false, false, %s, %s )' % (json_str, PPM1_participant_id[i], start_time )
|
||||
|
||||
stmt += ';'
|
||||
stmts.append(stmt)
|
||||
|
||||
# mine area
|
||||
for i in range(15, 17):
|
||||
start_time += 100
|
||||
|
||||
tmp = dict()
|
||||
tmp['originatorChargeTypeId'] = 351; #mine area
|
||||
tmp['stateTime'] = start_time;
|
||||
tmp['vulnerabilityState'] = 8;
|
||||
tmp['originatorId'] = 2; #mine
|
||||
tmp['originatorType'] = 2; #area effect simulation
|
||||
tmp['vulnerabilityKindId'] = 0;
|
||||
tmp['vulnerabilityBits'] = 2**8;
|
||||
|
||||
data = dict()
|
||||
data['ParticipantManagement::StateInformation'] = []
|
||||
data['ParticipantManagement::StateInformation'].append(tmp)
|
||||
json_str = json.dumps(data)
|
||||
stmt = 'INSERT INTO ex_42.rec_dynamic_participant_data ( state_history, has_nbc_protection_active, has_nbc_protection_configured, participant_id, sample_time ) VALUES (\'%s\', false, false, %s, %s )' % (json_str, PPM1_participant_id[i], start_time )
|
||||
|
||||
stmt += ';'
|
||||
stmts.append(stmt)
|
||||
|
||||
# functional area
|
||||
for i in range(10, 13):
|
||||
start_time += 100
|
||||
|
||||
tmp = dict()
|
||||
tmp['originatorChargeTypeId'] = 411; #functional area
|
||||
tmp['stateTime'] = start_time;
|
||||
tmp['vulnerabilityState'] = 0;
|
||||
tmp['originatorId'] = 4; #functional area
|
||||
tmp['originatorType'] = 2; #area effect simulation
|
||||
tmp['vulnerabilityKindId'] = 0;
|
||||
tmp['vulnerabilityBits'] = 0;
|
||||
|
||||
data = dict()
|
||||
data['ParticipantManagement::StateInformation'] = []
|
||||
data['ParticipantManagement::StateInformation'].append(tmp)
|
||||
json_str = json.dumps(data)
|
||||
stmt = 'INSERT INTO ex_42.rec_dynamic_participant_data ( state_history, has_nbc_protection_active, has_nbc_protection_configured, participant_id, sample_time ) VALUES (\'%s\', false, false, %s, %s )' % (json_str, PPM1_participant_id[i], start_time )
|
||||
|
||||
stmt += ';'
|
||||
stmts.append(stmt)
|
||||
|
||||
# explosive device
|
||||
for i in range(18, 21):
|
||||
start_time += 100
|
||||
|
||||
tmp = dict()
|
||||
if ((i%2) == 0):
|
||||
tmp['originatorChargeTypeId'] = 48;
|
||||
else:
|
||||
tmp['originatorChargeTypeId'] = 49;
|
||||
tmp['stateTime'] = start_time;
|
||||
tmp['vulnerabilityState'] = i-17; #1,2,3
|
||||
tmp['originatorId'] = 1; #ied 1
|
||||
tmp['originatorType'] = 20; #improvisedExplosiveDevice
|
||||
tmp['vulnerabilityKindId'] = 0;
|
||||
tmp['vulnerabilityBits'] = 2**(i-17);
|
||||
|
||||
data = []
|
||||
data.append(tmp)
|
||||
|
||||
# tmp1 = dict()
|
||||
# tmp1['originatorChargeTypeId'] = 70;
|
||||
# tmp1['stateTime'] = start_time;
|
||||
# tmp1['vulnerabilityState'] = 8;
|
||||
# tmp1['originatorId'] = 1; #ied 1
|
||||
# tmp1['originatorType'] = 20; #improvisedExplosiveDevice
|
||||
# tmp1['vulnerabilityKindId'] = 289;
|
||||
# tmp1['vulnerabilityBits'] = 256;
|
||||
|
||||
# data.append(tmp1)
|
||||
|
||||
json_str = json.dumps(data)
|
||||
stmt = 'INSERT INTO ex_42.rec_dynamic_participant_data ( state_history, has_nbc_protection_active, has_nbc_protection_configured, participant_id, sample_time ) VALUES (\'%s\', false, false, %s, %s )' % (json_str, PPM1_participant_id[i], start_time )
|
||||
|
||||
stmt += ';'
|
||||
stmts.append(stmt)
|
||||
|
||||
# air support
|
||||
for i in range(21, 24):
|
||||
start_time += 100
|
||||
|
||||
tmp = dict()
|
||||
tmp['originatorChargeTypeId'] = 471;
|
||||
tmp['stateTime'] = start_time;
|
||||
tmp['vulnerabilityState'] = 8;
|
||||
tmp['originatorId'] = 0;
|
||||
tmp['originatorType'] = 2; #area effect simulation
|
||||
tmp['vulnerabilityKindId'] = 0;
|
||||
tmp['vulnerabilityBits'] = 2**8;
|
||||
|
||||
data = []
|
||||
data.append(tmp)
|
||||
json_str = json.dumps(data)
|
||||
stmt = 'INSERT INTO ex_42.rec_dynamic_participant_data ( state_history, has_nbc_protection_active, has_nbc_protection_configured, participant_id, sample_time ) VALUES (\'%s\', false, false, %s, %s )' % (json_str, PPM1_participant_id[i], start_time )
|
||||
|
||||
stmt += ';'
|
||||
stmts.append(stmt)
|
||||
|
||||
return stmts
|
||||
|
||||
if __name__ == "__main__":
|
||||
print '\n'.join(generate_participant_state())
|
||||
Reference in new issue
Block a user