Skip to content
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

Make full use of UseCase class #102

Merged
merged 46 commits into from
Dec 5, 2023
Merged
Changes from 1 commit
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
bb8fcca
Add dates input options to usecase
Bachibouzouk Nov 17, 2023
f375fc3
Move calc_peak_time_range as method of usecase
Bachibouzouk Nov 17, 2023
d1d2123
Connect User instances to a potential usecase
Bachibouzouk Nov 17, 2023
62c5e0d
Update generate_daily_load_profiles
Bachibouzouk Nov 17, 2023
8b0148c
Adapt input files
Bachibouzouk Nov 17, 2023
e9824fd
Remove unused code
Bachibouzouk Nov 17, 2023
6957148
Change attribute name
Bachibouzouk Nov 17, 2023
c11d510
Add one example of rewritten notebook
Bachibouzouk Nov 17, 2023
6272db7
Modify run_uscase and cli modules
Bachibouzouk Nov 18, 2023
d33f264
Define num_days for User class
Bachibouzouk Nov 18, 2023
3d3a5b4
Fix failing test
Bachibouzouk Nov 18, 2023
68cd804
Enable python file to be run by ramp cli
Bachibouzouk Nov 19, 2023
7106134
Move code from Run postprocess to UseCase methods
Bachibouzouk Nov 20, 2023
b2da25e
Adapt README
Bachibouzouk Nov 20, 2023
d40836c
Add a test to make sure the .ipynb file in documentation run
Bachibouzouk Nov 24, 2023
f993703
Make get_day_type function accept iso format date string as input
Bachibouzouk Nov 30, 2023
f0ce520
Provide getter and setter for date input of UseCase
Bachibouzouk Nov 30, 2023
7155317
By default expect 366 days for power timeseries input
Bachibouzouk Nov 30, 2023
a957c1b
Make peak_enlarge an attribute of the UseCase
Bachibouzouk Nov 30, 2023
733de35
Fix parallel processing
Bachibouzouk Nov 30, 2023
7a89100
Add a property to check if UseCase was already initialized
Bachibouzouk Nov 30, 2023
b51c917
Make daily_profile method callable with default values
Bachibouzouk Nov 30, 2023
4ca0060
Manage options to build a date range depending on user inputs
Bachibouzouk Nov 30, 2023
1991528
Fix and lint jupter notebooks
Bachibouzouk Nov 30, 2023
fd8b22d
Fix conversion from .py to .xlsx
Bachibouzouk Nov 30, 2023
7eb6abb
Fix failing tests
Bachibouzouk Nov 30, 2023
b09be99
Fix test requiring 365 days in a year
Bachibouzouk Nov 30, 2023
45d4b5c
Comment out a failing test
Bachibouzouk Nov 30, 2023
1939c8c
Lint test file
Bachibouzouk Nov 30, 2023
7c3199c
Add nbformat to test requirements
Bachibouzouk Nov 30, 2023
69738f4
Correct typo in core.py
FLomb Dec 1, 2023
8c4f97b
Update, fix and refine jupyter notebooks
FLomb Dec 1, 2023
fbbc8f2
Update README file
FLomb Dec 1, 2023
2f67728
Update test requirements
Bachibouzouk Dec 1, 2023
fee9a81
Add local ramp package to test requirements
Bachibouzouk Dec 1, 2023
f4e4abd
Fix twine check errors
Bachibouzouk Dec 1, 2023
50b5d38
Update .rst files based on jupyter notebooks examples
Bachibouzouk Dec 1, 2023
c4e3ca0
Improve cli help text and lint jupyter example notebooks
Bachibouzouk Dec 1, 2023
67231ed
Updaing the API docs for UseCase
mohammadamint Dec 4, 2023
3bad531
Update api_references.rst
mohammadamint Dec 4, 2023
3791f67
Update readme to showcase UseCase
FLomb Dec 4, 2023
0dd2ad8
Update docstrings
Bachibouzouk Dec 4, 2023
240ce33
Fix docs warnings
Bachibouzouk Dec 4, 2023
f8c4adb
Add missing images for the docs
Bachibouzouk Dec 4, 2023
7189443
Update changelog
Bachibouzouk Dec 4, 2023
f78dee4
Minor typo fixes in CHANGELOG.md
FLomb Dec 5, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Update readme to showcase UseCase
FLomb authored and Bachibouzouk committed Dec 4, 2023
commit 3791f67fcfc693420e1be67e233beefea76a2a63
54 changes: 42 additions & 12 deletions README.rst
Original file line number Diff line number Diff line change
@@ -207,8 +207,8 @@ Building a model with a python script
from ramp import UseCase, User
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A problem I see in the README.rst file is that we import the UseCase but never use it. We just run the profiles for one User, which is not what one typically wants to do. We should show how to add Users to a UseCase and how to run via the UseCase class.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree, I just translated the existing example but we should also showcase the UseCase more


