Common Event Trigger

This MotoHawk™ block triggers a Simulink Function-Call subsystem based upon the specified event via the tasking kernel of the target OS.

Block ID

Common Event Trigger

Library

motohawk_tasking_lib/Triggers

Description

This MotoHawk™ block allows work to be executed in response to some common MotoHawk™ events. In most cases the work is assigned to execute within a developer specified task. An event that does not offer an option to specify the task executes within an implied task. IDLE is such an event. It executes in the task that has been designated as the idle task via a block like the ControlCore OS Definition block.

The block aims to emulate much of the functionality of the legacy Function Trigger block, but without being constrained by a generic event needing to execute within a specific task. This block also offers the flexibility to specify periodic interval triggers that are any multiple of the target OS's interval timer (RTI) instead of just supporting a few pre-defined intervals or alternatively allow a specific time interval to be specified.

A MotoHawk help topic is available that provides further detail on the operation of triggers.

This block can be used without enabling Advanced Target OS Configuration. In this situation the Target Definition will create a default set of tasks. Events that want to target one of these default tasks can do so by referencing the appropriate implicit task name that is defined here.

The MotoHawk help topic Understanding ControlCore Task Scheduling is still applicable. The key difference between that behavior description and this block relates to the option to be able to specify the task that will execute the event.

The execution performance of a periodic trigger group (RTIx_PERIODIC or TIME_PERIODIC) can be measured by including the Global Periodic Trigger Slip and Execution Metric Definition block in the model. These performance metrics can be read by the application and/or exposed to instrumentation. This block, or its explicit alternative, also allow the timeliness of execution of the trigger group to be monitored.

Block Parameters

Parameter Field Values Comments/Description
Trigger Name Single quote enclosed alpha-numeric text This text will be appended to code generated function name. This is useful when using a difference tool to compare the difference from one build to another. If this is left as an empty cell the appended value will be generated at build time, and can change from build to build.
Target OS Drop down Selects the OS that the block is expected to be used with. The block's mask will only show attributes appropriate for the selected OS. This block will not function in the model if the OS selected via the Target Definition block is not available as an option of this drop down. For instance, this block is not supported by Classic ControlCore.
Event The event that will execute the trigger.
  ANGLE_INTERVAL Trigger occurs approximately every Angle Interval crank angle degrees relative to engine TDC#1. So an angle interval of 180 would execute when the encoder observed the angles of 0, 180, 360 and 540 degAfTDC#1. The execution may resolve to a physical encoder tooth or use interpolation depending upon the capability of the module being used. A Flexible Encoder implementation will use interpolation.
ANGLE_HIRES Trigger occurs each time an encoder tooth is detected. Whether missing teeth will cause the trigger to fire is dependent upon the encoder implementation. Flexible Encoder type encoder systems don't detect missing teeth, but Legacy Encoder implementations typically do detect missing teeth.
ANGLE_MID_TDC Trigger occurs each time the encoder observes the mid way point of a firing engine TDC angle (as defined by the relevant Encoder System). Thus a two cylinder with TDCs of 0 degAfTDC#1 and 360 degAfTDC#1 would generate events at 180 degAfTDC#1 and 540 degAfTDC#1. The execution may resolve to a physical encoder tooth or use interpolation depending upon the capability of the module being used. A Flexible Encoder implementation will use interpolation.
ANGLE_TDC Trigger occurs each time the encoder observes an engine firing TDC angle (as defined by the relevant Encoder System). The execution may resolve to a physical encoder tooth or use interpolation depending upon the capability of the module being used. A Flexible Encoder implementation will use interpolation.
ANGLE_TDC1 Trigger occurs each time firing engine TDC#1 is observed. The execution may resolve to a physical encoder tooth or use interpolation depending upon the capability of the module being used. A Flexible Encoder implementation will use interpolation.
RTIx_PERIODIC Trigger occurs periodically at a rate defined by the RTI and the Multiplier value.
TIME_PERIODIC Trigger occurs periodically at a rate defined by the specified Period value.
STARTUP Triggers when the application is starting. Startup results when the module powers up when the key is applied or because of a module reset. Triggers of this type will execute to completion before any other events will execute.

