Skip to content

Commit ada2bbb

Browse files
committed
Fix Integration block 0 error, update folder structure for Eclipse project
1 parent 3a61129 commit ada2bbb

File tree

197 files changed

+35589
-81
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

197 files changed

+35589
-81
lines changed

.DS_Store

-6 KB
Binary file not shown.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

.project

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<projectDescription>
3-
<name>OfficialGitRepo</name>
3+
<name>PLSIM</name>
44
<comment></comment>
55
<projects>
66
</projects>
@@ -14,4 +14,4 @@
1414
<natures>
1515
<nature>org.python.pydev.pythonNature</nature>
1616
</natures>
17-
</projectDescription>
17+
</projectDescription>

PLSim1.2/CalculationEngine.py renamed to CalculationEngine.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import pickle
55
import numpy as np
66
import sys
7+
from io import StringIO #this line may be needed if not present in your python setup
78
from pathlib import Path
89

910
#***NOTICE:: Run through project "PLSim 1.2" as the set relative location within the entire project.
@@ -123,7 +124,7 @@ def print_to_console(file_name, device_map, integral_array,integration_period,de
123124
energy = make_integral_array((state_np*device_map[device][state]['power']),integration_period)[-1]
124125
print(f'Device Name: {device:<50s}\t\tState: {state:<20s} Taken Entered Period: {enter_p:>7.3f}%\tTaken Whole Day Period: {day_p:>7.3f}%\tDaily Usage: {energy:>8.2f} Wh')
125126
# Total Usage
126-
print('\nDaily Energy Usage:')
127+
print('\nPeriod Energy Usage:')
127128
for device_name in device_cate_map:
128129
power = make_integral_array(device_cate_map[device_name]['power'], integration_period)
129130
print(f"Device:\t\t{device_name:<50s} {power[-1]:>8.3f} Wh")
File renamed without changes.
File renamed without changes.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
File renamed without changes.

PLSim1.2/.DS_Store

-10 KB
Binary file not shown.

PLSim1.2/.project

-17
This file was deleted.

PLSim1.2/.pydevproject

-5
This file was deleted.
-6.22 KB
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
-712 Bytes
Binary file not shown.
-663 Bytes
Binary file not shown.

PLSim1.2/graphs/graph1.png

-59.8 KB
Binary file not shown.

PLSim1.2/graphs/graph2.png

-78.8 KB
Binary file not shown.

PLSim1.2/graphs/graph3.png

-42.9 KB
Binary file not shown.

PLSim1.2/graphs/graph4.png

-56.3 KB
Binary file not shown.

PLSim1.2/graphs/graph5.png

-70.3 KB
Binary file not shown.

PLSim1.2/graphs/graph6.png

-76.4 KB
Binary file not shown.

PLSim1.2/logfile.log

-22
This file was deleted.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

PLSim1.2/simulationfiles/calculationoutputs/graph_file_test.csv

-15
This file was deleted.

PLSim1.2/simulationfiles/scheduleobjects/csvs/run_perams.cfg

-2
This file was deleted.

PLSim1.2/simulationfiles/scheduleobjects/csvs/test_group.csv

-5
This file was deleted.
-795 Bytes
Binary file not shown.

PLSim1.2/Scheduler.py renamed to Scheduler.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,9 @@
1111
# a modified file path corresponding to this new file structure ***
1212

1313
# input files
14+
#Note, use your project's local folder as the reference point!
1415
#INPUT_XML = "simulationfiles/devicedatabases/xmls/PLSim2Format.xml" #This is the input power usage "database" format
15-
INPUT_XML = "simulationfiles/devicedatabases/xmls/DeviceList_xml.xml"
16+
INPUT_XML = "simulationfiles/devicedatabases/xmls/DeviceListDB7.27.19.xml"
1617

1718
# output files
1819
OUTPUT_PICKLE = 'simulationfiles/scheduleobjects/run_params' #this is the pickled object file passed with the selected device list onto the calculation engine
@@ -155,7 +156,7 @@ def run_sim_state(integration_period: int, input_generators: list):
155156
elif inp == 'r':
156157
input_generators = make_input_generators(device_map)
157158
# Get Integration Period
158-
integration_period = input_int('Enter integration period for simulation calculation framework (whole seconds): ')
159+
integration_period = input_int('Enter block period for simulation calculation framework (specify number of units that fit in an hour - e.g. 1 minute=60): ')
159160
# Get Periods
160161
run_sim_state(integration_period, input_generators)
161162
# run_sim(integration_period, input_generators)
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

PLSim1.2/enginelib/graph.py renamed to enginelib/graph.py

+11-5
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,20 @@
66
num_graphs = 1
77

88
def make_integral_array(power_array: list, integration_period: int):
9-
to_return = [0]
10-
for i in range(len(power_array)-1):
11-
to_return.append(energy_used(power_array[i:i+2], integration_period) + to_return[-1])
9+
to_return = [0] #initialize the array with a 0
10+
for i in range(len(power_array)): #previously, len(power_array)-1, this would never evaluate length 1 arrays
11+
to_return.append(energy_used(power_array[i:i+2], integration_period) + to_return[-1]) #after first array entry, add new value to appended value
1212
return to_return
1313

1414
def energy_used(power_array, int_period: int):
15-
'''trapezoidal riemman sum estimate of the amount of power used'''
16-
return (sum(power_array[1:])/3600*int_period + sum(power_array[:len(power_array)-1])/3600*int_period)/2
15+
''' Integrate the array given period length per hour'''
16+
#return (sum(power_array[1:])/3600*int_period + sum(power_array[:len(power_array)-1])/3600*int_period)/2 # or #return ((sum(power_array[1:]))/(int_period * len(power_array))) #previously, len(power_array)-1, this would never evaluate length 1 arrays, prior '''trapezoidal riemman sum estimate of the amount of power used'''
17+
#return(np.trapz(power_array,dx=(int_period/3600)))#print (np.trapz(power_array,dx=(int_period/3600))) #debug print out of step integration value, the problem here is this needs a range, but we are using unitary periods
18+
return(sum(power_array)/len(power_array)*(int_period/3600)) #calculate with unitary period addition versus integration
19+
20+
21+
22+
1723

1824
def make_graph(data: list, int_period, x_label, y_label, title, fig, sub)-> None:
1925
''' graphs the data from the list using each point as a y coordinate in the line graph
File renamed without changes.
File renamed without changes.
File renamed without changes.

graphs/graph1.png

153 KB

graphs/graph2.png

237 KB

graphs/graph3.png

149 KB

graphs/graph4.png

206 KB

graphs/graph5.png

147 KB

graphs/graph6.png

175 KB
File renamed without changes.

0 commit comments

Comments
 (0)