lanl-ansi / gasmodels.jl Goto Github PK
View Code? Open in Web Editor NEWA Julia/JuMP Package for Gas Network Optimization
Home Page: https://lanl-ansi.github.io/GasModels.jl/latest/
License: Other
A Julia/JuMP Package for Gas Network Optimization
Home Page: https://lanl-ansi.github.io/GasModels.jl/latest/
License: Other
When compression ratio >= 1 for compressors, the following constraint can be used to enforce one way direction of compression
f * (1 - \alpha) <= 0.
The reciprocal constraint can be used for control valves.
Note that binary variables are still needed if the min compression is anything other than 1.
Change data format to use a friction factor instead of a resistance. Compute the resistance needed for the mathematical in the constraint template (similar to admittance values in Power Systems).
Create a constraint_template.jl so that parameters of constraints can be passed as variables or constants (or a mix). See PowerModels.jl for an example
Use this as a guide,
https://github.com/lanl-ansi/PowerModels.jl/blob/master/.travis.yml
Adding cacheing back in will help in reading the travis logs.
Probably want to setup Documentor.jl. Even with just some basic.
This is a good example of a minimalist Documentor setup, https://github.com/lanl-ansi/Katana.jl/tree/master/docs
Implement a constraint of the form r * f (\alpha^m-1) \le E to enforce constraints on horsepower for compressors. For backwards compatibility, assume E is infinity of the data is not provided (and don't post the constraint). Also, for now, the current relaxation implementations will complete relax this constraint. (see MISOCP).
In the test/REQUIRE includes,
AmplNLWriter
CoinOptServices
but in runtests there are guards of the form,
if (Pkg.installed("AmplNLWriter") != nothing && Pkg.installed("CoinOptServices") != nothing)
...
end
If AmplNLWriter, CoinOptServices remain in REQUIRE, these guards are not need. Otherwise AmplNLWriter, CoinOptServices should be removed from REQUIRE.
On a side note, I briefly used AmplNLWriter, CoinOptServices in the PowerModels CI, but pulling in the packages ended up taking so long the CI ran out of time! So I stopped using them.
This is at least useful for update_data in this package.
Can be addressed once this PR is merged, JuliaLang/METADATA.jl#14192
This becomes helpful once you start doing PRs.
See this as an example, https://github.com/lanl-ansi/PowerModels.jl/blob/master/.codecov.yml
When running tests there are several of these warnings,
WARNING: filter(flt, itr) is deprecated, use Iterators.filter(flt, itr) instead.
See if these can be resolved.
Consider removing the constraint return values, e.g.,
c1 = @constraint(gm.model, -(1-yp)*gm.ref[:max_flow] <= f)
c2 = @constraint(gm.model, f <= (1-yn)*gm.ref[:max_flow])
return Set([c1, c2])
In PowerModels these were not being used anyone and they were causing a performance issue. So I removed them.
Supporting the concepts of both qlfirm and qlmin/qlmax seems counter intuitive to many people. However, there are some use cases that needed both of these concept. Now that there is support for multiple loads at a junction, it is time to revisit this. It might be possible to support these use cases with multiple loads.
This becomes helpful once you start doing PRs.
See this as an example, https://github.com/lanl-ansi/PowerModels.jl/blob/master/.codecov.yml
This will improve coverage.
Update the docs links to stable
instead of latest
after the first version is tagged.
In the github interface add, a description, keywords, and setup the website to link to the documentation on github pages.
Modify the data model to support multiple load and production objects at every node.
The tag name "v0.1.0" is not of the appropriate SemVer form (vX.Y.Z).
cc: @rb004f
There should be at least one test for these models or they should be moved to a code base where they are used.
To address the request here,
JuliaLang/METADATA.jl#11108
Update the code here,
GasModels.jl/src/core/solution.jl
Line 103 in 0508f62
to be something like this,
https://github.com/lanl-ansi/PowerModels.jl/blob/master/src/core/solution.jl#L155
Questions
The PowerModels convention is,
Modify the compressor and control valve data model so that they (de)compress in only one direction (implied in the from->to direction). If flow goes in the opposite direction, then no (de)compression occurs.
Bi-directional regulation objects will require two sequential objects in the data, one that (de)compresses in one direction and one in the other direction
The internal data structures of GasModels.jl assume all component ids are integers, however the json data input format uses strings for component ids, but all references to these ids use their integer equivalent. This should be unified as strings or integers, not a mix.
In the data file, what do you think about breaking the connections into two separate component lists, pipes and compressors?
See if the functions in relaxation_scheme.jl
are being used. If so, add a test. If not, remove the file.
Consider adding a CHANGELOG.md
file in the root directory to document what changes between versions.
Right now there are separate calls for flux and flux square variable creation. Flux square is just used for in the relaxation model of flux, so we should create these in the MISCOP version of the problem
Hi,
I believe functions run_soc_gf
and run_nl_gf
have a misspell on their definition, calling run_pf
instead of run_gf
. In file GasModels.jl/src/prob/gf.jl one finds the following functions:
" entry point into running the gas flow feasability problem "
function run_gf(file, model_constructor, solver; kwargs...)
return run_generic_model(file, model_constructor, solver, post_gf; kwargs...)
end
""
function run_soc_gf(file, solver; kwargs...)
return run_pf(file, MISOCPGasModel, solver; kwargs...)
end
""
function run_nl_gf(file, solver; kwargs...)
return run_pf(file, MINLPGasModel, solver; kwargs...)
end
When using GasModels in Julia and after defining a solver (with Pavito), executing run_soc_gf("../test/data/gaslib-40.json", solver)
will yield an error whilst running run_soc_gf("../test/data/gaslib-40.json", MISOCPGasModel, solver)
will return results. Both run_soc_gf
and run_nl_gf
call function run_pf
which is undefined in the remainder of the source code.
Hi,
One question regarding the math in the online documentation. Before integration, when writing p dp/dx = - λ a² ϕ |ϕ| / (2 D)
it should be equal to writing d(p²)/dx = - λ a² ϕ |ϕ| / D
. Thus, after integration you should get p²(L) - p²(0) = - L λ a² ϕ |ϕ| / D = - L λ a² f |f| / (A² D)
, however you have an extra ½ in your equations. Am I missing something? If not, the implementation in the code is affected by this ½ factor or is just a glitch in the manual.
Thank you for your work on GasModels.jl and your decision on releasing the code. I'm planning on using it for lecturing purposes, if there is no conflict.
Best regards.
Is Julia v0.6 a strick requirement of GasModels? Based on other reqs it looks like v0.5 would be fine.
Currently, GasModels. jl assumes all input is in the correct units. We need to support different types of units and have "make_per_unit" like function to normalize everything into the correct units.
Consider revising tests so that they pass on os x.
As of Julia v0.5,
if VERSION >= v"0.5.0-dev+7720"
using Base.Test
else
using BaseTestNext
const Test = BaseTestNext
end
Can be replaced with,
using Base.Test
BaseTestNext can then be removed from REQUIRE.
Pattern an update_data function like PowerModels.jl
There seems to be an issue with robustness in runtests.jl. I found that if you have gurobi installed the 6 tests listed below fail. The reason for the failures appears to be a miss-match in the value of the objective function at algorithm termination.
I would guess this is because the solver being used for testing is changed based on which solvers are installed, combined with the fact that the test problems are sufficiently challenging, so the runtime can effect their performance.
Best practice for unit tests is to use open source solvers, and to test on toy models so that the solver algorithm can complete in a few seconds.
Test Summary: | Pass Fail Total
test misocp ne | 42 3 45
A1 MISCOP case | 2 2
A2 MISCOP case | 2 2
A3 MISCOP case | 2 2
gaslib 40 case 10% | 2 2
gaslib 40 case 5% | 2 2
gaslib 40 case 25% | 2 2
gaslib 40 case 50% | 2 2
gaslib 40 case 75% | 2 2
gaslib 40 case 100% | 2 2
gaslib 40 case 125% | 1 1
gaslib 40 case 150% | 1 1
gaslib 135 case 5% | 2 2
gaslib 135 case 10% | 2 2
gaslib 135 case 25% | 2 2
gaslib 135 case 50% | 2 2
gaslib 135 case 75% | 2 2
gaslib 135 case 100% | 2 2
gaslib 135 case 125% | 1 1
gaslib 135 case 150% | 1 1
gaslib 135 case 200% | 1 1
gaslib 582 case 5% | 1 1 2
gaslib 582 case 10% | 2 2
gaslib 582 case 25% | 1 1 2
gaslib 582 case 50% | 1 1 2
gaslib 582 case 200% | 1 1
gaslib 582 case 300% | 1 1
variable definitions like this,
gm.var[:p] = @variable(gm.model,
gm.ref[:junction][i]["pmin"]^2 <= p[i in keys(gm.ref[:junction])] <= gm.ref[:junction][i]["pmax"]^2,
start = getstart(gm.ref[:junction], i, "p_start", gm.ref[:junction][i]["pmin"]^2)
)
return gm.var[:p]
should be changed to this format so that the variables in the JuMP model are anonymous.
gm.var[:p] = @variable(gm.model,
[i in keys(gm.ref[:junction])], basename="p",
lowerbound = gm.ref[:junction][i]["pmin"]^2,
upperbound = gm.ref[:junction][i]["pmax"]^2,
start = getstart(gm.ref[:junction], i, "p_start", gm.ref[:junction][i]["pmin"]^2)
)
return gm.var[:p]
The key point is that the variable index set do does not have an identifier in front of it.
On a related note, the current convention in PowerModels is not to return anything in variable_
and constraint_
functions.
Hi,
In the definitions for the friction and resistance terms, functions calc_pipe_resistance_thorley
and calc_resistor_resistance_simple
in
src/core/data.jl, the cross-sectional area is being computed as:
A = (pi*D) / 4 # cross sectional area
instead of
A = (pi*D^2) / 4 # cross sectional area
Considering that the resistance term is computed as,
resistance = ( (D * A^2) / (lambda * L * a_sqr)) * (data["baseP"]^2 / data["baseQ"]^2)
and the dimensions of baseQ
are mass/time, the resistance term will be dimensionless only if the dimensions of A
are m^2
instead of m
. Unless there is some discrepancy in dimensions I am not understanding.
Best regards.
The CodeCov reports do not seem to be going through. Double check the settings at the end of the travis file are correct. Most likely the token information is out of date.
Is this file needed in the root directory? It seems that SCIP is not used in the tests.
CoinOptServices is effectively deprecated.
Is it possible to move to Juniper and/or POD for tests?
Probably extending the JuMP version to JuMP 0.17 0.19-
will still be fine. The METADATA managers prefer the widest possible version bounds.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.