I/O with DSS files (debug)

krangpower offers compatibilty with the classic DSS format of OpenDSS, mainly for purposes of back-compatibility and debugging.

Loading

Krang exposes a Krang.from_dss class method. It was written with the only scope of allowing direct use of existing dss scripts without having to translate them to krangpower instructions; in all other cases, writing a krangpower script is to be always preferred.

classmethod Krang.from_dss(file_path, target_krang=None, frequency=50.0)

from_dss(file_path, target_krang, frequency) allows to create a krang from an existing dss script or to pass commands to a krang from an existing dss script. USE AT YOUR OWN RISK.

Parameters:
  • file_path – The path of the dss file to utilize
  • target_krang
    • If None, a new krang will be created and initialized with the information from the file (must contain a ‘new circuit’ command).
    • If a Krang is passed, the commands in the script will be passed to that Krang.
  • frequency – the general frequency to use for the krang, if a new one is created.

Saving

Krang.save_dss saves a dss from the series of instructions that were imparted through the Krang.command method.

Warning

Modifications operated through other means than the text interface won’t be included!

Krang.save_dss(path=None)

Saves a file with the text commands that were imparted by the Krang.command method aside from those for which echo was False. The file output should be loadable and runnable in traditional OpenDSS with no modifications.