DCOPF, 0 <= P2total <= 80); @variable(DCOPF, -50 <= F13 <= 50); @variable(DCOPF, -50 <= F12 <= 50); @variable(DCOPF, -50 <= F23 <= 50); @variable(DCOPF, Pmin[i] <= P1[i= 1:2] <= Pseg1[i]); @variable(DCOPF, Pmin[i] <= P2[i= 1:2] <= Pseg2[i]); @variable(DCOPF, Pmin[i] <= P3[i= 1:2] <= Pseg3[i]); @variable(DCOPF, Pmin[i] <= P4[i= 1:2] <= Pseg4[i]); @variable(DCOPF, -1 <= theta1 <= 1); @variable(DCOPF, -1 <= theta2 <= 1); @variable(DCOPF, -1 <= theta3 <= 1); @objective(DCOPF, Min, 400 + Cost[1,1]P1[1] + Cost[1,2]P2[1] + Cost[1,3]P3[1] + Cost[1,4]P4[1] + 500 + Cost[2,1]P1[2] + Cost[2,2]P2[2] + Cost[2,3]P3[2] + Cost[2,4]P4[2]); @constraint(DCOPF, P1total == P1[1] + P2[1] + P3[1] + P4[1]); @constraint(DCOPF, P2total == P1[2] + P2[2] + P3[2] + P4[2]); @constraint(DCOPF, PowerB1, P1total - F13 - F12 == 0); @constraint(DCOPF, PowerB2, P2total - F23 - F12 == 0); @constraint(DCOPF, PowerBalance, F13 == 10100(theta1-theta3)); @constraint(DCOPF, PowerBalance1, F12 == 10100(theta1-theta2)); @constraint(DCOPF, PowerBalance2, F23 == 10*100(theta2-theta3)); @constraint(DCOPF, PowerBalance3, P1total - F13 - F12 == 0); @constraint(DCOPF, PowerBalance4, P2total + F12 - F23 == 0); @constraint(DCOPF, PowerBalance5, F13+F23 == 100); @constraint(DCOPF, PowerBalance6, theta1 == 0); optimize!(DCOPF); println("Objective Value: ", objective_value(DCOPF)); println("P1 = ", value(P1total)); println("P2 = ", value(P2total)); println("F13 = ", value(F13)); println("F12 = ", value(F12)); println("F23 = ", value(F23)); println("theta1 = ", value(theta1)); println("theta2 = ", value(theta2)); println("theta3 = ", value(theta3)); I keep getting this error: ERROR: Result index of attribute MathOptInterface.ObjectiveValue(1) out of bounds. There are currently 0 solution(s) in the model. Stacktrace: [1] check_result_index_bounds @ C:\Users\ncpat\.julia\packages\MathOptInterface\3JqTJ\src\attributes.jl:207 [inlined] [2] get(model::Gurobi.Optimizer, attr::MathOptInterface.ObjectiveValue) @ Gurobi C:\Users\ncpat\.julia\packages\Gurobi\yvF0V\src\MOI_wrapper\MOI_wrapper.jl:3133 [3] get(b::MathOptInterface.Bridges.LazyBridgeOptimizer{Gurobi.Optimizer}, attr::MathOptInterface.ObjectiveValue) @ MathOptInterface.Bridges C:\Users\ncpat\.julia\packages\MathOptInterface\3JqTJ\src\Bridges\bridge_optimizer.jl:1111 [4] _get_model_attribute(model::MathOptInterface.Utilities.CachingOptimizer{…}, attr::MathOptInterface.ObjectiveValue) @ MathOptInterface.Utilities C:\Users\ncpat\.julia\packages\MathOptInterface\3JqTJ\src\Utilities\cachingoptimizer.jl:828 [5] get @ MathOptInterface.Utilities C:\Users\ncpat\.julia\packages\MathOptInterface\3JqTJ\src\Utilities\cachingoptimizer.jl:895 [inlined] [6] _moi_get_result(model::MathOptInterface.Utilities.CachingOptimizer{…}, args::MathOptInterface.ObjectiveValue) @ JuMP C:\Users\ncpat\.julia\packages\JuMP\027Gt\src\optimizer_interface.jl:663 [7] get(model::Model, attr::MathOptInterface.ObjectiveValue) @ JuMP C:\Users\ncpat\.julia\packages\JuMP\027Gt\src\optimizer_interface.jl:683 [9] objective_value(model::Model) @ JuMP C:\Users\ncpat\.julia\packages\JuMP\027Gt\src\objective.jl:50 [10] top-level scope @ REPL[154]:1 Some type information was truncated. Use `show(err)` to see complete types. The point of this code is to implement the DCOPF problem with piece-wise linear cost functions for the 3-bus system

