From 896d2215517275317fad4c0982094ef482292484 Mon Sep 17 00:00:00 2001 From: Oscar Dowson Date: Thu, 23 Jul 2026 15:37:39 +1200 Subject: [PATCH] Add PrecompileTools.jl --- Project.toml | 4 +++- src/PowerOperationsModels.jl | 2 ++ src/precompile_tools.jl | 11 +++++++++++ 3 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 src/precompile_tools.jl diff --git a/Project.toml b/Project.toml index fa73c032..0b5a2531 100644 --- a/Project.toml +++ b/Project.toml @@ -15,6 +15,7 @@ LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" Logging = "56ddb016-857b-54e1-b83d-db4d58db5568" PowerNetworkMatrices = "bed98974-b02a-5e2f-9fe0-a103f5c450dd" PowerSystems = "bcd98974-b02a-5e2f-9ee0-a103f5c450dd" +PrecompileTools = "aea7be01-6a6a-4083-8856-8a6e6704d82a" PrettyTables = "08abe8d2-0d0c-5749-adfa-8a2ac140af0d" ProgressMeter = "92933f4c-e287-5a05-a399-4b506db050ca" Serialization = "9e88b42a-f829-5b0c-bbe9-9e923198166b" @@ -39,9 +40,10 @@ DocStringExtensions = "~0.8, ~0.9" InfrastructureSystems = "3" InteractiveUtils = "1.11.0" JuMP = "^1.28" -PowerSystems = "^5.10" PowerFlows = "0.21, 0.22" PowerNetworkMatrices = "^0.24" +PowerSystems = "^5.10" +PrecompileTools = "1" PrettyTables = "3" ProgressMeter = "1.11.0" TimerOutputs = "~0.5" diff --git a/src/PowerOperationsModels.jl b/src/PowerOperationsModels.jl index 7e0d2551..3263eb3d 100644 --- a/src/PowerOperationsModels.jl +++ b/src/PowerOperationsModels.jl @@ -973,4 +973,6 @@ export PostContingencyBranchRatingTimeSeriesParameter # Network model capability traits (IOM default + POM overrides in core/network_formulations.jl) export branches_modeled +include("precompile_tools.jl") + end diff --git a/src/precompile_tools.jl b/src/precompile_tools.jl new file mode 100644 index 00000000..3ea76840 --- /dev/null +++ b/src/precompile_tools.jl @@ -0,0 +1,11 @@ +import PrecompileTools + +PrecompileTools.@setup_workload begin + PrecompileTools.@compile_workload begin + template = PowerOperationsProblemTemplate() + set_device_model!(template, PSY.ThermalStandard, ThermalDispatchNoMin) + set_device_model!(template, PSY.PowerLoad, StaticPowerLoad) + set_device_model!(template, DeviceModel(PSY.Line, StaticBranch)) + set_device_model!(template, PSY.TModelHVDCLine, DCLossyLine) + end +end