Skip to content

Commit

Permalink
0.7.3 - testing accim custom param analysis
Browse files Browse the repository at this point in the history
  • Loading branch information
dsanchez-garcia committed Apr 5, 2024
1 parent 4d06c36 commit 63bc43a
Show file tree
Hide file tree
Showing 6 changed files with 46 additions and 54 deletions.
16 changes: 0 additions & 16 deletions V940 error

This file was deleted.

File renamed without changes.
File renamed without changes.
16 changes: 8 additions & 8 deletions accim/sim/accim_Base_EMS.py
Original file line number Diff line number Diff line change
Expand Up @@ -520,20 +520,20 @@ def addEMSProgramsBase(self, ScriptType: str = None, verboseMode: bool = True):
Program_Line_15='endif',
Program_Line_16='endif',
Program_Line_17='if (ComfStand == 99) && (ComfMod == 3)',
Program_Line_18='if (RMOT >= ACSTall) && (RMOT <= ACSTaul)',
Program_Line_19='set ACST = RMOT*m+n+ACSToffset+ACSTtol',
Program_Line_20='elseif RMOT < ACSTall',
Program_Line_18='if (PMOT >= ACSTall) && (PMOT <= ACSTaul)',
Program_Line_19='set ACST = PMOT*m+n+ACSToffset+ACSTtol',
Program_Line_20='elseif PMOT < ACSTall',
Program_Line_21='set ACST = ACSTall*m+n+ACSToffset+ACSTtol',
Program_Line_22='elseif RMOT > ACSTaul',
Program_Line_22='elseif PMOT > ACSTaul',
Program_Line_23='set ACST = ACSTaul*m+n+ACSToffset+ACSTtol',
Program_Line_24='endif',
Program_Line_25='endif',
Program_Line_26='if (ComfStand == 99) && (ComfMod == 3)',
Program_Line_27='if (RMOT >= AHSTall) && (RMOT <= AHSTaul)',
Program_Line_28='set AHST = RMOT*m+n+AHSToffset+AHSTtol',
Program_Line_29='elseif RMOT < AHSTall',
Program_Line_27='if (PMOT >= AHSTall) && (PMOT <= AHSTaul)',
Program_Line_28='set AHST = PMOT*m+n+AHSToffset+AHSTtol',
Program_Line_29='elseif PMOT < AHSTall',
Program_Line_30='set AHST = AHSTall*m+n+AHSToffset+AHSTtol',
Program_Line_31='elseif RMOT > AHSTaul',
Program_Line_31='elseif PMOT > AHSTaul',
Program_Line_32='set AHST = AHSTaul*m+n+AHSToffset+AHSTtol',
Program_Line_33='endif',
Program_Line_34='endif',
Expand Down
25 changes: 25 additions & 0 deletions accim/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,31 @@ def modify_timesteps_path(idfpath, timesteps: int):
modify_timesteps(idf_object=building, timesteps=timesteps)
building.save()

def set_occupancy_to_always(idf_object):
if 'On 24/7' in [i.Name for i in idf_object.idfobjects['Schedule:Compact']]:
print('On 24/7 Schedule:Compact object was already in the model.')
else:
idf_object.newidfobject(
key='Schedule:Compact',
Schedule_Type_Limits_Name='Any Number',
Field_1='Through: 12/31',
Field_2='For: AllDays',
Field_3='Until: 24:00',
Field_4='1'
)

obj_ppl = [i for i in idf_object.idfobjects['people']]
for ppl in obj_ppl:
ppl.Number_of_People_Schedule_Name = 'On 24/7'
print(f'{ppl.Name} Number of People Schedule Name has been set to always occupied.')


def set_occupancy_to_always_path(idfpath):
from besos.eppy_funcs import get_building
building = get_building(idfpath)
set_occupancy_to_always(idf_object=building)
building.save()

