Custom set of TRNSYS Types that evaluate relational comparison between two inputs and output a logical signal based on the chosen operator.
Type3808-3813 allows simulating relational operators within TRNSYS models. These Types compare inputs using relational operations (==, !=, >, >=, <, <=) and output a logical TRUE (1) or FALSE (0). This facilitates condition checks, control logic, and system decision-making in your simulations.
Note
TRNSYS already provides relational operators EQ, NE, GT,GE,LT and LE gates within the Calculator Type, which are generally more optimized for simulation speed.
The advantage of this set of Types is that they do not require creating custom inputs or outputs within the Calculator, making them easier to integrate and more visually intuitive compared to code-based implementations.
- TRNSYS v.18
-
Clone the repo or download the source files:
git clone https://github.com/allachance/TRNSYS-RelationalOperators-Type3808-3813.git -
Copy the folders into your TRNSYS 18 installation directory, e.g.,
C:\TRNSYS18
| Name | Description | Options |
|---|---|---|
Input-x |
First input value | — |
Input-y |
Second input value | — |
| Name | Description | Options |
|---|---|---|
Output |
Logical result of the relational comparison | — |
-
Add the Component in TRNSYS Studio
-
Insert the desired operators into your simulation workspace:
Type3808:==Type3809:!=Type3810:>Type3811:>=Type3812:<Type3813:<=
-
-
Connect the two inputs value
Input xInput y
-
Use the Output
- The
Outputprovides a logical value (0or1) according to relational operation
- The
| Input X | Input Y | Output |
|---|---|---|
| 0 | 0 | 1 |
| 0 | 1 | 0 |
| 1 | 0 | 0 |
| 1 | 1 | 1 |
| Input X | Input Y | Output |
|---|---|---|
| 0 | 0 | 0 |
| 0 | 1 | 1 |
| 1 | 0 | 1 |
| 1 | 1 | 0 |
| Input X | Input Y | Output |
|---|---|---|
| 0 | 0 | 0 |
| 0 | 1 | 0 |
| 1 | 0 | 1 |
| 1 | 1 | 0 |
| Input X | Input Y | Output |
|---|---|---|
| 0 | 0 | 1 |
| 0 | 1 | 0 |
| 1 | 0 | 1 |
| 1 | 1 | 1 |
| Input X | Input Y | Output |
|---|---|---|
| 0 | 0 | 0 |
| 0 | 1 | 1 |
| 1 | 0 | 0 |
| 1 | 1 | 0 |
| Input X | Input Y | Output |
|---|---|---|
| 0 | 0 | 1 |
| 0 | 1 | 1 |
| 1 | 0 | 0 |
| 1 | 1 | 1 |