MotoHawk:Blocks:Delta Time

From MotoHawk
Jump to navigationJump to search

Delta Time

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

Block ID

motohawk_delta_time

Library

MotoHawk_lib/Extra Development Blocks

Description

Delta Time.png

This block provides the delta time since the last time this block was called (in seconds).

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 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 output data type is the same as the 'Sample Time' parameter.
Initial Value Numeric Initial value expressed when delta time is called for (default is 0).