Пример #1
0
    def test_write_tiem_orbit_files_directory_contents(self):
        """Tests that DrillSim.directory contains the expected files
        """
        # Create a DrillSim object
        drill_sim = DrillSim(self.drill_string, self.event,
                             self.solver_settings, TEST_WORKING_DIRECTORY,
                             TEST_ANALYSIS_NAME)

        expected_contents = [
            drill_sim.event.filename,
            os.path.join(drill_sim.directory, drill_sim.string_filename),
            drill_sim.solver_settings.filename
        ]
        for tool in drill_sim.string.tools:
            expected_contents.append(
                os.path.join(drill_sim.directory, tool['Property_File']))

        expected_contents.append(
            os.path.join(drill_sim.directory,
                         drill_sim.string.top_drive['Property_File']))
        expected_contents.append(
            os.path.join(drill_sim.directory,
                         drill_sim.string.parameters['Hole_Property_File']))

        actual_contents = glob.glob(os.path.join(drill_sim.directory, '*'))

        self.assertListEqual(sorted(actual_contents),
                             sorted(expected_contents))
Пример #2
0
    def test_stabilizer_measure_on_object(self):
        """Tests that measure is turned off on drill pipe in the string file.

        """
        drill_sim = DrillSim(self.drill_string, self.event,
                             self.solver_settings, TEST_WORKING_DIRECTORY,
                             TEST_ANALYSIS_NAME)
        measure = drill_sim.string.tools[1]['Measure']
        self.assertEqual(measure, 'yes')
Пример #3
0
    def test_get_inputs_from_pason_rop(self):
        """Tests that setting the inputs from a :class:`PasonData` object works.
        
        """
        pason_data = dripy.PasonData(TEST_PASON_DATA)
        drill_sim = DrillSim(self.drill_string, self.event,
                             self.solver_settings, TEST_WORKING_DIRECTORY,
                             TEST_ANALYSIS_NAME)
        drill_sim.get_pason_inputs(pason_data, show_plots=False)

        self.assertListEqual(drill_sim.pason_inputs['rop'][0][1000:1010],
                             TEST_EXPECTED_CLEANED_ROP)
Пример #4
0
    def test_drillsim_from_existing_event_file_2019(self):
        event_from_file = adripy.event.DrillEvent.read_from_file(
            TEST_EVENT_FILE_2019_2)
        drill_sim = DrillSim(self.drill_string, event_from_file,
                             self.solver_settings, TEST_WORKING_DIRECTORY,
                             TEST_ANALYSIS_NAME)
        drill_sim.build()

        failures = check_file_contents(
            os.path.join(drill_sim.directory, drill_sim.acf_filename),
            EXPECTED_DRILLSIM_FROM_EXISTING_EVENT_FILE_ACF_TEXT)
        self.assertListEqual(failures, [])
Пример #5
0
    def test_relativity_in_string_event_reference(self):
        """Tests that the file references in the string file are relative to drill_sim.directory       
        """
        drill_sim = DrillSim(self.drill_string, self.event,
                             self.solver_settings, TEST_WORKING_DIRECTORY,
                             TEST_ANALYSIS_NAME)

        event_filepath = adripy.get_TO_param(
            os.path.join(drill_sim.directory, drill_sim.string_filename),
            'Event_Property_File')
        self.assertFalse(
            thornpy.utilities.convert_path(drill_sim.directory) in
            thornpy.utilities.convert_path(event_filepath))
Пример #6
0
    def test_write_tiem_orbit_files_ssf_filename(self):
        """Tests that DrillSim.event has the correct string filename 
        """
        # Create a DrillSim object
        drill_sim = DrillSim(self.drill_string, self.event,
                             self.solver_settings, TEST_WORKING_DIRECTORY,
                             TEST_ANALYSIS_NAME)

        # Test the filename
        expected_filename = os.path.join(TEST_WORKING_DIRECTORY,
                                         TEST_ANALYSIS_NAME + '.ssf')
        actual_filename = drill_sim.solver_settings.filename
        self.assertEqual(actual_filename, expected_filename)
Пример #7
0
 def test_build_evt_contents(self):
     """Tests that the event file created in the DrillSim directory has the correct contents.        
     
     """
     drill_sim = DrillSim(self.drill_string, self.event,
                          self.solver_settings, TEST_WORKING_DIRECTORY,
                          TEST_ANALYSIS_NAME)
     drill_sim.build()
     evt_file = os.path.join(TEST_WORKING_DIRECTORY,
                             TEST_ANALYSIS_NAME + '.evt')
     failures = check_file_contents(evt_file,
                                    EXPECTED_DRILLSIM_EVENT_FILE_TEXT)
     self.assertListEqual(failures, [])
Пример #8
0
    def test_string_file_contents(self):
        """Checks that the contents of the string file generated by drill_sim.setup() are as expected.
        
        """
        drill_sim = DrillSim(self.drill_string, self.event,
                             self.solver_settings, TEST_WORKING_DIRECTORY,
                             TEST_ANALYSIS_NAME)

        failures = check_file_contents(
            os.path.join(drill_sim.directory, drill_sim.string_filename),
            EXPECTED_DRILLSIM_STRING_FILE_TEXT)

        self.assertListEqual(failures, [])
Пример #9
0
    def test_relativity_in_string_pdc_reference(self):
        """Tests that the file references in the string file are relative to drill_sim.directory       
        """
        drill_sim = DrillSim(self.drill_string, self.event,
                             self.solver_settings, TEST_WORKING_DIRECTORY,
                             TEST_ANALYSIS_NAME)

        _name, pdc_filepath, _so, _gn = adripy.get_tool_name(
            os.path.join(drill_sim.directory, drill_sim.string_filename),
            'pdc_bit',
            return_full_path=True)

        self.assertFalse(
            thornpy.utilities.convert_path(drill_sim.directory) in
            thornpy.utilities.convert_path(pdc_filepath))
Пример #10
0
 def test_build_adm_contents(self):
     """Tests that the event file created in the DrillSim directory has the correct contents.        
     
     """
     drill_sim = DrillSim(self.drill_string, self.event,
                          self.solver_settings, TEST_WORKING_DIRECTORY,
                          TEST_ANALYSIS_NAME)
     pason_data = dripy.PasonData(TEST_PASON_DATA)
     drill_sim.get_pason_inputs(pason_data, show_plots=False)
     drill_sim.build()
     adm_file = os.path.join(TEST_WORKING_DIRECTORY,
                             TEST_ANALYSIS_NAME + '.adm')
     n_adm_lines = len(open(adm_file, 'r').readlines())
     expected_n_adm_lines = 12538
     self.assertEqual(n_adm_lines, expected_n_adm_lines)
Пример #11
0
    def test_input_deck_directory_contents(self):
        """Tests that the input deck (adm, acf, cmd files) are written to the directory
        """
        drill_sim = DrillSim(self.drill_string, self.event,
                             self.solver_settings, TEST_WORKING_DIRECTORY,
                             TEST_ANALYSIS_NAME)

        drill_sim.build()
        expected_contents = [
            drill_sim.event.filename,
            os.path.join(drill_sim.directory, drill_sim.string_filename),
            drill_sim.solver_settings.filename,
            os.path.join(drill_sim.directory, drill_sim.adm_filename),
            os.path.join(drill_sim.directory, drill_sim.acf_filename),
            os.path.join(drill_sim.directory, drill_sim.cmd_filename),
            os.path.join(drill_sim.directory, 'aview.cmd'),
            os.path.join(drill_sim.directory, 'aview.log'),
            os.path.join(drill_sim.directory, 'build.cmd'),
        ]

        for tool in drill_sim.string.tools:
            tool_file = tool['Property_File']
            expected_contents.append(
                os.path.join(drill_sim.directory, tool_file))
        expected_contents.append(
            os.path.join(drill_sim.directory,
                         drill_sim.string.top_drive['Property_File']))
        expected_contents.append(
            os.path.join(drill_sim.directory,
                         drill_sim.string.parameters['Hole_Property_File']))

        actual_contents = glob.glob(os.path.join(drill_sim.directory, '*'))

        # Remove the aview.cmd.bak file from the actual contents list
        if os.path.join(drill_sim.directory,
                        'aview.cmd.bak') in actual_contents:
            actual_contents.remove(
                os.path.join(drill_sim.directory, 'aview.cmd.bak'))

        # Remove the aview.loq file from the actual contents list
        if os.path.join(drill_sim.directory, 'aview.loq') in actual_contents:
            actual_contents.remove(
                os.path.join(drill_sim.directory, 'aview.loq'))

        self.assertListEqual(sorted(actual_contents),
                             sorted(expected_contents))