New data collection trial tracking w/ extra file corresponding to experiment run data

This commit is contained in:
cs-powell
2025-04-17 08:25:21 -04:00
parent 8b6e14720c
commit 537bc9474e
2 changed files with 91 additions and 33 deletions

View File

@@ -1,11 +1,61 @@
Turbulence Experiments,Starting Altitude (AGL),Wind Layer Altitude,Wind Direction,Wind Speed,Turbulence,Thermal Rate,Thermal Percent,Thermal Altitude
0,2900,0,179,0,1,500,0.9,15000
1,2900,0,179,0,2,500,0.9,15000
2,2900,0,179,0,3,500,0.9,15000
3,2900,0,179,0,4,500,0.9,15000
4,2900,0,179,0,5,500,0.9,15000
5,2900,0,179,0,6,500,0.9,15000
6,2900,0,179,0,7,500,0.9,15000
7,2900,0,179,0,8,500,0.9,15000
8,2900,0,179,0,9,500,0.9,15000
9,2900,0,179,0,10,500,0.9,15000
Turbulence Experiments,Starting Altitude (AGL),Wind Layer Altitude,Wind Direction,Wind Speed,Turbulence,Thermal Rate,Thermal Percent,Thermal Altitude,Cognitive Delay
0,2900,0,179,0,1,500,0.9,15000,0.05
1,2900,0,179,0,1,500,0.9,15000,0.15
2,2900,0,179,0,1,500,0.9,15000,0.25
3,2900,0,179,0,1,500,0.9,15000,0.35
4,2900,0,179,0,1,500,0.9,15000,0.45
5,2900,0,179,0,1,500,0.9,15000,0.55
6,2900,0,179,0,2,500,0.9,15000,0.05
7,2900,0,179,0,2,500,0.9,15000,0.15
8,2900,0,179,0,2,500,0.9,15000,0.25
9,2900,0,179,0,2,500,0.9,15000,0.35
10,2900,0,179,0,2,500,0.9,15000,0.45
11,2900,0,179,0,2,500,0.9,15000,0.55
12,2900,0,179,0,3,500,0.9,15000,0.05
13,2900,0,179,0,3,500,0.9,15000,0.15
14,2900,0,179,0,3,500,0.9,15000,0.25
15,2900,0,179,0,3,500,0.9,15000,0.35
16,2900,0,179,0,3,500,0.9,15000,0.45
17,2900,0,179,0,3,500,0.9,15000,0.55
18,2900,0,179,0,4,500,0.9,15000,0.05
19,2900,0,179,0,4,500,0.9,15000,0.15
20,2900,0,179,0,4,500,0.9,15000,0.25
21,2900,0,179,0,4,500,0.9,15000,0.35
22,2900,0,179,0,4,500,0.9,15000,0.45
23,2900,0,179,0,4,500,0.9,15000,0.55
24,2900,0,179,0,5,500,0.9,15000,0.05
25,2900,0,179,0,5,500,0.9,15000,0.15
26,2900,0,179,0,5,500,0.9,15000,0.25
27,2900,0,179,0,5,500,0.9,15000,0.35
28,2900,0,179,0,5,500,0.9,15000,0.45
29,2900,0,179,0,5,500,0.9,15000,0.55
30,2900,0,179,0,6,500,0.9,15000,0.05
31,2900,0,179,0,6,500,0.9,15000,0.15
32,2900,0,179,0,6,500,0.9,15000,0.25
33,2900,0,179,0,6,500,0.9,15000,0.35
34,2900,0,179,0,6,500,0.9,15000,0.45
35,2900,0,179,0,6,500,0.9,15000,0.55
36,2900,0,179,0,7,500,0.9,15000,0.05
37,2900,0,179,0,7,500,0.9,15000,0.15
38,2900,0,179,0,7,500,0.9,15000,0.25
39,2900,0,179,0,7,500,0.9,15000,0.35
40,2900,0,179,0,7,500,0.9,15000,0.45
41,2900,0,179,0,7,500,0.9,15000,0.55
42,2900,0,179,0,8,500,0.9,15000,0.05
43,2900,0,179,0,8,500,0.9,15000,0.15
44,2900,0,179,0,8,500,0.9,15000,0.25
45,2900,0,179,0,8,500,0.9,15000,0.35
46,2900,0,179,0,8,500,0.9,15000,0.45
47,2900,0,179,0,8,500,0.9,15000,0.55
48,2900,0,179,0,9,500,0.9,15000,0.05
49,2900,0,179,0,9,500,0.9,15000,0.15
50,2900,0,179,0,9,500,0.9,15000,0.25
51,2900,0,179,0,9,500,0.9,15000,0.35
52,2900,0,179,0,9,500,0.9,15000,0.45
53,2900,0,179,0,9,500,0.9,15000,0.55
54,2900,0,179,0,10,500,0.9,15000,0.05
55,2900,0,179,0,10,500,0.9,15000,0.15
56,2900,0,179,0,10,500,0.9,15000,0.25
57,2900,0,179,0,10,500,0.9,15000,0.35
58,2900,0,179,0,10,500,0.9,15000,0.45
59,2900,0,179,0,10,500,0.9,15000,0.55
1 Turbulence Experiments Starting Altitude (AGL) Wind Layer Altitude Wind Direction Wind Speed Turbulence Thermal Rate Thermal Percent Thermal Altitude Cognitive Delay
2 0 2900 0 179 0 1 500 0.9 15000 0.05
3 1 2900 0 179 0 2 1 500 0.9 15000 0.15
4 2 2900 0 179 0 3 1 500 0.9 15000 0.25
5 3 2900 0 179 0 4 1 500 0.9 15000 0.35
6 4 2900 0 179 0 5 1 500 0.9 15000 0.45
7 5 2900 0 179 0 6 1 500 0.9 15000 0.55
8 6 2900 0 179 0 7 2 500 0.9 15000 0.05
9 7 2900 0 179 0 8 2 500 0.9 15000 0.15
10 8 2900 0 179 0 9 2 500 0.9 15000 0.25
11 9 2900 0 179 0 10 2 500 0.9 15000 0.35
12 10 2900 0 179 0 2 500 0.9 15000 0.45
13 11 2900 0 179 0 2 500 0.9 15000 0.55
14 12 2900 0 179 0 3 500 0.9 15000 0.05
15 13 2900 0 179 0 3 500 0.9 15000 0.15
16 14 2900 0 179 0 3 500 0.9 15000 0.25
17 15 2900 0 179 0 3 500 0.9 15000 0.35
18 16 2900 0 179 0 3 500 0.9 15000 0.45
19 17 2900 0 179 0 3 500 0.9 15000 0.55
20 18 2900 0 179 0 4 500 0.9 15000 0.05
21 19 2900 0 179 0 4 500 0.9 15000 0.15
22 20 2900 0 179 0 4 500 0.9 15000 0.25
23 21 2900 0 179 0 4 500 0.9 15000 0.35
24 22 2900 0 179 0 4 500 0.9 15000 0.45
25 23 2900 0 179 0 4 500 0.9 15000 0.55
26 24 2900 0 179 0 5 500 0.9 15000 0.05
27 25 2900 0 179 0 5 500 0.9 15000 0.15
28 26 2900 0 179 0 5 500 0.9 15000 0.25
29 27 2900 0 179 0 5 500 0.9 15000 0.35
30 28 2900 0 179 0 5 500 0.9 15000 0.45
31 29 2900 0 179 0 5 500 0.9 15000 0.55
32 30 2900 0 179 0 6 500 0.9 15000 0.05
33 31 2900 0 179 0 6 500 0.9 15000 0.15
34 32 2900 0 179 0 6 500 0.9 15000 0.25
35 33 2900 0 179 0 6 500 0.9 15000 0.35
36 34 2900 0 179 0 6 500 0.9 15000 0.45
37 35 2900 0 179 0 6 500 0.9 15000 0.55
38 36 2900 0 179 0 7 500 0.9 15000 0.05
39 37 2900 0 179 0 7 500 0.9 15000 0.15
40 38 2900 0 179 0 7 500 0.9 15000 0.25
41 39 2900 0 179 0 7 500 0.9 15000 0.35
42 40 2900 0 179 0 7 500 0.9 15000 0.45
43 41 2900 0 179 0 7 500 0.9 15000 0.55
44 42 2900 0 179 0 8 500 0.9 15000 0.05
45 43 2900 0 179 0 8 500 0.9 15000 0.15
46 44 2900 0 179 0 8 500 0.9 15000 0.25
47 45 2900 0 179 0 8 500 0.9 15000 0.35
48 46 2900 0 179 0 8 500 0.9 15000 0.45
49 47 2900 0 179 0 8 500 0.9 15000 0.55
50 48 2900 0 179 0 9 500 0.9 15000 0.05
51 49 2900 0 179 0 9 500 0.9 15000 0.15
52 50 2900 0 179 0 9 500 0.9 15000 0.25
53 51 2900 0 179 0 9 500 0.9 15000 0.35
54 52 2900 0 179 0 9 500 0.9 15000 0.45
55 53 2900 0 179 0 9 500 0.9 15000 0.55
56 54 2900 0 179 0 10 500 0.9 15000 0.05
57 55 2900 0 179 0 10 500 0.9 15000 0.15
58 56 2900 0 179 0 10 500 0.9 15000 0.25
59 57 2900 0 179 0 10 500 0.9 15000 0.35
60 58 2900 0 179 0 10 500 0.9 15000 0.45
61 59 2900 0 179 0 10 500 0.9 15000 0.55

