Skip to content

Commit

Permalink
fixed small errors in DC docs
Browse files Browse the repository at this point in the history
  • Loading branch information
mcosovic committed Jul 31, 2023
1 parent dacdaac commit 4ebfb95
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 20 deletions.
12 changes: 6 additions & 6 deletions docs/src/manual/dcOptimalPowerFlow.md
Original file line number Diff line number Diff line change
Expand Up @@ -340,17 +340,17 @@ model.power.from.active

##### Powers Related to Bus
Instead of calculating powers for all components, users have the option to compute specific quantities for particular components. In this regard, the following function can be utilized to calculate active powers associated with a specific bus:
```@example DCOptimalPowerFlowPower
injection = powerInjection(system, model; label = 1)
supply = powerSupply(system, model; label = 1)
```@repl DCOptimalPowerFlowPower
powerInjection(system, model; label = 1)
powerSupply(system, model; label = 1)
```

---

##### Powers Related to Branch
Similarly, we can compute the active powers related to a particular branch using the following function:
```@example DCOptimalPowerFlowPower
from = powerFrom(system, model; label = 2)
to = powerTo(system, model; label = 2)
```@repl DCOptimalPowerFlowPower
powerFrom(system, model; label = 2)
powerTo(system, model; label = 2)
```

19 changes: 10 additions & 9 deletions docs/src/manual/dcPowerFlow.md
Original file line number Diff line number Diff line change
Expand Up @@ -175,31 +175,32 @@ system.base.power.value * model.power.from.active
```

!!! note "Info"
To better understand the powers associated with buses, branches and generators that are calculated by the [`power`](@ref power(::PowerSystem, ::DCPowerFlow)) function, we suggest referring to the tutorials on [DC power flow analysis](@ref DCPowerAnalysisTutorials).
To better understand the powers associated with buses, branches and generators that are calculated by the [`power!`](@ref power!(::PowerSystem, ::DCPowerFlow)) function, we suggest referring to the tutorials on [DC power flow analysis](@ref DCPowerAnalysisTutorials).

---

##### Powers Related to Bus
Instead of calculating powers for all components, users have the option to compute specific quantities for particular components. In this regard, the following function can be utilized to calculate active powers associated with a specific bus:
```@example ComputationPowersCurrentsLosses
injection = powerInjection(system, model; label = 1)
supply = powerSupply(system, model; label = 1)
```@repl ComputationPowersCurrentsLosses
powerInjection(system, model; label = 1)
powerSupply(system, model; label = 1)
```

---

##### Powers Related to Branch
Similarly, we can compute the active powers related to a particular branch using the following function:
```@example ComputationPowersCurrentsLosses
from = powerFrom(system, model; label = 2)
to = powerTo(system, model; label = 2)
```@repl ComputationPowersCurrentsLosses
powerFrom(system, model; label = 2)
powerTo(system, model; label = 2)
```

---

##### Power Related to Generator
Finally, we can compute the active output power of a particular generator using the function:
```@example ComputationPowersCurrentsLosses
generator = powerGenerator(system, model; label = 1)
```@repl ComputationPowersCurrentsLosses
powerGenerator(system, model; label = 1)
```

6 changes: 3 additions & 3 deletions docs/src/tutorials/acOptimalPowerFlow.md
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ V_i - V_{\text{slack}} = 0,\;\;\; i \in \mathcal{N_{\text{sb}}} \\
\theta_i - \theta_{\text{slack}} = 0,\;\;\; i \in \mathcal{N_{\text{sb}}}. \\
\end{aligned}
```
Here, the set ``\mathcal{N}_{\text{sb}}`` contains the index of the slack bus. These constraints are implemented using the `magnitude` and `angle` keywords within the [addBus!](@ref addBus!) function, where the bus is defined as a slack bus (`type = 3`).
Here, the set ``\mathcal{N}_{\text{sb}}`` contains the index of the slack bus. These constraints are implemented using the `magnitude` and `angle` keywords within the [`addBus!`](@ref addBus!) function, where the bus is defined as a slack bus (`type = 3`).

To retrieve the equality constraints from the model, you can access the corresponding variables using the following code:
```@repl ACOptimalPowerFlow
Expand All @@ -179,7 +179,7 @@ h_{P_i}(\mathbf {P}_{\text{g}}, \mathbf {V}, \boldsymbol{\theta}) = 0,\;\;\; \f
\end{aligned}
```

The active power balance equation is derived using the [unified branch model](@ref ACUnifiedBranchModelTutorials) and can be represented as:
The active power balance equation is derived using the [unified branch model](@ref UnifiedBranchModelTutorials) and can be represented as:
```math
h_{P_i}(\mathbf {P}_{\text{g}}, \mathbf {V}, \boldsymbol{\theta}) = {V}_{i}\sum\limits_{j=1}^n {V}_{j} (G_{ij}\cos\theta_{ij}+B_{ij}\sin\theta_{ij}) - \sum_{k=1}^{n_{\text{g}i}} P_{\text{g}k} + P_{\text{d}i}
```
Expand All @@ -196,7 +196,7 @@ Similarly, the next constraint in the optimization problem is associated with th
h_{Q_i}(\mathbf {Q}_{\text{g}}, \mathbf {V}, \boldsymbol{\theta}) = 0,\;\;\; \forall i \in \mathcal{N} \\
\end{aligned}
```
The reactive power balance equation is derived using the [unified branch model](@ref ACUnifiedBranchModelTutorials) and can be represented as:
The reactive power balance equation is derived using the [unified branch model](@ref UnifiedBranchModelTutorials) and can be represented as:
```math
h_{Q_i}(\mathbf {Q}_{\text{g}}, \mathbf {V}, \boldsymbol{\theta}) = {V}_{i}\sum\limits_{j=1}^n {V}_{j} (G_{ij}\sin\theta_{ij}-B_{ij}\cos\theta_{ij}) - \sum_{k=1}^{n_{\text{g}i}} Q_{\text{g}k} + Q_{\text{d}i}
```
Expand Down
6 changes: 4 additions & 2 deletions src/postprocessing/dcAnalysis.jl
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ function powerInjection(system::PowerSystem, model::DCOptimalPowerFlow; label)

injectionActive = copy(-system.bus.demand.active[index])
@inbounds for i in system.bus.supply.generator[index]
injectionActive += model.power.active[i]
injectionActive += model.power.generator.active[i]
end

return injectionActive
Expand Down Expand Up @@ -237,6 +237,8 @@ function powerSupply(system::PowerSystem, model::DCPowerFlow; label)
else
supplyActive = bus.supply.active[index]
end

return supplyActive
end

function powerSupply(system::PowerSystem, model::DCOptimalPowerFlow; label)
Expand All @@ -248,7 +250,7 @@ function powerSupply(system::PowerSystem, model::DCOptimalPowerFlow; label)

supplyActive = 0.0
@inbounds for i in system.bus.supply.generator[index]
supplyActive += model.power.active[i]
supplyActive += model.power.generator.active[i]
end

return supplyActive
Expand Down

0 comments on commit 4ebfb95

Please sign in to comment.