PowerSystems.jl
PowerSystems.jl copied to clipboard
Add documentation on how to add validation for custom types
It isn't clear currently what's the process to avoid the warning
┌ Warning: struct MyCustomDevice does not exist in validation configuration file, validation skipped
└ @ InfrastructureSystems ~/.julia/dev/InfrastructureSystems/src/validation.jl:42
This means that the descriptor file does not contain the struct being used. We have an oversight in this process. A user might want validation of a struct without doing auto-generation. Is that what is happening here?
It might be better to make this warning message a debug message.
we currently throw a warning when there is no valid entry for a custom struct validation. We want to add validation for the DynamicInverter and also make sure that the validations on the field values of components are conducted.
My earlier statement was incorrect. You can define a validation descriptor for a struct that is not auto-generated by adding an entry here: https://github.com/NREL-SIIP/PowerSystems.jl/blob/master/src/descriptors/power_system_structs.json#L9581.
There are a few options:
- Add the descriptor.
- Implement a method for the function
IS.validate_struct(ist::InfrastructureSystemsType)
. (validate based on fields in struct) - Implement a method for the function
PSY.validate_struct(sys::System, value::PowerSystemType)
. (validate based on system)