trnsystor.component.Component¶
-
class
trnsystor.component.Component(*args, **kwargs)[source]¶ Component class.
Base class for Trnsys elements that interact with the Studio.
TrnsysModel,ConstantCollectionandEquationCollectionimplement this class.Initialize class.
- Parameters
-
property
link_styles¶ Return
LinkStylesof self.
-
set_canvas_position(pt, trnsys_coords=False)[source]¶ Set position of self in the canvas.
Use cartesian coordinates: origin 0,0 is at bottom-left.
Hint
The Studio Canvas origin corresponds to the top-left of the canvas. The x coordinates increase from left to right, while the y coordinates increase from top to bottom.
top-left = “* $POSITION 0 0”
bottom-left = “* $POSITION 0 2000”
top-right = “* $POSITION 2000” 0
bottom-right = “* $POSITION 2000 2000”
For convenience, users should deal with cartesian coordinates. trnsystor will deal with the transformation.
- Parameters
pt (Point or 2-tuple) – The Point geometry or a tuple of (x, y) coordinates.
trnsys_coords (bool) – Set to True of
ptis given in Trnsys Studio coordinates: origin 0,0 is at top-left.
-
set_component_layer(layers)[source]¶ Change the layer of self. Pass a list to change multiple layers.
-
property
unit_number¶ Return the model’s unit number (unique).
-
property
type_number¶ 104for Type104.- Type
Return the model’s type number, eg.
-
property
unit_name¶ ‘Type104’.
- Type
Return the model’s unit name, eg.
-
property
model¶ Return the path of this model’s proforma.
-
property
inputs¶ returns the model’s inputs.
- Type
-
property
outputs¶ returns the model’s outputs.
- Type
-
property
centroid¶ Returns the model’s center Point().
- Type
Point
-
set_link_style(other, loc='best', color='#1f78b4', linestyle='-', linewidth=1, path=None)[source]¶ Set outgoing link styles between self and other.
- Parameters
other (Component) – The destination model.
loc (str or tuple) – loc (str): The location of the anchor. The strings ‘top-left’, ‘top-right’, ‘bottom-left’, ‘bottom-right’ place the anchor point at the corresponding corner of the
TrnsysModel. The strings ‘top-center’, ‘center-right’, ‘bottom-center’, ‘center-left’ place the anchor point at the edge of the correspondingTrnsysModel. The string ‘best’ places the anchor point at the location, among the eight locations defined so far, with the shortest distance with the destinationTrnsysModel(other). The location can also be a 2-tuple giving the coordinates of the originTrnsysModeland the destinationTrnsysModel.color (str or tuple) – The color of the line. Accepts any matplotlib color. You can specify colors in many ways, including full names (‘green’), hex strings (‘#008000’), RGB or RGBA tuples ((0,1,0,1)) or grayscale intensities as a string (‘0.8’).
linestyle (str) – Possible values: ‘-‘ or ‘solid’, ‘–’ or ‘dashed’, ‘-.’ or ‘dashdot’, ‘:’ or ‘dotted’, ‘-.’ or ‘dashdotdot’.
linewidth (float) – The width of the line in points.
path (LineString or MultiLineString, optional) – The path of the link.
-
connect_to(other, mapping=None, link_style_kwargs=None)[source]¶ Connect the outputs of
selfto the inputs ofother.Important
Keep in mind that since python traditionally uses 0-based indexing, the same logic is used in this package even though TRNSYS uses traditionally 1-based indexing. The package will internally handle the 1-based index in the output .dck file.
Examples
Connect two
TrnsysModelobjects together by creating a mapping of the outputs of pipe_1 to the intputs of pipe_2. In this example we connect output_0 of pipe_1 to input_0 of pipe_2 and output_1 of pipe_1 to input_1 of pipe_2:>>> pipe_1.connect_to(pipe_2, mapping={0:0, 1:1})
The same can be acheived using input/output names.
>>> pipe_1.connect_to(pipe_2, mapping={'Outlet_Air_Temperature': >>> 'Inlet_Air_Temperature', 'Outlet_Air_Humidity_Ratio': >>> 'Inlet_Air_Humidity_Ratio'})
-
property
successors¶ Other objects to which this TypeVariable is connected. Successors.
-
property
is_connected¶ Whether or not this Component is connected to another TypeVariable.
Connected to or connected by.
-
property
predecessors¶ Other objects from which this TypeVariable is connected. Predecessors.