Example and homework problem involving fastsim.
The example code should be able to run in any major code editing software (e.g. Visual Studio Code, Spyder, PyCharm), but NREL recommends Visual Studio Code (VS Code). Install VS Code, and optionally add the following recommended plugins:
You can install Python in either of two ways:
- Anaconda Python Distribution or Miniconda -- Anaconda/Miniconda seems to work better on Windows. This will likely install Python 3.12, but that's ok -- when you create the Anaconda virtual environment, it will be Python 3.10.
- Python 3.10 -- this works pretty well on
Mac. For Mac or Windows, click the link to obtain an appropriate installer. For Mac, if you have
Homebrew, you can instead use
brew install python3.10
. For linux, runsudo apt install python3.10
,sudo dnf install python3.10
, or whatever works for your linux distribution.
- Place the project folder containing this readme anywhere you like (e.g.
c:\Users\<your username>\Documents\ENGY502\fastsim-hw\
) - Within the project folder you created above, create and activate a python enviroment (make sure
to be consistent with the method you used to install python above):
- Anaconda
- Open Anaconda Powershell Prompt or your Mac/linux terminal and run
conda create --name=engy502-env python=3.10
- Activate the environment:
conda activate engy502-env
- Install the dependencies:
pip install -r requirements.txt
- After finishing this assigment, you can delete the environment with
conda env remove --name engy502-env
from within the same folder
- Open Anaconda Powershell Prompt or your Mac/linux terminal and run
- Python3.10
- Open your preferred terminal environment, and run
python3.10 -m venv engy502-env
- Run
source engy502-env/bin/activate
(may differ on Windows) to activate the enviroment - Install dependencies:
pip install -r requirements.txt
- After finishing this assignment, run
rm -rf engy502-env
to remove the enviroment
- Open your preferred terminal environment, and run
- Anaconda
Open VS Code in the project folder (whatever folder you created in step one of Setting up your
local environment). Open example.py as a VS Code
tab. Click on the first line, and type <Ctrl>+<Shift>+P
(<Cmd>+<Shift>+P
on Mac) then type
jupyter: run all cells
to run all of the notebook cells (marked by # %%
) in an interactive
terminal.