lib/openstudio-standards/schedules/modify.rb in openstudio-standards-0.6.0.rc2 vs lib/openstudio-standards/schedules/modify.rb in openstudio-standards-0.6.3
- old
+ new
@@ -23,14 +23,14 @@
# Create new values by using the multiplier on the original values
new_values = []
values.each do |value|
if lower_apply_limit.nil?
- new_values << value * multiplier
+ new_values << (value * multiplier)
else
if value > lower_apply_limit
- new_values << value * multiplier
+ new_values << (value * multiplier)
else
new_values << value
end
end
end
@@ -311,25 +311,25 @@
if times[i] > before_time && times[i] <= after_time
# updated this so times[i] == before_time goes into the else
if inside_value.nil?
new_values << sch_values[i]
elsif modification_type == 'Sum'
- new_values << inside_value + sch_values[i]
+ new_values << (inside_value + sch_values[i])
elsif modification_type == 'Replace'
new_values << inside_value
else # should be Multiplier
- new_values << inside_value * sch_values[i]
+ new_values << (inside_value * sch_values[i])
end
else
if outside_value.nil?
new_values << sch_values[i]
elsif modification_type == 'Sum'
- new_values << outside_value + sch_values[i]
+ new_values << (outside_value + sch_values[i])
elsif modification_type == 'Replace'
new_values << outside_value
else # should be Multiplier
- new_values << outside_value * sch_values[i]
+ new_values << (outside_value * sch_values[i])
end
end
end
@@ -440,16 +440,16 @@
shift_time = OpenStudio::Time.new(0, shift_hours, shift_minutes, 0)
# calculations
if options['base_start_hoo'] <= options['base_finish_hoo']
base_opp_day_length = options['base_finish_hoo'] - options['base_start_hoo']
- mid_hoo = start_hoo_time + (finish_hoo_time - start_hoo_time) / 2
+ mid_hoo = start_hoo_time + ((finish_hoo_time - start_hoo_time) / 2)
mid_non_hoo = mid_hoo + time_12
if mid_non_hoo > time_24 then mid_non_hoo -= time_24 end
else
base_opp_day_length = options['base_finish_hoo'] - options['base_start_hoo'] + 24
- mid_non_hoo = finish_hoo_time + (start_hoo_time - finish_hoo_time) / 2
+ mid_non_hoo = finish_hoo_time + ((start_hoo_time - finish_hoo_time) / 2)
mid_hoo = mid_non_hoo + time_12
if mid_non_hoo > time_24 then mid_non_hoo -= time_24 end
end
adjusted_opp_day_length = base_opp_day_length + options['delta_length_hoo']
hoo_time_multiplier = adjusted_opp_day_length / base_opp_day_length
@@ -527,12 +527,12 @@
# create logic for four possible quadrants. Assume any quadrant can pass over 24/0 threshold
time < start_hoo_time ? (temp_time = time + time_24) : (temp_time = time)
# calculate change in time do to hoo delta
if temp_time <= adj_finish_hoo_time
- expand_time = (temp_time - adj_mid_hoo) * hoo_time_multiplier - (temp_time - adj_mid_hoo)
+ expand_time = ((temp_time - adj_mid_hoo) * hoo_time_multiplier) - (temp_time - adj_mid_hoo)
else
- expand_time = (temp_time - adj_mid_non_hoo) * non_hoo_time_multiplier - (temp_time - adj_mid_non_hoo)
+ expand_time = ((temp_time - adj_mid_non_hoo) * non_hoo_time_multiplier) - (temp_time - adj_mid_non_hoo)
end
new_time = time + shift_time + expand_time
# adjust wrap around times