trnsystor.deck.Deck¶
-
class
trnsystor.deck.
Deck
(name, author=None, date_created=None, control_cards=None, models=None, canvas_width=1200, canvas_height=1000)[source]¶ Deck class.
The Deck class holds
TrnsysModel
objects, theControlCards
and specifies the name of the project. This class handles reading from a file (seeread_file()
) and printing to a file (seesave()
).Initialize a Deck object.
- Parameters
name (str) – The name of the project.
author (str) – The author of the project.
date_created (str) – The creation date. If None, defaults to datetime.datetime.now().
control_cards (ControlCards, optional) – The ControlCards. See
ControlCards
for more details.models (list or trnsystor.collections.components.ComponentCollection) – A list of Components (
TrnsysModel
,EquationCollection
, etc.). If a list is passed, it is converted to aComponentCollection
. name (str): A name for this deck. Could be the name of the project.
- Returns
The Deck object.
- Return type
-
classmethod
read_file
(file, author=None, date_created=None, proforma_root=None)[source]¶ Returns a Deck from a file.
- Parameters
file (str or Path) – Either the absolute or relative path to the file to be opened.
author (str) – The author of the project.
date_created (str) – The creation date. If None, defaults to datetime.datetime.now().
proforma_root (str) – Either the absolute or relative path to the folder where proformas (in xml format) are stored.
-
property
graph
¶ Return the
MultiDiGraph
of self.
-
update_models
(amodel)[source]¶ Update the
models
attribute with aTrnsysModel
(or list).- Parameters
amodel (Component or list of Component) –
- Returns
None.
-
to_file
(path_or_buf, encoding=None, mode='w')[source]¶ Save the Deck object to file.
Examples
>>> from trnsystor.deck import Deck >>> deck = Deck("Unnamed") >>> deck.to_file("my_project.dck",None,"w")
- Parameters
-
return_equation_or_constant
(name)[source]¶ Return Equation or Constant for name.
If name parses to int literal, then the int is returned.