Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
ITCPG.jl
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Julian Stuermer
ITCPG.jl
Commits
87de6181
Commit
87de6181
authored
4 years ago
by
Julian Stürmer
Browse files
Options
Downloads
Patches
Plain Diff
Add get_bustypes
parent
0c8d4e94
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/Data.jl
+46
-2
46 additions, 2 deletions
src/Data.jl
with
46 additions
and
2 deletions
src/Data.jl
+
46
−
2
View file @
87de6181
...
@@ -45,11 +45,11 @@ function getlocs(network_data::Dict{String,<:Any}; getlims=false)
...
@@ -45,11 +45,11 @@ function getlocs(network_data::Dict{String,<:Any}; getlims=false)
lats
=
[
lats
=
[
network_data
[
"bus"
][
"
$
i"
][
"bus_lat"
]
network_data
[
"bus"
][
"
$
i"
][
"bus_lat"
]
for
i
in
keys
(
network_data
[
"bus"
])
for
i
in
keys
(
network_data
[
"bus"
])
]
]
# latitudes
lons
=
[
lons
=
[
network_data
[
"bus"
][
"
$
i"
][
"bus_lon"
]
network_data
[
"bus"
][
"
$
i"
][
"bus_lon"
]
for
i
in
keys
(
network_data
[
"bus"
])
for
i
in
keys
(
network_data
[
"bus"
])
]
]
# longitudes
xlims
=
(
minimum
(
lons
),
maximum
(
lons
))
xlims
=
(
minimum
(
lons
),
maximum
(
lons
))
ylims
=
(
minimum
(
lats
),
maximum
(
lats
))
ylims
=
(
minimum
(
lats
),
maximum
(
lats
))
return
pos
,
xlims
,
ylims
return
pos
,
xlims
,
ylims
...
@@ -57,3 +57,47 @@ function getlocs(network_data::Dict{String,<:Any}; getlims=false)
...
@@ -57,3 +57,47 @@ function getlocs(network_data::Dict{String,<:Any}; getlims=false)
return
pos
return
pos
end
end
end
end
#*------------------------------------------------------------------------------
#=
Returns the bus types of all buses in the NDD in form a dictionary. The different bus types are "load", "gen" (generator), "load_and_gen" and "empty".
=#
function
get_bustypes
(
network_data
::
Dict
{
String
,
<:
Any
})
### Active loads
loads
=
unique
(
[
load
[
"load_bus"
]
for
(
i
,
load
)
in
network_data
[
"load"
]
if
load
[
"status"
]
==
1
]
)
### Active generators
gens
=
unique
(
[
gen
[
"gen_bus"
]
for
(
i
,
gen
)
in
network_data
[
"gen"
]
if
gen
[
"gen_status"
]
==
1
]
)
### Buses with both load and generation
load_and_gen
=
[
i
for
i
in
loads
if
i
in
gens
]
### Remove buses with load and generation from pure loads and generators
filter!
(
i
->
i
∉
load_and_gen
,
loads
)
filter!
(
i
->
i
∉
load_and_gen
,
gens
)
### Empty buses with neither load nor generation
empty
=
unique
(
[
bus
[
"index"
]
for
(
i
,
bus
)
in
network_data
[
"bus"
]
if
bus
[
"index"
]
∉
vcat
(
loads
,
gens
,
load_and_gen
)]
)
### Check whether the right number of bus types was obtained
sum
=
(
length
(
loads
)
+
length
(
gens
)
+
length
(
load_and_gen
)
+
length
(
empty
))
N
::
Int64
=
length
(
network_data
[
"bus"
])
# number of buses
@assert
sum
==
N
"
$
sum bus types were obtained instead of
$
N"
return
Dict
(
"loads"
=>
loads
,
"gens"
=>
gens
,
"load_and_gen"
=>
load_and_gen
,
"empty"
=>
empty
)
end
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment