Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ version = "5.3.0"

[deps]
CSV = "336ed68f-0bac-5ca0-87d4-7b16caf5d00b"
Unitful = "1986cc42-f94f-5a68-af5c-568840ba703d"
DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0"
DataStructures = "864edb3b-99cc-5e75-8d2d-829cb0a9cfe8"
Dates = "ade2ca70-3891-5945-98fb-dc099432e06a"
Expand Down Expand Up @@ -35,6 +36,7 @@ Logging = "1"
PowerFlowData = "^1.5"
PrettyTables = "2.4, 3.1"
TimeSeries = "0.25"
Unitful = "^1.12"
UUIDs = "1"
Unicode = "1"
YAML = "~0.4"
Expand Down
19 changes: 19 additions & 0 deletions src/PowerSystems.jl
Original file line number Diff line number Diff line change
Expand Up @@ -565,6 +565,11 @@ export StructDefinition
export generate_struct_file
export generate_struct_files
export UnitSystem # internal.jl
# Unit types for explicit units in getters/setters
export MW, Mvar, MVA, kV, OHMS, SIEMENS
export DU, SU, DeviceBaseUnit, SystemBaseUnit
export AbstractRelativeUnit, RelativeQuantity
export ustrip

# ComponentSelector
export ComponentSelector
Expand Down Expand Up @@ -676,6 +681,20 @@ import InfrastructureSystems:
NormalizationTypes,
UnitSystem,
SystemUnitsSettings,
# Unit types for explicit units in getters/setters
MW,
Mvar,
MVA,
kV,
OHMS,
SIEMENS,
DU,
SU,
DeviceBaseUnit,
SystemBaseUnit,
AbstractRelativeUnit,
RelativeQuantity,
ustrip,
open_file_logger,
make_logging_config_file,
validate_struct,
Expand Down
11 changes: 6 additions & 5 deletions src/base.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3192,15 +3192,16 @@ function convert_component!(
new_type::Type{StandardLoad};
kwargs...,
)
# Use direct field access for unit-aware fields to preserve internal representation
new_load = new_type(;
name = get_name(old_load),
available = get_available(old_load),
bus = get_bus(old_load),
base_power = get_base_power(old_load),
constant_active_power = get_active_power(old_load),
constant_reactive_power = get_reactive_power(old_load),
max_constant_active_power = get_max_active_power(old_load),
max_constant_reactive_power = get_max_active_power(old_load),
base_power = old_load.base_power,
constant_active_power = old_load.active_power,
constant_reactive_power = old_load.reactive_power,
max_constant_active_power = old_load.max_active_power,
max_constant_reactive_power = old_load.max_reactive_power,
conformity = get_conformity(old_load),
dynamic_injector = get_dynamic_injector(old_load),
internal = _copy_internal_for_conversion(old_load),
Expand Down
1 change: 1 addition & 0 deletions src/definitions.jl
Original file line number Diff line number Diff line change
Expand Up @@ -532,6 +532,7 @@ Enumeration representing the location of a hydro reservoir relative to its assoc

const PS_MAX_LOG = parse(Int, get(ENV, "PS_MAX_LOG", "50"))
const DEFAULT_BASE_MVA = 100.0
const DEFAULT_POWER_UNITS_TYPE = typeof(0.0 * IS.MW)

const POWER_SYSTEM_STRUCT_DESCRIPTOR_FILE =
joinpath(dirname(pathof(PowerSystems)), "descriptors", "power_system_structs.json")
Expand Down
Loading