Commit 52f6f0fa authored by Unknown's avatar Unknown
Browse files

small code comment cleanup and adding of glpk windows instructions

parent 71848710
Loading
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -57,6 +57,8 @@ pip install -r requirements.txt

Also install GLPK or another Pulp supporting solver.
Can be found [here](https://www.gnu.org/software/glpk/).
Windows installation instructions [here](http://www.osemosys.org/uploads/1/8/5/0/18504136/glpk_installation_guide_for_windows10_-_201702.pdf)


Edit the `config.yaml` file to use a selected solver.

+0 −73
Original line number Diff line number Diff line
@@ -359,79 +359,6 @@ class _NewFormatConverter(Converter):

        return time_series_list

    # def _get_network_nodes(self):
    #     nodes = []
    #     for column in self._get_columns('Network nodes'):
    #         (node_id, geo_coords, grid_coords, building_id, building_type,
    #          system_id, system_type) = column
    #
    #         node = {
    #             'id': node_id,
    #             'coords': {},
    #             'building': {
    #                 'id': building_id,
    #                 'type': building_type,
    #             },
    #             'system': {
    #                 'id': system_id,
    #                 'type': system_type,
    #             },
    #         }
    #
    #         if geo_coords:
    #             (latitude, longitude) = geo_coords.split(',')
    #
    #             node['coords']['latitude'] = float(latitude)
    #             node['coords']['longitude'] = float(longitude)
    #
    #         if grid_coords:
    #             (x, y) = grid_coords.split(',')
    #
    #             node['coords']['x'] = float(x)
    #             node['coords']['y'] = float(y)
    #
    #         if system_id:
    #             node['system']['id'] = system_id
    #
    #         if system_type:
    #             node['system']['type'] = system_type
    #
    #         nodes.append(node)
    #
    #     return nodes
    #
    # def _get_network_links(self):
    #     links = []
    #     for column in self._get_columns('Network links'):
    #         (link_id, start_id, end_id, link_type, length, capacity, voltage,
    #          electrical_resistance, electrical_reactance, total_thermal_loss,
    #          total_pressure_loss, operating_temperature) = column
    #
    #         link = {
    #             'id': link_id,
    #             'start_id':start_id,
    #             'end_id': end_id,
    #             'type': link_type,
    #             'length': length,
    #             'voltage': voltage,
    #             'electrical_resistance':electrical_resistance,
    #             'electrical_reactance': electrical_reactance,
    #             'total_thermal_loss': total_thermal_loss,
    #             'total_pressure_loss': total_pressure_loss,
    #             'operating_temperature': operating_temperature,
    #         }
    #         try:
    #             capacity = float(capacity)
    #         except ValueError:
    #             # References a capacity
    #             capacity = str(capacity)
    #         link['capacity'] = capacity
    #
    #         links.append(link)
    #
    #     return links


def parse_args():
    """Parses the command-line arguments."""
    parser = argparse.ArgumentParser(
+2 −11
Original line number Diff line number Diff line
@@ -117,20 +117,13 @@ def run_split_period(excel=None, request=None, output_filename=None, max_carbon=
    :param num_periods_in_sample_period: Number of periods being grouped together to be represented by 1 sub problem EHub. Example: One week representing a whole month would be ~four periods in a sample period.
    :param sample_period_position: Which period in the grouped sample to use as the representative EHub. Example the second week of every month would be two.
    :param solver: Which MILP solver to use.
    :return: The status of pylp's solving, the list of hubs (each with their solution), and the absolute cost (cost of all the subproblems added together with the correct factor)
    """
    hubs = split_hubs(excel, request, max_carbon, num_periods, len_periods, num_periods_in_sample_period, sample_period_position)
    constraints = merge_hubs(hubs)

    #TODO: Make sure storage looping is working for each sub_hub

    #FIXME: Ralph had specific instructions for how to handle the objective (wanting a single one or something)
    # "Make the objective function only one of the investment consts (since they're all the same) 
    # plus the operating cost for each sub-hub scaled by an appropriate factor to represent the whole year.""
    # objective = hubs[0].investment_cost
    # for hub in hubs:
    #     objective += hub.operating_cost*(num_periods_in_sample_period) + hub.maintenance_cost*(num_periods_in_sample_period)
    #If I don't set the function to this the investement costs are not balanced across the sub problems and the accuracy goes down.
    #In taking the total_cost for the final solution the investement cost should only be counted once
    objective = hubs[0].investment_cost
    for hub in hubs:
        objective += hub.operating_cost + hub.maintenance_cost
@@ -141,5 +134,3 @@ def run_split_period(excel=None, request=None, output_filename=None, max_carbon=
    output = multi_run_output(hubs, num_periods_in_sample_period)

    return status, hubs, output
 No newline at end of file

    #TODO: Figure out setting up the output
 No newline at end of file