public OPFModelResult(IPowerSystem powerSystem, int status, double objVal, double[] pGen_Solution, double[] pFlow_Solution, double[] lShed_Solution, double[] busAng_Solution, double[] nodalSpotPrice, Dictionary<int, int> PFlow_TLsIDs) : base(status, objVal) { this.PowerSystem = powerSystem; //Generating units this.GeneratingUnitOPFResults = new List<GeneratingUnitOPFResult>(); foreach (GeneratingUnit gen in this.PowerSystem.GeneratingUnits) { this.GeneratingUnitOPFResults.Add(new GeneratingUnitOPFResult(gen, pGen_Solution[gen.Id])); } //Transmission lines this.TransmissionLineOPFResults = new List<TransmissionLineOPFResult>(); foreach (TransmissionLine tl in this.PowerSystem.TransmissionLines) { this.TransmissionLineOPFResults.Add(new TransmissionLineOPFResult(tl, pFlow_Solution[PFlow_TLsIDs[tl.Id]])); } //Nodes this.NodeOPFResults = new List<NodeOPFResult>(); foreach (Node node in this.PowerSystem.Nodes) { double pgen = 0; foreach (GeneratingUnit gen in node.GeneratingUnits) { pgen += this.GeneratingUnitOPFResults[gen.Id].Output; } double pcons = 0; double lshed = 0; foreach (InelasticLoad load in node.InelasticLoads) { pcons += load.ConsumptionMW - lShed_Solution[load.Id]; lshed += lShed_Solution[load.Id]; } this.NodeOPFResults.Add(new NodeOPFResult(node, busAng_Solution[node.Id], pgen, pcons, lshed, nodalSpotPrice[node.Id])); } }
/// <summary> /// Creates the Gurobi OPF model for the provided power system. /// </summary> /// <param name="powerSystem">The power system for which the OPF will be solved.</param> public OPFModel(IPowerSystem powerSystem) : base() { this.MyPowerSystem = powerSystem; }
/// <summary> /// Adds the Gurobi OPF model for the provided power system, to the provided gurobi model. /// </summary> /// <param name="powerSystem"></param> /// <param name="env"></param> /// <param name="model"></param> public OPFModel(IPowerSystem powerSystem, GRBEnv env, GRBModel model) : base(env,model) { this.MyPowerSystem = powerSystem; }
public OPFModelForLDC(IPowerSystem powerSystem, GRBEnv env, GRBModel model, LoadBlock loadBlock) : base(powerSystem, env, model) { this.LoadBlock = loadBlock; }