Originally posted by: gustavgans123
Hi Alex,
thank you very much for your reply! I already saw that other topic on pwl functions with breakpoints - I think it is not quite what I need atm, as I am fine specifying the pwl with slopes. My standalone pwl is exactly what I want:
range Wind = 0..30;
pwlFunction fpow = piecewise{0->3.66; 459.32->12; 0->25;-3830.7288->26;0} (3.66,0);
float powerc[i in Wind] = fpow(i);
execute
{
for(var i in Wind) writeln(i," ==> ",powerc[i]);
} ;
Before using the pwl I had a working code, that calculated the production at one node (NW) based on the wind speed at that node (NW). The respective section of code:
.mod: //NEW --- cost due to lost production
float Wndsd[i in NW] = ...; // Wind speed at windpark i
float elecpr = ...; // electricity price
float powerc = ...;
float produc[i in NW] = powerc * Wndsd[i];
float loPro[i in NW] = produc[i] * elecpr; //lost production per hour in wind park i
float lostProMa[i in NW][m in M] = loPro[i] * Tmt[m][s];
//penalty for not completed or started tasks
float Cpen[i in NW][m in M][s in S] = (Ctmt[i][m][s]+loPro[i]) * (Tmt[m][s]+Tshift[s]*2);
//////////
.dat
Wndsd= [8,0]; // Wind speed at Nodes (NW 1..2)
elecpr= 0.02; //(electricity price)
powerc= 459.32; // to be replaced by pwl
This first try worked, but I now want to replace "produc" by the above pwl funct. in order to represent the production more accurately.
I get confused with the arrays / indexes - i need something like:
i in NW -> Nodes
Windspeed[i in NW] -> Wind speed at node i in NW
produc[w in Windspeed] -> pwl(i) supposed to be the production at node i in NW as a pwl function of the windspeed at that node (but not a allowed to index over windspeed[]...)
Sorry, I really hope it is understandable. Thanks a lot for any help!!
Gustav
#DecisionOptimization#OPLusingCPLEXOptimizer