View File

@@ -46,7 +46,7 @@ def loadFile():
def selectWeather(matrix,experimentNumber):
return matrix[experimentNumber]
def experimentSetUp(client,currentConditions,newExperiment):
def experimentSetUp(client,currentConditions,newExperiment,file):
# input("Check The Loaded File Now")
print("Entered: EXPERIMENTSETUP")
if(newExperiment):
@@ -146,10 +146,16 @@ def experimentSetUp(client,currentConditions,newExperiment):
print("Setting initial velocity")
zInit = "sim/flightmodel/position/local_vz"
client.sendDREF(zInit, 50)
print("Setting Fuel to Experiment Level")
# fuel = "sim/aircraft/weight/acf_m_fuel_tot"
fuel = "sim/flightmodel/weight/m_fuel"
fuelLevels = [20,20]
client.sendDREF(fuel, fuelLevels)
print("setup complete")
"""
Set orientation and Position
1 - Time
@@ -168,12 +174,13 @@ def experimentSetUp(client,currentConditions,newExperiment):
"Turbulence: {} \n" \
"Thermal Rate: {} \n" \
"Thermal Percent: {}\n" \
"Thermal Altitude: {}\n".format(currentConditions[0],currentConditions[1],currentConditions[2],currentConditions[3],currentConditions[4],
currentConditions[5],currentConditions[6],currentConditions[7],currentConditions[8])
"Thermal Altitude: {}\n" \
"Cognitive Delay: {}\n".format(currentConditions[0],currentConditions[1],currentConditions[2],currentConditions[3],currentConditions[4],
currentConditions[5],currentConditions[6],currentConditions[7],currentConditions[8],currentConditions[9])
specialPrint(message,False,messageType.REGULAR)
# file.write("[[[" + message + "]]]")
specialPrint(message,False,messageType.REGULAR)
else:
print("Experiment currently in progress, not resetting position and environmental conditions")
@@ -223,7 +230,7 @@ def runExperiment(title,currentConditions,allowPrinting,isNewExperiment,experime
while(timeElapsed <= timeoutLimit and experimentInProgress):
try:
with xpc.XPlaneConnect() as client:
"""
"""
Test Connection
"""
client.getDREF("sim/test/test_float")
@@ -235,13 +242,13 @@ def runExperiment(title,currentConditions,allowPrinting,isNewExperiment,experime
"""
Set Simulator Conditions
"""
experimentSetUp(cogModel.client,currentConditions,newExperiment)
experimentSetUp(cogModel.client,currentConditions,newExperiment,file)
currentDelay = float(currentConditions[9])
"""
"""
cogModel.client.pauseSim(False)
newExperiment = False
"""
SETUP DATA THREAD
"""
@@ -255,7 +262,7 @@ def runExperiment(title,currentConditions,allowPrinting,isNewExperiment,experime
elapsed = endTime - startTime
while(experimentInProgress):
elapsed = endTime - startTime
if(elapsed > 0.05):
if(elapsed > currentDelay):
cogModel.update_aircraft_state()
cogModel.update_controls_simultaneously()
client.pauseSim(False) #Unpause Simulator
@@ -340,38 +347,39 @@ def ex():
"""
One Time experimental setup
"""
title = specialPrint("Please Enter Experiment Set Title, leave blank for trial runs", False, messageType.REGULAR)
startAt = input("Start At Experiment #")
prefix = specialPrint("Please Enter Experiment Set Title, leave blank for trial runs", True, messageType.REGULAR)
experimentConditionMatrix = loadFile()
title = str(experimentConditionMatrix[0][0])
startAt = input("Start At Experiment # 1 to " + str(len(experimentConditionMatrix)-1))
title = str(prefix + "--" + experimentConditionMatrix[0][0])
specialPrint("Title is: " + title, False, messageType.REGULAR)
allowPrinting = False
isNewExperiment = True
experimentCount = int(startAt)
header = "Cycle Time,Latitude, Longitude, Altitude, Pitch, Roll\n"
file2 = open("/Users/flyingtopher/Desktop/Test Destination/Current Experiment/CurrentExperimentList.txt", 'w')
"""
Experiment Loop
"""
while(experimentCount<len(experimentConditionMatrix)):
setUp()
file = open("/Users/flyingtopher/X-Plane 11/Data.txt", 'a')
file.write(str(header)) #Write Header to File
file.write(str(header)) #Write Header to File$
currentConditions = experimentConditionMatrix[experimentCount]
exitExperimentLoop = runExperiment(title,currentConditions,allowPrinting,isNewExperiment,(experimentCount+1),file)
file2.write(str(experimentCount) +" // " + str(currentConditions) + "\n")
exitExperimentLoop = runExperiment(title,currentConditions,allowPrinting,isNewExperiment,experimentCount,file)
if(exitExperimentLoop):
break
cleanUp(experimentCount,title)
experimentCount+=1
cleanUp((experimentCount),title)
# pag.alert(text="Experiment " + str(experimentCount+1) + " complete. Starting new Experiment", title="EXPERIMENT STATUS UPDATE")
"""
End of Experiments
"""
now = datetime.datetime
##Adding something to copy all the battery files into a safe folder so they don't get overwritten
shutil.copytree("/Users/flyingtopher/Desktop/Test Destination/Current Experiment", ("/Users/flyingtopher/Desktop/Test Destination/Data Storage/" + str(now.now())), dirs_exist_ok=True)
shutil.copytree("/Users/flyingtopher/Desktop/Test Destination/Current Experiment", ("/Users/flyingtopher/Desktop/Test Destination/Data Storage/" + title + " " + str(now.now())), dirs_exist_ok=True)
specialPrint("Experiment Battery Complete", False,messageType.REGULAR)
if __name__ == "__main__":
ex()