Introductory Circuit Analysis (13th Edition)
13th Edition
ISBN:9780133923605
Author:Robert L. Boylestad
Publisher:Robert L. Boylestad
Chapter1: Introduction
Section: Chapter Questions
Problem 1P: Visit your local library (at school or home) and describe the extent to which it provides literature...
icon
Related questions
Question

can you fix my code:

using JuMP, Gurobi DCOPF = Model(Gurobi.Optimizer);

NoLoadCost = [400 500];

Cost = [26 29 33 37;44 52 60 68];

Pseg1 = [10 20];

Pseg2 = [20 20];

Pseg3 = [20 20];

Pseg4 = [20 20];

Pmin = [0 0];

@variable(DCOPF, 0 <= P1total <= 70);

@variable(DCOPF, 0 <= P2total <= 80);

@variable(DCOPF, -50 <= F13 <= 50);

@variable(DCOPF, -50 <= F12 <= 50);

@variable(DCOPF, -50 <= F23 <= 50);

@variable(DCOPF, Pmin[i] <= P1[i= 1:2] <= Pseg1[i]);

@variable(DCOPF, Pmin[i] <= P2[i= 1:2] <= Pseg2[i]);

@variable(DCOPF, Pmin[i] <= P3[i= 1:2] <= Pseg3[i]);

@variable(DCOPF, Pmin[i] <= P4[i= 1:2] <= Pseg4[i]);

@variable(DCOPF, -1 <= theta1 <= 1);

@variable(DCOPF, -1 <= theta2 <= 1);

@variable(DCOPF, -1 <= theta3 <= 1);

@objective(DCOPF, Min, 400 + Cost[1,1]P1[1] + Cost[1,2]P2[1] + Cost[1,3]P3[1] + Cost[1,4]P4[1] + 500 + Cost[2,1]P1[2] + Cost[2,2]P2[2] + Cost[2,3]P3[2] + Cost[2,4]P4[2]); @constraint(DCOPF, P1total == P1[1] + P2[1] + P3[1] + P4[1]);

@constraint(DCOPF, P2total == P1[2] + P2[2] + P3[2] + P4[2]);

@constraint(DCOPF, PowerB1, P1total - F13 - F12 == 0);

@constraint(DCOPF, PowerB2, P2total - F23 - F12 == 0);

@constraint(DCOPF, PowerBalance, F13 == 10100(theta1-theta3));

@constraint(DCOPF, PowerBalance1, F12 == 10100(theta1-theta2));

@constraint(DCOPF, PowerBalance2, F23 == 10*100(theta2-theta3));

@constraint(DCOPF, PowerBalance3, P1total - F13 - F12 == 0);

@constraint(DCOPF, PowerBalance4, P2total + F12 - F23 == 0);

@constraint(DCOPF, PowerBalance5, F13+F23 == 100); @constraint(DCOPF, PowerBalance6, theta1 == 0);

optimize!(DCOPF);

println("Objective Value: ", objective_value(DCOPF));

println("P1 = ", value(P1total));

println("P2 = ", value(P2total));

println("F13 = ", value(F13));

println("F12 = ", value(F12));

println("F23 = ", value(F23));

println("theta1 = ", value(theta1));

println("theta2 = ", value(theta2));

println("theta3 = ", value(theta3));

 

I keep getting this error:

