# CTime

## `CTime` (FB)

FUNCTION\_BLOCK CTime

### Short description

> Conversion of a time input (UDINT) into a time output (TIME). The scaling for the time input can be selected. Automatic calculation of min/max limits for the input as well as monitoring of the input.

### Representation

<figure><img src="/files/2b4931ab9ad85fa91ee1d5c269d2f2c024ab72ac" alt=""><figcaption></figcaption></figure>

### Interfaces

#### Inputs

#### Outputs

| Name         | Data type | Value range      | Initial value | Function                                      |
| ------------ | --------- | ---------------- | ------------- | --------------------------------------------- |
| *tOutTime*   | TIME      | 0 … 4294967295ms |               | Time specification in TIME format             |
| *udiMinVisu* | UDINT     |                  |               | Display of **tMinTime** for the visualization |
| *udiMaxVisu* | UDINT     |                  |               | Display of **tMaxTime** for the visualization |

#### Setpoints / parameters

| Name           | Data type | Value range          | Initial value | Function                                                              |
| -------------- | --------- | -------------------- | ------------- | --------------------------------------------------------------------- |
| **udiTime**    | UDINT     | 0 … 4294967295       |               | Time input (absolute limits: 0..7 days) depending on scaling          |
| **eTimeScale** | eTime     | Second, Minute, Hour | eTime.Second  | Definition of the scaling of the time input (seconds, minutes, hours) |
| **tMinTime**   | TIME      | 0 … 4294967295ms     | 0s            | Lower limit for the time input **udiTime**                            |
| **tMaxTime**   | TIME      | 0 … 4294967295ms     | 2h            | Upper limit for the time input **udiTime**                            |

### Function description

#### General

This function block is used to convert a time input **udiTime** into a time output *tOutTime*.\
The scaling for the time input **udiTime** is determined via the setpoint and parameters **eTimeScale**.\
The time input is absolutely limited to a value range of 0 … 7 days.\
The time input is limited by a lower limit **tMinTime** and an upper limit **tMaxTime** both limits are also subject to scaling.\
The time output *tOutTime* is accordingly also limited to the range **tMinTime** - **tMaxTime** .\
If the lower limit exceeds **tMinTime** the upper limit **tMaxTime**, the lower limit **tMinTime** is reduced to the upper limit.\
This block can, for example, be used for input in a visualization.

### Visualization

Matching visualization element from the HVACV Visu Library: **CTime** and **CTime\_single\_input**

#### Representation

<figure><img src="/files/492684a928c2b460785b11565a1b4c6c50398515" alt=""><figcaption></figcaption></figure>

#### Interfaces Visu-Element

<table><thead><tr><th>Name</th><th>Data type</th><th>Type</th><th width="150.7777099609375">Initial value</th><th>Function</th></tr></thead><tbody><tr><td><strong>FB_CTime</strong></td><td>CTime</td><td>VAR_IN_OUT</td><td></td><td>Enter FB instance CTime here e.g. PRG.CTime</td></tr><tr><td><strong>sDialogTitle</strong></td><td>STRING</td><td>VAR_INPUT</td><td></td><td>Enter the title in string format e.g.: 'Input room temperature' - appears on the numpad during input.</td></tr><tr><td><strong>iFieldSizeL</strong></td><td>INT</td><td>VAR_INPUT</td><td>0</td><td>Field expands by the number of entered pixels to the left. Required to display long numbers or units.</td></tr><tr><td><strong>iFieldSizeR</strong></td><td>INT</td><td>VAR_INPUT</td><td>0</td><td>Field expands by the number of entered pixels to the right. Required to display long numbers or units.</td></tr></tbody></table>

The unit second 's', minute 'm' or hour 'h' is automatically adjusted via the setting in FB CTime. The MIN and MAX input limits are also automatically generated by the FB and adjusted in the visual element. Can be changed at runtime!&#x20;

{% hint style="info" %}
Note: VAR\_IN\_OUT interfaces must be assigned, VAR\_INPUT are optional.
{% endhint %}

The visualization element **CTime\_single\_input** works like **CTime** however all inputs must be entered separately via the interfaces. Thus you can also use this visualization element without your CTime block.

#### Interfaces Visu-Element CTime\_single\_input

| Name             | Data type  | Type         | Initial value | Function                                                                                               |
| ---------------- | ---------- | ------------ | ------------- | ------------------------------------------------------------------------------------------------------ |
| **udiTime**      | UDINT      | VAR\_IN\_OUT |               | Enter the UDINT variable here.                                                                         |
| **eTimeScale**   | HVAC.eTime | VAR\_INPUT   |               | Here the enum eTimeScale can be entered. Displays whether second, minute or hour.                      |
| **udiMinVisu**   | UDINT      | VAR\_INPUT   | 0             | Here the MIN input limit can be entered. Inputs below this will not be accepted via the visualization. |
| **udiMaxVisu**   | UDINT      | VAR\_INPUT   | 7200          | Here the MAX input limit can be entered. Inputs above this will not be accepted via the visualization. |
| **sDialogTitle** | STRING     | VAR\_INPUT   |               | Enter the title in string format e.g.: 'Input post-run time' - appears on the numpad during input.     |
| **iFieldSizeL**  | INT        | VAR\_INPUT   | 0             | Field expands by the number of entered pixels to the left. Required to display long numbers or units.  |
| **iFieldSizeR**  | INT        | VAR\_INPUT   | 0             | Field expands by the number of entered pixels to the right. Required to display long numbers or units. |

### CODESYS

InOut:

| Scope       | Name         | Type    | Initial        |
| ----------- | ------------ | ------- | -------------- |
| Input Const | `tMaxTime`   | `TIME`  | TIME#120m0s0ms |
| Input Const | `tMinTime`   | `TIME`  | TIME#0ms       |
| Input Const | `eTimeScale` | eTime   | eTime.Second   |
| Input Const | `udiTime`    | `UDINT` |                |
| Output      | `tOutTime`   | `TIME`  |                |
| Output      | `udiMinVisu` | `UDINT` |                |
| Output      | `udiMaxVisu` | `UDINT` |                |


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://support.powerio.com/hub/codesys-hvac/en/hvac-library/functionblocks/general/ctime.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
