ORNL-CEES / Cap

A library for modeling energy storage devices.
http://cap.readthedocs.org
Other
16 stars 6 forks source link

Error catch within ragone_plot.py #203

Closed iSchomer closed 8 years ago

iSchomer commented 8 years ago
def run_discharge(device, ptree):
    data = initialize_data()

    # (re)charge the device
    initial_voltage = ptree.get_double('initial_voltage')

When the RagoneAnalysis object calls run_discharge, that method tries to get two values from PropertyTree.

except RuntimeError:
      print('Failed to discharge at {0} watt'.format(
                discharge_power))
      break

RagoneAnalysis catches that potential RuntimeError, but only with the assumption that it was caused by a failed constant-power discharge, so the user is not notified that they are missing PropertyTree entries.

Rombur commented 8 years ago

@iSchomer can you add the line and the file where we catch the exception

dalg24 commented 8 years ago

Mm I see. The error log should indicate that the exception is thrown in the tree though. Is that not happening?

Rombur commented 8 years ago

Even if it does, it's pretty confusing to see an error message about a failed discharge when in fact the problem is a missing input.

iSchomer commented 8 years ago

Also it's worth mentioning that the automatic charge that happens within run_discharge is quite time-consuming with Dualfoil. The voltage hold at the end of the charge could last up to 40 minutes in run time I would guess.

dalg24 commented 8 years ago

Yes we need to expose some of the parameters on the (re)charging step to the user.

dalg24 commented 8 years ago

This isa possible fix

except RuntimeError as e:
    print(e)
    print('Failed to discharge at {0} watt'.format(discharge_power))
    break
dalg24 commented 8 years ago

It is not ideal but I'm not sure we can throw different kind of errors with Boost.Python See the doc

dalg24 commented 8 years ago

PR #205 should resolve this issue. Errors raised from the PropertyTree will not be casted as RuntimeError any more.