DTUWindEnergy / TOPFARM

A repository for a wind plant layout optimisation tool based on FUSED-Wind and FUSED-Wake
GNU Affero General Public License v3.0
33 stars 15 forks source link

Problem running the tutorial #4

Open rethore opened 9 years ago

rethore commented 9 years ago

This cell is generating an error:

Loading all the input data
In [4]:
datadir = './'
dat = loadtxt(datadir+'WaterDepth1.dat')
X, Y = meshgrid(linspace(0., 1000., 50), linspace(0., 1000., 50))
depth = array(zip(X.flatten(), Y.flatten(), dat.flatten()))
borders = array([[200, 200], [150, 500], [200, 800], [600, 900], [700, 700], [900, 500], [800, 200], [500, 100], [200, 200]])
baseline = array([[587.5, 223.07692308], [525., 346.15384615], [837.5, 530.76923077], [525., 530.76923077], [525., 838.46153846], [837.5, 469.23076923]])
​
wt_desc = WTDescFromWTG(datadir+'V80-2MW-offshore.wtg').wt_desc
wt_layout = GenericWindFarmTurbineLayout([WTPC(wt_desc=wt_desc, position=pos) for pos in baseline])
​
​
# The wind rose
weibull_array = np.array([[  0.00000000e+00,   3.59673400e-02,  9.22422800e+00,   2.38867200e+00],
                         [  3.00000000e+01,   3.94977300e-02,   9.86435600e+00,   2.44726600e+00],
                         [  6.00000000e+01,   5.17838000e-02,   9.65220200e+00,   2.41992200e+00],
                         [  9.00000000e+01,   6.99794900e-02,   9.98217800e+00,   2.58789100e+00],
                         [  1.20000000e+02,   8.36383000e-02,   1.00946000e+01,   2.74804700e+00],
                         [  1.50000000e+02,   6.43412500e-02,   9.64369000e+00,   2.59179700e+00],
                         [  1.80000000e+02,   8.64220000e-02,   9.63377500e+00,   2.58007800e+00],
                         [  2.10000000e+02,   1.17690000e-01,   1.05678600e+01,   2.54492200e+00],
                         [  2.40000000e+02,   1.51555100e-01,   1.14525200e+01,   2.46679700e+00],
                         [  2.70000000e+02,   1.47361100e-01,   1.17423700e+01,   2.60351600e+00],
                         [  3.00000000e+02,   1.00109800e-01,   1.16923200e+01,   2.62304700e+00],
                         [  3.30000000e+02,   5.16542400e-02,   1.01385800e+01,   2.32226600e+00]])
wind_rose = WeibullWindRoseVT()
wind_rose.wind_directions = weibull_array[:,0]
wind_rose.frequency = weibull_array[:,1]
wind_rose.k = weibull_array[:,3]
wind_rose.A = weibull_array[:,2]
​
# Minimum distance between turbines
dist_WT_D = 3.0

Traceback:

E:root:'' is a reserved or invalid name
---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
<ipython-input-4-5ca424573668> in <module>()
      7
      8 wt_desc = WTDescFromWTG(datadir+'V80-2MW-offshore.wtg').wt_desc
----> 9 wt_layout = GenericWindFarmTurbineLayout([WTPC(wt_desc=wt_desc, position=pos) for pos in baseline])
     10
     11

c:\users\moserw\projects\toolsdev\openmdao-0.10.3.2\src\fusedwind\src\fusedwind\plant_flow\vt.pyc in __init__(self, wt_list)
    525         super(GenericWindFarmTurbineLayout, self).__init__()
    526         for wt in wt_list:
--> 527             self.add_wt(wt)
    528
    529     def add_wt(self, wt):

c:\users\moserw\projects\toolsdev\openmdao-0.10.3.2\src\fusedwind\src\fusedwind\plant_flow\vt.pyc in add_wt(self, wt)
    535         """
    536         wt.name = wt.name.replace('-','_')
--> 537         self.add(wt.name, VarTree(wt))
    538         self.wt_names.append(wt.name)
    539

c:\Users\moserw\Projects\ToolsDev\openmdao-0.10.3.2\Lib\site-packages\openmdao.main-0.10.3.2-py2.7.egg\openmdao\main\vartree.pyc in add(self, name, obj)
    131             msg = "a VariableTree may only contain Variables or VarTrees"
    132             self.raise_exception(msg, TypeError)
--> 133         return super(VariableTree, self).add(name, obj)
    134
    135     def add_trait(self, name, trait, refresh=True):

c:\Users\moserw\Projects\ToolsDev\openmdao-0.10.3.2\Lib\site-packages\openmdao.main-0.10.3.2-py2.7.egg\openmdao\main\container.pyc in add(self, name, obj)
    587         Returns the added object.
    588         """
--> 589         removed = self._prep_for_add(name, obj)
    590
    591         if has_interface(obj, IContainer):

c:\Users\moserw\Projects\ToolsDev\openmdao-0.10.3.2\Lib\site-packages\openmdao.main-0.10.3.2-py2.7.egg\openmdao\main\container.pyc in _prep_for_add(self, name, obj)
    553         elif not is_legal_name(name):
    554             self.raise_exception("'%s' is a reserved or invalid name" % name,
--> 555                                  NameError)
    556
    557         removed = False

c:\Users\moserw\Projects\ToolsDev\openmdao-0.10.3.2\Lib\site-packages\openmdao.main-0.10.3.2-py2.7.egg\openmdao\main\container.pyc in raise_exception(self, msg, exception_class)
   1449             full_msg = '%s: %s' % (self.get_pathname(), msg)
   1450         self._logger.error(msg)
-> 1451         raise exception_class(full_msg)
   1452
   1453     def reraise_exception(self, msg='', info=None):

NameError: : '' is a reserved or invalid name
rethore commented 9 years ago

I think that the error might be in FUSED-Wind, I will try to see if I can fix it there.

rethore commented 9 years ago

Could you tell me how you have installed topfarm? Which OS are you running it on? Assuming you are running the install_all.sh script, try to rerun it. I have updated the remote_install.txt so that it uses the latest version of FUSED-Wind. That might be where the bug is coming from.

Edit: otherwise try to update FUSED-Wind to its latest version on github.com:

pip install -e  git+http://github.com/FUSED-Wind/fusedwind.git#egg=fusedwind
moserw commented 9 years ago

Hi Pierre,

I am trying to run TOPFARM under Windows 7. I installed it following your instructions given in github using Python v2.7.9. I used the command pip install -r http://raw.githubusercontent.com/DTUWindEnergy/TOPFARM/master/remote_install.txt after installing openmdao in version 10.3.2.

I had to ad a setup.py file in the fusedwake package with the following content:

from setuptools import setup, find_packages

##################################################################### kwargs = {'author': 'DTU WInd Energy and NREL NWTC', 'author_email': 'TBD', 'classifiers': ['Intended Audience :: Science/Research', 'Topic :: Scientific/Engineering'], 'description': 'Framework for Unified Systems Engineering and Design of Wind Plants', 'include_package_data': True, 'install_requires': ['openmdao.main'], 'keywords': ['openmdao'], 'license': 'Apache v. 2.0',

'maintainer': '',

'maintainer_email': '',

'name': 'fusedwake', 'packages': find_packages(),

'url': '',

'version': '0.1', 'zip_safe': False}

setup(**kwargs)
##################################################################

Unfortunately your update did not have any effect :-(

Best regards, Wolfgang