- Variable-Size Signal: Adjust your unprotected model parts to work with variable-size signals, ensuring that the protected model's inputs can adapt to different signal dimensions.
- Masked Subsystem: Implement a masked subsystem that wraps your protected model. The mask can provide an interface for input size configuration, managing the adaptation of signal dimensions internally.
- Multiple Protected Models: If the range of input sizes is known and limited, create different protected models for each specific input size. Use a MATLAB script to select and load the appropriate model based on the current input size.
- Wrapper Model: Develop a wrapper model that preprocesses the input signals, either by padding or truncating, to fit the protected model's expected input dimensions.
- For infrequent changes in configurations, you may recompile the model with new dimensions and re protect it each time the input size changes.
- Design your system to include Simulink Function blocks that are called with variable-size inputs. Ensure the function blocks are set up to handle variable-size signals.
- Custom S-Function: Write a custom S-function that handles variable-size inputs and adapts them for the protected model.
Changing the port dimensions of a "protected model" / Support of variable size signals
6 views (last 30 days)
Show older comments
Vladislav Staver
on 12 Jan 2024
Commented: Vladislav Staver
on 29 Jan 2024
Hello everyone,
I use the "Protected Models" feature to protect the contents of my model. However, this causes some difficulties. One of them is that the port dimensions of this "Protected Model" are defined when the model is created.
Unfortunately, this is critical in my case, as only 1 part of my model is protected. All inputs are outside the protected subsystem. This is because different configurations are possible. This means that I can have both [1,2,3] and [1,2,3,4,5,6] as inputs. This should change the dimension of the input port from 3 to 6. Is this somehow possible (if the model has already been created?)? Goal - to have only 1 model for all configurations!!!
I have tried to work with global variables, e.g. "InpDim". I have entered these in the "Port dimensions" field in the input block of my protected subsystem. However, if I change my global variable "InpDim" via Matlab Workspace, this does not really help if the model has already been created.
I don't want to work with placeholders (like -1 or 0) because the model is not suitable for that!!!
Do you happen to have any other ideas on how to get around working with placeholders? Of course, the content should be protected :)
Thank you very much!
0 Comments
Accepted Answer
UDAYA PEDDIRAJU
on 25 Jan 2024
Hello Vladislav,
The limitations you're experiencing with the port dimensions in a protected model are indeed a challenge when dealing with different configurations. Unfortunately, once a model is protected, its port dimensions cannot be directly altered. However, here are some targeted solutions to consider for your situation:
These workarounds can help you maintain a single model configuration while addressing the varying input size requirements. You can look at other features of protected model in the documentation: https://www.mathworks.com/help/simulink/slref/protected-models-for-model-reference.html.
More Answers (0)
See Also
Categories
Find more on Model Protection in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!