zach401/acnportal: v0.2.0
Description
We added lots of cool stuff.
FeaturesAdds functionality to set tolerance for
is_feasibleat both the network initialization and interface levels. Also, the warning raised upon submission of an invalid schedule is more descriptive, now containing the maximum violation, the time index at which this violation occurred, and the constraint that this violation violated.Adds a function that, given a run simulation, returns a NumPy array of the datetimes over which the simulation was run. This is useful for plotting results from a simulation; namely, the time axis can now be expressed in terms of actual days/hours instead of periods. An example showing how to do this has been added to tutorial 2.
Adds a developer guide (
CONTRIBUTING.md) and aCODE_OF_CONDUCT.md. We should add additional guidelines toCONTRIBUTING.mdas needed.Adds function to calculate the percentage of sessions where energy demands were fully met (within a tolerance).
Adds option to run simulation with or without verbose outputs.
Adds functionality to dump and load ACN-Sim objects as JSON serializable objects. The serializer is invoked using obj.to_json() and the deserializer is invoked using cls.from_json([output from to_json]). The to_json method may take a file location or filehandle as an argument to specify where to dump. No input argument to to_json yields a JSON string. Likewise, the from_json method may take a file location, filehandle, or JSON string as an argument to specify from where to load.
As part of this feature, a BaseSimObj from which all ACN-Sim objects inherit from was added, in which some common serialization logic takes place. Each BaseSimObj-like defines its own to_ and from_dict methods, which convert BaseSimObj-likes into JSON serializable dicts.
The serializer handles the following cases:
- A native ACN-Sim object: dumps and loads without a problem.
- An extended ACN-Sim object that does not define
to/from_dictmethods:- If the object has no additional attributes (and the same constructor signature), dumps and loads without a problem.
- if the object has additional attributes, dumps as follows:
- The object's to_registry method is called if it has one; the resulting id is placed in the args_dict of the overall object.
- Next, if the object is JSON serializable, the object is left unchanged and placed in the args_dict.
- otherwise, the object's repr is placed in the args_dict.
- if the object has additional attributes, loads as follows:
- if read_from_id works on this object's id in the context_dict, use that and setattr.
- otherwise,
setattrdirectly without modification.
- Adds support to gather timeseries of charging current and pilot signal via the ACN-Data api.
- Adds support to get the number of charging sessions which match a query without returning those sessions.
- Adds support to get data from JPL and office001.
- Adds definitions of JPL and office001 networks.
- Adds
simple_acnwhich models a single-phase network with a single capacity constraint.station_idsargument allowssimple_acnto work with sessions from any real ACN.
- Adds support for discrete allowable charging rates for
SortedSchedulingAlgo. - Add
last_come_first_servedandlargest_remaining_processing_timefunctions for prioritizing sessions.
When calculating energy delivered in each period using the
Linear2Stagemodel, allows user to select between a "stepwise" energy calculation (assumes constant current in the period) or a more accurate "continuous" model. This only applies during the "tail" portion of the charging curve.Add function to estimate a feasible battery capacity from the requested_energy and stay_duration. Estimate is based on the smallest battery capacity (from a set of real battery capacities) and largest initial charge for which it would be feasible to deliver that much energy in the given amount of time. This puts the maximum amount of energy in the "tail" of the charging curve.
- Add support for utility tariffs and calculating charging cost including demand charge.
Refactored the representation of network constraints. Currently, network constraints are represented through the ConstraintSet class, which contains Constraints, each with a limit and a dictionary of lists representing a Current. This pull request changes the ConstraintSet representation into pandas.DataFrame of constraints, mapping individual EVSE currents to aggregate constraint currents in the network. Representing the network constraints as a DataFrame maintains information about EVSEs and Currents while also giving easy access to a matrix representation of the constraints, which is useful in optimization. Additionally, to preserve speed, is_feasible and constraint_current use pre-loaded NumPy matrices to do their calculations rather than pandas objects. Lesson 2 runs about twice as fast with these changes.
Voltage and phase angle moved to
ChargingNetworkrather than eachEVSE.Adds support for DeadbandEVSE in Interface's allowable_pilot_signals function by:
- Moving logic for determining allowable set into the EVSE-like classes.
- Returning the deadband end as the minimum rate for DeadbandEVSE.
A pilot signal of 0 is implied to be allowed for all EVSEs. This is mentioned in the documentation for the Interface's
allowable_pilot_signalsfunction.EVSEs have different salient parameters in their constructors depending on their types. So that constructors don't need to retain redundant arguments, a BaseEVSE class is created from which all EVSE classes inherit.
Convert models within ACN-Sim to use kW and kWh instead of A and A * period.
- Added methods to
Interfaceto convert kWh to A * period for easy use by algorithms.
- Added methods to
ChargingNetworks are now created by factory functions rather than each being a subclass, this allows a single network definition function to easily interface with multiple subclasses of
ChargingNetwork.max_recompute(the maximum number of periods between calls to the algorithm) is now an attribute of the algorithm, not the simulator. This makes it easier to ensure that max_recompute is set correctly for algorithms which require being called every so often, i.e. every period.
Added tests for ChargingNetwork, Simulator, and (new) Current classes. The Simulator tests include a test for the run method, which runs the first simulation of lesson 2 of the tutorials and compares charging_rates, pilot_signals, and peak with the known results from the master branch. As such, the simulator test directory now has a folder simulation data from the tutorial simulations. The integration test for run in test_simulator.py will catch tutorial-breaking bugs in future changes at the very least. Integration tests with scope between that of a unit test and that of a test running an entire simulation may be needed in the future.
Automated testing pipelines through Travis CI (+ build passing badge)
Removed an incorrect sym_comp current unbalance function from analysis, and the associated (commented out) test in test_integration.
evse_voltageininterface.pywas behaving as if network.voltages returned an array when it actually behaves as adict. The tests did not account for this error due to incorrect mocking of the voltages. This release fixes the bug and the test.Fixed dimension mismatch in
charging_rates_as_dfandpilot_signals_as_dfFixes a bug in which Interface's
last_applied_pilot_signalsmethod returned all pilot signals instead of the last ones applied.Fixes bug in
EV.reset()function by makinginit_chargeinput toBattery.reset()optional.Battery.reset()now resets to initial Battery charge on initialization by default.An index out of bounds error could occur when an empty schedule was submitted by the scheduler in the same iteration in which the pilot_signals and charging_rates matrices need to be expanded to accommodate the current iteration. The submission of an empty schedule caused the
_update_schedulesmethod to return before the lengths of the matrices were checked. This release ensures that pilot_signals and charging_rates at least have space to store data for the current iteration.Standardizes allowable_rates attribute in
FiniteRatesEVSEobjects. The allowable_rates attribute is now a list of rates, sorted in increasing order, with each rate occurring once and 0 included. User input to__init__is processed accordingly. Appropriate tests have been added.Also, a bug in which the
atolargument was not used for certain boundaries of theDeadbandEVSE's feasible set was fixed, and tests were added for theatolfunctionality.Use
timezone.localize()instead ofastimezonewhen converting naive date times to fix issues with usingastimezonewith pytz.Update laxity definition to account for current time rather than using arrival time.
Updated caltech_acn definition to put CC_pod EVSEs on phase AB rather than CA, as this is the true arrangement.
Files
zach401/acnportal-v0.2.0.zip
Files
(154.9 kB)
| Name | Size | Download all |
|---|---|---|
|
md5:ac789e69176c32fe50f594cedee3f563
|
154.9 kB | Preview Download |
Additional details
Related works
- Is supplement to
- https://github.com/zach401/acnportal/tree/v0.2.0 (URL)