Exemple #1
0
 def _process_collections(self, description, data_type_text, unit):
     """Convert the raw data in the hidden _data property to data collections."""
     data_type = Power() if unit == 'W' else MassFlowRate()
     collections = []
     for i, col_head in enumerate(self._headers):
         if data_type_text in col_head:
             metadata = {
                 'type': description,
                 'Zone': col_head.split(':')[0]
             }
             head = Header(data_type, unit, self._a_period, metadata)
             collections.append(
                 HourlyContinuousCollection(
                     head, [float(val) for val in self._data[i]]))
     return collections
def data_to_load(data_colls, data_type, analysis_period):
    """Convert data collections output by EnergyPlus to a single load collection.

    Args:
        data_colls: A list of monthly data collections for an energy term.
        data_type: Text for the data type of the collections (eg. "Cooling").
        analysis_period: AnalysisPeriod object describing the date and timestep
            of the design day.
    """
    if len(data_colls) != 0:
        total_vals = [sum(ts_vals) for ts_vals in zip(*data_colls)]
    else:  # just make a "filler" collection of 0 values
        total_vals = [0] * (24 * analysis_period.timestep)
    meta_dat = {'type': data_type}
    total_head = Header(Power(), 'W', analysis_period, meta_dat)
    return HourlyContinuousCollection(total_head, total_vals)
 def heat_loss_convection(self):
     """Data Collection of heat loss by convection in [W]."""
     return self._get_coll('_hl_convection_coll',
                           self._heat_loss_convection,
                           Power('Heat Loss From Convection'), 'W')
 def heat_loss_dry_respiration(self):
     """Data Collection of heat loss by dry respiration in [W]."""
     return self._get_coll('_hl_dry_respiration_coll',
                           self._heat_loss_dry_respiration,
                           Power('Heat Loss From Dry Respiration'), 'W')
 def heat_loss_latent_respiration(self):
     """Data Collection of heat loss by latent respiration in [W]."""
     return self._get_coll('_hl_latent_respiration_coll',
                           self._heat_loss_latent_respiration,
                           Power('Heat Loss From Latent Respiration'), 'W')
 def heat_loss_sweating(self):
     """Data Collection of heat loss by sweating in [W]."""
     return self._get_coll('_hl_sweating', self._heat_loss_sweating,
                           Power('Heat Loss From Sweating'), 'W')
Exemple #7
0
                pv = val[0]['size_kw']
            elif key == 'storage' and len(val) != 0:
                storage = [val[0]['size_kw'], val[0]['size_kwh']]
            elif key == 'generator' and len(val) != 0:
                generator = val[0]['size_kw']

    # parse the CSV results of the simulation if successful
    if os.path.isfile(re_csv):
        data = []  # final list of data to be collected
        # parse the data and figure out the timeseries properties
        csv_data = csv_to_matrix(re_csv)
        csv_header = csv_data.pop(0)
        a_period = extract_analysis_period(csv_data)
        for col, col_name in zip(zip(*csv_data), csv_header):
            if col_name.startswith('REopt:'):
                # figure out the type of object to write into the metadata
                base_name = col_name.replace('REopt:', '').split(':')
                end_name, units_init = base_name[-1].split('(')
                units_init = units_init.replace(')', '')
                if units_init == 'kw':
                    units, data_type = 'kW', Power()
                elif units_init == 'pct':
                    units, data_type = 'fraction', Fraction()
                else:
                    continue
                metadata = {'type': ':'.join(base_name[:-1] + [end_name])}
                # create the final data collections
                result_vals = [float(val) for val in col]
                header = Header(data_type, units, a_period, metadata)
                data.append(HourlyContinuousCollection(header, result_vals))