├── REPRODUCING.md ├── code ├── functions │ ├── addGenerators.m │ ├── numberOfScenarios.m │ ├── percentilePlot.m │ ├── pfsolution.m │ ├── removeRedundantConstraints.m │ ├── saveFigure.m │ └── sensitivityMatrix.m ├── run ├── scripts │ ├── powerDemandDistribution.m │ └── voltageDistribution.m └── tests │ ├── test_addGenerators.m │ ├── test_environment.m │ ├── test_numberOfScenarios.m │ ├── test_pfsolution.m │ ├── test_removeRedundantConstraints.m │ └── test_sensitivityMatrix.m ├── data ├── case_ieee123.m └── historicalPowerDemands.mat ├── environment ├── Dockerfile └── postInstall-copyme └── metadata └── metadata.yml /REPRODUCING.md: -------------------------------------------------------------------------------- 1 | This [Code Ocean](https://codeocean.com) compute capsule will allow you to reproduce the results published by the author on your local machine1. Follow the instructions below, or consult [our knowledge base](https://help.codeocean.com/user-manual/sharing-and-finding-published-capsules/exporting-capsules-and-reproducing-results-on-your-local-machine) for more information. Don't hesitate to reach out via live chat or [email](mailto:support@codeocean.com) if you have any questions. 2 | 3 | 1 You may need access to additional hardware and/or software licenses. 4 | 5 | # Prerequisites 6 | 7 | - [Docker Community Edition (CE)](https://www.docker.com/community-edition) 8 | - MATLAB/MOSEK/Stata licenses where applicable 9 | 10 | # Instructions 11 | 12 | ## The computational environment (Docker image) 13 | 14 | This capsule is private and its environment cannot be downloaded at this time. You will need to rebuild the environment locally. 15 | 16 | > If there's any software requiring a license that needs to be run during the build stage, you'll need to make your license available. See [our knowledge base](https://help.codeocean.com/user-manual/sharing-and-finding-published-capsules/exporting-capsules-and-reproducing-results-on-your-local-machine) for more information. 17 | 18 | In your terminal, navigate to the folder where you've extracted the capsule and execute the following command: 19 | ```shell 20 | cd environment && docker build . --tag 5972b691-484f-4c4b-acc1-70b5807111e6; cd .. 21 | ``` 22 | 23 | > This step will recreate the environment (i.e., the Docker image) locally, fetching and installing any required dependencies in the process. If any external resources have become unavailable for any reason, the environment will fail to build. 24 | 25 | ## Running the capsule to reproduce the results 26 | 27 | In your terminal, navigate to the folder where you've extracted the capsule and execute the following command, adjusting parameters as needed: 28 | ```shell 29 | docker run --rm \ 30 | --workdir /code \ 31 | --mac-address=12:34:56:78:9a:bc \ # this should match your local machine MAC address 32 | --volume "$PWD/license.lic":/MATLAB/licenses/network.lic \ 33 | --volume "$PWD/data":/data \ 34 | --volume "$PWD/code":/code \ 35 | --volume "$PWD/results":/results \ 36 | 5972b691-484f-4c4b-acc1-70b5807111e6 ./run 37 | ``` 38 | -------------------------------------------------------------------------------- /code/functions/addGenerators.m: -------------------------------------------------------------------------------- 1 | function mpc = addGenerators(mpc, generatorBuses) 2 | 3 | % Adds generators to the MATPOWER testcases. 4 | % Generators are listed before the existing ones. 5 | % Zero power limits are set (only used in OPF). 6 | 7 | define_constants; 8 | 9 | if any(~ismember(generatorBuses,mpc.bus(:, BUS_I))) 10 | error('You are trying to place generators in a non-existing bus.'); 11 | end 12 | 13 | newGenLines = [generatorBuses(:), repmat([0 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0], length(generatorBuses),1)]; 14 | newGencostLines = repmat([2 0 0 2 0 0],length(generatorBuses),1); 15 | 16 | mpc.gen = [newGenLines; mpc.gen]; 17 | mpc.gencost = [newGencostLines; mpc.gencost]; 18 | 19 | -------------------------------------------------------------------------------- /code/functions/numberOfScenarios.m: -------------------------------------------------------------------------------- 1 | function n = numberOfScenarios(d, epsilon, beta); 2 | 3 | % Example values 4 | % d = 1; 5 | % epsilon = 0.05; 6 | % beta = 1e-3; 7 | 8 | n = d+1; 9 | nb = 0; 10 | 11 | while true 12 | nb = 0; 13 | for ii = 0:(d-1) 14 | nb = nb + nchoosek(n,ii) * epsilon^ii * (1-epsilon)^(n-ii); 15 | end 16 | if nb <= beta 17 | break; 18 | end 19 | n = n+1; 20 | end 21 | -------------------------------------------------------------------------------- /code/functions/percentilePlot.m: -------------------------------------------------------------------------------- 1 | function h = percentilePlot(data) 2 | 3 | Q = quantile(data,[.05 .50 .95], 2); 4 | h = errorbar(1:size(data,1),Q(:,2),Q(:,2)-Q(:,1),Q(:,3)-Q(:,2), 'k* '); 5 | xlim([0 size(data,1)+1]) 6 | set(gca, 'YGrid', 'on'); 7 | -------------------------------------------------------------------------------- /code/functions/pfsolution.m: -------------------------------------------------------------------------------- 1 | function [voltages, substationPower] = pfsolution(testGrid, powerDemand, powerGeneration); 2 | 3 | define_constants; 4 | 5 | if ~isvector(powerDemand) 6 | error('Power demand is not a vector'); 7 | end 8 | 9 | if ~isvector(powerGeneration) 10 | error('Power generation is not a vector'); 11 | end 12 | 13 | if length(powerDemand) ~= (size(testGrid.bus,1)-1) 14 | error('Number of load buses different from number of demands'); 15 | end 16 | 17 | if length(powerGeneration) ~= (size(testGrid.gen,1)-1) 18 | error('Number of generators different from number of generation setpoints'); 19 | end 20 | 21 | testGrid.bus(1:end-1,PD) = powerDemand(:); 22 | testGrid.bus(1:end-1,QD) = 0; 23 | 24 | testGrid.gen(1:end-1,PG) = powerGeneration(:); 25 | testGrid.gen(1:end-1,QG) = 0; 26 | 27 | pfresult = runpf(testGrid, mpoption('VERBOSE', 0, 'OUT_ALL',0)); 28 | 29 | voltages = pfresult.bus(:,VM); 30 | substationPower = pfresult.gen(end,PG); 31 | -------------------------------------------------------------------------------- /code/functions/removeRedundantConstraints.m: -------------------------------------------------------------------------------- 1 | function reducedPoly = removeRedundantConstraints( poly ) 2 | 3 | OPTIONS.Display = 'off'; 4 | tol = 1e-8; 5 | 6 | A = poly.A; 7 | b = poly.b; 8 | 9 | validRows = true(size(b)); 10 | 11 | for i = 1:size(A,1) 12 | 13 | [~,fval] = linprog(-A(i,:)',A(validRows,:),b(validRows),[],[],[],[],OPTIONS); 14 | validRows(i) = (-fval > b(i) - tol); 15 | 16 | end 17 | 18 | reducedPoly = Polyhedron('A',A(validRows,:),'b',b(validRows)); 19 | 20 | -------------------------------------------------------------------------------- /code/functions/saveFigure.m: -------------------------------------------------------------------------------- 1 | function saveFigure(filename) 2 | 3 | figureNumber = gcf; 4 | figureNumber.PaperPositionMode = 'manual'; 5 | figureNumber.PaperUnits = 'inches'; 6 | figureNumber.PaperPosition = [0.25 0.25 16 8]; 7 | fig_pos = figureNumber.PaperPosition; 8 | figureNumber.PaperSize = [fig_pos(3) fig_pos(4)]; 9 | print(figureNumber,sprintf('../output/%s.pdf',filename),'-fillpage', '-dpdf'); 10 | -------------------------------------------------------------------------------- /code/functions/sensitivityMatrix.m: -------------------------------------------------------------------------------- 1 | function R = sensitivityMatrix(testGrid); 2 | 3 | Y = makeYbus(testGrid); 4 | X = inv(Y(1:end-1,1:end-1)); 5 | R = full(real(X)); -------------------------------------------------------------------------------- /code/run: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | set -ex 3 | 4 | # This is the master script for the capsule. When you click "Reproducible Run", the code in this file will execute. 5 | matlab -nodisplay -r "addpath(genpath('.')); test_environment" 6 | 7 | -------------------------------------------------------------------------------- /code/scripts/powerDemandDistribution.m: -------------------------------------------------------------------------------- 1 | load '../data/historicalPowerDemands.mat' 2 | numberOfDataPoints = size(historicalPowerDemands,2); 3 | 4 | figure(1) 5 | subplot(1,3,1) 6 | histogram(historicalPowerDemands(1,:), 'Normalization', 'pdf') 7 | subplot(1,3,2) 8 | histogram(historicalPowerDemands(2,:), 'Normalization', 'pdf') 9 | subplot(1,3,3) 10 | histogram(historicalPowerDemands(3,:), 'Normalization', 'pdf') 11 | saveFigure('powerDemandDistribution'); 12 | 13 | figure(2) 14 | aggregatedPowerDemand = sum(historicalPowerDemands); 15 | histogram(sum(historicalPowerDemands), 'Normalization', 'pdf'); 16 | hold on 17 | xaxRange = max(aggregatedPowerDemand)-min(aggregatedPowerDemand); 18 | xax = (min(aggregatedPowerDemand)-0.5*xaxRange):(0.01*xaxRange):(max(aggregatedPowerDemand)+0.1*xaxRange); 19 | plot(xax, normpdf(xax, mean(aggregatedPowerDemand), std(aggregatedPowerDemand))); 20 | saveFigure('aggregatedPowerDemandDistribution'); -------------------------------------------------------------------------------- /code/scripts/voltageDistribution.m: -------------------------------------------------------------------------------- 1 | testGrid = loadcase('../data/case_ieee123'); 2 | 3 | genBuses = [20]; 4 | testGrid = addGenerators(testGrid, genBuses); 5 | powerGeneration = 0; 6 | 7 | load '../data/historicalPowerDemands.mat' 8 | numberOfDataPoints = size(historicalPowerDemands,2); 9 | 10 | voltages = zeros(size(testGrid.bus,1), numberOfDataPoints); 11 | 12 | for dataPoint = 1:numberOfDataPoints 13 | 14 | voltages(:,dataPoint) = pfsolution(testGrid, historicalPowerDemands(:,dataPoint), powerGeneration); 15 | fprintf(1,'\b\b\b\b%03.f%%',dataPoint/numberOfDataPoints*100); 16 | 17 | end 18 | 19 | percentilePlot(voltages); 20 | saveFigure(sprintf('errorbar_voltages_%0.3fMW',powerGeneration)); -------------------------------------------------------------------------------- /code/tests/test_addGenerators.m: -------------------------------------------------------------------------------- 1 | define_constants; 2 | testGrid = loadcase('../data/case_ieee123'); 3 | 4 | newTestGrid = addGenerators(testGrid, [1 3 4]); 5 | disp(newTestGrid.gen(:,GEN_BUS)); 6 | 7 | newTestGrid = addGenerators(testGrid, [1; 3; 4]); 8 | disp(newTestGrid.gen(:,GEN_BUS)); 9 | 10 | try 11 | newTestGrid = addGenerators(testGrid, [1; 3; 400]); 12 | catch ME 13 | warning(ME.message); 14 | end -------------------------------------------------------------------------------- /code/tests/test_environment.m: -------------------------------------------------------------------------------- 1 | disp('test MPT'); 2 | mpt_init; 3 | 4 | disp('test Matpower'); 5 | test_matpower; 6 | 7 | -------------------------------------------------------------------------------- /code/tests/test_numberOfScenarios.m: -------------------------------------------------------------------------------- 1 | warning('off','MATLAB:nchoosek:LargeCoefficient') 2 | 3 | disp('As a function of n') 4 | epsilon = 0.05; 5 | beta = 1e-3; 6 | for n = [1 10 100] 7 | disp(sprintf('n = %3.0d, N = %d', [n numberOfScenarios(n, epsilon, beta)])); 8 | end 9 | 10 | disp('As a function of epsilon') 11 | n = 3; 12 | beta = 1e-3; 13 | for epsilon = [1e-1 1e-2 1e-3] 14 | disp(sprintf('epsilon = %e, N = %d', [epsilon numberOfScenarios(n, epsilon, beta)])); 15 | end 16 | 17 | disp('As a function of beta') 18 | n = 3; 19 | epsilon = 0.05; 20 | for beta = [1e-2 1e-3 1e-4 1e-5] 21 | disp(sprintf('beta = %e, N = %d', [beta numberOfScenarios(n, epsilon, beta)])); 22 | end 23 | -------------------------------------------------------------------------------- /code/tests/test_pfsolution.m: -------------------------------------------------------------------------------- 1 | testGrid = loadcase('../data/case_ieee123'); 2 | testGrid = addGenerators(testGrid, [27 30]); 3 | 4 | load '../data/historicalPowerDemands.mat' 5 | powerDemand = historicalPowerDemands(:,1); 6 | powerGeneration = [0.5 0.9]; 7 | 8 | [voltages, substationPower] = pfsolution(testGrid, powerDemand, powerGeneration); 9 | 10 | disp([(1:56)', voltages]); 11 | disp(substationPower); 12 | disp(sum(powerDemand)-sum(powerGeneration)); -------------------------------------------------------------------------------- /code/tests/test_removeRedundantConstraints.m: -------------------------------------------------------------------------------- 1 | A = rand(10,3); 2 | b = rand(10,1); 3 | 4 | % create polyhedron 5 | P = Polyhedron('A',A,'b',b); 6 | 7 | % display some information about the polyhedron 8 | P.display(); 9 | 10 | % remove all redundant constraints 11 | reducedP = removeRedundantConstraints(P); 12 | 13 | % display some information about the reduced polyhedron 14 | reducedP.display(); 15 | -------------------------------------------------------------------------------- /code/tests/test_sensitivityMatrix.m: -------------------------------------------------------------------------------- 1 | testGrid = loadcase('../data/case_ieee123'); 2 | 3 | genBuses = [27 30]; 4 | testGrid = addGenerators(testGrid, genBuses); 5 | 6 | load '../data/historicalPowerDemands.mat' 7 | powerDemand = historicalPowerDemands(:,1); 8 | powerGeneration = [0.5; 0.9]; 9 | 10 | [voltages, substationPower] = pfsolution(testGrid, powerDemand, powerGeneration); 11 | 12 | R = sensitivityMatrix(testGrid); 13 | 14 | powerInjections = -powerDemand; 15 | powerInjections(genBuses) = powerInjections(genBuses) + powerGeneration; 16 | approximateLoadVoltages = 1 + R * powerInjections; 17 | 18 | plot(1:55, voltages(1:end-1), 'ko ', 1:55, approximateLoadVoltages, 'k* '); 19 | xlabel('load bus index'); 20 | ylabel('voltage [pu]'); 21 | saveFigure('linearizationAccuracy'); -------------------------------------------------------------------------------- /data/case_ieee123.m: -------------------------------------------------------------------------------- 1 | function mpc = case_ieee123_gen20 2 | % Power flow data for IEEE 123 bus test case. 3 | % Please see CASEFORMAT for details on the case file format. 4 | % 5 | % This testbed is distributed in the hope that it will be useful, but without any warranty. 6 | % If you use this testbed, kindly cite its source: 7 | % 8 | % S. Bolognani, S. Zampieri 9 | % "On the existence and linear approximation of the power flow solution in power distribution networks" 10 | % IEEE Transactions on Power Systems ( Volume: 31 , Issue: 1 , Jan. 2016 ) 11 | % DOI: 10.1109/TPWRS.2015.2395452 12 | 13 | %% MATPOWER Case Format : Version 2 14 | mpc.version = '2'; 15 | 16 | %%----- Power Flow Data -----%% 17 | %% system MVA base 18 | mpc.baseMVA = 1; 19 | 20 | VMAX = 1.06; 21 | VMIN = 0.64; 22 | 23 | %% bus data 24 | % bus_i type Pd Qd Gs Bs area Vm Va baseKV zone Vmax Vmin 25 | mpc.bus = [ 26 | 1 1 0.160 0.080 0.000 0.000 1 1 0 4.16 1 VMAX VMIN ; 27 | 2 1 0.020 0.010 0.000 0.000 1 1 0 4.16 1 VMAX VMIN ; 28 | 3 1 0.120 0.060 0.000 0.000 1 1 0 4.16 1 VMAX VMIN ; 29 | 4 1 0.100 0.050 0.000 0.000 1 1 0 4.16 1 VMAX VMIN ; 30 | 5 1 0.040 0.020 0.000 0.000 1 1 0 4.16 1 VMAX VMIN ; 31 | 6 1 0.040 0.020 0.000 0.000 1 1 0 4.16 1 VMAX VMIN ; 32 | 7 1 0.000 0.000 0.000 0.000 1 1 0 4.16 1 VMAX VMIN ; 33 | 8 1 0.020 0.010 0.000 0.000 1 1 0 4.16 1 VMAX VMIN ; 34 | 9 1 0.020 0.010 0.000 0.000 1 1 0 4.16 1 VMAX VMIN ; 35 | 10 1 0.000 0.000 0.000 0.000 1 1 0 4.16 1 VMAX VMIN ; 36 | 11 1 0.020 0.010 0.000 0.000 1 1 0 4.16 1 VMAX VMIN ; 37 | 12 1 0.040 0.020 0.000 0.000 1 1 0 4.16 1 VMAX VMIN ; 38 | 13 1 0.040 0.020 0.000 0.000 1 1 0 4.16 1 VMAX VMIN ; 39 | 14 1 0.075 0.035 0.000 0.000 1 1 0 4.16 1 VMAX VMIN ; 40 | 15 1 0.140 0.100 0.000 0.000 1 1 0 4.16 1 VMAX VMIN ; 41 | 16 1 0.075 0.035 0.000 0.000 1 1 0 4.16 1 VMAX VMIN ; 42 | 17 1 0.120 0.060 0.000 0.000 1 1 0 4.16 1 VMAX VMIN ; 43 | 18 1 0.120 0.060 0.000 0.000 1 1 0 4.16 1 VMAX VMIN ; 44 | 19 1 0.245 0.180 0.000 0.000 1 1 0 4.16 1 VMAX VMIN ; 45 | 20 1 0.040 0.020 0.000 0.000 1 1 0 4.16 1 VMAX VMIN ; 46 | 21 1 0.000 0.000 0.000 0.000 1 1 0 4.16 1 VMAX VMIN ; 47 | 22 1 0.040 0.020 0.000 0.000 1 1 0 4.16 1 VMAX VMIN ; 48 | 23 1 0.040 0.020 0.000 0.000 1 1 0 4.16 1 VMAX VMIN ; 49 | 24 1 0.060 0.030 0.000 0.000 1 1 0 4.16 1 VMAX VMIN ; 50 | 25 1 0.040 0.020 0.000 0.000 1 1 0 4.16 1 VMAX VMIN ; 51 | 26 1 0.020 0.010 0.000 0.000 1 1 0 4.16 1 VMAX VMIN ; 52 | 27 1 0.020 0.010 0.000 0.000 1 1 0 4.16 1 VMAX VMIN ; 53 | 28 1 0.080 0.040 0.000 0.000 1 1 0 4.16 1 VMAX VMIN ; 54 | 29 1 0.040 0.020 0.000 0.000 1 1 0 4.16 1 VMAX VMIN ; 55 | 30 1 0.040 0.020 0.000 0.000 1 1 0 4.16 1 VMAX VMIN ; 56 | 31 1 0.040 0.020 0.000 0.000 1 1 0 4.16 1 VMAX VMIN ; 57 | 32 1 0.000 0.000 0.000 0.000 1 1 0 4.16 1 VMAX VMIN ; 58 | 33 1 0.000 0.000 0.000 0.000 1 1 0 4.16 1 VMAX VMIN ; 59 | 34 1 0.040 0.020 0.000 0.000 1 1 0 4.16 1 VMAX VMIN ; 60 | 35 1 0.040 0.020 0.000 0.000 1 1 0 4.16 1 VMAX VMIN ; 61 | 36 1 0.040 0.020 0.000 0.000 1 1 0 4.16 1 VMAX VMIN ; 62 | 37 1 0.100 0.050 0.000 0.000 1 1 0 4.16 1 VMAX VMIN ; 63 | 38 1 0.080 0.040 0.000 0.000 1 1 0 4.16 1 VMAX VMIN ; 64 | 39 1 0.140 0.070 0.000 0.000 1 1 0 4.16 1 VMAX VMIN ; 65 | 40 1 0.080 0.040 0.000 0.000 1 1 0 4.16 1 VMAX VMIN ; 66 | 41 1 0.040 0.020 0.000 0.000 1 1 0 4.16 1 VMAX VMIN ; 67 | 42 1 0.040 0.020 0.000 0.000 1 1 0 4.16 1 VMAX VMIN ; 68 | 43 1 0.080 0.040 0.000 0.000 1 1 0 4.16 1 VMAX VMIN ; 69 | 44 1 0.040 0.020 0.000 0.000 1 1 0 4.16 1 VMAX VMIN ; 70 | 45 1 0.040 0.020 0.000 0.000 1 1 0 4.16 1 VMAX VMIN ; 71 | 46 1 0.040 0.020 0.000 0.000 1 1 0 4.16 1 VMAX VMIN ; 72 | 47 1 0.120 0.060 0.000 0.000 1 1 0 4.16 1 VMAX VMIN ; 73 | 48 1 0.020 0.010 0.000 0.000 1 1 0 4.16 1 VMAX VMIN ; 74 | 49 1 0.060 0.030 0.000 0.000 1 1 0 4.16 1 VMAX VMIN ; 75 | 50 1 0.040 0.020 0.000 0.000 1 1 0 4.16 1 VMAX VMIN ; 76 | 51 1 0.105 0.075 0.000 0.000 1 1 0 4.16 1 VMAX VMIN ; 77 | 52 1 0.210 0.150 0.000 0.000 1 1 0 4.16 1 VMAX VMIN ; 78 | 53 1 0.140 0.095 0.000 0.000 1 1 0 4.16 1 VMAX VMIN ; 79 | 54 1 0.040 0.020 0.000 0.000 1 1 0 4.16 1 VMAX VMIN ; 80 | 55 1 0.020 0.010 0.000 0.000 1 1 0 4.16 1 VMAX VMIN ; 81 | 56 3 0.000 0.000 0.000 0.000 1 1 0 4.16 1 1 1 ; 82 | ]; 83 | 84 | %% generator data 85 | % bus Pg Qg Qmax Qmin Vg mBase status Pmax Pmin Pc1 Pc2 Qc1min Qc1max Qc2min Qc2max ramp_agc ramp_10 ramp_30 ramp_q apf 86 | mpc.gen = [ 87 | 56 0 0 200 -200 1 1 1 200 -200 0 0 0 0 0 0 0 0 0 0 0; 88 | ]; 89 | 90 | %% branch data 91 | % fbus tbus r x b rateA rateB rateC ratio angle status angmin angmax 92 | mpc.branch = [ 93 | 56 1 0.0013398623 0.0027450827 3.02770271595392E-008 100 100 100 0 0 1 -360 360 ; 94 | 1 2 0.0010048967 0.0020588120 2.27077703696544E-008 100 100 100 0 0 1 -360 360 ; 95 | 2 3 0.0006699312 0.0013725413 1.51385135797696E-008 100 100 100 0 0 1 -360 360 ; 96 | 3 4 0.0010048967 0.0020588120 2.27077703696544E-008 100 100 100 0 0 1 -360 360 ; 97 | 4 5 0.0013398623 0.0027450827 3.02770271595392E-008 100 100 100 0 0 1 -360 360 ; 98 | 5 6 0.0006699312 0.0013725413 1.51385135797696E-008 100 100 100 0 0 1 -360 360 ; 99 | 6 7 0.0004187070 0.0008578383 9.46157098735599E-009 100 100 100 0 0 1 -360 360 ; 100 | 7 8 0.0009211553 0.0018872444 2.08154561721832E-008 100 100 100 0 0 1 -360 360 ; 101 | 8 9 0.0009211553 0.0018872444 2.08154561721832E-008 100 100 100 0 0 1 -360 360 ; 102 | 7 10 0.0011723795 0.0024019474 2.64923987645968E-008 100 100 100 0 0 1 -360 360 ; 103 | 10 11 0.0025122418 0.0051470300 5.67694259241360E-008 100 100 100 0 0 1 -360 360 ; 104 | 11 12 0.0027749546 0.0013221274 1.83926822251266E-007 100 100 100 0 0 1 -360 360 ; 105 | 12 13 0.0019424682 0.0009254892 1.28748775575886E-007 100 100 100 0 0 1 -360 360 ; 106 | 13 14 0.0038849364 0.0018509784 2.57497551151773E-007 100 100 100 0 0 1 -360 360 ; 107 | 14 15 0.0047174228 0.0022476166 3.12675597827153E-007 100 100 100 0 0 1 -360 360 ; 108 | 15 16 0.0036074409 0.0017187657 2.39104868926646E-007 100 100 100 0 0 1 -360 360 ; 109 | 11 17 0.0011723795 0.0024019474 2.64923987645968E-008 100 100 100 0 0 1 -360 360 ; 110 | 17 18 0.0009211553 0.0018872444 2.08154561721832E-008 100 100 100 0 0 1 -360 360 ; 111 | 18 19 0.0006699312 0.0013725413 1.51385135797696E-008 100 100 100 0 0 1 -360 360 ; 112 | 19 20 0.0013398623 0.0027450827 3.02770271595392E-008 100 100 100 0 0 1 -360 360 ; 113 | 20 21 0.0003349656 0.0006862707 7.56925678988480E-009 100 100 100 0 0 1 -360 360 ; 114 | 21 22 0.0007536726 0.0015441090 1.70000000000000E-008 100 100 100 0 0 1 -360 360 ; 115 | 21 23 0.0015910865 0.0032597857 3.60000000000000E-008 100 100 100 0 0 1 -360 360 ; 116 | 23 24 0.0015910865 0.0032597857 3.60000000000000E-008 100 100 100 0 0 1 -360 360 ; 117 | 24 25 0.0008374139 0.0017156767 1.89231419747120E-008 100 100 100 0 0 1 -360 360 ; 118 | 25 26 0.0008374139 0.0017156767 1.89231419747120E-008 100 100 100 0 0 1 -360 360 ; 119 | 19 27 0.0023447590 0.0048038947 5.30000000000000E-008 100 100 100 0 0 1 -360 360 ; 120 | 27 28 0.0015073451 0.0030882180 3.40616555544816E-008 100 100 100 0 0 1 -360 360 ; 121 | 28 29 0.0009211553 0.0018872444 2.08154561721832E-008 100 100 100 0 0 1 -360 360 ; 122 | 29 30 0.0007536726 0.0015441090 1.70000000000000E-008 100 100 100 0 0 1 -360 360 ; 123 | 30 31 0.0007536726 0.0015441090 1.70000000000000E-008 100 100 100 0 0 1 -360 360 ; 124 | 31 32 0.0010048967 0.0020588120 2.27077703696544E-008 100 100 100 0 0 1 -360 360 ; 125 | 17 33 0.0008374139 0.0017156767 1.89231419747120E-008 100 100 100 0 0 1 -360 360 ; 126 | 33 34 0.0009211553 0.0018872444 2.08154561721832E-008 100 100 100 0 0 1 -360 360 ; 127 | 34 35 0.0018423107 0.0037744887 4.16309123443664E-008 100 100 100 0 0 1 -360 360 ; 128 | 35 36 0.0010048967 0.0020588120 2.27077703696544E-008 100 100 100 0 0 1 -360 360 ; 129 | 33 37 0.0008374139 0.0017156767 1.89231419747120E-008 100 100 100 0 0 1 -360 360 ; 130 | 37 38 0.0009211553 0.0018872444 2.08154561721832E-008 100 100 100 0 0 1 -360 360 ; 131 | 38 39 0.0010886381 0.0022303797 2.46000845671256E-008 100 100 100 0 0 1 -360 360 ; 132 | 4 40 0.0027634660 0.0056617331 6.24463685165496E-008 100 100 100 0 0 1 -360 360 ; 133 | 40 41 0.0010048967 0.0020588120 2.27077703696544E-008 100 100 100 0 0 1 -360 360 ; 134 | 41 42 0.0008374139 0.0017156767 1.89231419747120E-008 100 100 100 0 0 1 -360 360 ; 135 | 42 43 0.0009211553 0.0018872444 2.08154561721832E-008 100 100 100 0 0 1 -360 360 ; 136 | 43 44 0.0006699312 0.0013725413 1.51385135797696E-008 100 100 100 0 0 1 -360 360 ; 137 | 44 45 0.0010048967 0.0020588120 2.27077703696544E-008 100 100 100 0 0 1 -360 360 ; 138 | 45 46 0.0011723795 0.0024019474 2.64923987645968E-008 100 100 100 0 0 1 -360 360 ; 139 | 40 47 0.0012561209 0.0025735150 2.83847129620680E-008 100 100 100 0 0 1 -360 360 ; 140 | 47 48 0.0008374139 0.0017156767 1.89231419747120E-008 100 100 100 0 0 1 -360 360 ; 141 | 48 49 0.0008374139 0.0017156767 1.89231419747120E-008 100 100 100 0 0 1 -360 360 ; 142 | 49 50 0.0006699312 0.0013725413 1.51385135797696E-008 100 100 100 0 0 1 -360 360 ; 143 | 50 51 0.0008374139 0.0017156767 1.89231419747120E-008 100 100 100 0 0 1 -360 360 ; 144 | 51 52 0.0005024484 0.0010294060 1.13538851848272E-008 100 100 100 0 0 1 -360 360 ; 145 | 51 53 0.0008374139 0.0017156767 1.89231419747120E-008 100 100 100 0 0 1 -360 360 ; 146 | 53 54 0.0008374139 0.0017156767 1.89231419747120E-008 100 100 100 0 0 1 -360 360 ; 147 | 54 55 0.0008374139 0.0017156767 1.89231419747120E-008 100 100 100 0 0 1 -360 360 ; 148 | ]; 149 | 150 | %%----- OPF Data -----%% 151 | %% generator cost data 152 | % 1 startup shutdown n x1 y1 ... xn yn 153 | % 2 startup shutdown n c(n-1) ... c0 154 | mpc.gencost = [ 155 | 2 0 0 2 0 0; 156 | ]; 157 | 158 | 159 | -------------------------------------------------------------------------------- /data/historicalPowerDemands.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/saveriob/data-driven-control/ff324c29615a524026ad3ecb58117fe7793a4d54/data/historicalPowerDemands.mat -------------------------------------------------------------------------------- /environment/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM registry.codeocean.com/codeocean/matlab:2017b-ubuntu16.04 2 | 3 | ARG DEBIAN_FRONTEND=noninteractive 4 | ARG MLM_LICENSE_FILE 5 | 6 | COPY postInstall / 7 | RUN /postInstall 8 | -------------------------------------------------------------------------------- /environment/postInstall-copyme: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | set -e 3 | 4 | echo 'Download YALMIP' 5 | YALMIP_RELEASE=R20190425 6 | curl -sL https://github.com/yalmip/YALMIP/archive/$YALMIP_RELEASE.tar.gz | tar xz 7 | mv YALMIP-$YALMIP_RELEASE YALMIP 8 | 9 | echo 'Download Matpower' 10 | git clone --branch 7.0b1 https://github.com/MATPOWER/matpower.git 11 | 12 | matlab -nodisplay -r "\ 13 | disp('Install YALMIP');\ 14 | addpath(genpath('/YALMIP'));\ 15 | disp('Install tbxmanager');\ 16 | mkdir('/tbxmanager');\ 17 | cd('/tbxmanager');\ 18 | urlwrite('http://www.tbxmanager.com/tbxmanager.m', 'tbxmanager.m');\ 19 | a=evalc('tbxmanager');\ 20 | disp('Install MPT3');\ 21 | evalc('tbxmanager install mpt mptdoc cddmex fourier glpkmex hysdel lcp sedumi espresso');\ 22 | evalc('mpt_init');\ 23 | savepath;\ 24 | disp('Install Matpower');\ 25 | cd('/matpower');\ 26 | install_matpower(1,1);\ 27 | disp('Done');" -------------------------------------------------------------------------------- /metadata/metadata.yml: -------------------------------------------------------------------------------- 1 | metadata_version: 1 2 | name: A Fast Method for Real-Time Chance-Constrained Decision with Application to 3 | Power Systems 4 | corresponding_contributor: {} 5 | --------------------------------------------------------------------------------