Quick Start#
Generate one house with a single occupant and simulate consumption and discharge events at enduse level for single day, using the following steps.
Currently, there is no cli available so you must run pysimdeum via a .py script or .ipynb Jupyter notebook.
To use pysimdeum, you first have to import it in your script:
In pysimdeum, everything is about the House. If you want to build a specific House, e.g., a one-erson household, you can use the house_type keyword. Type the following:
The house is automatically populated by a person, which follows certain statistics, and "furnished" with water end-use devices or appliances (e.g., toilet, bathtub, ...). You can check which appliances are available, and who are the possible users, by using the appliances or users property of the House:
To simulate the water consumption of a house, you can use the House's simulate method:
pysimdeum also allows you to simulate discharge flows that are linked to your consumption flows.
# Simulate water consumption and discharge for house
consumption, discharge = house.simulate(num_patterns=1, simulate_discharge=True)
The consumption (and discharge) simulation result is an xarray.DataArray - basically a labelled numpy.ndarray with five dimensions / axes (i.e. time, user, enduse, patterns, flowtypes)
You can easily create statistics over the consumption and discharge objects, for example, to compute the total consumption (sum of consumption of all users and enduses), you can build the sum over the user and enduse axes (the total consumption). Within consumption, there are two flowtypes defined. totalflow and hotflow. totalflow reflects the total water use while hotflow reflects the water that has been heated up.
# Build statistics from consumption
tot_cons = consumption.sum(['enduse', 'user']).sel(flowtypes='totalflow').mean(['patterns'])
If you want to plot the results and additionally depict some rolling averages (e.g. hourly means = 3600 seconds), you can do this in the following way:
# Plot total consumption
tot_cons.plot()
tot_cons.rolling(time=3600, center=True).mean().plot()
plt.show()
Or produce plots for a specific enduse such as KitchenTap
# Plot total consumption of KitchenTap enduse
consumption.sum(["user"]).sel(enduse="KitchenTap").sel(flowtypes="totalflow").plot()