-
Notifications
You must be signed in to change notification settings - Fork 5
Major modifications to input and backend for capacities, system validation, and time series handling #39
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Major modifications to input and backend for capacities, system validation, and time series handling #39
Conversation
BREAKING CHANGE: changes API for max/min capacities
| if len(self.price_profile) > 0: | ||
| self.price_profile = np.multiply(self.alpha, self.price_profile) | ||
|
|
||
| def evaluate(self, t: int, dispatch: float) -> float: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
very cool. perhaps we can add some logic to the extract_results() method that puts the time-dependent cashflow in addition to the total "objective"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To clarify, you're thinking of printing the sum of the cashflows on all components in the system for each timestep?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes.
BREAKING CHANGE: changes API for max/min capacities
…/caleb-sitton-inl/DOVE into feature/update-capacity-handling
|
I've attempted to approximate the effect of using functions for capacity and minimums on running time. I've done this by timing a DOVE script that contains 10 components and dispatches over a time series of length 8760. I timed this script when using the DOVE setup in this PR , then with a simple design that does not use functions. In this alternate design, I created attributes of components called |
dylanjm
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes look good to me.
| ] | ||
| ) | ||
|
|
||
| # This is a real capacity time series, which must be normalized |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is fine, but I think we should maybe turn off formatting for example files? @GabrielSoto-INL what do you think?
BREAKING CHANGE: changes API for max/min capacities
Addresses #36
Major changes included in this request include:
Adds a required float "
installed_capacity" attribute and an optional time-dependent "capacity_factor" attribute containing floats from 0 to 1 to the Component class. These correspond to the previousmax_capacity_profileattribute.Adds a time-dependent "
min_profile" attribute to replace the previousmin_capacity_profile.Adds methods to retrieve the capacity and minimum of a Component given a specific time index. Advantages of this design are that:
The primary disadvantage of this design is that a conditional check must now be executed whenever the component's capacity at a specific timestep is requested by Pyomo. Since this is likely a frequent event, this change may increase computation time, though I personally have no estimate of the magnitude of the increase.
Adds an attribute for Sink components called
demand_profile, which is a time-dependent version ofinstalled_capacity. Exactly one ofinstalled_capacityanddemand_profilemust be specified. Only ifinstalled_capacityis provided cancapacity_factoralso be provided. When the Component super class is instantiated inSink.__init__, ifdemand_profilewas provided, the requiredinstalled_capacityis set to the maximum value in the demand profile (installed_capacityis not used or needed for Sinks that have ademand_profile). The method for retrieving the capacity of a Component is overwritten in Sink to return the demand profile at the specified time index if provided, or if not, to callComponent.capacity_at_timestep.Reorganizes System validation to be contained in a single method. This method is automatically called immediately before solving the System, which is significant because this is the only window prior to the System solution at which the entire System is known to be final. The validation method does not require an explicit call from the user. This strategy, combined with the new methods added to the Component and CashFlow classes, allows users to modify specific attributes of Components in the System prior to solving the System while preventing them from circumventing the System's validation checks. This also improves computation time by only validating everything once, instead of potentially validating the same data multiple times as was possible previously. The debugging experience is slightly changed; when a System validation check fails, the error will appear on the line containing
System.solve(), not the line containing the first faulty input. Well-written error messages should be able to cover the clarity lost by this.The
time_indexattribute of the System has been renamed todispatch_window. In addition, validation for time series data has been relaxed to allow for adispatch_windowthat is not from 0 to the length of every time series. As long as the time series data contains values for every time index specified by thedispatch_window, the System will not error and will solve the dispatch problem for thedispatch_window.Creates a method belonging to the
CashFlowclass that calculates the value of the cashflow, given a time index and a dispatch value. This was previously implemented in the objective rule inrulelib.py, but it seems to belong better in theCashFlowclass since a method of calculatingCashFlowvalues is inherently part of theCashFlow's definition. The objective rule has been updated to use this new method. This method mirrors the new Component methods by removing the need for time series normalization of CashFlowprice_profileattributes.Adds a column to the dataframe returned by
extract_resultsthat shows the net cashflow of the system at each timestep.Updates and adds Component validation as necessary.
Updates examples to use new API.
Updates and adds tests.