Skip to content

Commit

Permalink
save_before_set_nom_voltage
Browse files Browse the repository at this point in the history
  • Loading branch information
wwang2 committed Aug 23, 2024
1 parent 40b0c30 commit ce0077b
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 12 deletions.
10 changes: 5 additions & 5 deletions ditto/modify/system_structure.py
Original file line number Diff line number Diff line change
Expand Up @@ -241,9 +241,9 @@ def set_nominal_voltages_recur(self, *args):
new_value = new_value *1.732
if num_phases!=3:
new_value = new_value *1.732
print(f"1num_phases={num_phases}")
print(f"1trans_name={trans_name}")
print(f"1new_value={new_value}")
#print(f"1num_phases={num_phases}")
#print(f"1trans_name={trans_name}")
#print(f"1new_value={new_value}")

elif (node, previous) in self.edge_equipment and self.edge_equipment[
(node, previous)
Expand All @@ -262,8 +262,8 @@ def set_nominal_voltages_recur(self, *args):

if num_phases!=3:
new_value = new_value *1.732
print(f"2trans_name={trans_name}")
print(f"2new_value={new_value}")
#print(f"2trans_name={trans_name}")
#print(f"2new_value={new_value}")
else:
new_value = voltage
if hasattr(self.model[node], "nominal_voltage"):
Expand Down
6 changes: 3 additions & 3 deletions ditto/readers/synergi/read.py
Original file line number Diff line number Diff line change
Expand Up @@ -2279,7 +2279,7 @@ def parse(self, model):
api_transformer.xhl = 0.1
api_transformer.pct_loadloss = 0.1
api_transformer.conn = ['wye' , 'wye']
api_transformer.kvas = api_transformer.ConnKvaPh
api_transformer.kvas = api_transformer.ConnKvaPh*10**3

# check if kvas and ConnKvaPh is enough to carry the load, then update it if needed
bus_loads = bus_load_map[api_transformer.connecting_element]
Expand Down Expand Up @@ -2784,7 +2784,7 @@ def parse(self, model):
### wenbo added this:model pv as generator in opendss
####################################################################################
# #
# Generator genpv.dss #
# Photovoltaic model (PVsystem/pvgenerator) #
# #
####################################################################################
#
Expand Down Expand Up @@ -3166,5 +3166,5 @@ def parse(self, model):
modifier = system_structure_modifier(model)
modifier.set_nominal_voltages_recur()
modifier.set_nominal_voltages_recur_line()

#print('hold')
# end of parse function
11 changes: 7 additions & 4 deletions ditto/writers/opendss/write.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ def __init__(self, **kwargs):
self.feeder_head_line = None
self.model_dtrans = True # this will decide if model secondary / dtrans

self.write_distribution_transformers = True
#self.write_distribution_transformers = True
self.write_taps = False
self.separate_feeders = False
self.separate_substations = False
Expand Down Expand Up @@ -1166,7 +1166,10 @@ def write_dtransformers(self, model):


if hasattr(i, "kvas") and i.kvas is not None:
txt += f" kvas = ({sum(i.kvas)}, {sum(i.kvas)})"
if sum(i.kvas)*10**-3 <5:
txt += f" kvas = (100, 100)"
else:
txt += f" kvas = ({sum(i.kvas)*10**-3}, {sum(i.kvas)*10**-3})"
if hasattr(i, "xhl") and i.conn is not None:
txt += f" xhl=0.1"
if hasattr(i, "pct_loadloss") and i.pct_loadloss is not None:
Expand Down Expand Up @@ -2120,7 +2123,7 @@ def write_loads(self, model):
txt += "New Load." + i.name
load_list.append(i.name)
else:
continue
#continue
txt += "New Load." + i.name + '_dup'
#print(f"i.name = {i.name}")
else:
Expand Down Expand Up @@ -4308,7 +4311,7 @@ def write_master_file(self, model):
):
fp.write("Redirect {file}\n".format(file=file))

_baseKV_list_ = list(self._baseKV_) + [0.24, 0.416]
_baseKV_list_ = list(self._baseKV_) + [0.416]
_baseKV_list_ = sorted(_baseKV_list_)
fp.write("\nSet Voltagebases={}\n".format(_baseKV_list_))

Expand Down

0 comments on commit ce0077b

Please sign in to comment.