def create_csv_PDG(name_file=ROOT_PATH,
                   name_file_csv='Area2_PDG',
                   folder_name=NAME_FOLDER_PDG):
    load_file(path_file=file_mpt, shabl='мегаточка')
    create_csv(name_file_csv=name_file_csv,
               path=name_file,
               folder_name=folder_name)
    load_file(path_file='', shabl='мегаточка')
def create_csv_SMZU(name_file=ROOT_PATH,
                    name_file_csv='Area2_SMZU',
                    folder_name=NAME_FOLDER_SMZU):
    load_file(path_file=f'{name_file}/smzu_mega_XML_UR_MDP.mptsmz',
              shabl='мегаточка')
    create_csv(name_file_csv=name_file_csv,
               path=name_file,
               folder_name=folder_name)
    load_file(path_file='', shabl='мегаточка')
Exemple #3
0
    def __init__(self,
                 rastr_win,
                 dir_name_file_excel,
                 name_list_excel,
                 switch_command_line=False):

        self.rastr_win = rastr_win
        load_file(rastr_win=rastr_win, shabl=Shabl.shablon_file_scenario)
        excel_wb = load_workbook(filename=dir_name_file_excel, data_only=True)
        self.ws = excel_wb[name_list_excel]

        Variable.__init__(self,
                          rastr_win=self.rastr_win,
                          switch_command_line=switch_command_line)
Exemple #4
0
    variable_.make_changes_filling_row(table=Exciter.table,
                                       column=Exciter.Type_rg,
                                       row_id=row_id,
                                       value=Type_rg)


