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

3 次查看(过去 30 天)
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

回答(1 个)

Alex Reilly
Alex Reilly 2019-11-13
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.

类别

Help CenterFile Exchange 中查找有关 Variable Initialization 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by