Sienna-Platform / Sienna-Platform/PowerOperationsModels.jl

Combine Active/Reactive device constructors

Open
#165 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement question
Dominant language
Julia
Stars
2
Forks
1
Avg merge
1d 16h
Merged PRs (30d)
26

Description

Currently there's a number of device constructors that have reactive and non-reactive formulations where the reactive formulation is a strict superset of the non-reactive. I experimented in the past with making some helpers like _maybe_add_reactive... which unfortunately ended up in https://github.com/Sienna-Platform/PowerOperationsModels.jl/blob/main/src/common_models/network_conditional.jl which I would like removed ASAP.

I had Claude sketch a plan in https://github.com/Sienna-Platform/PowerOperationsModels.jl/tree/ac/reactive-refactor that I haven't examined closely yet. The important parts are:

on_reactive_power(f::F, ::NetworkModel{<:AbstractPowerModel}) where {F} = f()
on_reactive_power(::F, ::NetworkModel{<:AbstractActivePowerModel}) where {F} = nothing

and then for example

on_reactive_power(network_model) do
    add_variables!(container, ReactivePowerVariable, devices, D)
    add_to_expression!(
        container,
        ReactivePowerBalance,
        ReactivePowerVariable,
        devices,
        model,
        network_model,
    )
end

The diff is hard to tell right now, but looks like roughly ~1700 LOC removed and ~500 LOC added. My guess though is it slightly hurts precompilation time because now both branches have to be compiled?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing src/common_models/network_conditional.jl and the reactive-refactor plan linked in the issue, then inspect the affected active and reactive constructors. Consolidate the constructor paths without the obsolete helper approach, preserving behavior for both network-model variants and evaluating the possible precompilation impact.

Written by the indexing model from the issue text.

Assessment

Tech stack
julia
Domain
backend
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.