convexengineering / gplibrary

Useful subsystem models
MIT License
10 stars 11 forks source link

Linked Constraint exclusion error #79

Closed mjburton11 closed 7 years ago

mjburton11 commented 7 years ago

Got this error while trying to link submodels. The varkeys are different for each new Flight Segment that I want to create and it seems to be stopping me from excluding certain variables from being linked. I think subinplace could solve this, but I'm unsure how to use it. See commit 37e5a52b560395bee32f47cd77a83fe330cd096b on branch flightsegments in gpkit-models/1682/gas_male/gas_male_rubber.py

/Users/mjburton11/Documents/SuperUROP/gpkit/gpkit/constraints/linked.pyc in __init__(self, constraints, include_only, exclude)
     52                                          " %s was set to %s" % (
     53                                              subbed_vk, sub,
---> 54                                              vk, self.substitutions[vk]))
     55             # vks is a set, so it's convenient to use the loop variable here
     56             # since we've already verified above that vks is not null

ValueError: substitution conflict: could not link because h_Climb_(0,) was set to 5000.0 but h_Loiter_(0,) was set to 15000.0
bqpd commented 7 years ago

What happens if you do LinkedConstraintSet(..., exclude=["h"])?

whoburg commented 7 years ago

Looks like he does have h in the exclude set: https://github.com/hoburg/gpkit-models/commit/37e5a52b560395bee32f47cd77a83fe330cd096b

+        lc = LinkedConstraintSet(
+            [fs for fs in self.mission, constraints], exclude={
+                "t_{loiter}", "h_{climb}", "h_{dot}", "h", "T_{atm}",
+                "\\mu", "\\rho", "W_{start}", "W_{end}", "W_{fuel}",
+                "W_{fuel-fs}", "W_{finish}", "W_{begin}", "C_L", "C_L",
+                "V", "eta_{prop}", "P_{shaft}", "T", "BSFC", "RPM",
+                "P_{shaft-max}", "L_factor", "P_{shaft-tot}", "t", "R",
+                "Re", "C_{f-fuse}", "C_{D-fuse}", "Re_{fuse}", "c_{dp}",
+                "V_{wind}"})
bqpd commented 7 years ago

Oh, sorry, this got fixed over email and I need to push the PR up.

bqpd commented 7 years ago

PR is up