# Help Needed Urgently - Master Thesis Causing Pain

1. Feb 5, 2014

### Fjolvar

Hello,

I have been working on my master thesis topic and have been struggling to find a solution to a particular problem. I was hoping someone here could at least shed some light and point me in the right direction. My thesis topic is simulating natural gas networks and my task is to find an optimal way of operating a gas transmission network.

As for the math related part, I'm trying to determine an optimal way of increasing gas volume/pressure steadily while taking into account the minimum and maximum constraints. I'll share a picture of the graph to help get a visual.

Basically, I'm trying to find a mathematical relation I can program into a simulation model that satisfies a curve similar to "case 2" in the picture. You can see in the graph that this function/curve must be above the "necesssary" curve's maximum point and below the "maximal" curve's lowest point, or rather the minimum and maximum gas volume constraints.

Hopefully this post isn't too long winded. I was first trying to work with a basic quadratic formula, since there is always a known y-intercept or starting point. But I'm not sure how to manipulate this formula so that it takes into account these min/max constraints. Any help would be very much appreciated. If you have any questions or need further explanation just let me know please. I thank anyone who can help in advance.

#### Attached Files:

• ###### IMG_1523.jpg
File size:
35.4 KB
Views:
80
Last edited: Feb 5, 2014
2. Feb 5, 2014

### Stephen Tashi

To explain what "optimal" means, you need to explain what criteria make one way of increasing the gas volumne/pressure better or worse than another way.

If you just want a curve between the max and the min curves, you could form a set of data points by taking the average of the max and min curves and then fitting a polynomial function to that data. If the fit is tight enough, it will be between the max and min curves.

3. Feb 6, 2014

### Fjolvar

The only criteria is to try and maintain the least amount of change in the curve, because the more it fluctuates and becomes non-uniform or if it has very high peaks, means supplying more gas, which should be avoided because of costs.

Last edited: Feb 6, 2014
4. Feb 6, 2014

### Fjolvar

Any other ideas how to figure out what type of equation I could use to simply give a slight 'hill-like' function, not too steep, while considering maximum/minimum values? I tried simply using a quadratic form (y = ax^2 + bx + c ), but it seems rather complicated to me and maybe not possible to directly manipulate this equation to satisfy these max/min restrictions.

5. Feb 8, 2014

### Stephen Tashi

Your statement of the problem is unclear.

Are you trying to create a general algorithm whose input is a set of (x,y) data that defines two curves, or are you trying to solve a problem whose input only involves a single specific set of data defining two curves?

What you mean by "directly manipulate"? Do you know how to write the equation of a quadratic whose peak is at the given point (x_max, y_max) and which passes through another given point?

6. Feb 9, 2014

### Fjolvar

Hi Stephen. Basically I'm given the two functions (set of data points) marked as "necessary" and "maximal" in the picture, which can change and take on different values. I'm trying to figure out a way to produce a third function "case 2" (no data points given) which is always in between the values of the two other functions as shown, no matter what these other values might be. The case 2 function must steadily increase so it's only slightly greater than the maximum point of the "necessary" function and then steadily decrease. The total amount increase of the function must equal the total decrease.

My experience with writing quadratic equations is very rust unfortunately, so I'm not sure if this would be a possible approach or not. I hope you can help point me in the right direction.

Last edited: Feb 9, 2014
7. Feb 9, 2014

### Stephen Tashi

Be specific about the "givens" that you can provide for the quadratic function. For example, do you want a quadratic function that passes through the endpoints of the line segment from (x_0,y_min) to (x_1,y_min) and has a peak over the midpoint of that line segment at the point ( (x_0 + x_1)/2, y_max)?

8. Feb 9, 2014

### Fjolvar

I suppose a midpoint at point ( (x_0 + x_1)/2, y_max) would work in this situation, but my concern is if the maximum of the "necessary" function (lower boundary) occurs at a small x-value, would the 'case 2' function intersect the 'maximal' function (upper boundary). Because if the lower boundary function has a small x-value, then our 'case 2' function must have a very high slope and will increase significantly before it reaches point ( (x_0 + x_1)/2, y_max), therefore it may be optimal to have a maximum value at the same small x-value of the 'necessary' function and then slowly decrease until (x_1, y_min). This would result in an unsymmetrical curve though, so it couldn't be quadratic in that case. Does that make sense to you?

9. Feb 9, 2014

### Stephen Tashi

It makes sense that a quadratic that was symmetric about the midpoint of the interval might need a higher peak than one that was not symmetric about the midpoint in order to fit it between the min and max curves. But you still haven't explained what would make one feasible solution better than another one. You haven't specified any trade-off between having a low max vs being symmetrical vs being nearly flat. There are many curves that have these properties. How do you decide if one is better than another?

10. Feb 10, 2014

### Fjolvar

The symmetry of the curve is not important in my case, only the amount increased must equal the amount decreased, which would result in different rates slopes for the increasing/decreasing portions of the curve, unless the maximum was exactly at ( (x_0 + x_1)/2, y_max), however in my case that will rarely occur.

The other criteria as mentioned before is having a low maximum point. Since this is for an energy network, with stores energy vs time, it is optimal to use low energy values or x-values, as long as it's consistently above the minimum constraint.

The feed-in of energy results with an increase in stored energy and the feed-out with a decrease. These amounts must be equal over the full span of the x-axis.

Abrupt changes of the Y-axis or quick fluctuations of energy is also to be avoided as it may cause instability in the network, but this is less important than the above criteria.

Does that help any?

In addition: I was looking at the behavior of different functions with the form -ax^3+bx+c, but I couldn't get it to satisfy the constraints because there is a conflict when trying to change the local maximum point of the curve with the x_min to x_max range, which is reduced, and I need this range to be constant, where as the beginning point of the curve is the same as the end.

Before this I was thinking about two different sine functions, integrating the first from 0 to pi/2 and the other from pi/2 to pi, with the second sine function sharing a point with the maximum of the first, but with a different slope, although it seems we would have the same problem with the x_min to x_max range..

I feel like I'm maybe making this more complicated than it has to be, or maybe it is just this complicated. Well I appreciate any help and taking the time to read all of this. It is really important and means a lot to me.

Last edited: Feb 10, 2014
11. Feb 12, 2014

### Fjolvar

I'm trying to find more info about regression models.. perhaps this is the right path? Can anyone suggest where I can find information on regression models that take into account min/max constraints?

Last edited: Feb 12, 2014