if __name__ == '__main__':
    from RastrWinLib.AstraRastr import RASTR
    from RastrWinLib.Load import load_file
    from RastrWinLib.Load.save import save_file
    from RastrWinLib.Load.shablon import Shabl
    from RastrWinLib.Tables.Dynamic.Exciter import Exciter

    load_file(rastr_win=RASTR,
              file_path=r'C:\Users\Ohrimenko_AG\Desktop\test_filling\test.rst',
              shabl=Shabl.shablon_file_dynamic)

    table_ = RASTR.Tables(Exciter.table)

    for i in range(0, 10):
        table_.AddRow()
        filling_exciter(rastr_win=RASTR,
                        row_id=i,
                        Id=123456789,
                        sel=None,
                        sta=None,
                        Name=f'Генератор {i}',
                        CustomModel=None,
                        ModelType=None,
                        Brand=None,
Exemple #5
0
# -*- coding: utf-8 -*-
from time import time
from RastrWinLib.AstraRastr import RASTR
from RastrWinLib.Load import load_file
from RastrWinLib.Load.save import save_file
from RastrWinLib.Load.shablon import Shabl
from RastrWinLib.FillingTable.ARV_Filling import filling_ExcControl
from RastrWinLib.Tables.Dynamic.ExcControl import ExcControl

file_rst_dir = r'C:\Users\Ohrimenko_AG\Desktop\test_filling'
file_name = r'\test.rst'

load_file(rastr_win=RASTR,
          file_path=file_rst_dir + file_name,
          shabl=Shabl.shablon_file_dynamic)

load_file(rastr_win=RASTR, shabl=Shabl.shablon_file_automation)

table_ = RASTR.Tables(ExcControl.table)

start_time = time()

for i in range(0, 1000):
    table_.AddRow()
    filling_ExcControl(rastr_win=RASTR,
                       row_id=i,
                       sel=None,
                       sta=None,
                       Id=123456789,
                       Name=f'Генератор {i}',
                       ModelType=None,
Exemple #6
0
                 b=b,
                 ktr=ktr,
                 vetv_list=list_vetv)


# load - BARS
wb_skuns = load_workbook(
    filename=r'C:\Users\Ohrimenko_AG\Desktop\BARS\ВетвиСкунс.xlsx')
ws_skuns = wb_skuns["Ветви"]
vetv_list_bars = []
for i in range(3, 1430):
    create_data_list(list_vetv=vetv_list_bars, work_sheet=ws_skuns, index=i)

# load - SMZU
load_file(rastr_win=RASTR,
          file_path=r'C:\Users\Ohrimenko_AG\Desktop\BARS\smzu_mega.mptsmz',
          shabl=Shabl.without_shabl,
          switch_command_line=True)

vetv_list_smzu = []
getting_parameter_obj = GettingParameter(rastr_win=RASTR)
count_smzu_vetv = getting_parameter_obj.get_count_table(Vetv.table)
for i in range(count_smzu_vetv):
    create_data_smzu(list_vetv=vetv_list_smzu, i=i)

count_bars_vetv = len(vetv_list_bars)
for i in range(count_bars_vetv - 3):
    name_bars = vetv_list_bars[i]['name']
    tip_bars = vetv_list_bars[i]['tip']
    ip_bars = vetv_list_bars[i]['ip']
    iq_bars = vetv_list_bars[i]['iq']
    np_bars = vetv_list_bars[i]['np']
Exemple #7
0
# -*- coding: utf-8 -*-
from RastrWinLib.operation.get import GettingParameter
from RastrWinLib.Load import load_file
from RastrWinLib.Load.save import save_file
from RastrWinLib.Load.shablon import Shabl
from RastrWinLib.Tables.tables_attributes import vetv_table, node_table
from RastrWinLib.operation.Variable import Variable

load_file(
    file_path=
    r'C:\Users\Ohrimenko_AG\Desktop\Test_equiPy\02-БРМ Зима максимум [уст].rg2',
    shabl=Shabl.shablon_file_regime,
    switch_command_line=True)

get_ = GettingParameter()
variable_ = Variable()
for i in range(0, 26558):
    ip = get_.get_cell(table=vetv_table, column='ip', row_id=i)

    iq = get_.get_cell(table=vetv_table, column='iq', row_id=i)

    row_ny_ip = get_.get_row_node(node_ny=ip)
    row_ny_iq = get_.get_row_node(node_ny=iq)

    na_ip = get_.get_cell(table=node_table, column='na', row_id=row_ny_ip)

    na_iq = get_.get_cell(table=node_table, column='na', row_id=row_ny_iq)

    if na_ip == na_iq:
        print(f'na_ip={na_ip} == na_iq={na_iq}')
        variable_.make_changes_row(table=vetv_table,
Exemple #8
0
file_one_rg2 = rf'{dir_file}\4.rg2'
file_two_rst = rf'{dir_file}\Дин модель Лето минимум.rst'
file_log_gen = rf'{dir_file}\log_set_gen.txt'
file_log_vetv = rf'{dir_file}\log_set_vetv.txt'
file_log_node = rf'{dir_file}\log_set_node.txt'
file_log_area = rf'{dir_file}\log_set_area.txt'

n = open(file_log_node, 'w')
f = open(file_log_gen, 'w')
g = open(file_log_vetv, 'w')
area = open(file_log_area, 'w')

one_rastr = win32com.client.Dispatch("Astra.Rastr")
two_rastr = win32com.client.Dispatch("Astra.Rastr")

load_file(rastr_win=one_rastr, file_path=file_one_rg2, shabl=Shabl.shablon_file_regime, switch_command_line=False)
load_file(rastr_win=two_rastr, file_path=file_two_rst, shabl=Shabl.shablon_file_dynamic, switch_command_line=False)

gen_table_file_one = one_rastr.Tables(Generator.table)
max_column_gen_file_one = gen_table_file_one.Count - 1
print(f'Max Gen file_one: {max_column_gen_file_one}')

get_one = GettingParameter(rastr_win=one_rastr)
get_two = GettingParameter(rastr_win=two_rastr)
val_file_one = Variable(rastr_win=one_rastr, switch_command_line=False)
val_file_two = Variable(rastr_win=two_rastr, switch_command_line=False)
switch_two = SwitchVetv(rastr_win=two_rastr)
gen_fl = 1
if gen_fl == 1:
    # ********** Генератор ****************
    for i in range(0, max_column_gen_file_one):
Exemple #9
0
# -*- coding: utf-8 -*-
from RastrWinLib.Load import load_file
from win32com.client import Dispatch
from RastrWinLib.Load.shablon import Shabl

rast = Dispatch('Astra.Rastr')
load_file(rastr_win=rast, path_file='', shabl=Shabl.shablon_file_regime)

sb = rast.SubstServer
substId = sb.TypeIdByName("Substation")
print(substId)
from RastrWinLib.Load.save import save_file
from RastrWinLib.Load.shablon import shablon_file_regime
from RastrWinLib.operation.removal_marked_objects import RemoveSelObjects
from gen_equivalent import equivalent_gen
# from gen_equivalent import equivalent_smart

print('*********************************************')
print('*********** Эквивалентирование **************')
print('*********************************************')

regime = SteadyState(rastr_win=RASTR, switch_command_line=False)
equivalent = Equivalent(rastr_win=RASTR, switch_command_line=False)

file_rg2 = r'C:\Users\Ohrimenko_AG\Desktop\Test_equiPy\test_123.rg2'
load_file(rastr_win=RASTR,
          file_path=file_rg2,
          shabl=shablon_file_regime,
          switch_command_line=True)

# common_info = GetTableCommonInfo(rastr_win=RASTR, switch_command_line=False)
# common_info.get()

regime.rgm()

remove_obj_sel = RemoveSelObjects(rastr_win=RASTR, switch_command_line=False)
remove_obj_sel.remove_sel_node()
remove_obj_sel.remove_sel_vetv()
#
# set_com_ekviv(selekv=0,
#               met_ekv=0,
#               tip_ekv=0,
#               ekvgen=0,
Exemple #11
0
            pt.add_row([
                'Выявлено превышение допустимой скорости вращения одного или нескольких генераторов.'
                'Допустимая скорость вращения задается уставкой автомата безопасности в настройках динамики.',
                ''
            ])
        print(pt.show())
        print(pt.get_string(title="Расчет ЭМПП"))
        return ResultMessage


if __name__ == '__main__':
    from RastrWinLib.Load import load_file
    from RastrWinLib.AstraRastr import RASTR

    load_file(rastr_win=RASTR,
              path_file=r'',
              shabl='сценарий',
              switch_command_line=True)

    load_file(rastr_win=RASTR,
              path_file=
              r'C:\Users\Ohrimenko_AG\Desktop\ДРМ Зима максимум 2021_64.rst',
              shabl='динамика',
              switch_command_line=True)

    calc = Dynamic(rastr_win=RASTR,
                   calc_time=0.5,
                   snap_max_count=1,
                   switch_command_line=True)
    calc.change_calc_time()
    calc.change_snap_max_count()
    calc.run()
Exemple #12
0
# # -*- coding: utf-8 -*-

from RastrWinLib.Load import load_file
from RastrWinLib.calculation.regime import SteadyState
from RastrWinLib.calculation.dynamic import Dynamic
from RastrWinLib.Load.shablon import Shabl

file_rst = r'C:\Users\Ohrimenko_AG\Desktop\тест АР\test9.rst'
file_scn = r'C:\Users\Ohrimenko_AG\Desktop\тест АР\test9.scn'

file_rst2 = r'C:\Users\Ohrimenko_AG\Documents\RastrWin3\test-rastr\RUSTab\test9.rst'
file_scn2 = r'C:\Users\Ohrimenko_AG\Documents\RastrWin3\test-rastr\RUSTab\test9.scn'

load_file(file_path=file_rst2,
          shabl=Shabl.shablon_file_dynamic,
          switch_command_line=True)
load_file(file_path=file_scn2,
          shabl=Shabl.shablon_file_scenario,
          switch_command_line=True)
load_file(shabl=Shabl.shablon_file_automation, switch_command_line=True)

dyn = Dynamic(switch_command_line=True)
st = SteadyState(switch_command_line=True)

# st.rgm()
print(dyn.run())

# FWDynamic = RASTR.FWDynamic()
# FWDynamic.Run()
# print(f'TimeReached = {FWDynamic.TimeReached}')
# print(f'FWDynamic.Run() = {FWDynamic.Run()}')
Exemple #13
0
from RastrWinLib.operation.get import GettingParameter
from RastrWinLib.Load import load_file
from RastrWinLib.Load.shablon import Shabl
from RastrWinLib.AstraRastr import RASTR

file = r'C:\Users\Ohrimenko_AG\Documents\RastrWin3\test-rastr\RUSTab\test9.rst'
load_file(file_path=file, shabl=Shabl.shablon_file_dynamic)

get_ = GettingParameter(rastr_win=RASTR)

t = get_.get_row_vetv_a_node(ny=349)
print(t)
# r = get_.get_cell_id(table=ExcControl.table, column=ExcControl.Ku, Id=1320)
# print(r)
#
# trr = get_.get_cell_id(table=ExcControl.table,
#                        column=ExcControl.Tf,
#                        Id=1320)
# print(trr)
Exemple #14
0
# -*- coding: utf-8 -*-

from RastrWinLib.Load import load_file
from RastrWinLib.Load.shablon import shablon_file_dynamic, test_9_rst, shablon_file_ut_common
from RastrWinLib.Settings.dynamic import set_dynamic
from RastrWinLib.Load.save import save_file

load_file(file_path=test_9_rst,
          shablon=shablon_file_dynamic)
load_file(shablon=shablon_file_ut_common)

# set_regim(switch_command_line=True)
# set_ut_common(switch_command_line=True)
# set_com_ekviv(switch_command_line=True)

set_dynamic(switch_command_line=True)

save_file(file_path=r'C:\Users\Ohrimenko_AG\Desktop\Test_equiPy\test9_123.rst',
          shablon=shablon_file_dynamic)
Exemple #15
0
    def output_messages_results(kod):
        pt = PrettyTable()
        pt.title = "Расчет УР режима"
        pt.field_names = ['Описание', 'Параметр']
        pt.add_row(['Запуск "Расчет режима"', ''])
        if kod != 0:
            pt.add_row([
                'Сообщение о результатх расчета УР', 'Режим не сбалансирован!'
            ])
        elif kod == 0:
            pt.add_row([
                'Сообщение о результатх расчета УР',
                'Расчет УР завершен успешно!'
            ])
        print(pt)
        return kod


if __name__ == '__main__':
    from RastrWinLib.AstraRastr import RASTR
    from RastrWinLib.Load import load_file

    load_file(
        rastr_win=RASTR,
        path_file=
        r'C:\Users\Ohrimenko_AG\Documents\RastrWin3\test-rastr\RUSTab\test9.rst',
        shabl='динамика')

    regim = Regime(rastr_win=RASTR, switch_command_line=True)
    regim.rgm()
Exemple #16
0
    rastr_win.Save(path_file, directory_shabl(rus_name_shabl=shabl))

    if switch_command_line:
        pt = PrettyTable()
        pt.title = 'Сохранение файла RastrWin3'
        pt.field_names = ['Файл', 'Шаблон']
        if path_file == '' or path_file is None:
            pt.add_row(['Ссылка для сохранения файла не задана!', shabl])
        else:
            pt.add_row([f'{path.basename(path_file)}', shabl])
    return True


if __name__ == '__main__':
    from RastrWinLib.Load import load_file
    from RastrWinLib.AstraRastr import RASTR

    load_file(rastr_win=RASTR,
              path_file=r'C:\Users\Ohrimenko_AG\Documents\RastrWin3\test-rastr\RUSTab\test9.scn',
              shabl='сценарий',
              switch_command_line=True)

    load_file(rastr_win=RASTR,
              path_file=r'C:\Users\Ohrimenko_AG\Documents\RastrWin3\test-rastr\RUSTab\test9.rst',
              shabl='динамика',
              switch_command_line=True)

    save_file(path_file=r'C:\Users\Ohrimenko_AG\Desktop\test_911.rst',
              switch_command_line=True,
              shabl='динамика')
Exemple #17
0
from RastrWinLib.Load import load_file
from RastrWinLib.Load.shablon import Shabl
from RastrWinLib.AstraRastr import RASTR

load_file(
    file_path=
    r'C:\Users\Ohrimenko_AG\Documents\RastrWin3\test-rastr\RUSTab\test9.rst',
    shabl=Shabl.shablon_file_dynamic,
    switch_command_line=True,
    rastr_win=RASTR)

# var_ = Variable(switch_command_line=True)
# get_ = GettingParameter()
# xd11 = get_.get_cell_row(table=Generator.table,
#                          column=Generator.sel,
#                          row_id=1)
# var_.make_changes_row(table=Generator.table,
#                       column=Generator.sel,
#                       row_id=1,
#                       value=None)
#
# xd1 = get_.get_cell_row(table=Generator.table,
#                         column=Generator.sel,
#                         row_id=1)
# print(f'xd11={xd11}')
# print(f'xd1={xd1}')
#
# save_file(file_path=r'C:\Users\Ohrimenko_AG\Desktop\ForTest\test9.rst',
#           shabl=Shabl.shablon_file_dynamic,
#           switch_command_line=True)
list_ = []
Exemple #18
0
        :param number_or_formula:
        :return: nothing returns;
        """
        pt = PrettyTable()
        pt.field_names = ['Таблица', 'Номер/Формула']
        pt.add_row([table, number_or_formula])
        print(pt.get_string(title="ERROR: Удаление элемента из Таблицы RastrWin3"))


if __name__ == '__main__':
    from RastrWinLib.Load import load_file
    from RastrWinLib.Load.shablon import Shabl
    from RastrWinLib.AstraRastr import RASTR

    load_file(rastr_win=RASTR,
              file_path=r'',
              shabl=Shabl.shablon_file_automation,
              switch_command_line=True)

    load_file(rastr_win=RASTR,
              file_path=r'C:\Users\Ohrimenko_AG\Documents\RastrWin3\test-rastr\RUSTab\test9.scn',
              shabl=Shabl.shablon_file_scenario,
              switch_command_line=True)

    load_file(rastr_win=RASTR,
              file_path=r'C:\Users\Ohrimenko_AG\Documents\RastrWin3\test-rastr\RUSTab\test9.rst',
              shabl=Shabl.shablon_file_dynamic,
              switch_command_line=True)

    # delete = Delete(switch_command_line=True)
    # # output = ErrorOutput()
    # #
                                       value=TH11)

    variable_.make_changes_filling_row(table=DFWIEEE421PSS4B.table,
                                       column=DFWIEEE421PSS4B.TH12,
                                       row_id=row_id,
                                       value=TH12)


if __name__ == '__main__':
    from RastrWinLib.AstraRastr import RASTR
    from RastrWinLib.Tables.Dynamic.DFWIEEE421PSS4B import DFWIEEE421PSS4B
    from RastrWinLib.Load import load_file
    from RastrWinLib.Save import save_file

    load_file(rastr_win=RASTR,
              path_file=r'C:\Users\Ohrimenko_AG\Desktop\test_filling\test.rst',
              shabl='динамика')

    load_file(rastr_win=RASTR,
              path_file='',
              shabl='автоматика')

    table_ = RASTR.Tables(DFWIEEE421PSS4B.table)

    for i in range(0, 1000):
        table_.AddRow()

        filling_DFWIEEE421PSS4B(
            rastr_win=RASTR,
            row_id=i,
            sel=None,
Exemple #20
0
import win32com.client
from RastrWinLib.Load import load_file
from RastrWinLib.Load.shablon import Shabl

RASTR = win32com.client.Dispatch('Astra.Rastr')
RASTR_ = win32com.client.Dispatch('Rastr_')


def Rastr_OnLog(code, description):
    print(code[0])
    # print(f'[ERROR] {description}')
    # print(f'[ERROR] {description}')
    # print(f'[ERROR] {description}')
    # print(f'[WARNING] {description}')
    # print(f'[MESSAGE] {description}')
    # print(f'[INFO] {description}')


load_file(
    rastr_win=RASTR,
    shabl=Shabl.shablon_file_regime,
    file_path=r'C:\Users\Ohrimenko_AG\Documents\RastrWin3\test-rastr\cx195.rg2'
)

RASTR.Rgm('')
Exemple #21
0
list_name_excel = ['Раздел 1.1', 'Раздел 1.2', 'Раздел 2.1', 'Раздел 2.2']

wb.close()

wb_w = load_workbook(filename=file_excel)
ws_1 = wb_w['Раздел 1.1']
ws_2 = wb_w['Раздел 1.2']
ws_3 = wb_w['Раздел 2.1']
ws_4 = wb_w['Раздел 2.2']

fl_1_1 = 0
if fl_1_1 == 1:
    # 1. ********************* Режим 1 сценарий 1 ******************
    load_file(rastr_win=Rastr,
              file_path=file_rst_regim_one,
              shabl=Shabl.shablon_file_dynamic,
              switch_command_line=True)
    load_file(rastr_win=Rastr,
              file_path=dir_name_scn_one,
              shabl=Shabl.shablon_file_scenario,
              switch_command_line=True)
    load_file(rastr_win=Rastr,
              file_path='',
              shabl=Shabl.shablon_file_automation,
              switch_command_line=True)

    dyn_obj = Dynamic(rastr_win=Rastr,
                      calc_time=t_ras,
                      snap_max_count=1,
                      switch_command_line=True)
    rgm_obj = SteadyState(rastr_win=Rastr, par="", switch_command_line=True)
Exemple #22
0
from RastrWinLib.Load import load_file
from RastrWinLib.Load.save import save_file
from RastrWinLib.Load.shablon import shablon_file_dynamic
from CustomModels.AC5B.AC5B import change_parameters_AC5B

file = r'C:\Users\Ohrimenko_AG\Documents\RastrWin3\test-rastr\RUSTab\test9.rst'
file_save = r'C:\Users\Ohrimenko_AG\Desktop\test9.rst'

load_file(file_path=file,
          shablon=shablon_file_dynamic,
          switch_command_line=True)

load_file(switch_command_line=True)

# change_parameters_ARV3M(Id=1320, switch_command_line=True)
change_parameters_AC5B(Id=1300, switch_command_line=True)

save_file(file_path=file_save, shablon=shablon_file_dynamic)