Оптимизируйте типы данных системы
В этом примере показано, как оптимизировать типы данных, используемые системой на основе заданных допусков.
Чтобы начаться, откройте систему, для которой вы хотите оптимизировать типы данных.
model = 'ex_auto_gain_controller'; sud = 'ex_auto_gain_controller/sud'; open_system(model)

Создайте fxpOptimizationOptions объект задать ограничения и допуски, чтобы удовлетворить вашим целям проекта. Установите UseParallel свойство fxpOptimizationOptions возразите против true запускать итерации оптимизации параллельно. Можно также задать размеры слова, чтобы позволить в проекте через AllowableWordLengths свойство.
opt = fxpOptimizationOptions('AllowableWordLengths', 10:24, 'UseParallel', true)
opt =
fxpOptimizationOptions with properties:
MaxIterations: 50
MaxTime: 600
Patience: 10
Verbosity: High
AllowableWordLengths: [10 11 12 13 14 15 16 17 18 19 20 21 22 23 24]
UseParallel: 1
Advanced Options
AdvancedOptions: [1×1 struct]
Используйте addTolerance метод, чтобы задать допуски к различиям между исходным поведением системы и поведением с помощью оптимизированных типов данных с фиксированной точкой.
tol = 10e-2; addTolerance(opt, [model '/output_signal'], 1, 'AbsTol', tol);
Используйте fxpopt функционируйте, чтобы запустить оптимизацию. Программное обеспечение анализирует области значений объектов в вашей системе в соответствии с проектом и ограничениями, заданными в fxpOptimizationOptions объект применить типы гетерогенных данных к вашей системе при минимизации общей битной ширины.
result = fxpopt(model, sud, opt);
Starting parallel pool (parpool) using the 'local' profile ... Connected to the parallel pool (number of workers: 4). + Preprocessing + Modeling the optimization problem - Constructing decision variables + Running the optimization solver Analyzing and transferring files to the workers ...done. - Evaluating new solution: cost 180, does not meet the tolerances. - Evaluating new solution: cost 198, does not meet the tolerances. - Evaluating new solution: cost 216, does not meet the tolerances. - Evaluating new solution: cost 234, does not meet the tolerances. - Evaluating new solution: cost 252, does not meet the tolerances. - Evaluating new solution: cost 270, does not meet the tolerances. - Evaluating new solution: cost 288, does not meet the tolerances. - Evaluating new solution: cost 306, meets the tolerances. - Evaluating new solution: cost 324, meets the tolerances. - Evaluating new solution: cost 342, meets the tolerances. - Evaluating new solution: cost 360, meets the tolerances. - Evaluating new solution: cost 378, meets the tolerances. - Evaluating new solution: cost 396, meets the tolerances. - Evaluating new solution: cost 414, meets the tolerances. - Evaluating new solution: cost 432, meets the tolerances. - Updated best found solution, cost: 306 - Evaluating new solution: cost 304, meets the tolerances. - Evaluating new solution: cost 304, meets the tolerances. - Evaluating new solution: cost 301, meets the tolerances. - Evaluating new solution: cost 305, does not meet the tolerances. - Evaluating new solution: cost 305, meets the tolerances. - Evaluating new solution: cost 301, meets the tolerances. - Evaluating new solution: cost 299, meets the tolerances. - Evaluating new solution: cost 299, meets the tolerances. - Evaluating new solution: cost 296, meets the tolerances. - Evaluating new solution: cost 299, meets the tolerances. - Evaluating new solution: cost 291, meets the tolerances. - Evaluating new solution: cost 296, does not meet the tolerances. - Evaluating new solution: cost 299, meets the tolerances. - Evaluating new solution: cost 300, meets the tolerances. - Evaluating new solution: cost 296, does not meet the tolerances. - Evaluating new solution: cost 301, meets the tolerances. - Evaluating new solution: cost 303, meets the tolerances. - Evaluating new solution: cost 299, meets the tolerances. - Evaluating new solution: cost 304, does not meet the tolerances. - Evaluating new solution: cost 300, meets the tolerances. - Updated best found solution, cost: 304 - Updated best found solution, cost: 301 - Updated best found solution, cost: 299 - Updated best found solution, cost: 296 - Updated best found solution, cost: 291 - Evaluating new solution: cost 280, meets the tolerances. - Evaluating new solution: cost 287, meets the tolerances. - Evaluating new solution: cost 288, does not meet the tolerances. - Evaluating new solution: cost 287, does not meet the tolerances. - Evaluating new solution: cost 283, meets the tolerances. - Evaluating new solution: cost 283, does not meet the tolerances. - Evaluating new solution: cost 262, does not meet the tolerances. - Evaluating new solution: cost 283, does not meet the tolerances. - Evaluating new solution: cost 282, does not meet the tolerances. - Evaluating new solution: cost 288, meets the tolerances. - Evaluating new solution: cost 289, meets the tolerances. - Evaluating new solution: cost 288, meets the tolerances. - Evaluating new solution: cost 290, meets the tolerances. - Evaluating new solution: cost 281, does not meet the tolerances. - Evaluating new solution: cost 286, does not meet the tolerances. - Evaluating new solution: cost 287, meets the tolerances. - Evaluating new solution: cost 284, meets the tolerances. - Evaluating new solution: cost 282, meets the tolerances. - Evaluating new solution: cost 285, does not meet the tolerances. - Evaluating new solution: cost 277, meets the tolerances. - Updated best found solution, cost: 280 - Updated best found solution, cost: 277 - Evaluating new solution: cost 272, meets the tolerances. - Evaluating new solution: cost 266, meets the tolerances. - Evaluating new solution: cost 269, meets the tolerances. - Evaluating new solution: cost 271, does not meet the tolerances. - Evaluating new solution: cost 274, meets the tolerances. - Evaluating new solution: cost 275, meets the tolerances. - Evaluating new solution: cost 274, does not meet the tolerances. - Evaluating new solution: cost 275, meets the tolerances. - Evaluating new solution: cost 276, does not meet the tolerances. - Evaluating new solution: cost 271, meets the tolerances. - Evaluating new solution: cost 267, meets the tolerances. - Evaluating new solution: cost 270, meets the tolerances. - Evaluating new solution: cost 272, meets the tolerances. - Evaluating new solution: cost 264, does not meet the tolerances. - Evaluating new solution: cost 265, does not meet the tolerances. - Evaluating new solution: cost 269, meets the tolerances. - Evaluating new solution: cost 270, meets the tolerances. - Evaluating new solution: cost 269, meets the tolerances. - Evaluating new solution: cost 276, meets the tolerances. - Evaluating new solution: cost 274, meets the tolerances. - Updated best found solution, cost: 272 - Updated best found solution, cost: 266 + Optimization has finished. - Neighborhood search complete. - Maximum number of iterations completed. + Fixed-point implementation that met the tolerances found. - Total cost: 266 - Maximum absolute difference: 0.087035 - Use the explore method of the result to explore the implementation.

