Program that buys and sell energy
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
I need to create a program that buys energy from 3 to 7 o’clock, and sells it at 13, if the price of 13 is 1.6x the price of 3, otherwise I should sell it at 19 if this price is 1.6x the price of 3.
I need to buy only a quantity of 800, between 3 and 7. If I do not find a price 1.6x superior at 13 or 19 I should sell it another day again on 13 or 19 if this price numbers are 1.6x superior to the price I bought energy.
Can you please give me suggestions to address this question?
I’ve made some if conditions but maybe it is not the best solution to this program.
if week1(1,13)*1.6 >= week1(1,53) & sum(week1(2,13:32))< 800
price=week1(1,13:32).*week1 (2,13:32)
total_cost=sum(price(1,:))
Power=sum(week1(1,13:32))
sold=Power*week1(1,53)
Profit=sum(sold-total_cost)
elseif week1(1,13)*1.6 >= week1(1,77) & sum(week1(2,13:32))< 800
price=week1(1,13:32).*week1 (2,13:32)
total_cost=sum(price(1,:))
Power=sum(week1(1,13:32))
sold=Power*week1(1,77)
Profit=sum(sold-total_cost)
else …
end
week1(1:2:11) are the prices,each row represents a day
week1(2:2:12) are the quantities.
week1(1,13) is the price of energy at 3 at the first day.
week1(1,77) is the price of energy at 19 at the first day.
week1(1,52) is the price of energy at 13 at the first day.
I tried to mix in the same matrix, quantities and prices, maybe that's part of the problem.
Time starts at 0 and finishes at 23, it goes in periods of 15 mins, so when I talk about the indexes 13:32 it means prices from 3 to 7 a.m, index 53 will be the price at 13, and 77 will be price 19.
In the second row I talk about quantities, so index 53 at row 2 will be the quantity to buy at 13.
I'm not used to as you can see matlab.
0 Kommentare
Antworten (0)
Siehe auch
Kategorien
Mehr zu Stochastic Differential Equation (SDE) Models finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!