Can Simscape handle Arrays or Vector Data? if so, how?

3 views (last 30 days)
To any Matlab Expert,
I have a problem, I am trying to model two bays connected via several orifices. However, I want the user of the model to be able to set the number of orifices by using a GUI.
My question is, is it possible to put data into an array or vector while using simscape?... I have tried feeding a vector to a PS to S block but it doesnt allow it, I have also tried to vectorize my own custom component block but, if I try to vectorize the variables or Nodes I am unable to build the block using ssc_build.
My goal is to place all orifice data into an array that the user can choose the size of; for example if he chooses "4" orifices then my array would have 4 dimensions for things like orifice location and radius, however I need to be able to send this data through simscape components like Pressure Source Blocks and Flow Sensors, etc.
I hope I am making sense, please help if possible!
Thanks, Kris

Answers (1)

Alex Reilly
Alex Reilly on 13 Nov 2019
I'm trying to accomplish a similar task. I was able to package an array of data like this:
outputs
myOut = {zeros(1,4), '1'} m:right
end
equations
myOut(1)= x;
myOut(2) =y;
etc
end
This puts alll my data on the same pin, but I'm stuck on 'decomposing' the pin on the next block that uses that data.

Categories

Find more on Variable Initialization 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!