Filter löschen
Filter löschen

how to call the service time of an entity service

3 Ansichten (letzte 30 Tage)
Laila El Warraqi
Laila El Warraqi am 21 Nov. 2022
Bearbeitet: Rishav am 5 Sep. 2023
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

Antworten (1)

Rishav
Rishav am 5 Sep. 2023
Bearbeitet: Rishav am 5 Sep. 2023
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.

Kategorien

Mehr zu Simulink Functions finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by