Conversation
|
More commits welcome if you want to run with this... |
|
Two options:
|
|
Using substitutions sounds great. If I create a from materials import Aluminum6061
from structures import ColumnBuckling
alum = Aluminum6061()
colb = ColumnBuckling()... then how do I substitute |
|
That sounds like a GPkit which hasn't been updated to use the substitutions arg... |
|
Ah -- you're correct. Fixed that. It looks like the substitution doesn't happen quite as intended though -- is the In [1]: from materials import Aluminum6061
In [2]: from structures import ColumnBuckling
In [3]: alum = Aluminum6061()
In [4]: colb = ColumnBuckling(substitutions=alum.constants)
In [5]: colb
Out[5]:
gpkit.ColumnBuckling(# minimize
F_ColumnBuckling**-1 [1/lbf],
[ # subject to
9.87*E_ColumnBuckling*I_ColumnBuckling*K_ColumnBuckling**-2*L_ColumnBuckling**-2 [GPa*m**2] >= F_ColumnBuckling [lbf],
],
substitutions={E_ColumnBucklingAluminum6061: 69, rho_ColumnBucklingAluminum6061: 2.7, sigma_{y}_ColumnBucklingAluminum6061: 55, I_ColumnBuckling: 1e-09, K_ColumnBuckling: 2.0, L_ColumnBuckling: 1})
In [6]: colb.solve()
E_ColumnBuckling has no upper bound
Using solver 'cvxopt'
Solving for 2 variables. |
|
(it's perfectly possible I'm using substitutions wrong -- let me know if there's a better way to get the desired behavior). |
|
Ack, no, this is expected. And right now merging doesn't cover substitutions, otherwise I'd just recommend you merge them... |
@bqpd, this isn't working quite yet, but could you take a quick look at what I'm trying to do? I thought it might be really clean to implement a material property look-up table as a model, but turns out this is awkward because it requires adding constraints when all I really want is the variable values (for now at least).