Acnportal

Latest version: v0.3.3

Safety actively analyzes 621469 Python packages for vulnerabilities to keep your Python projects secure.

Scan your dependencies

Page 1 of 2

1.0

ACN-Sim Case Study
Comparing Baseline Algorithms in Constrained Infrastructure

To demonstrate the usefulness of ACN-Sim we present two simple case studies.

unbalanced_three_phase_infrastructure.ipynb

In the first study, we demonstrate the importance of considering the three-phase nature of charging networks by showing that only considering limits on the aggregate charging current can lead to line overloads in an unbalanced three-phase system.

baseline_algorithms_w_constrained_infrastructure.ipynb

In the second study, we compare the percentage of energy demands which are met at various infrastructure capacities for Earliest Deadline First, Least Laxity First, First Come First Served, and Round Robin.

infrastructure_design_evaluation.ipynb

In this third study, we evaluate 4 infrastructure designs including uncontrolled charging with level-1 and level-2 charging as well as level-2 smart charging using LLF.

simple_pandapower_cosim.ipynb

In this forth study, we use pandapower to examine the effect of uncontrolled and smart EV charging on a simple stylized distribution feeder.

0.3.3

What's Changed
* Refactor test_interface to add constraints using built-in functions. by sunash in https://github.com/zach401/acnportal/pull/100
* Remove Python 3.6 and 3.7 and add 3.10 and 3.11 in GHA. by zach401 in https://github.com/zach401/acnportal/pull/117
* Update pandas version direct to master by zach401 in https://github.com/zach401/acnportal/pull/116
* Version bump. by zach401 in https://github.com/zach401/acnportal/pull/118


**Full Changelog**: https://github.com/zach401/acnportal/compare/0.3.2...v0.3.3

0.3.2

Features
ACN-Sim
- ChargingNetwork.plugin() now uses the station_id attribute of the EV which is plugging in instead of a separate argument.
- ChargingNetwork.unplug() takes in a session_id and does not unplug the EV if its session_id does not match.
- Ensure that tariff schedules are included during pip install.
- Support for generating events from statistical models, including utilities to train and draw from Gaussian Mixture Models.
- Support for dynamic space assignment and waiting queues.
- Update UnplugEvent so that it contains a reference to the EV object so that it can properly unplug the EV even it its station_id changes.

Algorithms
- Add pipeline step to remove sessions where remaining energy demand is less than the minimum energy that can be delivered in a single time period.
- Algorithms now use estimated departure instead of actual departure.

Overall
- Better mypy type checking.
- Integration with Github actions for automated testing.

0.2.2

Enforces pandas >=1.0.0 in setup.py requirements. This avoids a bug (ImportError on stringify_path) that occurs if pandas 0.x.x is used.

0.2.1

Fix a test failing due to numerical errors on Python 3.6.

0.2.0

We added lots of cool stuff.

Features

- Adds functionality to set tolerance for `is_feasible` at 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 a `CODE_OF_CONDUCT.md`. We should add additional guidelines to `CONTRIBUTING.md` as 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.

JSON Serializer
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 `dict`s.

Behaviors

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_dict` methods:
- 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, `setattr` directly without modification.

ACN-Data Client
- 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.

Networks
- Adds definitions of JPL and office001 networks.
- Adds `simple_acn` which models a single-phase network with a single capacity constraint.
- `station_ids` argument allows `simple_acn` to work with sessions from any real ACN.

Algorithms
- Adds support for discrete allowable charging rates for `SortedSchedulingAlgo`.
- Add `last_come_first_served` and `largest_remaining_processing_time` functions for prioritizing sessions.

Battery Models
- When calculating energy delivered in each period using the `Linear2Stage` model, 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.


Tariffs
- Add support for utility tariffs and calculating charging cost including demand charge.

Refactors

- 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 `ChargingNetwork` rather than each `EVSE`.

- 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_signals` function.

- 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 `Interface` to convert kWh to A * period for easy use by algorithms.

- 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.

Additional Testing

- 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)

Bug Fixes

- Removed an incorrect sym_comp current unbalance function from analysis, and the associated (commented out) test in test_integration.

- `evse_voltage` in `interface.py` was behaving as if network.voltages returned an array when it actually behaves as a `dict`. 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_df` and `pilot_signals_as_df`

- Fixes a bug in which Interface's `last_applied_pilot_signals` method returned all pilot signals instead of the last ones applied.

- Fixes bug in `EV.reset()` function by making `init_charge` input to `Battery.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_schedules` method 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 `FiniteRatesEVSE` objects. 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 `atol` argument was not used for certain boundaries of the `DeadbandEVSE`'s feasible set was fixed, and tests were added for the `atol` functionality.

- Use `timezone.localize()` instead of `astimezone` when converting naive date times to fix issues with using `astimezone` with 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.

Page 1 of 2

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.