Beispiel #1
0
    def setUpClass(cls):

        logging.basicConfig(level=logging.DEBUG)
        cls.logger = logging.getLogger(__name__)

        file_cfg = os.path.join(BASE_DIR, 'test_interaction.cfg')
        cls.cfg = Config(file_cfg, cls.logger)
        cls.scenario = Scenario(cfg=cls.cfg,
                                event=cls.cfg.events[0],
                                logger=cls.logger)
Beispiel #2
0
    def setUpClass(cls):

        logging.basicConfig(level=logging.INFO)
        cls.logger = logging.getLogger(__name__)

        cls.cfg = Config(os.path.join(BASE_DIR, 'test.cfg'), logger=cls.logger)

        event_name = 'test2'
        event_scale = 1.0
        path_event = os.path.join(cls.cfg.path_wind_event_base, event_name)
        path_output = os.path.join(cls.cfg.path_output, 'test2_s1.0')
        # LineB
        dic_line = cls.cfg.lines['LineA'].copy()
        cls.no_sims = 10000
        dic_line.update({
            'name':
            'LineA',
            'no_sims':
            cls.no_sims,
            'damage_states':
            cls.cfg.damage_states,
            'non_collapse':
            cls.cfg.non_collapse,
            'event_name':
            event_name,
            'event_id':
            cls.cfg.event_id_format.format(event_name=event_name,
                                           scale=event_scale),
            'rtol':
            cls.cfg.rtol,
            'atol':
            cls.cfg.atol,
            'dmg_threshold':
            cls.cfg.dmg_threshold,
            'scale':
            event_scale,
            'rnd_state':
            np.random.RandomState(0),
            'path_event':
            path_event,
            'path_output':
            path_output,
            'dic_towers':
            cls.cfg.towers_by_line['LineA']
        })

        cls.line = Line(**dic_line)

        for _, tower in cls.line.towers.items():
            # tower._wind = create_wind_given_bearing(10.0, 1.0)
            tower.axisaz = 11.0
            tower._damage_prob = None
            tower._damage_prob_sim = None
            tower._dmg_sim = None
            tower._dmg_id_sim = None
    def setUpClass(cls):

        logging.basicConfig(level=logging.DEBUG)
        cls.logger = logging.getLogger(__name__)

        file_cfg = os.path.join(BASE_DIR, 'test.cfg')

        assert os.path.exists(file_cfg), 'config file does not exist'
        cls.cfg = Config(file_cfg, cls.logger)
        cls.scenario = Scenario(cfg=cls.cfg,
                                event=('test2', 1.5, 1),
                                logger=cls.logger)
Beispiel #4
0
    def setUpClass(cls):

        logging.basicConfig(level=logging.WARNING)
        logger = logging.getLogger(__name__)
        file_cfg = os.path.join(BASE_DIR, 'test1.cfg')

        cls.cfg = Config(file_cfg=file_cfg, logger=logger)
        cls.cfg.no_sims = 1000000
        cls.cfg.save = False
        cls.cfg.figure = False

        with cls.assertLogs('wistl', level='INFO') as cm:
            cls.lines = run_simulation(cls.cfg)
Beispiel #5
0
def main():

    parser = process_commandline()

    (options, args) = parser.parse_args()

    if options.config_file:
        if not os.path.isfile(options.config_file):
            sys.exit(f'{options.config_file} not found')
        else:
            path_cfg = os.path.dirname(os.path.realpath(options.config_file))
            set_logger(path_cfg, options.verbose)
            conf = Config(file_cfg=options.config_file)
            run_simulation(cfg=conf, client_ip=options.client_ip)
    else:
        parser.print_help()
Beispiel #6
0
    def setUpClass(cls):

        cls.cfg = Config(os.path.join(BASE_DIR, 'test_interaction.cfg'))

        dic_line = cls.cfg.lines['LineA'].copy()
        cls.no_sims = 10000
        event_name = 'test1'
        event_scale = 14.0
        path_event = os.path.join(cls.cfg.path_wind_event_base, event_name)
        path_output = os.path.join(cls.cfg.path_output, 'test1_s14.0')
        dic_line.update({
            'name':
            'LineA',
            'no_sims':
            cls.no_sims,
            'damage_states':
            cls.cfg.damage_states,
            'non_collapse':
            cls.cfg.non_collapse,
            'event_name':
            event_name,
            'event_id':
            cls.cfg.event_id_format.format(event_name=event_name,
                                           scale=event_scale),
            'rtol':
            0.01,
            'atol':
            0.1,
            'dmg_threshold':
            cls.cfg.dmg_threshold,
            'scale':
            event_scale,
            'rnd_state':
            np.random.RandomState(0),
            'path_event':
            path_event,
            'path_output':
            path_output,
            'dic_towers':
            cls.cfg.towers_by_line['LineA']
        })

        cls.line = Line(**dic_line)

        with cls.assertLogs('wistl', level='INFO') as cm:
            cls.line.compute_damage_prob()
            cls.line.compute_damage_prob_sim()
Beispiel #7
0
    def setUpClass(cls):

        cls.cfg = Config(os.path.join(BASE_DIR, 'test.cfg'))

        dic_line = cls.cfg.lines['LineA'].copy()
        cls.no_sims = 1000
        event_name = 'test2'
        event_scale = 2.0
        path_event = os.path.join(cls.cfg.path_wind_event_base, event_name)
        path_output = os.path.join(cls.cfg.path_output, 'test2_s2.0')
        dic_line.update({
            'name':
            'LineA',
            'no_sims':
            cls.no_sims,
            'damage_states':
            cls.cfg.damage_states,
            'non_collapse':
            cls.cfg.non_collapse,
            'event_name':
            event_name,
            'event_id':
            cls.cfg.event_id_format.format(event_name=event_name,
                                           scale=event_scale),
            'rtol':
            0.01,
            'atol':
            0.1,
            'dmg_threshold':
            cls.cfg.dmg_threshold,
            'scale':
            event_scale,
            'rnd_state':
            np.random.RandomState(0),
            'path_event':
            path_event,
            'path_output':
            path_output,
            'dic_towers':
            cls.cfg.towers_by_line['LineA']
        })

        cls.line = Line(**dic_line)