From 78860c60664391784bc6175d8b6fad10ebd02335 Mon Sep 17 00:00:00 2001
From: mikf <mikf@dtu.dk>
Date: Wed, 24 Nov 2021 11:36:35 +0100
Subject: [PATCH] updated docs and readme

---
 README.md                                     |  20 ++++
 ed_win/__init__.py                            |   4 +-
 .../tests/__pycache__/__init__.cpython-39.pyc | Bin 183 -> 184 bytes
 ...d_farm_network.cpython-39-pytest-6.2.4.pyc | Bin 2681 -> 2681 bytes
 ed_win/wind_farm_network.py                   |  29 +++++
 ed_win/wind_farm_network.py.bak               | 110 ------------------
 6 files changed, 51 insertions(+), 112 deletions(-)
 delete mode 100644 ed_win/wind_farm_network.py.bak

diff --git a/README.md b/README.md
index 70db1e5..4410ecc 100644
--- a/README.md
+++ b/README.md
@@ -1,4 +1,24 @@
 [![pipeline status](https://gitlab.windenergy.dtu.dk/TOPFARM/edwin/badges/main/pipeline.svg)](https://gitlab.windenergy.dtu.dk/TOPFARM/edwin/-/commits/main)
+[![coverage report](https://gitlab.windenergy.dtu.dk/TOPFARM/edwin/badges/main/coverage.svg)](https://gitlab.windenergy.dtu.dk/TOPFARM/edwin/commits/main)
+[![PyPi](https://img.shields.io/pypi/v/ed_win)](https://pypi.org/project/ed_win/)
+[![License](https://img.shields.io/pypi/l/ed_win)](https://gitlab.windenergy.dtu.dk/TOPFARM/EDWIN/blob/main/LICENSE)
+
 # EDWIN
 
 EDWIN: Electrical network Design for WINdfarms
+
+## Quick Start:
+
+`pip install ed_win`
+
+## Source code repository (and issue tracker):
+
+[https://gitlab.windenergy.dtu.dk/TOPFARM/EDWIN](https://gitlab.windenergy.dtu.dk/TOPFARM/EDWIN)
+
+## License:
+[MIT](https://gitlab.windenergy.dtu.dk/TOPFARM/EDWIN/blob/main/LICENSE)
+
+## Documentation, installation, etc:
+
+[https://topfarm.pages.windenergy.dtu.dk/EDWIN](https://topfarm.pages.windenergy.dtu.dk/EDWIN).
+
diff --git a/ed_win/__init__.py b/ed_win/__init__.py
index a4bbf1f..ba7a0ac 100644
--- a/ed_win/__init__.py
+++ b/ed_win/__init__.py
@@ -1,3 +1,3 @@
 # 'filled_by_setup.py'
-__version__ = '0.0.0'
-__release__ = '0.0.0'
+__version__ = '0.0.1'
+__release__ = '0.0.1'
diff --git a/ed_win/tests/__pycache__/__init__.cpython-39.pyc b/ed_win/tests/__pycache__/__init__.cpython-39.pyc
index fc1e7fdf4ee8a9106ca57d916cbdf9a610644874..2033630fc9237359db49115b1ee0b063ee726ccb 100644
GIT binary patch
delta 37
rcmdnaxPy^9k(ZZ?0SGR0&zs1d$Y?e(SAx^kCEU|5CN(8~Vy_kes?iD*

delta 36
qcmdnNxSf$Zk(ZZ?0SG3ArB38dWHg<aE5VVPQl6O?lbSNIPYVE|UJ4}u

diff --git a/ed_win/tests/__pycache__/test_wind_farm_network.cpython-39-pytest-6.2.4.pyc b/ed_win/tests/__pycache__/test_wind_farm_network.cpython-39-pytest-6.2.4.pyc
index a5318aa33695c99f0edc297875fb7ea7ee1942de..12363c49943350713d310929043b741f76630b45 100644
GIT binary patch
delta 31
lcmew<@>7I6k(ZZ?0SGR0&)dj-m4nsQCEU|*^HYu~i~x}^32^`b

delta 31
lcmew<@>7I6k(ZZ?0SMMypR<wsDhF$7N_l49=BFG}7y+Q(3bX(K

diff --git a/ed_win/wind_farm_network.py b/ed_win/wind_farm_network.py
index 99038b8..a366587 100644
--- a/ed_win/wind_farm_network.py
+++ b/ed_win/wind_farm_network.py
@@ -32,6 +32,19 @@ class HeuristicDriver(Driver):
 
 class WindFarmNetwork():
     def __init__(self, initial_layout, driver=HeuristicDriver(), cables=[]):
+        """WindFarmNetwork object
+
+        Parameters
+        ----------
+        initial_layout : array-like
+            The shape of the array is (i, j), where i is 2 and j is the number of  turbines + 1.
+            i=1 is x and i=2 is y. j=0 is the coordinates of the offshore sub station and j=1: are the turbine coordinates.
+        driver : Driver
+            Driver object
+        cables : array-like
+            The shape of the array is (n, m), where n is the number of available cables and m is 3.
+            m=1 is cross-section, m=2 is the allowed number of connected WTs and m=3 is the price/km of the cable
+        """
         self.initial_layout = initial_layout
         self.driver = driver
         self.cables = cables
@@ -44,6 +57,22 @@ class WindFarmNetwork():
         setattr(self.driver, 'wfn', self)
 
     def design(self, x=None, y=None, **kwargs):
+        """designs or optimizes the electrical wind farm network
+
+        Parameters
+        ----------
+        x : array-like
+            concatenated list of sub station and turbine x-coordinates
+        y : array-like
+            concatenated list of sub station and turbine y-coordinates
+
+        Returns
+        -------
+        cost : float
+            The cost of the electrical network
+        state : DataFrame
+            The current network tree with the columns f{self.columns}
+        """
         if isinstance(x, type(None)):
             x = self.initial_layout['x']
         if isinstance(y, type(None)):
diff --git a/ed_win/wind_farm_network.py.bak b/ed_win/wind_farm_network.py.bak
deleted file mode 100644
index b264f6b..0000000
--- a/ed_win/wind_farm_network.py.bak
+++ /dev/null
@@ -1,110 +0,0 @@
-from abc import ABC, abstractmethod
-from edwin.collection_system import collection_system
-from edwin.c_mst_cables import plot_network
-import pandas as pd
-import numpy as np
-
-
-class Driver(ABC):
-    @abstractmethod
-    def run():
-        '''
-
-        '''
-
-
-class HeuristicDriver(Driver):
-    def __init__(self, option=3, Inters_const=True, max_it=20000):
-        self.option = option
-        self.Inters_const = Inters_const
-        self.max_it = max_it
-        Driver.__init__(self)
-
-    def run(self, x, y):
-        T, cables_cost = collection_system(x,
-                                           y,
-                                           self.option,
-                                           self.Inters_const,
-                                           self.max_it,
-                                           self.wfn.cables)
-        return T, cables_cost
-
-
-class WindFarmNetwork():
-    def __init__(self, initial_layout, driver=HeuristicDriver(), cables=[]):
-        self.initial_layout = initial_layout
-        self.driver = driver
-        self.cables = cables
-        self.state = None
-        self.T = None
-        self.columns = ['from_node', 'to_node', 'cable_length', 'cable_type', 'cable_cost']
-        self.setup()
-
-    def setup(self):
-        setattr(self.driver, 'wfn', self)
-
-    def design(self, x=None, y=None, **kwargs):
-<<<<<<< HEAD
-        x = x or self.initial_layout['x']
-        y = y or self.initial_layout['y']
-=======
-        if isinstance(x, type(None)):
-            x = self.initial_layout['x']
-        if isinstance(y, type(None)):
-            y = self.initial_layout['y']
->>>>>>> upd
-        self.x = x
-        self.y = y
-        T, cost = self.driver.run(x, y)
-        state = pd.DataFrame(T, columns=self.columns)
-        state = state.astype({'from_node': int,
-                              'to_node': int,
-                              'cable_type': int})
-        self.T = T
-        self.cost = cost
-        self.state = state
-        return cost, state
-
-    def plot(self):
-        if self.state is not None:
-            self.design()
-        plot_network(self.x, self.y, self.cables, self.T)
-
-
-class Constraints(dict):
-    def __init__(self, **kwargs):
-        dict.__init__(self, {'crossing': False,
-                             'tree': False,
-                             'thermal_capacity': False,
-                             'number_of_main_feeders': False})
-        self.update(kwargs)
-
-
-def main():
-    if __name__ == '__main__':
-        initial_layout = dict(x=np.array([0., 2000., 4000., 6000.,
-                                          8000., 498.65600569, 2498.65600569, 4498.65600569,
-                                          6498.65600569, 8498.65600569, 997.31201137, 2997.31201137,
-                                          4997.31201137, 11336.25662483, 8997.31201137, 1495.96801706,
-                                          3495.96801706, 5495.96801706, 10011.39514341, 11426.89538545,
-                                          1994.62402275, 3994.62402275, 5994.62402275, 7994.62402275,
-                                          10588.90471566]),
-                              y=np.array([0., 0., 0., 0.,
-                                          0., 2000., 2000., 2000.,
-                                          2000., 2000., 4000., 4000.,
-                                          4000., 6877.42528387, 4000., 6000.,
-                                          6000., 6000., 3179.76530545, 5953.63051694,
-                                          8000., 8000., 8000., 8000.,
-                                          4734.32972738]))
-        settings = {'option': 3,
-                    'Inters_const': True,
-                    'max_it': 20000}
-        cables = np.array([[500, 3, 100000], [800, 5, 150000], [1000, 10, 250000]])
-        wfn = WindFarmNetwork(initial_layout=initial_layout,
-                              driver=HeuristicDriver(**settings),
-                              cables=cables)
-        cost, state = wfn.design()
-        wfn.plot()
-
-
-main()
-- 
GitLab