I have made your code a little easier to see.
(please read: PSA: how to quote code with backticks and Style Guide · JuMP )
using Distributions, Random
#Just to give a hint about my data, this are required for this one
I = 3 #conventional units
J = 1 #stochastic units
W = 20 #number of scenarios
# RAMDOM GENERATION
# this one scalar, I wanted to try a vector of Renewable generations in the last code where I have trouble
Q_mean = [5000]
Q_std = 0.2
Q_sigma = Q_std .* Q_mean
dQ = MvNormal(Q_mean,Q_sigma)
Q = rand(dQ,W); #random renewable generation
phi = 0
risk_vec = [0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1]
cont=0
for risk_v in risk_vec
global cont
cont = cont+1
phi = risk_v
end
# This one works properly (it does not -- see `qmean` comment)
Q_mean_vec = [0 3000 3500 4000 4500 5000 5500 6000 6500 7000 7500 10000]
# qmean = ????
for Q_v in Q_mean_vec
global qmean
qmean = qmean + 1
Q_mean = Q_v
Q_std = 0.2
Q_sigma = Q_std .* Q_v
dQ = MvNormal(Q_v, Q_sigma)
Q = rand(dQ,W)
end
qmean
is undefined
you should define functions and call them rather than making everything cascade into itself
(it will help you work faster and more cleanly and help others see where issues may arise)
Where there are #long expressions
in your code that are not of import in determining how to help you, just omit them without comment – this is part of what is called making a Minimal Working Example [MWE}, or in this case a Minimal NonWorking Example and that helps.
[put yourself in our shoes – and make it as simple as can be while keeping the essential]