Can I optimise a dynamic model where the objective function is equal just a variable?

5 views (last 30 days)
I am trying to run an optimisation in Matlab. I have modelled a hydrogen refuelling station. The model basically consists of one tank and the car tank, and the hydrogen flows from the tank to the car.
This is a dynamic model where the pressure and mass inside each tanks change with time. For the tank in the station the mass and pressure decreases and for the car increases until it gets a 100% full.
My objective is to find the minimum size of the tank of the station (i.e. its volume) that achieves a filling of 100% in the car.
I have several problems:
1. I don’t know if I can do this with an optimisation tool, as my function to minimise in reality is just a volume. (so I don’t know if there is any other way I can write it)
2. the constraint will be that the % =100 , however to be able to know the this, the model has to be run, therefore I don’t know how to write this in a constraint form
Thank you

Accepted Answer

Are Mjaavatten
Are Mjaavatten on 21 Mar 2018
What do you mean by 100% full? Is this defined by the hydrogen mass in the car or by the pressure?
Either way, you will need to run the dynamic model for the whole filling period to know how the temperature and pressure in both tanks change with time.
Create a function
deltafill = fill(tankvol)
This function shuold take the station tank volume as input and return the final filling percent minus 100 as output. Obviously, it must call your simulator to achieve this.
Then solve fill(tankvol) = 0, e.g by fzero:
minvol = fzero(@fill,v0)
If you want your model to be accurate, heat transfer between tanks and ambient is essential. You should also take into account that hydrogen at high pressures does not behave as an ideal gas. You may want to take a look at Thermo: Compressible real gas tool in the Mathworks file exchange.
Of course, if you are allowed to make the unrealistic assumptions of ideal gas and that the final temperatures in both tanks are given, then the problem reduces to a linear relationship between station tank volume and the number of moles in the car. This may be useful as a reality check on the more complex simulation results, though.
  5 Comments
Are Mjaavatten
Are Mjaavatten on 22 Mar 2018
This is a common filling procedure, so I might have guessed. However, the problem is no longer so clear-cut, as there are many options as to which variables are known and which to calculate. I suggest that you extend your simulator to handle the multi-tank situation and play around with it a bit. Then try to figure out the precise problems that you want to solve. The simulator can form the basis for formulating a host of problems, depending on the situation:
For design, you may want to determine tank volumes or piping and valve sizes. During operation, you may want to minimize the filling time or the compressor work for refilling the station tanks. And so on.
You may end up with a nonlinear equation system or an optimization problem in several variables. These will normally require the Optimization Toolbox.
CB5
CB5 on 22 Mar 2018
I have a model that works for more than one tank and it works as a cascade system.
The way it works is that I set up the volumes and pressures before run it.
For example for two tanks, I have tried to do a system where : function input is volume and f (1) = V(1) - V(2) f(2) = car% - 100 using fsolve function
However, it tells me that there is no solution, do you know how else I can do it ?

Sign in to comment.

More Answers (0)

Categories

Find more on Thermal Analysis 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!