ERROR: Result index of attribute MathOptInterface.ObjectiveValue(1) out of bounds. There are currently 0 solution(s) in the model.
Stacktrace:
  [1] check_result_index_bounds
    @ C:\Users\ncpat\.julia\packages\MathOptInterface\3JqTJ\src\attributes.jl:207 [inlined]
  [2] get(model::Gurobi.Optimizer, attr::MathOptInterface.ObjectiveValue) 
    @ Gurobi C:\Users\ncpat\.julia\packages\Gurobi\yvF0V\src\MOI_wrapper\MOI_wrapper.jl:3133
  [3] get(b::MathOptInterface.Bridges.LazyBridgeOptimizer{Gurobi.Optimizer}, attr::MathOptInterface.ObjectiveValue)
    @ MathOptInterface.Bridges C:\Users\ncpat\.julia\packages\MathOptInterface\3JqTJ\src\Bridges\bridge_optimizer.jl:1111
  [4] _get_model_attribute(model::MathOptInterface.Utilities.CachingOptimizer{…}, attr::MathOptInterface.ObjectiveValue)
    @ MathOptInterface.Utilities C:\Users\ncpat\.julia\packages\MathOptInterface\3JqTJ\src\Utilities\cachingoptimizer.jl:828
  [5] get
    @ MathOptInterface.Utilities C:\Users\ncpat\.julia\packages\MathOptInterface\3JqTJ\src\Utilities\cachingoptimizer.jl:895 [inlined]
  [6] _moi_get_result(model::MathOptInterface.Utilities.CachingOptimizer{…}, args::MathOptInterface.ObjectiveValue)
    @ JuMP C:\Users\ncpat\.julia\packages\JuMP\027Gt\src\optimizer_interface.jl:663
  [7] get(model::Model, attr::MathOptInterface.ObjectiveValue)
    @ JuMP C:\Users\ncpat\.julia\packages\JuMP\027Gt\src\optimizer_interface.jl:683
  [9] objective_value(model::Model)
    @ JuMP C:\Users\ncpat\.julia\packages\JuMP\027Gt\src\objective.jl:50
 [10] top-level scope
    @ REPL[154]:1
Some type information was truncated. Use `show(err)` to see complete types.

 

The point of this code is to implement the DCOPF problem with piece-wise linear cost functions for the 3-bus system

image attached 

 

Max: 70 MW
Cost: $30/MW
Max: 80 MW
Cost: $50/MW
G
G
MW
x=0.1 p.u.
Cap 50 1
x=0.1 p.u.
Cap = 50 MW
x=0.1 p.u.
Cap = 50 MW
3
Load: 100 MW
Transcribed Image Text:Max: 70 MW Cost: $30/MW Max: 80 MW Cost: $50/MW G G MW x=0.1 p.u. Cap 50 1 x=0.1 p.u. Cap = 50 MW x=0.1 p.u. Cap = 50 MW 3 Load: 100 MW
Expert Solution
steps

Step by step

Solved in 3 steps

Blurred answer
Knowledge Booster
Simplification of Boolean Functions Using Karnaugh Map
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, electrical-engineering and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Introductory Circuit Analysis (13th Edition)
Introductory Circuit Analysis (13th Edition)
Electrical Engineering
ISBN:
9780133923605
Author:
Robert L. Boylestad
Publisher:
PEARSON
Delmar's Standard Textbook Of Electricity
Delmar's Standard Textbook Of Electricity
Electrical Engineering
ISBN:
9781337900348
Author:
Stephen L. Herman
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Electrical Engineering
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education
Fundamentals of Electric Circuits
Fundamentals of Electric Circuits
Electrical Engineering
ISBN:
9780078028229
Author:
Charles K Alexander, Matthew Sadiku
Publisher:
McGraw-Hill Education
Electric Circuits. (11th Edition)
Electric Circuits. (11th Edition)
Electrical Engineering
ISBN:
9780134746968
Author:
James W. Nilsson, Susan Riedel
Publisher:
PEARSON
Engineering Electromagnetics
Engineering Electromagnetics
Electrical Engineering
ISBN:
9780078028151
Author:
Hayt, William H. (william Hart), Jr, BUCK, John A.
Publisher:
Mcgraw-hill Education,