Skip to content

Commit

Permalink
added compartment metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
willgebhardt committed Jul 23, 2024
1 parent 087706e commit f9289c5
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion ngcsimlib/compartment.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def is_compartment(cls, obj):
"""
return hasattr(obj, "_is_compartment")

def __init__(self, initial_value=None, static=False, is_input=False):
def __init__(self, initial_value=None, static=False, is_input=False, display_name=None, units=None):
"""
Builds a compartment to be used inside a component. It is important
to note that building compartments
Expand All @@ -56,6 +56,8 @@ def __init__(self, initial_value=None, static=False, is_input=False):
self.path = None
self.is_input = is_input
self._is_destination = False
self._display_name = display_name
self._units = units

def _setup(self, current_component, key):
"""
Expand Down Expand Up @@ -131,3 +133,12 @@ def is_wired(self):
return True

return self._is_destination

@property
def display_name(self):
return self._display_name if self._display_name is not None else self.name

@property
def units(self):
return self._units if self._units is not None else "dimensionless"

0 comments on commit f9289c5

Please sign in to comment.