MD_INIT MOST Data structure Initialization MD = MD_INIT Creates an empty MOST Data struct (MD) with all fields required for MOST, both input and output fields.
0001 function md = md_init 0002 %MD_INIT MOST Data structure Initialization 0003 % MD = MD_INIT 0004 % 0005 % Creates an empty MOST Data struct (MD) with all fields required for 0006 % MOST, both input and output fields. 0007 0008 % MOST 0009 % Copyright (c) 2010-2016, Power Systems Engineering Research Center (PSERC) 0010 % by Carlos E. Murillo-Sanchez, PSERC Cornell & Universidad Nacional de Colombia 0011 % and Ray Zimmerman, PSERC Cornell 0012 % 0013 % This file is part of MOST. 0014 % Covered by the 3-clause BSD License (see LICENSE file for details). 0015 % See https://github.com/MATPOWER/most for more info. 0016 0017 0018 %%----- start over ----- 0019 md = struct('Delta_T', 1); 0020 md.Storage.UnitIdx = []; 0021 md.UC.CommitKey = []; % If empty, no UC dimension; else, must contain key to be used 0022 md.Storage.ExpectedTerminalStorageAim = []; % expected terminal storage targe 0023 md.Storage.ExpectedTerminalStorageMin = []; % expected terminal storage LB 0024 md.Storage.ExpectedTerminalStorageMax = []; % expected terminal storage UB 0025 md.Storage.rho = []; % (i,t), varies bounding of storage dispatches between being 0026 % based on worst case (rho=1) vs. expected (rho=0) stored energy 0027 % at beginning of period 0028 md.Storage.TerminalChargingPrice0 = []; % applied to psc_tij0 (end-of-horizon terminal states) 0029 md.Storage.TerminalDischargingPrice0 = []; % applied to psd_tij0 (end-of-horizon terminal states) 0030 md.Storage.TerminalChargingPriceK = []; % applied to psc_tijk (contingency terminal states) 0031 md.Storage.TerminalDischargingPriceK = []; % applied to psd_tijk (contingency terminal states) 0032 0033 0034 % %%----- problem input data ----- 0035 % md = struct('OpenEnded', 1); % default = no terminal dispatch ramping constraints 0036 % md.QCoordination = 0; % Create Qg variables for coordination if 1. 0037 % md.TerminalPg = []; % dispatch to ramp to from the final period 0038 % md.InitialPg = []; % dispatch to ramp from in the initial period 0039 % 0040 % % used only when most.storage.terminal_target option is 1 0041 % md.Storage.ExpectedTerminalStorageAim = []; % expected terminal storage targe 0042 % md.Storage.ExpectedTerminalStorageMin = []; % expected terminal storage LB 0043 % md.Storage.ExpectedTerminalStorageMax = []; % expected terminal storage UB 0044 % 0045 % md.mpc.baseMVA = []; 0046 % md.mpc.bus = []; 0047 % md.mpc.gen = []; 0048 % md.mpc.branch = []; 0049 % md.mpc.gencost = []; 0050 % %md.offer(1).gencost = []; (deprecated) 0051 % md.offer(1).PositiveActiveReservePrice = []; % (t) 0052 % md.offer(1).PositiveActiveReserveQuantity = []; 0053 % md.offer(1).NegativeActiveReservePrice = []; 0054 % md.offer(1).NegativeActiveReserveQuantity = []; 0055 % md.offer(1).PositiveActiveDeltaPrice = []; 0056 % md.offer(1).NegativeActiveDeltaPrice = []; 0057 % %md.offer(1).PositiveReactiveReservePrice = []; 0058 % %md.offer(1).PositiveReactiveReserveQuantity = []; 0059 % %md.offer(1).NegativeReactiveReservePrice = []; 0060 % %md.offer(1).NegativeReactiveReserveQuantity = []; 0061 % %md.offer(1).PositiveReactiveDeltaPrice = []; 0062 % %md.offer(1).NegativeReactiveDeltaPrice = []; 0063 % md.offer(1).PositiveLoadFollowReservePrice = []; 0064 % md.offer(1).PositiveLoadFollowReserveQuantity = []; 0065 % md.offer(1).NegativeLoadFollowReservePrice = []; 0066 % md.offer(1).NegativeLoadFollowReserveQuantity = []; 0067 % md.RampWearCostCoeff = []; % (i,t) note different scheme! 0068 % % the first column is the cost from initial 0069 % % state to t=1; if there's a terminal 0070 % % state, then there must be nt+1 columns 0071 % md.UC.CommitSched = []; % if UC: solution on output; if not UC (mdi.CommitKey empty) then 0072 % % must contain UC status 0073 % % (i, t) 0074 % md.UC.CommitKey = []; % If empty, no UC dimension; else, must contain key to be used 0075 % % for UC problem as follows: 0076 % % Must run : 2 0077 % % Available for UC: 0, 1 0078 % % Offline: : -1 0079 % % (i, t) 0080 % md.UC.InitialState = []; % If positive, number of uptime periods; 0081 % % if negative, number of downtime periods at t = 0 0082 % % (ng) 0083 % md.UC.MinUp = []; % Minimum uptime (i) 0084 % md.UC.MinDown = []; % Minimum downtime (i) 0085 % md.UC.CyclicCommitment = []; % 1 if Commit restrictions roll over 0086 % md.UC.c00 = []; % (i,t) 0087 % md.Delta_T = 1; % length of each period in hours 0088 % md.Storage.UnitIdx = []; 0089 % md.Storage.MinStorageLevel = []; % (i,t) These are applied to the 0090 % md.Storage.MaxStorageLevel = []; % (i,t) bounds. 0091 % md.Storage.InitialStorage = []; 0092 % md.Storage.InitialStorageLowerBound = []; % initial s- value, or (if ForceCyclicStorage) lower bound on s0 0093 % md.Storage.InitialStorageUpperBound = []; % initial s+ value, or (if ForceCyclicStorage) upper bound on s0 0094 % md.Storage.OutEff = []; % (i,t), output efficency (if empty defaults to 1) 0095 % md.Storage.InEff = []; % (i,t), output efficency (if empty defaults to 1) 0096 % md.Storage.InitialStorageCost = []; % this is the cost of s0 (not adjusted for output efficiency) 0097 % md.Storage.TerminalStoragePrice = []; % applied to psc_tij0, psd_tij0 (non-terminal states) 0098 % md.Storage.TerminalChargingPrice0 = []; % applied to psc_tij0 (end-of-horizon terminal states) 0099 % md.Storage.TerminalDischargingPrice0 = []; % applied to psd_tij0 (end-of-horizon terminal states) 0100 % md.Storage.TerminalChargingPriceK = []; % applied to psc_tijk (contingency terminal states) 0101 % md.Storage.TerminalDischargingPriceK = []; % applied to psd_tijk (contingency terminal states) 0102 % md.Storage.LossFactor = []; % (i,t), fraction of storage lost per hour 0103 % % if empty, defaults to lossless (all zeros) 0104 % md.Storage.rho = []; % (i,t), varies bounding of storage dispatches between being 0105 % % based on worst case (rho=1) vs. expected (rho=0) stored energy 0106 % % at beginning of period 0107 % % Note: MinStorageLevel, MaxStorageLevel, InEff, OutEff, LossFactor and rho 0108 % % are optionally expanded automatically in most() from scalar, 0109 % % ns x 1, or 1 x nt to ns x nt matrix. 0110 % 0111 % md.idx.nt = []; 0112 % md.cont(1,1).contab = []; 0113 % md.tstep(1).OpCondSched(1).tab = []; 0114 % md.tstep(1).TransMat = []; % tstep(t).TransMat(j(t), j(t-1)). 0115 % % Note that for cyclic or terminal state 0116 % % problems, data for t=nt+1 is needed for 0117 % % this matrix! 0118 % md.tstep(1).TransMask = []; % Same format as TransMat, mask indicating 0119 % % whether to include transition in ramp reserve. 0120 % md.tstep(1).Li = sparse(0,0); % These 8 for computing expected storage states 0121 % md.tstep(1).Lf = sparse(0,0); 0122 % md.tstep(1).Mg = sparse(0,0); 0123 % md.tstep(1).Mh = sparse(0,0); 0124 % md.tstep(1).Ng = sparse(0,0); 0125 % md.tstep(1).Nh = sparse(0,0); 0126 % md.tstep(1).G = sparse(0,0); 0127 % md.tstep(1).H = sparse(0,0); 0128 % md.tstep(1).E = sparse(0,0); % To compute expected injections in t-th period 0129 % 0130 % md.dstep(1).A = sparse(0,0); 0131 % md.dstep(1).B = sparse(0,0); 0132 % md.dstep(1).C = sparse(0,0); 0133 % md.dstep(1).D = sparse(0,0); 0134 % md.dstep(1).zmax = []; 0135 % md.dstep(1).zmin = []; 0136 % md.dstep(1).ymax = []; 0137 % md.dstep(1).ymin = []; 0138 % md.idx.ntds = []; % Number of periods in the dynamical system horizon 0139 % md.z1 = []; % Initial state (t=1) 0140 % 0141 % %%----- internally created data: ----- 0142 % %% (1) Indexing mechanism 0143 % md.idx.nj = []; 0144 % md.idx.nc = []; 0145 % md.idx.nb = []; 0146 % md.idx.nb_total = []; 0147 % md.idx.ng = []; 0148 % md.idx.nf_total = []; 0149 % md.idx.ns = []; 0150 % md.idx.ns_total = []; 0151 % md.idx.nzds = []; % size of state vector for dynamical system 0152 % md.idx.nyds = []; 0153 % md.idx.ntramp = []; % number of periods of load following reserves 0154 % % md.idx.thbas = []; 0155 % % md.idx.thend = []; 0156 % % md.idx.pbas = []; 0157 % % md.idx.pend = []; % (t,j,k) 0158 % % md.idx.dppbas = []; % (t,j,k) 0159 % % md.idx.dppend = []; % (t,j,k) 0160 % % md.idx.dpmbas = []; % (t,j,k) 0161 % % md.idx.dpmend = []; % (t,j,k) 0162 % % md.idx.ybas = []; % (t,j,k) 0163 % % md.idx.yend = []; % (t,j,k) 0164 % % md.idx.pcbas = []; % (t) 0165 % % md.idx.pcend = []; % (t) 0166 % % md.idx.rppbas = []; % (t) 0167 % % md.idx.rppend = []; % (t) 0168 % % md.idx.rpmbas = []; % (t) 0169 % % md.idx.rpmend = []; % (t) 0170 % % md.idx.pscbas = []; % (t,j,k) 0171 % % md.idx.pscend = []; % (t,j,k) 0172 % % md.idx.psdbas = []; % (t,j,k) 0173 % % md.idx.psdend = []; % (t,j,k) 0174 % % md.idx.rrpbas = []; % (t) 0175 % % md.idx.rrpend = []; % (t) 0176 % % md.idx.rrmbas = []; % (t) 0177 % % md.idx.rrmend = []; % (t) 0178 % % md.idx.spbas = []; % (t) 0179 % % md.idx.spend = []; % (t) 0180 % % md.idx.smbas = []; % (t) 0181 % % md.idx.smend = []; % (t) 0182 % % md.idx.s0bas = []; % (1:ns) 0183 % % md.idx.s0end = []; % (i:ns) 0184 % % md.idx.ubas = []; % (t) 0185 % % md.idx.uend = []; % (t) 0186 % % md.idx.wbas = []; % (t) 0187 % % md.idx.wend = []; % (t) 0188 % % md.idx.vbas = []; % (t) 0189 % % md.idx.vend = []; % (t) 0190 % % md.idx.qbas = []; % (t) 0191 % % md.idx.qend = []; % (t) 0192 % % md.idx.netbas = []; % (t,j,k) 0193 % % md.idx.netend = []; % (t,j,k) 0194 % % md.idx.lfbas = []; % (t,j,k) 0195 % % md.idx.lfend = []; % (t,j,k) 0196 % % md.idx.lstibas = []; % (t,j,k) 0197 % % md.idx.lstiend = []; % (t,j,k) 0198 % % md.idx.Aybas = []; % (t,j) 0199 % % md.idx.Ayend = []; % (t,j) 0200 % % md.idx.lc1bas = []; % (t) 0201 % % md.idx.lc1end = []; % (t) 0202 % % md.idx.lc2bas = []; % (t) 0203 % % md.idx.lc2end = []; % (t) 0204 % % md.idx.lc3bas = []; % (t,j,k) 0205 % % md.idx.lc3end = []; % (t,j,k) 0206 % % md.idx.lc5bas = []; % (t,j,k) 0207 % % md.idx.lc5end = []; % (t,j,k) 0208 % % md.idx.lc6bas = []; % (t,j,k) 0209 % % md.idx.lc6end = []; % (t,j,k) 0210 % % md.idx.lc7bas = []; % (t,j,k) 0211 % % md.idx.lc7end = []; % (t,j,k) 0212 % % md.idx.lc8bas = []; % (t,j,k) 0213 % % md.idx.lc8end = []; % (t,j,k) 0214 % % md.idx.lc9bas = []; % (t,j,k) 0215 % % md.idx.lc9end = []; % (t,j,k) 0216 % % md.idx.lc10bas = []; % (t,j,k) 0217 % % md.idx.lc10end = []; % (t,j,k) 0218 % % md.idx.lc21bas = []; % (t,jt,j(t+1)) 0219 % % md.idx.lc21end = []; % (t,jt,j(t+1)) 0220 % % md.idx.lc22bas = []; % (t) 0221 % % md.idx.lc22end = []; % (t) 0222 % % md.idx.lc23bas = []; % (t,jt,j(t+1)) 0223 % % md.idx.lc23end = []; % (t,jt,j(t+1)) 0224 % % md.idx.lc24bas = []; % (t) 0225 % % md.idx.lc24end = []; % (t) 0226 % % md.idx.lc31bas = []; % (t) 0227 % % md.idx.lc31end = []; % (t) 0228 % % md.idx.lc32bas = []; % (t) 0229 % % md.idx.lc32end = []; % (t) 0230 % % md.idx.lc33bas = []; % (t) 0231 % % md.idx.lc33end = []; % (t) 0232 % % md.idx.lc34bas = []; % (t,j) 0233 % % md.idx.lc34end = []; % (t,j) 0234 % % md.idx.lc35bas = []; % (t,j) 0235 % % md.idx.lc35end = []; % (t,j) 0236 % % md.idx.lc36bas = []; % (t,j) 0237 % % md.idx.lc36end = []; % (t,j) 0238 % % md.idx.lc37bas = []; % (t,j) 0239 % % md.idx.lc37end = []; % (t,j) 0240 % % md.idx.lc38bas = []; % 0241 % % md.idx.lc38end = []; % 0242 % % md.idx.lc40bas = []; % (t) 0243 % % md.idx.lc40end = []; % (t) 0244 % % md.idx.lc41bas = []; % (t) 0245 % % md.idx.lc41end = []; % (t) 0246 % % md.idx.lc50bas = []; % (t) 0247 % % md.idx.lc50end = []; % (t) 0248 % % md.idx.lc51bas = []; % (i,t) 0249 % % md.idx.lc51end = []; % (i,t) 0250 % % md.idx.lc52bas = []; % (i,t) 0251 % % md.idx.lc52end = []; % (i,t) 0252 % % md.idx.lc53bas = []; % (t,j,k) 0253 % % md.idx.lc53end = []; % (t,j,k) 0254 % % md.idx.lc54bas = []; % (t,j,k) 0255 % % md.idx.lc54end = []; % (t,j,k) 0256 % % md.idx.lc55bas = []; % (t,j,k) 0257 % % md.idx.lc55end = []; % (t,j,k) 0258 % % md.idx.lc56bas = []; % (t,j,k) 0259 % % md.idx.lc56end = []; % (t,j,k) 0260 % 0261 % md.flow(1,1,1).mpc = md.mpc; 0262 % md.DCMODEL = []; % DC flow used to model the network as opposed 0263 % % to simple generation = demand constraint 0264 % % (set via mpopt.most.dc_line) 0265 % md.SecurityConstrained = []; % contingencies cases considered 0266 % % (set via mpopt.most.security_constraints and 0267 % % presence (or not) of contingency data) 0268 % md.Storage.ForceExpectedTerminalStorage = []; % flag, 0 or 1, terminal storage target included 0269 % md.Storage.ForceCyclicStorage = []; % 1 = includes cyclic constraint (initial storage 0270 % % is a var = final expected storage), 0 = does not include 0271 % md.UC.run = []; % 1 = run the unit commitment, 0 = don't 0272 % md.alpha = []; % defines when during period contingencies happen 0273 % 0274 % %% (2) QP problem 0275 % md.QP.A = sparse(0,0); 0276 % md.QP.l = []; 0277 % md.QP.u = []; 0278 % md.QP.xmin = []; 0279 % md.QP.xmax = []; 0280 % md.QP.vtype = ''; 0281 % md.QP.H = sparse(0,0); 0282 % md.QP.C1 = []; 0283 % md.QP.c1 = []; 0284 % md.QP.C = []; 0285 % md.QP.Cfstor = []; 0286 % md.CoordCost.Huser = sparse(0,0); 0287 % md.CoordCost.Cuser = []; 0288 % md.CoordCost.cuser = []; 0289 % md.QP.x = []; 0290 % md.QP.f = []; 0291 % md.QP.exitflag = []; 0292 % md.QP.output = []; 0293 % md.QP.lambda = []; 0294 % md.QP.opt = []; 0295 % 0296 % %%----- result data ----- 0297 % md.results.f = []; 0298 % md.results.Pc = []; 0299 % md.results.Rpp = []; 0300 % md.results.Rpm = []; 0301 % md.results.Rrp = []; 0302 % md.results.Rrm = []; 0303 % md.results.Sp = []; 0304 % md.results.Sm = []; 0305 % md.results.GenPrices = []; 0306 % md.results.CondGenPrices = []; 0307 % md.results.RrpPrices = []; 0308 % md.results.RrmPrices = []; 0309 % md.results.ExpectedRampCost = []; 0310 % md.results.SetupTime = []; 0311 % md.results.SolveTime = []; 0312 % md.results.Z = []; 0313 % md.results.Y = []; 0314 % 0315 % md.CostWeights = []; % (k,j,t) !!!! NOTE order! So that (:,:,t) 0316 % % refers to t-th period 0317 % md.CostWeightsAdj = []; % (k,j,t) !!!! NOTE order! So that (:,:,t) 0318 % % refers to t-th period 0319 % md.StepProb = []; % (t) - probability of making it to the t-th step 0320 % md.Storage.ExpectedStorageState = []; 0321 % md.Storage.ExpectedStorageDispatch = [];