My objective is to minimize the energie costs of a company

The curve P(t) represents the normalized power of one day.

I have a curve P(t) and I pay for the value of the curve

basis costs = 1.8

and it possible to buy peak energy for = 0.959

there are also operating costs for the value under the curve

Operating cost base = 0.04 or

Operating cost peak = 0.09

My approach now would be:

Basic cost = 1.8 * P (t) +0.04 * (tx * P (t) + integral (P (t), tx, 1))

Peak load = 0959 * (P (0)-P (t)) +0.09 * (integral (P (t), 0, tx) tx * P (t))

P = (1-0.63 * tn ^ 0.8981);

Unfortunately, however it did'nt worked.

Have somebody an approach or solution?