Clear Filters
Clear Filters

How can I use custom constraints for fxpopt?

2 views (last 30 days)
I am trying to use fxpopt with custom constraints and I cannot figure out how to do it. I am trying to have optimization be based on an SNR calculation and use that for behavioral constraint verification. I can see the addTolearnce API but that is not what I am trying to do. Is there a way to do what I am looking for?

Accepted Answer

MathWorks Fixed Point Team
fxpopt workflow allows user to automatically assign fixed-point data types
on a system by trying a basic trial and error loop. In the context of fxpopt
trial and error is based on the concept of behavioral constraint that the user
can utilize to declare a sense of "acceptable behavior" of the system.
Currently fxpopt offers two main ways to declare behavioral constraints:
1. Tolerance based simulation comparisons to a golden reference state of
2. Simulation based assertion checks
The first method can be leveraged using the addTolerance API that is part of the
fxpopt workflow. This will allow users to declare an envelope of passing behavior
that will be defined compared to the original state of the model. For example if
a user declares a tolerance of absolute tolerance of 1 then an acceptable behavior
will be +- 1 compared to the initial state of the model.
Secondly, a user might utilize any of the Model Verification library blocks to author
different verification expressions. Once placed in the model and active, the model
verification blocks will be interpreted as behavioral constraints by the fxpopt infrastructure
and hence they will be included in the behavioral constraints set.
fxpopt workflow will not process if none of the above methods are used for behavioral constraints.
One may use a combination of the two.
In order to author SNR or other custom metrics, one may choose the second route of authoring
behavioral constraints, utilizing model verification blocks. By doing so we can create a
"measurement system" that calculates SNR as a signal within Simulink and we can safeguard
for its values with the use of a static range check block during the simulation. If the values
that are being calculated during simulation are outside the bounds that are acceptable, fxpopt will
understand that the model is not passing the behavioral constraints.
In the attached two examples we see different ways of approaching this using different method of
calculating either an approximation to "noise floor" and guarding against an increase of values there
or calculating SNR difference between the original model VS the quantized one. In both cases the second way of declaring behavioral constraints is used.
Helpful links
Model Verification library in Simulink:
I hope this is helpful

More Answers (0)

Products


Release

R2020a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!