You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Update environment and README to latest Python version (#322)
* Update environment and README to latest Python version
* Adjust default timesteps
* Add information on activating environments in README
* Fix format in README
-[Installing a Python IDE (optional)](#installing-a-python-ide-optional)
15
+
-[Installing Git](#installing-git)
16
+
-[Cloning the urbs repository](#cloning-the-urbs-repository)
17
+
-[Installing your environment](#installing-your-environment)
18
+
-[Solver](#solver)
19
+
-[Get started](#get-started)
20
+
-[Next steps and tips](#next-steps-and-tips)
21
+
-[Further reading](#further-reading)
22
+
-[Example uses](#example-uses)
23
+
-[Contributing](#contributing)
24
+
-[License](#license)
25
+
8
26
## Features
9
27
10
28
* urbs is a linear programming model for multi-commodity energy systems with a focus on optimal storage sizing and use.
@@ -22,40 +40,65 @@ urbs is a [linear programming](https://en.wikipedia.org/wiki/Linear_programming)
22
40
23
41
## Installation
24
42
25
-
There are 2 ways to get all required packages under Windows. We recommend using the Python distribution Anaconda. If you don't want to use it or already have an existing Python (version 3.6 **recommended**, 2.7 is supported as well) installation, you can also download the required packages by yourself..
43
+
### Installing Python
26
44
27
-
### Anaconda/Miniconda (recommended)
45
+
1) Download and install [Python 3.12](https://www.python.org/downloads/). ***Note: Make sure to check the box "Add Python to PATH" during installation.***
46
+
2) Using your terminal you can check which Python versions are installed on your system with `py -0` and check your standard version with `python --version`. The output should be `Python 3.12.x` or similar.
47
+
<br /> (***Note: If your standard python version is Python 2.X, you might need to call `python3` instead of `python`.***)
28
48
29
-
1.**[Anaconda (Python 3)](http://continuum.io/downloads)/[Miniconda](https://docs.conda.io/en/latest/miniconda.html)**. Choose the 64-bit installer if possible.
30
-
During the installation procedure, keep both checkboxes "modify PATH" and "register Python" selected! If only higher Python versions are available, you can switch to a specific Python Version by typing `conda install python=<version>`
31
-
2.**Packages and Solver**: [GLPK](http://winglpk.sourceforge.net/).
32
-
1. Download the [environment file](https://github.com/tum-ens/urbs/blob/master/urbs-env.yml).
33
-
2. Launch a new command prompt (Windows: Win+R, type "cmd", Enter)
34
-
3. Install it via conda by `conda env create -f urbs-env.yml`.
35
-
4. Each time you open a new terminal for running urbs, you can activate the environment by `conda activate urbs`.
49
+
### Installing an IDE (optional)
36
50
37
-
Continue at [Get Started](#get-started).
51
+
If you want to use an IDE for Python, you can install [PyCharm](https://www.jetbrains.com/pycharm/download/#section=windows) or [Visual Studio Code](https://code.visualstudio.com/). Both are free to use.
38
52
39
-
### Manually (the hard way)
53
+
### Installing Git
40
54
41
-
For all packages, best take the latest release or release candidate version. Both 32 bit and 64 bit versions work, though 64 bit is recommended. The list of packages can be found in the [environment file](https://github.com/tum-ens/urbs/blob/master/urbs-env.yml).
42
-
43
-
## Get started
55
+
1) Download and install [Git](http://git-scm.com/). Make sure to check the box "Run Git from the Windows Command Prompt" during installation.
56
+
You can also use the [GitHub Desktop](https://desktop.github.com/) application if you prefer a graphical user interface.
57
+
2) Check that Git is installed by running the command `git --version` in your terminal.
58
+
59
+
### Cloning the urbs repository
60
+
61
+
1) Open your terminal and navigate to your preferred directory.
62
+
2) Clone the repository by running the following commands in your terminal.:
63
+
- For GitLab: `git clone git@gitlab.lrz.de:tum-ens/urbs.git`
64
+
- For GitHub: `git clone git@github.com:tum-ens/urbs.git`
65
+
3) Navigate to the cloned repository by running `cd urbs` in your terminal.
66
+
67
+
### Installing your environment
44
68
45
-
### Developers
46
-
Once installation is complete, finally [install git (for version control)](http://git-scm.com/). **Remark:** at step "Adjusting your PATH environment", select "Run Git from the Windows Command Prompt".
69
+
1) In windows you can install the environment by running the batch script `prepare-virtual-environment` in the root directory of the repository.
70
+
You can do so from a terminal or by double-clicking the file in the file explorer. This will create a virtual environment and install all necessary packages.
71
+
2) If you want to install the environment manually, enter the commands below in your terminal:
72
+
- Windows: <br />
73
+
`py -3.12 -m venv urbs-env` <br />
74
+
`urbs-env\Scripts\activate` <br />
75
+
`python -m pip install -r urbs-env.txt`
47
76
48
-
Then, in a directory of your choice, clone this repository by:
77
+
- Linux/MacOS: <br />
78
+
`python3.12 -m venv urbs-env` <br />
79
+
`source urbs-env/bin/activate` <br />
80
+
`python -m pip install -r urbs-env.txt`
49
81
50
-
git clone https://github.com/tum-ens/urbs.git
51
-
52
-
Continue like the users after they downloaded the zip file.
82
+
### Solver
83
+
There are several solvers that can be used to solve the optimization problems. Our recommendations are the following two python libraries that have been installed in the environment.
84
+
-[Highs](https://highs.dev/) (open-source)
85
+
-[Gurobi](https://www.gurobi.com/) (commercial): To run this powerful solver you first need to create an account, apply for an academic license in the license center and download it ([descriptions](https://www.gurobi.com/features/academic-named-user-license/)).
53
86
54
-
### Users
87
+
However, also other solvers such as [glpk](https://www.gnu.org/software/glpk/) (open-source) or [CPLEX](https://www.ibm.com/analytics/cplex-optimizer) (commercial) are compatible with the Pyomo interface in urbs.
55
88
56
-
If you are not planning on developing urbs, pick the [latest release](https://github.com/tum-ens/urbs/releases) and download the zip file.
89
+
### (optional) Installing Jupyter Notebook
90
+
If you want to use the Jupyter Notebook, install it by running `python -m pip install jupyter` in your terminal.
57
91
58
-
In the downloaded directory, open a execute the runme script by using the following on the command prompt (Windows) or Terminal (Linux). (Depending on what your standard python version is, you might need to call `python3` instead of `python`.):
92
+
## Get started
93
+
94
+
Before running a script, ensure your environment is activated:
95
+
- Either set up your interpreter in your IDE with your created environment.
96
+
- Or, if running from your terminal, use the following command to activate it:
97
+
- Windows: `urbs-env\Scripts\activate`
98
+
- Linux/MacOS: `source urbs-env/bin/activate`
99
+
100
+
In the downloaded directory, open a execute the runme script by using the following on the command prompt or Terminal.
101
+
<br /> (***Note: Depending on what your standard python version is, you might need to call `python3.12` instead of `python`.***):
59
102
60
103
python runme.py
61
104
@@ -67,7 +110,7 @@ and look at the new files `result/mimo-example-.../comparison.xlsx` and `result/
67
110
68
111
## Next steps and tips
69
112
70
-
1. Head over to the tutorial at http://urbs.readthedocs.io, which goes through runme.py step by step.
113
+
1. Head over to the tutorial at http://urbs.readthedocs.io, which goes through runme.py step by step or try out the Jupyter Notebook tutorial inside the teaching folder.
71
114
2. Read the source code of `runme.py` and `comp.py`.
72
115
3. Try adding/modifying scenarios in `scenarios.py` and see their effect on results.
73
116
4. If you need a nice python editor, think about using [PyCharm](https://www.jetbrains.com/pycharm/download). It has many features including easy Git integration, package management, etc.
@@ -90,15 +133,7 @@ and look at the new files `result/mimo-example-.../comparison.xlsx` and `result/
90
133
<ahref="https://raw.githubusercontent.com/ojdo/urbs/1house/img/comparison.png"><imgsrc="https://raw.githubusercontent.com/ojdo/urbs/1house/img/comparison.png"alt="Comparison plot in example study 1house."></a>
91
134
92
135
- Branch [haag15](https://github.com/ojdo/urbs/tree/haag15) in the forked repository [ojdo/urbs](https://github.com/ojdo/urbs) shows a larger example of a real-world use. Its input file contains a town divided into 12 regions, 12 process types, and 2 demand commodities (electricity and heat) . Patience and RAM (64 GB or more) is needed to run these scenarios with 8760 timesteps. The branch also contains three IPython notebooks that are used for result analysis and coupling to model [rivus](https://github.com/tum-ens/rivus).
0 commit comments