Delta Time

This MotoHawk™ block returns the delta time (change in time) since the last time this block was called.

Block ID

motohawk_delta_time

Library

MotoHawk_lib/Extra Development Blocks

Description

This block provides the delta time since the last time this block was called. The output will either be in seconds or microseconds depending on the mode selected.

Note that the block runs with inherited sample-time in the Simulink environment, no matter what sample-time is entered. It is legal to insert a 'wrong' value into the Sample Time (a value that doesn't actually represent the number of seconds between executions), and the block puts out that value.

Block Parameters

Parameter Field Values Comments/Description
Sample Time Numeric (Seconds) If a zero or negative 'Sample Time' is entered, the block will calculate the delta time, and the block will output 'Initial Value' the first time it is called. Using a constant sample time is more efficient than an inherited sample time, because it does not generate extra code and RAM to dynamically calculate the delta time. If a positive 'Sample Time' is entered, this constant value is given as the output each time. In this case, the 'Initial Value' parameter is unused. The sample time parameter will be in seconds no matter which mode is selected.
Initial Value Numeric Initial value expressed when delta time is called for (default is 0).
Output Mode Seconds(double) The output will be in seconds and the data type of the signal will be a double.
Seconds(single) The output will be in seconds and the data type of the signal will be a single.
Microseconds(uint32) The output will be in microseconds and the data type of the signal will be a unit32.