When I include this optimization problem in julia with include("file
name.jl") my julia window automatically close.Have you any idea about this
? Thank you for your time.
# In this cell we introduce binary decision u to the economic dispatch
problem (function solve_ed)
function solve_uc (g_max, g_min, c_g, c_w, d, w_f)
#Define the unit commitment (UC) model
uc=Model()
# Define decision variables
@defVar(uc, 0 <= g[i=1:2] <= g_max[i]) # power output of generators
@defVar(uc, u[i=1:2], Bin) # Binary status of generators
@defVar(uc, 0 <= w <= w_f ) # wind power injection
# Define the objective function
@setObjective(uc,Min,sum{c_g[i] * g[i],i=1:2}+ c_w * w)
# Define the constraint on the maximum and minimum power output of each
generator
for i in 1:2
@addConstraint(uc, g[i] <= g_max[i] * u[i]) #maximum
@addConstraint(uc, g[i] >= g_min[i] * u[i]) #minimum
end
# Define the constraint on the wind power injection
@addConstraint(uc, w <= w_f)
# Define the power balance constraint
@addConstraint(uc, sum{g[i], i=1:2} + w == d)
# Solve statement
status = solve(uc)
return status, getValue(g), getValue(w), w_f-getValue(w), getValue(u),
getObjectiveValue(uc)
end
# Solve the economic dispatch problem
status,g_opt,w_opt,ws_opt,u_opt,obj=solve_uc (g_max, g_min, c_g, c_w, d,
w_f);
println("\n")
println("Dispatch of Generators: ", g_opt[:], " MW")
println("Commitments of Generators: ", u_opt[:])
println("Dispatch of Wind: ", w_opt, " MW")
println("Wind spillage: ", w_f-w_opt, " MW")
println("\n")
println("Total cost: ", obj, "\$")