building on top of a PowerModelsDistribution JuMP model #362
-
Hello, I would like to combine an existing set of constraints and an objective with various the power flow models that this package provides. The power injections at various nodes in the network are decision variables in the problem that I have defined, and I want those power injections to obey the power flow constraints. How would I go about building such a model? For example, say I have built a power flow model using this package (and an OpenDSS file), then where would I find the appropriate JuMP variable reference for the power injection on a given phase and node? (So that I can set the variable from this package equal to to the variable in my set of constraints and objective). A helpful starting place would be to point me towards the definitions of all the symbols in the following: julia> typeof(pm)
LPUBFDiagPowerModel
julia> keys(pm.var[:it][:pmd][:nw][0])
KeySet for a Dict{Symbol, Any} with 28 entries. Keys:
:p
:CCdi
:CCdr
:se
:qsw
:ps
:w
:qs
:qg_bus
:Xdi
:sc
:Qt
:qg
:qsc
:pt
:qd
:pg_bus
:sd
:q
:Xdr
:Pt
:psw
:qt
:qd_bus
:ccms
:pg
:pd
:pd_bus These symbols access various |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 1 reply
-
Hi, Regarding the variables you mentioned above, I know the following by heart:
If you use a formulation with current variables, then you have similar as above, but for current, where "d" still indicates demand, "s" storage, etc. I think that in general capital letters indicate that the variable is in matrix form, which can be the case in conic formulations, although I am not 100% sure this is the rigorous definition of the capital letter notation. I keep forgetting which is which between :pg_bus and :pg, :pd_bus and :pd, etc. but they have to do with the generators and load models, and I think that if you simply want to model power injections that are not voltage dependent, they are equivalent. Note that while :pd and :qd appear in the variable list, they are not effectively problem variables (at least in the powerflow and in the opf prob variants that I am familiar with in PMD). For example, here they are kind of just "containers". If you want a continuous :pd variable you'll have to write yourself like I did for the package above, as I am pretty sure that it does not exist in PMD. If you want it binary, i.e., you switch something on/off, you can do something like this. The names of the variables above I got to know by going through the code of each constraint and the variables this calls, line by line. The docstrings normally are clear enough to understand what's going on, and the notation is consistent, i.e., "p" is always active power, and is always followed by an indication of the component it refers to , e.g., "s" storage, and so forth. I am not sure there is another efficient way to do that atm. But I think doing it this way really makes you aware of the maths and the details of what you are doing, which is something that I guess you have to go through often times when debugging anyway :). |
Beta Was this translation helpful? Give feedback.
-
PS: |
Beta Was this translation helpful? Give feedback.
-
I am planning to release a tutorial on how to do exactly this (example with external EV model linked to power injections in a PMD network model) in early October, because I believe this is a common use case for people interested in this package. I will post a link here when it is ready |
Beta Was this translation helpful? Give feedback.
Hi,
I am not one of the PMD developers, but perhaps I can give a couple hints, as I had to do something similar in the past for a package I built.
Basically, I create my own
prob
for different power flow formulations, where demand (injection) is a variable in my case, too.For instance, for the ACR and ACP prob formulations the variable is here, for the IVR is here, and so on.
And the variables I defined respectively here and here.
Regarding the variables you mentioned above, I know the following by heart: