Тёмный

Effectively Parameterize Your Simulink Models 

MATLAB
Подписаться 529 тыс.
Просмотров 10 тыс.
50% 1

Have you ever picked up someone else’s model only to discover that all of the model parameters were hardcoded. If you wanted to change the sample rate, you had to go on an Easter egg hunt to find everywhere the sample rate was defined and change it, one painful location at a time. Or, perhaps you tried to run someone else’s model only to discover that certain parameterized variables like “Fs” were undefined? Now you have to ask the model creator to send you another file for creating the model variables.
This video shows one way to minimize or eliminate such problems. This approach involves parameterization via model callbacks. A callback is MATLAB code called under certain model conditions, e.g. when the model opens. A common tendency for new Simulink users is to hardcode parameters directly into a given block, e.g. setting the gain to “3” instead of “k1”. Hardcoding, while handy at times, is both cumbersome and error prone as the model grows in scope. Many times the Simulink model creator uses a MATLAB script to assign variables used by the moel. This is a step in the right direction but then users of the model are still forced to recall which script to run and then actually run it as a manual step. Sometimes this initialization script was never shared and the user is left none the wiser.
This is where model callbacks come into play. Consolidate variable initialization into one script or function which attaches to the model as callback code. And depending on when and what conditions you want this script called, you place it in the appropriate callback slot. This makes model scaling and sharing far easier. The more we can avoid hardcoding and relying on human memory to kick off repeatable tasks, the better off we all are.
--------------------------------------------------------------------------------------------------------
Get a free product trial: goo.gl/ZHFb5u
Learn more about MATLAB: goo.gl/8QV7ZZ
Learn more about Simulink: goo.gl/nqnbLe
See what's new in MATLAB and Simulink: goo.gl/pgGtod
© 2023 The MathWorks, Inc. MATLAB and Simulink are registered trademarks of The MathWorks, Inc.
See www.mathworks.com/trademarks for a list of additional trademarks. Other product or brand names may be trademarks or registered trademarks of their respective holders.

Опубликовано:

 

17 окт 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 10   
Далее
Interacting with a Simulink Model from a Matlab Script
44:36
БАБУШКА ВСЁ ИСПОРТИЛА #shorts
00:24
Просмотров 602 тыс.
Simulink Basics - A Practical Look
57:44
Просмотров 149 тыс.
Everything You Need to Know About Control Theory
16:08
Просмотров 562 тыс.
HOW TRANSISTORS REMEMBER DATA
16:58
Просмотров 325 тыс.
КАК УСТРОЕН TCP/IP?
31:32
Просмотров 176 тыс.
Battery Modeling with Simulink
33:46
Просмотров 154 тыс.
Simulink Control Systems and PID,  Matlab R2020b
23:13
Просмотров 181 тыс.