My Blog

DTOcean Installation Solution

Sporadic Installation Issues Reported

Following the release of DTOcean (see DTOcean: An Introduction) a significant number of users reported issues with the installer crashing. This occurred after the main code installer had finished, when the hydrodynamic data installer fails to find the chosen installation directory.

Installation Error

Missing Registry Key

The symptom of this error is clear. The hydrodynamic data installer is looking for a registry key that contains the installation directory. This key should be written by a small script which is executed at the termination of the first installer. The registry key that should be written is HKEY_CURRENT_USER\Software\DTOcean, subkey INSTALL_DIR, however it is evident that this key was not written for those suffering this bug.

Missing Key

Uncertain Causes

It is currently not clear why the post-install script is not working for some systems whilst working for others. Some possibilities include:

  • The script is failing. This could be from the commands not being recognised on certain systems (or within certain shells).
  • The user does not have sufficient rights to either run the script or write to the registry
  • Anti-virus software is blocking the execution of the script.

Without some logging from the script to see why it failed to execute properly, it’s hard to accurately diagnose the problem. To this end, I created an issue for Anaconda Constructor here.

Temporary Solution

As the post-install script is not working in all cases, to solve this issue the user must write the installation directory to the registry prior to installing DTOcean.

To facilitate this, I have written a batch script which, when executed, will prompt the user to enter the chosen directory.

Pre-install Script

The script can be downloaded using this link. Once extracted, double click the dtocean_pre_install.bat script and follow the prompts, as shown in the image above.

Note, that the directory entered in the pre-install script must match exactly the directory entered into the installer. Also, the installation directory must not exist prior to beginning the installation. If the directory exists following a failed installation, either attempt to uninstall or delete it manually.

This solution should allow the current version of DTOcean (1.0) to be installed while a more robust fix is developed for future releases.

Notes

DTOcean: An Introduction

DTOcean GUI

What is DTOcean?

The official launch of the DTOcean software tool was announced on the 9th of January 2017. This was the final official output of a 3 year, 6 million Euro project to deliver a software tool to improve the decision making around designing arrays of ocean energy (wave and tidal) devices. Alongside the press release an installable graphical desktop tool (as seen above) and all its associated source code was made available to download by the general public under various open source licenses.

DTOcean is an ocean energy converter array planning tool that can be used to evaluate the impact of design decisions against quantitative metrics such as the levelised cost of energy. Various design choices can be evaluated using the 5 design modules: Hydrodynamics, Electrical Sub-systems, Moorings and Foundations, Installation and Operations and Maintenance. The results of varying parameters across these 5 modules can then be directly compared.

Who Developed it?

DTOcean was developed across 18 institutions across Europe (please see the official DTOcean website for further details). The bulk of the software development fell to about 8 of these, with Tecnalia Research and Innovation, of the Basque Country, playing a key role. In late 2014, I started a Marie Curie fellowship with the marine energy group of Tecnalia and I was principally working on DTOcean until the end of my contract in December 2016.

DTOcean Team

My role on the project was to coordinate the integration of the design modules and develop the framework for handling data between the modules, scheduling their execution, and interacting with the user through a graphical user interface. I also defined the unified data model that is observed and populated by the user of the tool.

I was not responsible for the development of the computational modules themselves or the supplementary database (they were led by other partners), although I did contribute to these projects and tried to coordinate their interactions with the other components of the tool. I was also not the sole contributor to the integration process: Vincenzo Nava, David Bould, Adam Collin, Rui Duarte and Francesco Ferri all contributed to giving the software as much functionality as possible by configuring and building upon the underlying framework.

Building a Community

Currently the installers, source code and supplementary data can be downloaded from SETIS, all of which corresponds to the 1.0 release at the end of the project. Although this portal provides a permanent home for these files it does not facilitate community engagement or future development.

To begin the process of developing a user community around DTOcean, I have placed all the source code onto the GitHub repository service. The “organisation” DTOcean contains a repository for each component (and subcomponent) of the tool and an important additional repository called dtocean-issues.

The dtocean-issues repository facilitates community engagement by allowing users of the integrated graphical tool to submit bugs or questions or even to suggest future improvements to the software. If you are using DTOcean and want to provide some feedback I would encourage you to open an issue.

DTOcean GUI

Although there is no formal, funded support for DTOcean at this point, collecting the experiences of the users will be invaluable for assessing how much interest the tool has among the ocean energy community and how it could be improved should resources become available in the future.

Building a Future

