DTOcean / dtocean

Download the DTOcean installation wizard, get help and report issues here.
GNU General Public License v3.0
4 stars 6 forks source link

Electrical Sub Systems module - input data for Array Layout by editing the table #21

Closed kilomwork closed 7 years ago

kilomwork commented 7 years ago

When I am running the Electrical Sub Systems module without inputs from the Hydrodynamics module, I want to input Array Layout and Mean Power Production Histogram Per Device data through editing the table instead of uploading an excel file. I expect that I can edit the table in a similar way as the lease boundary input as shown in Figure 1. However, it seems that the table function has been locked as shown in Figure 2.

Figure 1 3

Figure 2 1

H0R5E commented 7 years ago

Hi @kilomyau, there is a widget for these types of variables in the master branch and it will be included in the 1.1 release. For the time being you will have to enter the values using a file. The attached file array_layout_example.xlsx gives an example of how the input should be formatted.

Best wishes,

Mat

kilomwork commented 7 years ago

Hi @H0R5E,

I have tried to input the Mean Power Production Histogram Per Device data by the attached excel file.

bin.xlsx

However, the following error occurred. Could you suggest how I can fix it please? Thank you very much for your help.

error_electrical

2017-07-16 00:20:14,289 - CRITICAL - dtocean_gui.main - A RuntimeError occurred: Reading variable farm.mean_power_hist_per_device led to the following traceback:

Traceback (most recent call last): File "D:\DTOcean\lib\site-packages\aneris\control\data.py", line 446, in _get_data_obj data = data_structure.get_data(raw, metadata) File "D:\DTOcean\lib\site-packages\dtocean_core\data\definitions.py", line 1307, in get_data for k, v in raw.items()} AttributeError: 'tuple' object has no attribute 'items'

2017-07-16 00:20:14,292 - CRITICAL - dtocean_gui.main - File "D:\DTOcean\lib\site-packages\dtocean_gui\main.py", line 765, in read_file str(interface_name)) File "D:\DTOcean\lib\site-packages\dtocean_core\pipeline.py", line 987, in read_file overwrite) File "D:\DTOcean\lib\site-packages\dtocean_core\pipeline.py", line 956, in read log_exceptions) File "D:\DTOcean\lib\site-packages\dtocean_core\pipeline.py", line 1262, in _read_variables log_exceptions=log_exceptions) File "D:\DTOcean\lib\site-packages\dtocean_core\core.py", line 911, in add_datastate log_exceptions=log_exceptions) File "D:\DTOcean\lib\site-packages\aneris\control\simulation.py", line 672, in add_datastate metadata) File "D:\DTOcean\lib\site-packages\aneris\control\data.py", line 299, in create_new_data data_obj = self._get_data_obj(metadata, raw_data) File "D:\DTOcean\lib\site-packages\aneris\control\data.py", line 455, in _get_data_obj raise RuntimeError(errStr)

H0R5E commented 7 years ago

Hi @kilomyau, I'm afraid direct loading of this variable is broken in version 1.0. It's fixed in version 1.1 but in the meantime you can use the "Load test data..." menu option when you right click on "Electrical Sub Systems" in the pipeline to load it up using a python file. I've attached an example of the file you need and a screenshot of the menu I am referring to.

capture

inputs_dev_power_hist.zip

kilomwork commented 7 years ago

Hi @H0R5E, Thanks a lot for your help!

The python code you provided works well. However, it created another error that you may be able to help. Sorry for seeking lots of assistance here as I am experienced in python language.

type error1

