Anybody here knows how to work with Matlab/Simulink?

idk

Well-Known Member
Joined
Feb 18, 2007
Messages
1,836
Location
SW Germany
Car(s)
Hyundai i30N Performance
If yes, I've got a question:

I've got a simulation to run about a system of containers (filled with a liquid).

There are parameters for how much fluid goes in, and how much goes out. So I can simulate the fluid level in the container. Well.. it works fine basically. But my problem is:

I have to consider that a container can be full --> meaning I have to set a upper saturation limit in the used integrator.

I was creating a library with just one model of such a container including all the In- and Out-Ports I need. So I can use the same block over and over again and just connect different In/Out Parameters.

Well but that doesn't work for the saturation limit because there is no In-Port for that. It's just an entry in its advanced attributes.

Any ideas?

matlab.jpg
 
Last edited:

Greatgraddage

Well-Known Member
Joined
Jun 7, 2004
Messages
1,200
Location
Ottawa, Canada
I don't really get your problem, do you want to be able to vary the container size? Have a reasonable amount of matlab time but no simulink so doubt I can be much help mind.
 

idk

Well-Known Member
Joined
Feb 18, 2007
Messages
1,836
Location
SW Germany
Car(s)
Hyundai i30N Performance
I guess if you don't know simulink you can't get the problem but I'll try to explain anyway.

I tried my task before with a simple model with just one container.

matlab.png


On the left you can see the In-Flow Signal. On the right you can see a plot of the fluid level. You can see that the level doesn't get any higher than 1.1 meters because the container is full at 1.1meter. This can be set in the advanced attributes shown at the lower right of the screenshot where it says "hb1".

Since I was now building a "universal" container model without any prespecified settings and limits I need to find a way to set this parameter individually. That model will then be included in a library to be used as often as needed and you just have to assign the individual values to each of the subsystems.

Here is a example where I used 2 such subsystems. The out-flow of container 1 is the in-flow of container 2. But the height of both containers is the same now in this specific example, because well, it's the same block used twice and of course the both have the upper saturation limit "hb1".

What you can see on the graphs is the fluid level of container 1 and 2


matlab2.png


When you double click on the big rectangles in the picture above the submodels they contain open and the submodel looks like that:

matlab3.png


Just compare the labels of the Out- and In-Ports and you can see how it is linked.

I also want to set the saturation limit individually (and not only the parameter "zulauf") every time I use such a block. And I don't find a way how to do that.

Sorry, It's hard to explain in a foreign language.
 
Last edited:
Top