I am trying to add up time series of power values. For example, I will have a time series for the lighting power of a zone throughout the year, and I will have a time series for the equipment power of that zone throughout the year. What I want is the combined lighting and equipment power of that zone throughout the year. So say on March 3 at 5 PM, the lighting power is 500 W and the equipment power is 50 W, then I want the combined time series to show 350 W at that date and time.
I am trying to avoid a whole bunch of loops for now, as I noticed there was an operator+() method for time series in the OpenStudio SDK for version for 2.9.1. So say I have the following:
time_series_set = []
time_series = sql_file.timeSeries(run_period,"Zone Timestep","Zone Lights Electric Power","Zone 1")
if time_series.is_initialized then
time_series_set << time_series.get
end
time_series = sql_file.timeSeries(run_period,"Zone Timestep","Zone Electric Equipment Electric Power","Zone 1")
if time_series.is_initialized then
time_series_set << time_series.get
end
The above works just fine (notice how I gather the time_series into the array AFTER their .get). So then I did the following, just to make sure I get the right individual data.
time_series_set.each_with_index do |time_series,index|
runner.registerInfo("Time Series (#{index}) = #{time_series.values()}")
end
This works well also. Then I was hoping the following would work:
time_series_set.each_with_index do |time_series,index|
if index == 0 then
time_series_total = time_series
else
time_series_total = time_series_total.operator+(time_series)
end
end
However, this just seems to fail? I'd appreciate any thoughts about how to move this forward. Thank you.