allowModelReferenceDiscreteSampleTimeInheritanceImpl

Model reference sample time inheritance status for discrete sample times

Syntax

flag = allowModelReferenceDiscreteSampleTimeInheritanceImpl(obj)

Description

flag = allowModelReferenceDiscreteSampleTimeInheritanceImpl(obj) specifies whether a System object™ in a reference model is allowed to inherit the sample time of the parent model. Use this method only for System objects that use discrete sample time and are intended for inclusion in Simulink® via the MATLAB System block.

During model compilation, Simulink sets the model reference sample time inheritance before the System object setupImpl method is called.

Note

You must set Access = protected for this method.

Input Arguments

obj

System object handle

Output Arguments

flag

Flag indicating whether model reference discrete sample time inheritance is allowed for the MATLAB System block containing the System object, returned as a logical value.

The default value for this argument depends on the number of inputs to the System object. To use the default value, you do not need to include this method in your System object class definition file.

Number of System object InputsDefault Value and Override Effects
No inputs

Default: false — Model reference discrete sample time inheritance is not allowed.

If your System object uses discrete sample time in its algorithm, override the default by returning true from allowModelReferenceDiscreteSampleTimeInheritanceImpl.

One or more inputs

Default: true — If no other Simulink constraint prevents it, model reference sample time inheritance is allowed.

If your System object does not use sample time in its algorithm, override the default by returning false from allowModelReferenceDiscreteSampleTimeInheritanceImpl.

Examples

expand all

For a System object that has one or more inputs, to disallow model reference discrete sample time inheritance for that object, set the sample time inheritance to false. Include this code in your class definition file for the object.

methods (Access = protected)
   function flag = allowModelReferenceDiscreteSampleTimeInheritanceImpl(~)
      flag = false;
   end
end
Was this topic helpful?