Skip to content

Commit

Permalink
refactored code for improved structure and reduced memory allocations
Browse files Browse the repository at this point in the history
  • Loading branch information
mcosovic committed Sep 30, 2024
1 parent 86ce441 commit b69ac95
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/powerSystem/generator.jl
Original file line number Diff line number Diff line change
Expand Up @@ -303,8 +303,12 @@ function updateGenerator!(system::PowerSystem; label::IntStrMiss, kwargs...)
end
if statusOld == 0
gen.layout.inservice += 1
position = searchsortedfirst(bus.supply.generator[idxBus], idx)
insert!(bus.supply.generator[idxBus], position, idx)
if haskey(bus.supply.generator, idxBus)
position = searchsortedfirst(bus.supply.generator[idxBus], idx)
insert!(bus.supply.generator[idxBus], position, idx)
else
bus.supply.generator[idxBus] = [idx]
end
end
end
gen.layout.status[idx] = statusNew
Expand Down

0 comments on commit b69ac95

Please sign in to comment.