Sample Time End of trail navigation bar

Table of Contents

Time

Outputs the current time measured using the selected time source.

Library

QUARC Targets/Sources/Time

MATLAB Command Line

Click to copy the following command line to the clipboard. Then paste it in the MATLAB Command Window:

qc_open_library('quarc_library/Sources/Time')

Description

Time

The Time block outputs the current time measured using the selected time source. If the Time source is set to Wall clock then a high resolution independent time source is used. On some targets, such as the Windows target, this time may have nanosecond resolution. The time reported will be the actual time as if the time were measured on a wall clock.

If the Time source is set to Process CPU time then the CPU time used by the model process is output instead. This CPU time includes the CPU of all the threads in the model, including any threads handling Simulink external mode. It includes both kernel mode and user mode CPU time for the process. The difference between the wall clock measurement and process CPU time is the amount of time the process has spent sleeping between sampling instants.

If the Time source is set to Thread CPU time then the CPU time used by the task is output instead. Which task is measured is determined by the sample time of the block. This CPU time includes both kernel mode and user mode CPU time for the task.

Input Ports

This block has no input ports.

Output Ports

This block has a single output port containing the current time in seconds.

Parameters and Dialog Box

Time

Time source

The time source for which to report the current time. If the Time source parameter is set to Wall clock then it measures actual time, comparable to the time of a clock on the wall, but with much higher resolution. If the Time source parameter is set to Process CPU time then it measures the combined kernel mode and user mode CPU time for the entire model. If the Time source is set to Thread CPU time then it measures the combined kernel mode and user mode CPU time for the currrent task. The task is determined by the sample time of the block.

Sample time

The sample time of the block. A sample time of 0 indicates that the block will be treated as a continuous time block. A positive sample time indicates that the block is a discrete time block with the given sample time.

A sample time of -1 indicates that the block inherits its sample time. Since this is a source block, only inherent the sample time when it is placed in a conditionally executed subsystem, like a Triggered Subsystem, Enabled Subsystem, Function Call Subsystem or in a referenced model.

To use the fundamental sampling time of the model, set the sample time to qc_get_step_size, which is a QUARC function that returns the fundamental sampling time of the model.

The default sample time is set to qc_get_step_size.

Targets

Target Name

Compatible*

Model Referencing

Comments

QUARC Win32 Target

Yes

Yes

QUARC Win64 Target

Yes

Yes

QUARC Linux Nvidia Target

Yes

Yes

QUARC Linux QBot Platform Target

Yes

Yes

QUARC Linux QCar 2 Target

Yes

Yes

QUARC Linux QDrone 2 Target

Yes

Yes

QUARC Linux Raspberry Pi 3 Target

Yes

Yes

QUARC Linux Raspberry Pi 4 Target

Yes

Yes

QUARC Linux RT ARMv7 Target

Yes

Yes

QUARC Linux x64 Target

Yes

Yes

QUARC Linux DuoVero Target

Yes

Yes

QUARC Linux DuoVero 2016 Target

Yes

Yes

QUARC Linux Verdex Target

Yes

Yes

QUARC QNX x86 Target

Yes

Yes

Last fully supported in QUARC 2018.

Rapid Simulation (RSIM) Target

Yes

Yes

S-Function Target

No

N/A

Old technology. Use model referencing instead.

Normal simulation

Yes

Yes

* Compatible means that the block can be compiled for the target.

 

navigation bar