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

Replace parameterized type variables #1012

Merged
merged 4 commits into from
Sep 22, 2023
Merged

Conversation

daniel-thom
Copy link
Contributor

This PR allows SnoopCompile.jl to generate precompile statements for PowerSimulations.jl. In many cases I removed unused parameterized type variables. In other cases they were being used and I replaced uses with typeof(x). There should not be any functional or performance difference.

If this change is approved, I can move forward with integrating SnoopCompile.jl with this package in a separate branch. The only other realistic alternative is to report an issue with SnoopCompile.jl and see if they can help.

@daniel-thom daniel-thom requested a review from jd-lara September 21, 2023 21:12
@daniel-thom daniel-thom marked this pull request as draft September 21, 2023 21:12
get_available_components(T, sys, get_attribute(model, "filter_function"))
add_parameters!(container, ActivePowerTimeSeriesParameter, devices, model)
get_available_components(T, sys, get_attribute(device_model, "filter_function"))
add_parameters!(container, ActivePowerTimeSeriesParameter, devices, device_model)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This was an existing bug because model was not defined. Please confirm the fix.

Copy link
Member

Choose a reason for hiding this comment

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

This is a bug

Copy link
Member

@jd-lara jd-lara left a comment

Choose a reason for hiding this comment

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

I made some comments that need to be implemented across. Particularly the use of get_network_formulation

D <: AbstractThermalDispatchFormulation,
S <: PM.AbstractActivePowerModel,
}
model::DeviceModel{T, <:AbstractThermalDispatchFormulation},
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Changes to DeviceModel were not required. However, since these type variables were not used, I removed them.

Copy link
Member

Choose a reason for hiding this comment

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

That's ok

container,
devices,
device_model,
typeof(network_model).parameters[1],
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This was an existing bug because S was not defined. Please confirm the change.

Copy link
Member

Choose a reason for hiding this comment

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

This is correct. We probably should extend the tests to cover this area of the code

D <: AbstractThermalDispatchFormulation,
S <: PM.AbstractActivePowerModel,
}
model::DeviceModel{T, <:AbstractThermalDispatchFormulation},
Copy link
Member

Choose a reason for hiding this comment

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

That's ok

container,
devices,
device_model,
get_network_formulation(network_model)
Copy link
Contributor

Choose a reason for hiding this comment

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

[JuliaFormatter] reported by reviewdog 🐶

Suggested change
get_network_formulation(network_model)
get_network_formulation(network_model),

@daniel-thom daniel-thom force-pushed the dt/remove-unused-variables branch from e7b38ae to 4b23a31 Compare September 21, 2023 21:23
This change allows SnoopCompile.jl to generate precompile statements.
For a reason unknown as of now, SnoopCompile.jl generates invalid
statements for PowerModels.AbstractPowerModel and
PowerModels.AbstractActivePowerModel when type variables are used.
@daniel-thom daniel-thom force-pushed the dt/remove-unused-variables branch from 4b23a31 to 0eacd45 Compare September 21, 2023 22:14
@github-actions
Copy link
Contributor

github-actions bot commented Sep 21, 2023

Performance Results

Version Precompile Time
Main 8.745847526
This Branch 8.735026821
Version Build Time
Main-Build Time Precompile 75.111606593
Main-Build Time Postcompile 4.924087628
This Branch-Build Time Precompile 77.713546843
This Branch-Build Time Postcompile 4.977848639

@codecov
Copy link

codecov bot commented Sep 21, 2023

Codecov Report

Merging #1012 (d00da1e) into main (3cfd046) will decrease coverage by 0.01%.
Report is 2 commits behind head on main.
The diff coverage is 91.17%.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1012      +/-   ##
==========================================
- Coverage   79.94%   79.94%   -0.01%     
==========================================
  Files         116      116              
  Lines       12338    12337       -1     
==========================================
- Hits         9864     9863       -1     
  Misses       2474     2474              
Flag Coverage Δ
unittests 79.94% <91.17%> (-0.01%) ⬇️

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

Files Changed Coverage Δ
...els/device_constructors/constructor_validations.jl 100.00% <ø> (ø)
...evice_constructors/regulationdevice_constructor.jl 42.10% <0.00%> (ø)
...s_models/device_constructors/branch_constructor.jl 79.79% <88.88%> (ø)
...vice_constructors/thermalgeneration_constructor.jl 98.31% <94.11%> (ø)
...els/device_constructors/hvdcsystems_constructor.jl 100.00% <100.00%> (ø)
...ces_models/device_constructors/load_constructor.jl 100.00% <100.00%> (ø)
...ce_constructors/renewablegeneration_constructor.jl 92.72% <100.00%> (ø)

... and 17 files with indirect coverage changes

@daniel-thom daniel-thom marked this pull request as ready for review September 21, 2023 23:16
@jd-lara jd-lara merged commit 78f47b2 into main Sep 22, 2023
8 checks passed
@jd-lara jd-lara self-assigned this Sep 22, 2023
@jd-lara jd-lara deleted the dt/remove-unused-variables branch September 22, 2023 23:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants