convexengineering / gplibrary

Useful subsystem models
MIT License
10 stars 11 forks source link

Sig Eq Paper model units error #84

Closed mayork closed 7 years ago

mayork commented 7 years ago

This is the print out when I run @mopg signomial equality paper solar hale scripts

eginning signomial solve.
Solving took 4 GP solves and 0.228 seconds.

Traceback (most recent call last):
  File "/Users/mayork/Library/Containers/com.apple.mail/Data/Library/Mail Downloads/AEA1A38B-88E1-44A7-A3E8-D05EC2CAAB89/solar_hale_wind_hi_B.py", line 182, in <module>
    sol = M.localsolve("mosek",x0={h:60000*units.ft},iteration_limit=500)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/gpkit/constraints/prog_factories.py", line 83, in solvefn
    solution.to_united_array(unitless_keys=["sensitivities"], united=True)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/gpkit/small_classes.py", line 94, in to_united_array
    _enray_and_unit_dict(self, self, unitless_keys, united)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/gpkit/small_classes.py", line 140, in _enray_and_unit_dict
    unitless_keys, subunited)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/gpkit/small_classes.py", line 140, in _enray_and_unit_dict
    unitless_keys, subunited)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/gpkit/small_classes.py", line 145, in _enray_and_unit_dict
    v = [e.to(k.units).magnitude for e in v]*k.units
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pint/quantity.py", line 263, in to
    magnitude = self._convert_magnitude_not_inplace(other, *contexts, **ctx_kwargs)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pint/quantity.py", line 231, in _convert_magnitude_not_inplace
    return self._REGISTRY.convert(self._magnitude, self._units, other)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pint/unit.py", line 1026, in convert
    return self._convert(value, src, dst, inplace)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pint/unit.py", line 1063, in _convert
    raise DimensionalityError(src, dst, src_dim, dst_dim)
DimensionalityError: Cannot convert from 'dimensionless' (dimensionless) to 'pascal' ([mass] / [length] / [time] ** 2)

it looks like the model solves and then a unit error is thrown while creating the solution dict? I'm not sure how to proceed, but would really like to analyze this model to see if the atmosphere linearizes the same way as my atmosphere model. @bqpd thoughts?

the code is in PR #83

bqpd commented 7 years ago

It's a gpkit bug, closed in https://github.com/hoburg/gpkit/pull/876

mayork commented 7 years ago

forgot to mention I changed the SignomialEqualityLinTrust in the solar hale to be SignomialEquality and ran this on gpkit master

bqpd commented 7 years ago

Yup, did that.

bqpd commented 7 years ago

Will merge to master once tests pass.

bqpd commented 7 years ago

@mayork, try now.

mayork commented 7 years ago

it works, thanks!