# Create a user category
low_income_household = User(
user_name = "low_income_household", # an optional feature for the User class
household_1 = User(
user_name = "Household type 1", # an optional feature for the User class
num_users = 10, # Specifying the number of specific user category in the community
)

@@ -217,14 +217,15 @@ You can add appliances to a user category by:
.. code-block:: python

# adding some appliances for the household
radio = low_income_household.add_appliance(
radio = household_1.add_appliance(
name = "Small Radio", # optional feature for the appliance class
number = 1, # how many radio each low income household holds
power = 10, # RAMP does not take care of unit of measures , watt
number = 1, # how many radio each household type 1 has
power = 10, # RAMP does not take care of units of measure (e.g., Watts), you must be consistent
func_time = 120, # Total functioning time of appliance in minutes
num_windows = 2, # in how many time-windows the appliance is used
num_windows = 2, # how many time-windows the appliance is used in
)


The use time frames can be specified using the 'window' method for each appliance of the user category:

.. code-block:: python
@@ -235,15 +236,44 @@ The use time frames can be specified using the 'window' method for each applianc
window_2 = [1320,1380], # from 10 PM to 11 PM
)

Now you can generate your **stochastic profiles**:
You can also add another, different user to the simulation. In this case,
we use a more compact formulation:

.. code-block:: python

# generating load_curves
load = low_income_household.generate_aggregated_load_profile(
prof_i = 1, # the ith day profile
day_type = yearly_pattern()[1], # defining the yearly pattern (like weekdays/weekends)
)
# Create a second user category
household_2 = User(
user_name = "Household type 2", # an optional feature for the User class
num_users = 13, # Specifying the number of specific user category in the community
)

# adding some appliances for the new household type in compact form, with windows specified directly and random variability
light_bulbs = household_2.add_appliance(
name = "Light bulbs", # optional feature for the appliance class
number = 5, # how many light bulbs each household type 2 has
power = 7, # RAMP does not take care of units of measure (e.g., Watts), you must be consistent
func_time = 120, # total functioning time of appliance in minutes
time_fraction_random_variability=0.2, # 20% random variability associated to the total functioning time
num_windows = 2, # how many time-windows the appliance is used in
window_1 = [390,480], # from 6.30 AM to 8 AM
window_2 = [1020,1440], # from 5 PM to 12 PM
random_var_w=0.35 # 35% randomness assigned to the size of the functioning windows
)

At this point, we can group our different users into a "use case" and run the simulation,
for instance for a whole year.

.. code-block:: python

use_case = UseCase(users=[household_1,household_2], date_start="2020-01-01", date_end="2020-12-31")
whole_year_profile = use_case.generate_daily_load_profiles()

Here is your first load for a community including two types of housholds,
for a total of 23 individual users. Of course, more variations and many more
features are possible! For instance, you can simulate loads even for
an individual appliance or user. In addition, you can use in-built plotting
functionalities to explore your results. Check out the documentation
for all the possibilities.

Contributing
============