Используйте explore метод OptimizationResult объект, result, запустить Инспектора Данных моделирования и исследовать проект, содержащий самое маленькое общее количество битов при поддержании числовых допусков, заданных в opt объект.
explore(result);
Можно вернуться модель назад к ее исходному состоянию с помощью revert метод OptimizationResult объект.
revert(result);
model — Модель, содержащая систему в соответствии с проектом, sudИмя модели, содержащей систему, которую вы хотите оптимизировать.
Типы данных: char
sud — Модель или подсистема, типы данных которой вы хотите оптимизироватьМодель или подсистема, типы данных которой вы хотите оптимизировать в виде вектора символов, содержащего путь к системе.
Типы данных: char
options — Дополнительные опции оптимизацииfxpOptimizationOptions объектfxpOptimizationOptions объект, задающий дополнительные опции использовать во время процесса оптимизации типа данных.
result — Объект, содержащий оптимизированный проектOptimizationResult объектРезультат оптимизации, возвращенной как OptimizationResult объект. Используйте explore метод объекта открыть Инспектора Данных моделирования и просмотреть поведение оптимизированной системы. Можно также исследовать другие решения, найденные во время оптимизации, которая может или не может соответствовать ограничениям, заданным в fxpOptimizationOptions объект, options.
У вас есть модифицированная версия этого примера. Вы хотите открыть этот пример со своими редактированиями?
1. Если смысл перевода понятен, то лучше оставьте как есть и не придирайтесь к словам, синонимам и тому подобному. О вкусах не спорим.
2. Не дополняйте перевод комментариями “от себя”. В исправлении не должно появляться дополнительных смыслов и комментариев, отсутствующих в оригинале. Такие правки не получится интегрировать в алгоритме автоматического перевода.
3. Сохраняйте структуру оригинального текста - например, не разбивайте одно предложение на два.
4. Не имеет смысла однотипное исправление перевода какого-то термина во всех предложениях. Исправляйте только в одном месте. Когда Вашу правку одобрят, это исправление будет алгоритмически распространено и на другие части документации.
5. По иным вопросам, например если надо исправить заблокированное для перевода слово, обратитесь к редакторам через форму технической поддержки.