Specify name, value, units, and other properties of Simulink dual-scaled parameter
Use Simulink.DualScaledParameter
so that you can define an
object that stores two scaled values of the same physical value.
For example, for temperature measurement, you can store a Fahrenheit scale and a
Celsius scale with conversion defined by a computation method that you provide. Given
one scaled value, the Simulink.DualScaledParameter
computes the other scaled value using the computation method.
A dual-scaled parameter inherits some properties from the Simulink.Parameter
class. A dual-scaled parameter has:
A calibration value. The value that you prefer to use.
A main value. The real-world value that Simulink® uses.
An internal stored integer value. The value that is used in the embedded code.
You can use Simulink.DualScaledParameter
objects in
your model for both simulation and code generation. The parameter computes the internal
value before code generation via the computation method. This offline computation
results in leaner generated code.
If you provide the calibration value, the parameter computes the main value using the computation method. This method can be a first-order rational function.
x
is the calibration value.
y
is the main value.
a
and b
are the coefficients of the
CalToMain compute numerator.
c
and d
are the coefficients of the
CalToMain compute denominator.
If you provide the calibration minimum and maximum values, the parameter computes minimum and maximum values of the main value. Simulink performs range checking of parameter values. The software alerts you when the parameter object value lies outside a range that corresponds to its specified minimum and maximum values and data type.
Create a Simulink.DualScaledParameter
object:
By using the Model Data Editor. Instead of creating a
Simulink.Parameter
object, create a
Simulink.DualScaledParameter
object. See Interact with a Model That Uses Workspace Variables.
By using the Model Explorer:
In the Model Hierarchy pane, select a workspace or data dictionary.
On the toolbar, select Add > Add Custom.
In the Model Explorer — Select Object dialog box, set
Object class to
Simulink.DualScaledParameter
.
By using the Simulink.DualScaledParameter
function,
described below.
DSParam = Simulink.DualScaledParameter
returns a
Simulink.DualScaledParameter
object with default property
values.
Simulink.Parameter
| AUTOSAR.DualScaledParameter
(AUTOSAR Blockset)