trnsystor.typevariable.TypeVariable¶
-
class
trnsystor.typevariable.
TypeVariable
(val, order=None, name=None, role=None, dimension=None, unit=None, type=None, min=None, max=None, boundaries=None, default=None, symbol=None, definition=None, model=None)[source]¶ TypeVariable class.
TypeVariable
is the main object class that handles storage of TRNSYS component parameters, inputs, outputs and derivatives. Parameters, Inputs, Outputs and Derivatives are all subclasses of TypeVariable.See
Parameter
for more details.See
Input
for more details.See
Output
for more details.See
Derivative
for more details.
Initialize a TypeVariable with the following attributes.
- Parameters
val (int, float, _Quantity) – The actual value hold by this object.
order (str) – The order of the variable.
name (str) – This name will be seen by the user in the connections window and all other variable information windows.
role (str) – The role of the variables such as input, output, etc. Changing the role of a standard component requires reprogramming and recompiling the component.
dimension (str) – The dimension of the variable (power, temperature, etc.): This dimension must be already defined in the unit dictionary (refer to section 2.9) to be used. The pre-defined dimension ‘any’ allows to make a variable compatible with any other variable: no checks are performed on such variables if the user attempts to connect them to other variables.
unit (str) – The unit of the variable that the TRNSYS program requires for the specified dimension (C, F, K etc.)
type (type or str) – The type of the variable: Real, integer, Boolean, or string.
min (int, float or pint._Quantity) – The minimum value. The minimum and maximum can be “-INF” or “+INF” to indicate no limit (infinity). +/-INF is the default value.
max (int, float or pint._Quantity) – The maximum value. The minimum and maximum can be “-INF” or “+INF” to indicate no limit (infinity). +/-INF is the default value.
boundaries (str) – This setting determines if the minimum and maximum are included or not in the range. choices are “[;]”, “[;[“, “];]” ,”];[“
default (int, float or pint._Quantity) – the default value of the variable. The default value is replaced by the initial value for the inputs and derivatives and suppressed for the outputs.
symbol (str) – The symbol of the unit (not used).
definition (str) – A short description of the variable.
model (TrnsysModel) – the TrnsysModel this TypeVariable belongs to.
-
classmethod
from_tag
(tag, model=None)[source]¶ Class method to create a TypeVariable from an XML tag.
- Parameters
tag (Tag) – The XML tag with its attributes and contents.
model (TrnsysModel) – The model.
-
property
is_connected
¶ Whether or not this TypeVariable is connected to another TypeVariable.
Checks if self is in any keys
-
property
predecessor
¶ Other TypeVariable from which this Input TypeVariable is connected.
Predecessors
-
property
idx
¶ Get the 0-based variable index of self.
-
property
one_based_idx
¶ Get the 1-based variable index of self such as it appears in Trnsys.
-
connect_to
(other, link_style_kwargs=None)[source]¶ Connect a single TypeVariable to TypeVariable other.
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
TypeVariable
objects together>>> pipe_1.outputs['Outlet_Air_Temperature'].connect_to( >>> other=pipe2.intputs['Inlet_Air_Temperature'] >>> )
- Parameters
other (TypeVariable) – The other object.
- Raises
TypeError – When trying to connect to anything other than a
TrnsysModel
.