필터 지우기
필터 지우기

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 CenterFile Exchange에서 Simulink Functions에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by