question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Linking diagrams for models with duplicate variables

See original GitHub issue

This has to do with implementing gpkit/gpkit/interactive/linking_diagram.py in models with hierarchy, with duplicate variable names.

I have tried to make a linking diagram for hoburg/d8/CFP_Fuselage_Performance_int_HT.py, in commit cb63fa5, when I realized that the previous linking diagram infrastructure doesn’t like duplicate variable names.

As an example, the aircraft model in CFP has:

ac = Aircraft()
subsystems = [Fuselage(), Engine(), VerticalTail(), HorizontalTail(), Wing()]

I implement linking_diagram in the file make_figure.py, and it returns the following error

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\make_figure.py", line 111, in <module>
    make_figure()
  File "C:\Users\Berk\Dropbox (MIT)\MIT Graduate School\D8\d8\make_figure.py", line 55, in make_figure
    zidane[tuple(keychain[key])] += [key]
KeyError: ('VerticalTail', 'Wing', 'Wing')

because some variable names appear both in Wing and VerticalTail, although there are two distinct variables with the same name (example ‘I_{cap}’, which is a wing spar moment of inertia).

As a workaround, I was going to suggest scrubbing through the constraints within the hyperclasses of Aircraft and AircraftP, instead of variables within the model, to make the diagram. This way you avoid the issues with duplicate names (although you will oddly have two variables with the same name that are not related at all in the diagram). Or is there another way to fix the issue? Let me know what you think.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:14 (14 by maintainers)

github_iconTop GitHub Comments

1reaction
bqpdcommented, Dec 15, 2016

And/or, the models in a variable’s name tell you where it came from, which would be useful information to visualize…

0reactions
bqpdcommented, Jun 27, 2017

superseded by #1088

Read more comments on GitHub >

github_iconTop Results From Across the Web

Duplicating element from referenced project
Right click on the element you want to duplicate and select Duplicate to Current Project from the popup menu.
Read more >
How to Create Relationship in Excel with Duplicate Values
In the data model, we can see that both tables are already loaded. Switch to the Diagram view by clicking on the Diagram...
Read more >
Creating Entity Relationship Diagrams using Draw.io - YouTube
Dr. Soper demonstrates how to create entity-relationship diagrams (ERDs) using Draw.io. Topics covered include creating entities and ...
Read more >
Linking content in draw.io diagrams
Double click on the diagram on your Confluence page to open the diagram editor. Right-click the shape you want to create a link...
Read more >
Is it possible to control duplicate links in GOJS - Stack Overflow
that is container car of service params should not have more than one link to any other node in device model. similarly device...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found