フィルターのクリア

how to call the service time of an entity service

3 ビュー (過去 30 日間)
Laila El Warraqi
Laila El Warraqi 2022 年 11 月 21 日
編集済み: Rishav 2023 年 9 月 5 日
I have a simulink program with different entity SERVERs where I specified the service time value (e.g. 10).
Is there a way to call that service time value without inserting a constant equal to 10?
So a way that once I call service time value of entity server 1 (through a simulink function), it shows automatically the value 10?
Thank you

回答 (1 件)

Rishav
Rishav 2023 年 9 月 5 日
編集済み: Rishav 2023 年 9 月 5 日
Hi Laila,
It is possible to retrieve the service time value of an entity server in Simulink without explicitly inserting a constant value. You can acheive this by using Simulink's Parameter Objects feature.
Here's an approach:
  1. Open the Simulink file and locate the entity server block in which you want to work on.
  2. Double click on ther entity server block to open its block parameters.
  3. In the block parameters dialog, find the Service Time parameter and set it to a default value (e.g., 10).
  4. Right-click on the entity server block and select Create > Data > Parameter Object.
  5. In the Parameter Object dialog, give a name to the parameter object (e.g., "ServiceTime").
  6. In the Parameter Object dialog, click on the Add button and select the Service Time parameter from the entity server block.
  7. Click OK to create the parameter object.
  8. In your Simulink model, add a Simulink Function block where you want to retrieve the service time value.
  9. Inside the Simulink Function or MATLAB Function block, use the get_param function to retrieve the value of the Service Time parameter from the parameter object.
serviceTime = get_param('ServiceTime', 'Value');
This 'serviceTime' variable will reflect the current value of service time parameter of the entity server block.

カテゴリ

Help Center および File ExchangeSimulink Functions についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by