2017-07-18 23:39:28,457 - INFO - aneris.control.simulation - Datastate with level "electrical sub systems start" stored 2017-07-18 23:39:31,292 - CRITICAL - dtocean_gui.main - A TypeError occurred: ("'in ' requires string as left operand, not NoneType", u'occurred at index 0') 2017-07-18 23:39:31,293 - CRITICAL - dtocean_gui.main - File "D:\DTOcean\lib\site-packages\dtocean_gui\main.py", line 185, in run self._project) File "D:\DTOcean\lib\site-packages\dtocean_core\menu.py", line 457, in execute_current allow_unavailable=allow_unavailable) File "D:\DTOcean\lib\site-packages\dtocean_core\menu.py", line 168, in _execute allow_unavailable=allow_unavailable) File "D:\DTOcean\lib\site-packages\dtocean_core\core.py", line 1769, in execute_interface interface = core.connect_interface(project, interface) File "D:\DTOcean\lib\site-packages\dtocean_gui\core.py", line 267, in connect_interface interface = super(GUICore, self).connect_interface(project, interface) File "D:\DTOcean\lib\site-packages\dtocean_core\core.py", line 1244, in connect_interface interface.connect() File "D:\DTOcean\lib\site-packages\dtocean_core\interfaces\electrical.py", line 450, in connect shipping_hist) File "D:\DTOcean\lib\site-packages\dtocean_electrical\inputs.py", line 322, in init self.set_target_burial_depth() File "D:\DTOcean\lib\site-packages\dtocean_electrical\inputs.py", line 342, in set_target_burial_depth set_burial_from_bpi, axis = 1) File "D:\DTOcean\lib\site-packages\pandas\core\frame.py", line 4061, in apply return self._apply_standard(f, axis, reduce=reduce) File "D:\DTOcean\lib\site-packages\pandas\core\frame.py", line 4157, in _apply_standard results[i] = func(v) File "D:\DTOcean\lib\site-packages\dtocean_electrical\input_utils\utils.py", line 246, in set_burial_from_bpi elif row['layer 1 type'] in ('medium sand'):

H0R5E commented 7 years ago

Hi, version 1.0 of the electrical module can only work with the following soil types: 'hard glacial till', 'hard rock', 'gravel cobble'. This is fixed in version 1.1.

kilomwork commented 7 years ago

Hi @H0R5E ,

I have tried changing the soil type to 'hard rock' for tables beta.bathymetry_layer, beta.cable_corridor_bathymetry_layer, beta.project_bathymetry_layer and beta.project_cable_corridor_bathymetry_layer in the pgAdmin.

However, the same error happens again. Could you suggest any tables that I have missed to update please? Thank you very much for your help.

H0R5E commented 7 years ago

Hi, sorry about that! Does the example data run?

kilomwork commented 7 years ago

Hi @H0R5E

I installed DTOcean in my second laptop.

I checked the data stored in the pgAdmin and I found that the example data came with the installation package works well with 'medium sand'.

So, I guess that there may be other issues causing the error instead of the soil type?

Thank you!

H0R5E commented 7 years ago

Yes, on second thought medium sand may be the only soil type that will pass this bug. You will have to change all the soil types to medium sand.

Sorry for the confusion, I thought that the first if statement would skip the other conditions of it was true, but this is not the case.

On 20 Jul 2017 12:54 p.m., "Ka Man" notifications@github.com wrote:

Hi @H0R5E https://github.com/h0r5e

I installed DTOcean in my second laptop.

I checked the data stored in the pgAdmin and I found that the example data came with the installation package works well with 'medium sand'.

So, I guess that there may be other issues causing the error instead of the soil type?

Thank you!

— You are receiving this because you were mentioned.

Reply to this email directly, view it on GitHub https://github.com/DTOcean/dtocean-issues/issues/21#issuecomment-316668777, or mute the thread https://github.com/notifications/unsubscribe-auth/AE2lFwPRimzKx-EwXSXRJ150gffZWT8Aks5sPzH3gaJpZM4OT-4N .

kilomwork commented 7 years ago

Hi @H0R5E,

I have just set the soil type back to 'medium sand' for tables beta.bathymetry_layer, beta.cable_corridor_bathymetry_layer, beta.project_bathymetry_layer and beta.project_cable_corridor_bathymetry_layer using the code as follow medium sand

Unfortunately, the error still occurs.

As the error message said that it is caused by 'Nonetype', I would expect that it is related to some empty records?? However, I am searching through the above four tables and I have not found any empty records yet.

Thank you.