From b13ba4ddc31bc8bce4202c19f388d7847cb4b4c6 Mon Sep 17 00:00:00 2001 From: nadiavp Date: Thu, 14 Sep 2023 14:43:39 -0600 Subject: [PATCH] capacitors and cap controllers set with correct thresholds --- ditto/readers/synergi/read.py | 2 +- ditto/writers/opendss/write.py | 9 +++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/ditto/readers/synergi/read.py b/ditto/readers/synergi/read.py index e996ea7b..ddb16b77 100644 --- a/ditto/readers/synergi/read.py +++ b/ditto/readers/synergi/read.py @@ -2253,7 +2253,7 @@ def parse(self, model): # Maps control modes from Synergi format to DiTTo format # TODO: Complete the mapping with other control modes # - control_mode_mapping = {"VOLTS": "voltage"} + control_mode_mapping = {"VOLTS": "voltage", "AMPS": "currentflow"} # Set the nominal voltage # Convert from KV to Volts since DiTTo is in volts diff --git a/ditto/writers/opendss/write.py b/ditto/writers/opendss/write.py index 48b96e7f..e16fbfba 100644 --- a/ditto/writers/opendss/write.py +++ b/ditto/writers/opendss/write.py @@ -2740,6 +2740,9 @@ def write_capacitors(self, model): # Create CapControl if create_capcontrol: + # set all controllers to start at off unless ONSetting is met + txt += " states=0" + txt += "\n\nNew CapControl.{name} Capacitor={name}".format( name=i.name ) @@ -2763,11 +2766,13 @@ def write_capacitors(self, model): # Low (CONTROL) if hasattr(i, "low") and i.low is not None: - txt += " Vmin={vmin}".format(vmin=i.low) + #txt += " Vmin={vmin}".format(vmin=i.low) # this would be an emergency setting + txt += f" OFFSetting={i.low}" # high (CONTROL) if hasattr(i, "high") and i.high is not None: - txt += " Vmax={vmax}".format(vmax=i.high) + #txt += " Vmax={vmax}".format(vmax=i.high) # this would be an emergency setting + txt += f" ONSetting={i.high}" # Pt ratio (CONTROL) if hasattr(i, "pt_ratio") and i.pt_ratio is not None: