# Installation & Usage

## View Properly at

<https://pierpuccini.gitbook.io/ems-api/>

## Pre requisites & Installation for Ems-api&#x20;

#### Ems-api

> Note: DigSilents Powerfactory can **only** be run on a Windows machine. If you happen to be on a Unix based system, there are various virtualization tools in order to get windows setup. In the Help section you'll find some helpful tips with debugging on your unix machine while running the service in Windows.

* Windows 10
* DigSilent 15.1.7 *This can be checked by in the menu bar going to Help>About PowerFactory... And at the top you'll find the PowerFactory version.*
* Python 3.3.2 *This can be checked this by running* `python` *in your terminal.*&#x20;
  * if you don't have this version installed, you can get it from your:
    * **INSTALLATION\_DIRECTORY**\DIgSILENT\PowerFactory 15.1\python\python-3.3.2
    * Directly from python.org: <https://www.python.org/ftp/python/3.3.2/python-3.3.2.msi>
* Pip and setuptools **Note:** Since python 3.3.2 is no longer suported, Pip and setuptools can no longer be downloaded by tradicional methods *e.g.* get-pip.py. In order to get pip and setup tools, please follow the steps from: <https://stackoverflow.com/questions/56798617/how-to-install-pip-for-python-3-3-on-windows>
* For Flask and dependencies run:

```
pip install Flask Flask-Jsonpify Flask-RESTful
```

{% hint style="warning" %}
If your **INSTALLATION\_DIRECTORY** for PowerFactory is different than **C:\Program Files (x86)** please correct that path in *resources>powerfactory.py* on line 7.
{% endhint %}

## Run the app

In order to run the app, navigate via CMD to its installation directory and do the following

```bash
venv\Scripts\activate
set FLASK_APP=app.py
flask run
```

Now open up the provided url and port and feel free to use the api at your will.

{% hint style="info" %}
In order to change the host and port add `-h HOST -p PORT`
{% endhint %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://pierpuccini.gitbook.io/ems-api/master.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
