mbe-shipyard / sysml.py

A Python package for the Systems Modeling Language (SysML) for Model-based Systems Engineering (MBSE) applications
Apache License 2.0
68 stars 20 forks source link

"diagram object" generators #10

Open capsulecorplab opened 6 years ago

capsulecorplab commented 6 years ago

This issue is an enhancement for #3 and entails implementing instance methods for generating objects that can be passed to a plotting package (such as plotly matplotlib, bokeh) for generating the 9 SysML diagrams.

Diagrams are generated as "diagram objects" using generators in the form of instance methods via the Model() class, using the SysML diagram acronyms.

e.g.,

import sysml

# creates a model object from yaml file
model = sysml.import_yaml('deathstar_plans.yaml')

# generates an block definition diagram for package, 'Structure'
bdd = model['Structure'].bdd()
someplottingpackage.somegraphgenerator(bdd)
someplottingpackage.show() 

# generates an internal block diagram object for 'block AA23'
ibd = model['Structure']['block AA23'].ibd()
someplottingpackage.somegraphgenerator(ibd)
someplottingpackage.show() 

# generates an activity diagram object for 'order 66'
act = model['Behavior']['order 66'].act()
someplottingpackage.somegraphgenerator(act)
someplottingpackage.show()

# generates a state machine diagram object for 'statemachine 327'
stm = model['Behavior']['statemachine 327'].stm()
someplottingpackage.somegraphgenerator(stm)
someplottingpackage.show()

# generates a sequence diagram object for package, 'Behavior'
sd = model['Behavior'].sd()
someplottingpackage.somegraphgenerator(sd)
someplottingpackage.show()

# generates a use case diagram object for package, 'Behavior'
ud = model['Behavior'].ud()
someplottingpackage.somegraphgenerator(ud)
someplottingpackage.show()

# generates a requirements diagram object for package, 'Requirements'
req = model['Requirements'].req()
someplottingpackage.somegraphgenerator(req)
someplottingpackage.show()

# generates a parametric diagram object for 'block AA23'
par = model['Parametrics']['block AA23'].par()
someplottingpackage.somegraphgenerator(req)
someplottingpackage.show()

# generates a package diagram object for package, 'Structure'
pkg = model['Structure'].pkg()
someplottingpackage.somegraphgenerator(pkg)
someplottingpackage.show()