NREL-Sienna / InfrastructureSystems.jl

Utility package for Sienna's simulation infrastructure
https://nrel-sienna.github.io/InfrastructureSystems.jl/
BSD 3-Clause "New" or "Revised" License
39 stars 20 forks source link

Handle UUID clashes #197

Closed jd-lara closed 3 years ago

jd-lara commented 3 years ago

When serializing/deserializing a system there is a possibility to have the UUID clashes. This happens when the user modifies a deserialized system, serializes, and de-serializes back.

The attached file is a system JSON that I made with that workflow (github only allows certain extensions to be added to issues so I changed the extension to log)

DA_sys.log

Check UUID 281b8f3f-a231-4660-937b-6d0eb7f3f682. It is assigned to ThermalMultiStart DEER_PARK_ENERGY_CENTER_CC5 and also Bus MISSION 1

Also UUID 9732a557-2700-41c0-b5a7-d7147f8c98ea is assigned to SPENCER_STG_U4 and to BUS WICHITA FALLS 2

I won't add more instances of this situation happening, but as of this 3rd edit of the issue I have had 5 instances of repeated UUIDs

jd-lara commented 3 years ago

I've traced the issue here https://github.com/NREL-SIIP/InfrastructureSystems.jl/blob/f80be0827115cf268be2b58dc88f8e4fe264f191/src/internal.jl#L123 since the _RNG is the same every IS, then the risk of collision is large because we always start with the same seed after the package is compiled. If the user closes the session and starts again the _RNG is the same.