MotoHawk DateTime OBDFault Custom Field Default

This block overrides the 'Initial Value' specified in a DateTime OBDFault Custom Field Definition block. If this block is not used, the custom field will inherit the 'Initial Value' from the DateTime OBDFault Custom Field Definition block.

The Field Name must match a OBD Custom Field name that is present in the application. The data type of the Default value must match the Data Type of the original Custom Field definition.

The 'Definition File' can specify the defaults for a number of fields, or can be used for a single field.

Block ID

DateTime OBDFault Custom Field Default

Library

motohawk_datetime_lib/Date/Time Blocks

Description

This block allows the user to override initial DateTime or TimeSpan values for specific DateTime OBD Custom Field Definition. Multiple instance of this block can be present in a model, however, a particular Custom Field-Fault pair can only be specified once in the application.

The override values are specified via a m-script that has a specific format:
deflts.customfields{1}.name = '[[Custom Field Name]]';
deflts.customfields{1}.fault_name = '[[Fault Name]]';
deflts.customfields{1}.default_value = [[New Default Value]];

The "default_value" field has a few rules. It has to be a structure and it must be a DateTime or a TimeSpan structure. The helper functions "motohawk_datetime_matlabtime2timespanstruct" and "motohawk_datetime_matlabtime2datestruct" help define the default_value structure.

Example of an override m-script content:
cfield_ctr = 0;
cfield_ctr = cfield_ctr + 1;
deflts.customfields{cfield_ctr}.name = 'DateTime_CustomField';
deflts.customfields{cfield_ctr}.fault_name = 'Fault1';
deflts.customfields{cfield_ctr}.default_value = motohawk_datetime_matlabtime2datestruct(now);

DateTime and TimeSpan structures are described in the table below:

Format Field Required Datatype Description
TimeSpan days yes int32 Number of days in the TimeSpan.
hours no int8 Number of hours in the TimeSpan.
minutes no int8 Number of minutes in the TimeSpan.
seconds no int8 Number of seconds in the TimeSpan.
microseconds no int32 Number of microseconds in the TimeSpan.
DateTime years yes uint16 Year of the DateTime
month no uint8 Month of the DateTime
day no uint8 Day of the DateTime
hour no uint8 Hour of the DateTime
minute no uint8 Minute of the DateTime
second no uint8 Second of the DateTime
microsecond no uint32 Microsecond of the DateTime

Block Parameters

Parameter Field Values Comments/Description
Definition File String The expression that specifies the default value to fault mapping