Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
from andes import system, filters
from andes.routines import powerflow, timedomain
import os
from andes.plot import do_plot
os.chdir('../../cases/curent')
case = 'NA_50_50_50_HVDC3.dm'
sys = system.PowerSystem(case)
assert filters.guess(sys)
assert filters.parse(sys)
sys.setup()
sys.pf_init()
powerflow.run(sys)
sys.td_init()
sys.TDS.tf = 2
timedomain.run(sys)
Syn6a_omega = sys.Syn6a.omega
Syn6a_omega = [i + 1 for i in Syn6a_omega]
x, y = sys.varout.get_xy(Syn6a_omega)
"""
out = []
if not (group or category or model_list or model_format
or model_var or quick_help or help_option or help_config or data_example):
return False
from andes.models import all_models_list
if category:
raise NotImplementedError
if model_list:
raise NotImplementedError
system = PowerSystem()
# print example data
if data_example is not None:
out.append(system.get_data_example(data_example))
if model_format:
if model_format.lower() == 'all':
model_format = all_models_list
else:
model_format = model_format.split(',')
for item in model_format:
if item not in all_models_list:
logger.warning('Model <{}> does not exist.'.format(item))
model_format.remove(item)
from andes import system, filters
from andes.routines import powerflow, timedomain
import os
# os.chdir('/home/hcui7/repos/andes_github/cases')
# case = 'ieee14_syn.dm'
os.chdir('/home/hcui7/repos/andes_github/cases/curent')
case = 'NA_50_50_50_HVDC3.dm'
sys = system.PowerSystem(case)
assert filters.guess(sys)
assert filters.parse(sys)
sys.setup()
sys.pf_init()
powerflow.run(sys)
sys.td_init()
# timedomain.run(sys)
# bus list in NPCC
npcc_bus = list(range(100114, 100124)) + list(range(101001, 101120))
# In the test case ``NA_50_50_50_HVDC3.dm``, all NPCC generators are classical model
# ====== commented out ======
# 6-th order generator model on NPCC buses. All should be None.
# sys.Syn6a.on_bus(npcc_bus)
def __init__(self, event, t, case, save_file, e_idx):
sys = system.PowerSystem(case)
assert filters.guess(sys)
assert filters.parse(sys)
sys.setup()
sys.pflow.run()
sys.tds.init()
self.sys = sys
self.event = event
self.t = t
self.e_idx = e_idx
self.case = case
self.save_file = save_file
self.input_check()
self.e_count = self.t.__len__()
self.e_string = []
self.line_bus = sys.Line.bus1
Other keyword arguments
Returns
-------
PowerSystem
Andes PowerSystem object
"""
t0, _ = elapsed()
# enable profiler if requested
pr = cProfile.Profile()
if profile is True:
pr.enable()
system = PowerSystem(case, **kwargs)
# guess format and parse data
if not filters.guess(system):
return
if not filters.parse(system):
return
# dump system as raw file if requested
if dump_raw:
filters.dump_raw(system)
system.setup()
# show data
if show_data is not None:
# no ``--save-config ``
if cf_path == '':
return ret
if cf_path is None:
cf_path = 'andes.conf'
home = str(pathlib.Path.home())
path = os.path.join(home, '.andes')
if not os.path.exists(path):
os.makedirs(path)
cf_path = os.path.join(path, cf_path)
ps = PowerSystem()
ps.dump_config(cf_path)
ret = True
return ret