def reduce_runtime(
idf_object,
minimal_shadowing: bool = True,
Expand Down
43 changes: 13 additions & 30 deletions testing meter custom_v02_reduce_runtime.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
from besos.eplus_funcs import print_available_outputs
from besos.objectives import VariableReader, MeterReader

from accim.utils import print_available_outputs_mod
from accim.utils import print_available_outputs_mod, modify_timesteps, set_occupancy_to_always
import numpy as np

import accim.sim.accis_single_idf_funcs as accis
Expand All @@ -31,7 +31,7 @@
TempCtrl='temperature',
# Output_gen_dataframe=True,
make_averages=True,
debugging=True
# debugging=True
)

##
Expand Down Expand Up @@ -74,33 +74,16 @@ def reduce_runtime(
# maximum_figures_in_shadow_overlap_calculations=200
# )

def modify_timesteps(idf_object, timesteps: int):
obj_timestep = [i for i in idf_object.idfobjects['Timestep']][0]
timestep_prev = obj_timestep.Number_of_Timesteps_per_Hour
obj_timestep.Number_of_Timesteps_per_Hour = timesteps
print(f'Number of Timesteps per Hour was previously set to '
f'{timestep_prev} days, and it has been modified to {timesteps} days.')

modify_timesteps(idf_object=building, timesteps=2)
# def modify_timesteps(idf_object, timesteps: int):
# obj_timestep = [i for i in idf_object.idfobjects['Timestep']][0]
# timestep_prev = obj_timestep.Number_of_Timesteps_per_Hour
# obj_timestep.Number_of_Timesteps_per_Hour = timesteps
# print(f'Number of Timesteps per Hour was previously set to '
# f'{timestep_prev} days, and it has been modified to {timesteps} days.')

modify_timesteps(idf_object=building, timesteps=6)

def set_occupancy_to_always(idf_object):
if 'On 24/7' in [i.Name for i in idf_object.idfobjects['Schedule:Compact']]:
print('On 24/7 Schedule:Compact object was already in the model.')
else:
idf_object.newidfobject(
key='Schedule:Compact',
Schedule_Type_Limits_Name='Any Number',
Field_1='Through: 12/31',
Field_2='For: AllDays',
Field_3='Until: 24:00',
Field_4='1'
)

obj_ppl = [i for i in idf_object.idfobjects['people']]
for ppl in obj_ppl:
ppl.Number_of_People_Schedule_Name = 'On 24/7'
print(f'{ppl.Name} Number of People Schedule Name has been set to always occupied.')

set_occupancy_to_always(idf_object=building)

Expand Down Expand Up @@ -274,7 +257,7 @@ def mean(result):
##


inputs_lhs = sampling.dist_sampler(sampling.lhs, problem, num_samples=2)
inputs_lhs = sampling.dist_sampler(sampling.lhs, problem, num_samples=5)
inputs_lhs

num_samples = 1
Expand All @@ -293,7 +276,7 @@ def mean(result):
problem=problem,
building=building,
epw='Sydney.epw',
out_dir='besos_outdir_10timesteps_sydney_vof-0.1-max-6_debug'
out_dir='besos_outdir_6timesteps_sydney_vof-0.1-max-6'
)

outputs = evaluator.df_apply(
Expand All @@ -309,8 +292,8 @@ def mean(result):
# outputs_mod['energy ratio'] = outputs_mod['HVAC Electricity Usage'] / outputs_mod['Total Electricity Usage']

# generated_buildings = [evaluator.generate_building(df=samples_short, index=i, file_name=f'short_sample_row_{i}') for i in range(5)]
evaluator.generate_building(df=inputs_lhs, index=0, file_name='num_0')
evaluator.generate_building(df=inputs_lhs, index=1, file_name='num_1')
# evaluator.generate_building(df=inputs_lhs, index=0, file_name='num_0')
# evaluator.generate_building(df=inputs_lhs, index=1, file_name='num_1')
# evaluator.generate_building(df=inputs_lhs, index=2, file_name='num_2')
# evaluator.generate_building(df=inputs_lhs, index=3, file_name='num_3')
# evaluator.generate_building(df=inputs_lhs, index=4, file_name='num_4')
Expand Down

0 comments on commit 63bc43a

Please sign in to comment.