Triggers of this type implicitly execute in the task designated for Idle execution (thus there is no option to select the executing task), but are able to execute to completion because the Idle task is the only active task during STARTUP execution.
IDLE Triggers when the target OS detects an idle condition. That is there is no work of any priority pending.
USER_EVENT Triggers when the named event is signaled and the task referenced by this trigger has execution priority.
Multiplier Numeric (Integer) Defines the periodic rate as a multiple of the target OS's interval timer (RTI). The Trigger Definition block or an OS Definition block like the ControlCore OS Definition block are used to set the RTI interval.

Only visible and applicable when the RTIx_PERIODIC event is in use.
Period Numeric (ms) Defines the periodic rate at which the trigger will execute. Typically the period should be a multiple of the target OS's interval timer (RTI). An error may result if a value that is not a multiple of the interval timer is used. The Trigger Definition block or an OS Definition block like the ControlCore OS Definition block are used to set the RTI interval.

Only visible and applicable when the TIME_PERIODIC event is in use.
Angle Interval Dropdown Defines the angle interval used by the ANGLE_INTERVAL event.

Only visible and applicable when the ANGLE_INTERVAL event is in use.
User Event Name Single quote enclosed alpha-numeric text that is c-legal Defines the name of the USER_EVENT that when signaled will cause this trigger to execute.

Only visible and applicable when the USER_EVENT event is in use.
Execution Order within Task Numeric (Integer) More than one trigger may be placed in a model that is driven by the same event. Use the Execution Order within Task attribute to define the execution order of these triggers relative to one another. Triggers with the same Event and task will be grouped and execute from the lowest Execution Order within Task value to the highest.

The Control Core Tasking help topic has some further information.
Execute within this task Single quote enclosed alpha-numeric text The name of the Task Definition block that defines the task that this trigger will execute its work in. Will only be visible if the Event does not implicitly define the task where the execution is to take place.
This trigger is inside another triggered subsystem Check Box (enable) Enable if this trigger is inside another triggered subsystem. The trigger attempts to simulate the block inside of another triggered rate when the rate is periodic. The trigger from this block may occur in bursts, synchronized to the outer rate, while simulating, but will perform as expected on the target. Do not enable on top-level triggers because this will prevent the block from simulating.
Trigger even when containing subsystem is disabled Check Box (enable) If this trigger is used inside of a containing subsystem then normally the triggered subsystem will pause and resume based on the enable/disable status of the containing subsystem. Checking this causes triggers to occur even while the parent is disabled. Note that this feature will not simulate, but will execute correctly on the target.

Only visible when the trigger is inside another triggered subsystem attribute is checked and the trigger supports the pause and resume behavior based upon the condition of the containing sub-system. STARTUP for example never considers the condition of the containing sub-system and behaves as if this checkbox was available and checked.
Calculate CPU utilization for trigger Check Box (enable) The underlying OS will calculate CPU utilization for the trigger when checked. This operates in a similar vane to the task CPU utilization except it only applies while the content of the trigger is executing. This metrics is useful for determing the volume of work being executed by the trigger as the utilization measure will take into account when the trigger is pre-empted by another thread.

Each trigger that enables this feature will consume some CPU and some RAM.

The Get Trigger CPU block can be used by the application model to recover this data.
Expose CPU Utilization to Instrumentation Checkbox Check to have MotoHawk automatically expose the latest performance metric in a variable accessible to Instrumentation.
Read Access Level Dropdown Defines the access level of the automatically exposed CPU utilization metric.

Only visible when Expose CPU Utilization to Instrumentation is checked.
Instrumentation Group Single quote enclosed alphanumeric Defines the instrumentation group that will be associated to any execution metrics exposed to instrumentation.

Only visible when Expose CPU Utilization to Instrumentation is checked.