Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ac/documentation branch #1209

Closed

Conversation

annacasavant
Copy link

@annacasavant annacasavant commented Nov 5, 2024

Overhauled the Manipulating Data Sets Tutorial following the Diataxis guidelines.

@kdayday

Copy link

codecov bot commented Nov 5, 2024

Codecov Report

Attention: Patch coverage is 83.33333% with 4 lines in your changes missing coverage. Please review.

Project coverage is 84.45%. Comparing base (a603b75) to head (4eb8b54).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
src/models/generated/InterconnectingConverter.jl 50.00% 2 Missing ⚠️
src/models/cost_function_timeseries.jl 75.00% 1 Missing ⚠️
src/models/cost_functions/MarketBidCost.jl 90.90% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1209      +/-   ##
==========================================
+ Coverage   84.37%   84.45%   +0.08%     
==========================================
  Files         181      181              
  Lines        8382     8278     -104     
==========================================
- Hits         7072     6991      -81     
+ Misses       1310     1287      -23     
Flag Coverage Δ
unittests 84.45% <83.33%> (+0.08%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
src/PowerSystems.jl 0.00% <ø> (ø)
src/base.jl 88.87% <100.00%> (ø)
src/models/generated/TwoTerminalHVDCLine.jl 100.00% <100.00%> (+6.89%) ⬆️
src/models/supplemental_constructors.jl 28.57% <ø> (-6.43%) ⬇️
src/parsers/power_models_data.jl 91.98% <ø> (ø)
src/parsers/power_system_table_data.jl 82.36% <100.00%> (+0.29%) ⬆️
src/models/cost_function_timeseries.jl 79.16% <75.00%> (-0.84%) ⬇️
src/models/cost_functions/MarketBidCost.jl 84.84% <90.90%> (-3.53%) ⬇️
src/models/generated/InterconnectingConverter.jl 93.33% <50.00%> (-0.79%) ⬇️
---- 🚨 Try these New Features:

@kdayday kdayday self-requested a review November 8, 2024 16:39
Copy link
Contributor

@kdayday kdayday left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's discuss these changes, and figure out what to do with the get_buses sections. Thanks!

@@ -0,0 +1,303 @@
# Manipulating Static Data Sets using `get_component` and `set_*`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# Manipulating Static Data Sets using `get_component` and `set_*`
# Manipulating Data Sets


!!! note "Static vs Dynamic Data"

Static and dynamic data can be manipulated using the `get_*` and `set_*` functions. However, it is important to note their differences. Static data encompasses all data necessary to run a steady state model. Dynamic data encompasses the data necessary to run a transient model.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this is a focus here, so let's remove this note.


`PowerSystems` returns Julia iterators in order to avoid unnecessary memory allocations. The `get_*` and `set_*` functions are used as iterators to loop through data fields to access or set specific parameters. However, when using the `get_*` function you can use `collect` to return a vector.

We are going to begin by loading in a test case from the `PowerSystemCaseBuilder`, see the reference for [PSCB](https://nrel-sienna.github.io/PowerSystems.jl/stable/how_to/powersystembuilder/#psb).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
We are going to begin by loading in a test case from the `PowerSystemCaseBuilder`, see the reference for [PSCB](https://nrel-sienna.github.io/PowerSystems.jl/stable/how_to/powersystembuilder/#psb).
We are going to begin by loading in a test case from the [`PowerSystemCaseBuilder.jl`](https://nrel-sienna.github.io/PowerSystems.jl/stable/how_to/powersystembuilder/#psb):

sys = build_system(PSISystems, "c_sys5_pjm")
```

Recall that we can see the components of our system simply by printing it.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Recall that we can see the components of our system simply by printing it.
Notice this system contains various [static](@ref S) components, including 5 [ThermalStandard](@ref) generators.


Recall that we can see the components of our system simply by printing it.

```@repl system
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's remove this print statement, since the system was just printed above. Might not be the right fit for this tutorial after all, since we're not adding components


```@repl system
get_units_base(sys)
```
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need a specific reflection statement here about what the data just showed above means in this unit base

show_components(ThermalStandard, sys, [:active_power, :reactive_power])
```

We can see that our values have changed, based on the unit base our system is in.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

More specific here -- explain an actual example

Now when we look at our `active_power` and `reactive_power` we can see that they have changed.

```@repl system
show_components(ThermalStandard, sys, [:active_power, :reactive_power])
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Show Base power again, so you can see it hasn't changed?


Now lets focus on accessing all `ACBus` components and adjusting their base voltages. We can access all the buses in the system using two key function, `get_components`, which we have already seen, and `get_buses` which we will dive into now.

### Iterator Approach
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's remove this section. We should be using power systems functions to get iterators -- that's either get_buses or get_components in case

Now let's set all of our thermal generators to unavailable.

```@repl system
for i in thermal_iter
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Check with function dot notation also works here

@annacasavant annacasavant closed this by deleting the head repository Nov 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants