Пример #1
0
    def setUp(self):
        # Create a test config file containing the test database
        adripy.create_cfg_file(TEST_CONFIG_FILENAME, [TEST_DATABASE_PATH, TEST_NEW_DATABASE_PATH])
        
        # Create a DrillTool object representing a stabilizer
        self.pdc_bit = adripy.DrillTool(TEST_PDC_FILE)

        # Create a DrillTool object representing a motor
        self.motor = adripy.DrillTool(TEST_MOTOR_FILE)

        # Create a DrillTool object representing a stabilizer
        self.stabilizer = adripy.DrillTool(TEST_STABILIZER_FILE)

        # Create a DrillTool object representing an mwd
        self.mwd = adripy.DrillTool(TEST_MWD_FILE)

        # Create a DrillTool object representing a stabilizer
        self.upper_stabilizer = adripy.DrillTool(TEST_STABILIZER_FILE)

        # Create a DrillTool object representing a collar
        self.collar = adripy.DrillTool(TEST_COLLAR_FILE)

        # Create a DrillTool object representing a drill pipe
        self.drill_pipe = adripy.DrillTool(TEST_DRILLPIPE_FILE)

        # Create a DrillTool object representing EUS
        self.eus = adripy.DrillTool(TEST_EUS_FILE)
        
        # Create a DrillTool object representing a top drive
        self.top_drive = adripy.DrillTool(TEST_TOP_DRIVE_FILE)
Пример #2
0
    def setUp(self):
        # Create a test config file containing the test database
        adripy.create_cfg_file(TEST_CONFIG_FILENAME,
                               [TEST_DATABASE_PATH, TEST_NEW_DATABASE_PATH])

        # Create a drill_hole object
        self.drill_hole = adripy.DrillHole(TEST_HOLE_NAME)
 def setUpClass(cls):        
     # Create a configuration file for testing
     adripy.create_cfg_file(TEST_CONFIG_FILENAME, [TEST_DATABASE_PATH])
     try:            
         os.remove(os.path.join(TEST_WORKING_DIRECTORY, TEST_SOLVER_SETTINGS_NAME + '.ssf'))
     except FileNotFoundError:
         pass
Пример #4
0
def create_existing_drillsim(directory):
    # Create a test config file containing the test database
    adripy.create_cfg_file(TEST_CONFIG_FILENAME,
                           [TEST_DATABASE_PATH, TEST_NEW_DATABASE_PATH])

    # Create a DrillTool object representing a stabilizer
    pdc_bit = adripy.DrillTool(TEST_PDC_FILE)

    # Create a DrillTool object representing a motor
    motor = adripy.DrillTool(TEST_MOTOR_FILE)

    # Create a DrillTool object representing a stabilizer
    stabilizer = adripy.DrillTool(TEST_STABILIZER_FILE)

    # Create a DrillTool object representing a drill pipe
    drill_pipe = adripy.DrillTool(TEST_DRILLPIPE_FILE)

    # Create a DrillTool object representing EUS
    eus = adripy.DrillTool(TEST_EUS_FILE)

    # Create a DrillTool object representing a top drive
    top_drive = adripy.DrillTool(TEST_TOP_DRIVE_FILE)

    # Create a DrillString object
    drill_string = adripy.DrillString(TEST_STRING_NAME,
                                      TEST_EXISTING_HOLE_FILE, TEST_EVENT_FILE)

    # Add the DrillTool objects to the DrillString object
    drill_string.add_tool(pdc_bit, measure='yes')
    drill_string.add_tool(motor, measure='yes')
    drill_string.add_tool(stabilizer, measure='yes')
    drill_string.add_tool(drill_pipe, joints=20, group_name='Upper_DP_Group')
    drill_string.add_tool(eus,
                          joints=20,
                          group_name='equivalent_pipe',
                          equivalent=True)
    drill_string.add_tool(top_drive)

    # Create an event object
    event = adripy.DrillEvent(TEST_EVENT_NAME, 2000, 3)
    event.add_simulation_step(10)
    event.add_simulation_step(100)
    event.add_ramp('FLOW_RATE', 0, 15, 500)
    event.add_ramp('ROTARY_RPM', 15, 15, 60)
    event.add_ramp('WOB', 30, 15, 50000)
    event.add_ramp('ROP', 30, 15, 100)

    # Create a solver settings object
    solver_settings = adripy.DrillSolverSettings(TEST_SOLVER_SETTINGS_NAME)

    if os.path.exists(directory):
        shutil.rmtree(directory, ignore_errors=True)

    drill_sim = adripy.DrillSim(drill_string, event, solver_settings,
                                directory, TEST_ANALYSIS_NAME)
Пример #5
0
    def setUp(self):
        # Create a test config file containing the test database
        adripy.create_cfg_file(TEST_CONFIG_FILENAME,
                               [TEST_DATABASE_PATH, TEST_NEW_DATABASE_PATH])

        # Create the res and msg files
        for file in glob.glob(
                os.path.join(TEST_EXISTING_DRILLSIM_DIRECTORY, '*.cached')):
            shutil.copyfile(file, file.replace('.cached', ''))

        self.drill_sim = DrillSim.read_from_directory(
            TEST_EXISTING_DRILLSIM_DIRECTORY)
        if not self.drill_sim.solved:
            self.drill_sim.run()
Пример #6
0
    def setUp(self):

        # Create a test config file containing the test database
        adripy.create_cfg_file(TEST_CONFIG_FILENAME, [TEST_DATABASE_PATH])

        # Create a DrillTool object from a stabilizer property file
        filename = os.path.join(f'<{TEST_DATABASE_NAME}>', 'stabilizers.tbl',
                                self.TEST_STABILZIER_NAME + '.sta')
        self.stabilizer = adripy.DrillTool(filename)

        # Create an identical DrillTool object that will be modified later
        self.stabilizer_to_modify = adripy.DrillTool(
            os.path.join(f'<{TEST_DATABASE_NAME}>', 'stabilizers.tbl',
                         self.TEST_STABILZIER_NAME + '.sta'))
        self.stabilizer_to_modify.rename(self.NEW_STABILIZER_NAME)
Пример #7
0
    def setUp(self):
        # Create a configuration file for testing
        adripy.create_cfg_file(TEST_CONFIG_FILENAME, [TEST_DATABASE_PATH])

        self.written_event_file_2018 = os.path.join(
            os.getcwd(), 'test', 'files', 'read_then_write_2018.evt')
        self.written_event_file_2019 = os.path.join(
            os.getcwd(), 'test', 'files', 'read_then_write_2019.evt')

        for file in [
                self.written_event_file_2018, self.written_event_file_2019
        ]:
            try:
                os.remove(file)
            except Exception:  # pylint: disable=broad-except
                pass
Пример #8
0
    def setUp(self):

        # Create a configuration file for testing
        adripy.create_cfg_file(TEST_CONFIG_FILENAME, [TEST_DATABASE_PATH])

        # Create event file object
        self.event = adripy.DrillEvent(TEST_CREATED_EVENT_NAME, 4000, 4)

        # Add ramp parameters to event file object
        self.event.add_ramp('FLOW_RATE', 1, 10, 500, clear_existing=True)
        self.event.add_ramp('ROTARY_RPM', 10, 15, 60, clear_existing=True)
        self.event.add_ramp('WOB', 30, 10, 50000, clear_existing=True)
        self.event.add_ramp('ROP', 35, 10, 100, clear_existing=True)

        # Add simulation steps to event file object
        self.event.add_simulation_step(10, clear_existing=True)
        self.event.add_simulation_step(100)

        # Write an event file from the event file object
        self.event.write_to_file(cdb=TEST_DATABASE_NAME)
Пример #9
0
    def setUp(self):
        # Create a test config file containing the test database
        adripy.create_cfg_file(TEST_CONFIG_FILENAME,
                               [TEST_DATABASE_PATH, TEST_NEW_DATABASE_PATH])

        # Create a DrillTool object representing a stabilizer
        self.pdc_bit = adripy.DrillTool(TEST_PDC_FILE)

        # Create a DrillTool object representing a stabilizer
        self.stabilizer = adripy.DrillTool(TEST_STABILIZER_FILE)

        # Create a DrillTool object representing a drill pipe
        self.drill_pipe = adripy.DrillTool(TEST_DRILLPIPE_FILE)

        # Create a DrillTool object representing EUS
        self.eus = adripy.DrillTool(TEST_EUS_FILE)

        # Create a DrillTool object representing a top drive
        self.top_drive = adripy.DrillTool(TEST_TOP_DRIVE_FILE)

        # Create a DrillString object
        self.drill_string = adripy.DrillString(TEST_STRING_NAME,
                                               TEST_EXISTING_HOLE_FILE,
                                               TEST_EVENT_FILE)

        # Add the DrillTool objects to the DrillString object
        self.drill_string.add_tool(self.pdc_bit, measure='yes')
        self.drill_string.add_tool(self.stabilizer, measure='yes')
        self.drill_string.add_tool(self.drill_pipe,
                                   joints=20,
                                   group_name='Upper_DP_Group')
        self.drill_string.add_tool(self.eus,
                                   joints=20,
                                   group_name='equivalent_pipe',
                                   equivalent=True)
        self.drill_string.add_tool(self.top_drive)

        # Create an event object
        self.event = adripy.DrillEvent(TEST_EVENT_NAME, 2000, 3)
        self.event.add_simulation_step(10)
        self.event.add_simulation_step(100)
        self.event.add_ramp('FLOW_RATE', 0, 15, 500)
        self.event.add_ramp('ROTARY_RPM', 15, 15, 60)
        self.event.add_ramp('WOB', 30, 15, 50000)
        self.event.add_ramp('ROP', 30, 15, 100)

        # Create a solver settings object
        self.solver_settings = adripy.DrillSolverSettings(
            TEST_SOLVER_SETTINGS_NAME)

        # If the "existing" drill sims don't exit, create them
        for directory in [
                TEST_EXISTING_DRILLSIM_DIRECTORY,
                TEST_EXISTING_UNBUILT_DRILLSIM_DIRECTORY
        ]:
            if not os.path.exists(directory):
                create_existing_drillsim(directory)

        drill_sim = DrillSim.read_from_directory(
            TEST_EXISTING_DRILLSIM_DIRECTORY)
        if drill_sim.built is False:
            drill_sim.build()
Пример #10
0
 def setUp(self):
     # Create a test configuration file
     adripy.create_cfg_file(TEST_CONFIG_FILENAME, [EXISTING_CDB_PATH, CDB_TO_REMOVE_PATH, TEST_DATABASE_PATH])
Пример #11
0
    def setUp(self):
        # Create a test config file containing the test database
        adripy.create_cfg_file(TEST_CONFIG_FILENAME, [TEST_DATABASE_PATH])

        self.agitator = adripy.DrillTool(TEST_EXISTING_AGITATOR_FILE)
Пример #12
0
 def setUp(self):
     adripy.create_cfg_file(TEST_CONFIG_FILENAME, [TEST_DATABASE_PATH, TEST_NEW_DATABASE_PATH])