convexengineering / SPaircraft

Models for commercial aircraft design
http://spaircraft.readthedocs.org
25 stars 17 forks source link

Introducing PRFC optimization #67

Closed 1ozturkbe closed 7 years ago

1ozturkbe commented 7 years ago

@mayork this is a heads-up that I am adding a new objective function for payload-range fuel consumption. For this objective, we remove the ReqRng and n_{pax} substitutions, and let the model figure out what the optimal mission is for the given configuration. it's a work in progress (I got a pretty funny result for the first solve with D8_eng_wing, but the results should be valuable).

1ozturkbe commented 7 years ago

As a teaser, here is the VSP image of the solve (with set npax and ReqRng) prfcd8 Wonky, ey? Also, I don't know exactly what happened with y_{eng}.

1ozturkbe commented 7 years ago

Oh, because there is no y_{eng} sub in D8_eng_wing. I think your merge conflict overwrote my fix :P Will add again.

mayork commented 7 years ago

oh shoot, sorry!

mayork commented 7 years ago

this looks really neat! @1ozturkbe do you want to meet up tomorrow and outline what we want to present Tuesday?

1ozturkbe commented 7 years ago

Sounds good. I'm free pretty much all day, but I would prefer the afternoon. I can also meet today if you are free; before 1pm works best.

1ozturkbe commented 7 years ago

I want to keep this issue open until we resolve the vector subs issues. Currently, we have to comment out the n_{pax} 'substitution' equations within D8.py to be able to run with a PRFC objective. Hopefully we should no longer have to do this soon.

mayork commented 7 years ago

tomorrow is best for me. There's a chance we might fly JHO saturday so I'd need to verify the plane is ready in the late afternoon..how's 1pm?

1ozturkbe commented 7 years ago

Cool, let's do it.

mayork commented 7 years ago

@bqpd could you give us an example of the right way to do one of these vector subs?

bqpd commented 7 years ago

What you were doing before should work fine! [5*units("m")]. np,array([1, 2, 3])*units("m") should also work.

1ozturkbe commented 7 years ago

Cool, will implement this.

1ozturkbe commented 7 years ago

I can't get the subs to work with BCS or relaxed_constants. I created new branch vectorsubs until we can resolve this, because I can't run any of the models with the recent changes I made. the error is:

run SP_aircraft
Backend Qt4Agg is interactive backend. Turning interactive mode on.
D8_eng_wing executing...
Traceback (most recent call last):
  File "C:\Users\Berk\Anaconda2\lib\site-packages\IPython\core\interactiveshell.py", line 2666, in safe_execfile
    self.compile if kw['shell_futures'] else None)
  File "C:\Users\Berk\Anaconda2\lib\site-packages\IPython\utils\py3compat.py", line 276, in execfile
    exec(compiler(scripttext, filename, 'exec'), glob, loc)
  File "C:\Users\Berk\Dropbox (MIT)\MIT Graduate School\D8\d8\SP_aircraft.py", line 562, in <module>
    m = Model(m.cost,BCS(m))
  File "c:\users\berk\dropbox (mit)\mit graduate school\code\gpkit\gpkit\constraints\bounded.py", line 73, in __init__
    self.bounded_varkeys = tuple(vk for vk in constraints.varkeys
  File "c:\users\berk\dropbox (mit)\mit graduate school\code\gpkit\gpkit\constraints\bounded.py", line 74, in <genexpr>
    if vk not in constraints.substitutions)
  File "c:\users\berk\dropbox (mit)\mit graduate school\code\gpkit\gpkit\keydict.py", line 106, in __contains__
    % (key, dict.__getitem__(self, key)))
TypeError: n_{pax}_Mission, Aircraft, Fuselage has an idx, but its value in this KeyDict is the scalar 180.0.
mayork commented 7 years ago

@1ozturkbe can we close this since it isn't really an issue?

1ozturkbe commented 7 years ago

I guess the issue is in vector substitutions, and PRFC works anyways. CLosing.

bqpd commented 7 years ago

Hmm, it worked with the example code @mayork posted. I'll add an issue.