A lot of work remains to be completed to organise the future development and exploitation of DTOcean. Currently, I am available to do a small amount of unpaid work to help disseminate the tool and advise potential users, but it is important for the future of the tool that some funding can be secured in order to improve the stability and accuracy of the software and respond to issues raised by the user community.

Although DTOcean has garnered significant interest from various actors such as research institutions and device developers, neither the tool itself, or the industry it is designed for, is mature enough to appeal to the utilities that would pay for its full exploitation.

Even though the software itself is free, the investment of time to develop and improve it is not. Ultimately, the success of DTOcean will be judged on whether it can attract the funding required to secure its future. Developing a strong user community is the first step to achieving that goal.

Better zero crossing estimation for fifthwave

Had some difficulties getting decent zero crossing approximations for fifthwave. The main issue is that the data generated from the Starccm+ plots is quite messy in that it is rather zig-zaggy having some points very close to others, but not coincident or even the direction you might expect.

This has caused a number of problems with the code in the past (particularly when estimating wavelength and celerity which relies on good estimation of the zero crossings). The original code had a basic linear interpolation routine checking for a switch of sign and them some error checking after that to make sure it wasn’t an inflection. Unfortunately the messiness of the data made this process extremely unreliable.

Moving onto examining all the waves in the numerical wave tank (NWT) rather than just a region of it required much better estimation of the zero crossings in order to strongly identify which wave was which after a time step and thus, monitor its progress. I needed to smooth the data before it could be really useful and then best solution to this would seem to be splines.

Spline fitting is a pretty heavy bit of mathematics, but I am lucky that the authors of Scipy (the scientific Python library) created an interface to FITPACK (a FORTRAN curve fitting library) called scipy.interpolate. Thus generating splines was not too difficult, it’s just deciding what to do with them. This takes me on a slight tangent where I must express the discomfort caused by using something you don’t understand and the risks associated with that. I have a mathematics degree, but not enough time to learn splines again so I just merrily let the smoothing routine do it’s business and harvested the neat roots() method which gives the roots of the spline (or the zero crossings. Only until the results continued to be a bit rubbish did I actually investigate what was going on and this is what I found.

Spline1

Basically the default spline is absolutely nowhere near the wave form. The smoothing parameter ‘s’ was set way to high (in fact, if it’s not specified its the length of the data i.e O(1000)). Ideally the smoothing in this first case should be O(0.01) which generates a results like this:

Spline2

Close up though this still isn’t perfect and it may be that it won’t calculate this level of smoothing which means that I want to reduce the amount of data that the spline is fitted to, idealy to go from peak to trough to peak. To get a good estimate of the locations of the peaks and troughs, I create another graph of the 1st derivative of the above spline and fit another spline (with even lower s this time) and find it’s roots. This gives me the turning points of the original data. I do need to be careful here, however, as I want to get peak trough, so if there is another peak in there, I skip it till I find a trough. Finally I trim the data to a region between a peak and trough and fit a new spline (default smoothing is fine now), and voila, a good approximation to the zero crossing can be found. Here’s one I made earlier.

Spline3

Finally, I’ll just put a quick summery of the code for getting these plots, etc, so that I can do it again if it all goes a bit airy.

# Import the fifthwave module
import fifthwave as fw
from numpy import linspace

# Set up the wave form data from a csv file
test_data = fw.TwoD_Wave_Form()
test_data.import_csv('mycsv.csv')

# Fit the first spline to that data and plot it
test_data.fit_spline(smoothing=0.01)
test_data.spline_plot('first_spline.png')

# Now build another wave form based on the gradient of the first spline
new_x = linspace(test_data.x[0], test_data.x[-1], len(test_data.x))
new_eta = test_data._spline(newx, 1)

work_data = fw.TwoD_Wave_Form(eta_list=new_eta, x_list=new_x)

# Get the spline approximation and the roots.
work_data.fit_spline(smoothing=0.001)
work_data.spline_plot('gradient_spline.png')

inflections = work_data._spline.roots()

# You can now filter the inflections to make sure they run peak to trough Finally for each inflection move the work data and find the root, i.e there may be a crossing between the start of the data and the first inflection
fromindex = 0
toindex = test.closest_x(inflections[0]) + 1

work_data.x = test_data.x[fromindex:toindex]
work_data.eta = test_data.eta[fromindex:toindex]

work_data.fit_spline()
work_data.spline_plot('final_spline.png')

print 'Zero crossing is at ', work_data._spline.roots()[0]

# Note that the current smoothing factor is not easy to recover from the spline, but in fact it is given by
test_data_spline_smoothing_factor = test_data._spline._data[6]