Skip to content

Commit

Permalink
Merge pull request #32 from marinlauber/15-update-readme
Browse files Browse the repository at this point in the history
  • Loading branch information
TAJD authored Feb 12, 2024
2 parents a8031df + 0dcd3de commit b2a46f8
Show file tree
Hide file tree
Showing 4 changed files with 74 additions and 59 deletions.
100 changes: 49 additions & 51 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,61 +1,32 @@
# Python-VPP

3-DOF Velocity Prediction Program base on the [ORC](https://www.orc.org/index.asp?id=21) aero and hydro dynamic models. The code makes use of Object-oriented-Programming to be as general as possible.
3-DOF Velocity Prediction Program based on the [ORC](https://www.orc.org/index.asp?id=21) aero and hydro dynamic models.

## Contributing

### Installing dependencies

Install the required dependencies from the `requirements.txt` file.

If using `pip` then `pip install requirements.txt`.

If using `conda` then follow these steps to create an environment with the right dependencies:

```bash
conda create --name Python-VPP \
&& conda config --add channels conda-forge \
&& conda activate Python-VPP \
&& conda install -y --file requirements.txt
```

### Running tests
Please see the demo hosted at [https://yacht-vpp.streamlit.app/](https://yacht-vpp.streamlit.app/) and go for a test sail!

Tests are implemented using [pytest](https://docs.pytest.org/en/8.0.x/).

You can run tests with

```bash
pytest -vv
```

You can run a benchmark against the YD-41 results from WinVPP by running the `benchmark.py` script.

```bash
$ python benchmark/benchmark.py -g -o
```
## Using the code

with `save`, `graph` and `output` as optional keyboard arguments and `output` only working in combination with `save`.
To use the code, first clone or download this repository then install the required dependencies (see below).

## Using the code
The main files that are used are `runVPP.py` and `righting_moment.json`. These have to be filled with the data of your boat. By default they are using the YD-41 (from Principle of Yacht Design).

To use the code, first clone or download this repository onto your own machine. The main file that are used are `runVPP.py` and `righting_moment.json`. These have to be filled with the data of your boat. By default they are using the YD-41 (from Principle of Yacht Design). To run the code simply type
The VPP is run with.

```bash
$ python runVPP.py
```

into your console, and the code should run. Once the code has run, it should generate the following figure (or a similar one)
Once the code has run, it should generate the following figure (or a similar one)

<p align="center">
<img src="Figure.png" alt="YD-41 VPP results" width="1024">
</p>

See the [documentation](https://marinlauber.github.io/Python-VPP/).

### Input variable
### Input variables

This is a crude list of all the input variables and their meaning, as well as the units they are expected to be in.
Here is a list of the key variables used in the VPP.

1. Appendages :
* Cu : Root Chord / Upper Chord (m)
Expand Down Expand Up @@ -83,24 +54,51 @@ This is a crude list of all the input variables and their meaning, as well as th
* TWA range : range of TWA to use
* TWS range : range of TWS, must be between [2, 35]

## Contributing

We are very keen to see contributions to code, documentation and feature development!

## Authors
When you make a contribution please make sure that any new functionality is covered with additional tests.

* **[Otto Villani](https://www.linkedin.com/in/otto-villani-552760108/)** - *Initial idea, model selection* - [github](https://github.com/ottovillani)
* **[Marin Lauber](https://www.linkedin.com/in/marin-lauber/)** - *Initial idea, developement* - [github](https://github.com/marinlauber)
* **[Thomas Dickson](https://tajd.co.uk/about)** - *Developer* - [github](http://github.com/TAJD)
Follow the steps below to contribute to this project.

## License
### Install dependencies

This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details
Install the required dependencies from the `requirements.txt` file.

If using `pip` then `pip install requirements.txt`.

If using `conda` then follow these steps to create an environment with the right dependencies:

```bash
conda create --name Python-VPP \
&& conda config --add channels conda-forge \
&& conda activate Python-VPP \
&& conda install -y --file requirements.txt
```

### Run tests

## Acknowledgments
Tests are implemented using [pytest](https://docs.pytest.org/en/8.0.x/).

You can run tests with

```bash
pytest -vv
```

You can run a benchmark against the YD-41 results from WinVPP by running the `benchmark.py` script.

```bash
$ python benchmark/benchmark.py -g -o
```

## Acknowledgements

* Hat tip to anyone whose code was used
* Inspiration
* **[Otto Villani](https://www.linkedin.com/in/otto-villani-552760108/)** - *Initial idea, model selection* - [GitHub](https://github.com/ottovillani)
* **[Marin Lauber](https://www.linkedin.com/in/marin-lauber/)** - *Initial idea, development* - [GitHub](https://github.com/marinlauber)
* **[Thomas Dickson](https://tajd.co.uk/about)** - *Developer* - [GitHub](http://github.com/TAJD)

## Modifications
## License

1. Formatted using [Black](https://github.com/psf/black).
1. Added a "name" to the Yacht class which can be passed to plotting function.
1. Renamed instances of Keel and Rudder objects in the example function.
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details
4 changes: 1 addition & 3 deletions demos/Home.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,7 @@
It is based on the [ORC model](https://orc.org/uploads/files/ORC-VPP-Documentation-2023.pdf).
The source code can be [found here](https://github.com/marinlauber/Python-VPP) and any and all contributions are welcome 😊.
If you have a question, feature request or perhaps a bug report then please open an issue here or [send me an email](mailto:[email protected]).
If you have a question, feature request or perhaps a bug report then please open an issue [here](https://github.com/marinlauber/Python-VPP) or [send me an email](mailto:[email protected]).
"""
)

Expand Down
2 changes: 1 addition & 1 deletion demos/readme.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Demos

This directory contains a VPP demo that is deployed on streamlit. It has site analytics that are GDPR compliant and collected on goat counter.
This directory contains a VPP demo that is currently deployed at [https://yacht-vpp.streamlit.app/](https://yacht-vpp.streamlit.app/)

27 changes: 23 additions & 4 deletions demos/utils.py
Original file line number Diff line number Diff line change
@@ -1,25 +1,44 @@
import streamlit as st
import streamlit.components.v1 as components
import subprocess

def get_git_hash():
try:
git_hash = subprocess.check_output(['git', 'rev-parse', '--short', 'HEAD']).strip().decode('utf-8')
return git_hash
except subprocess.CalledProcessError:
return None


def header():
header = """
<script>
window.goatcounter = {no_onload: true}
window.addEventListener('hashchange', function(e) {
window.goatcounter.count({
path: location.pathname + location.search + location.hash,
})
})
</script>
<script data-goatcounter="https://yacht-vpp.goatcounter.com/count"
async src="//gc.zgo.at/count.js"></script>
async src="//gc.zgo.at/count.js"></script>
"""
return components.html(header)


def footer():
footer = """
git_hash = get_git_hash()
footer = f"""
<div style="text-align: center; margin-top: 50px;">
<hr>
<p>Yacht VPP</p>
<p>Contact: <a href="mailto:[email protected]">[email protected]</a></p>
<p style="font-size: 12px; color: gray;">
This application is provided as is and without warranty. The source code is available on <a href="https://github.com/marinlauber/Python-VPP">GitHub</a>.
This application is provided as is and without warranty.
The source code is available on <a href="https://github.com/marinlauber/Python-VPP">GitHub</a>.
Please file bug reports as an <a href="https://github.com/marinlauber/Python-VPP/issues">issue here</a>.
</p>
<p style="font-size: 12px; color: gray;">Version {git_hash}</p>
</div>
"""

Expand Down

0 comments on commit b2a46f8

Please sign in to comment.