Example #1
0
    def test_process_iv_curves_no_inputs(self):
        self._make_mocked_api()
        module = Module(api=self.mocked_api)

        with self.assertRaises(ValueError) as e:
            module.process_iv_curves()
        self.assertEqual(
            e.exception.args[0],
            "Either a file path to the .xslx template for Full IV Curves input or "
            "the properly formatted JSON-serializable data structure for Key IV "
            "Points input must be assigned as input. See the Python SDK "
            "documentation (https://plantpredict-python.readthedocs.io/en/latest/)"
            " for more information.")
Example #2
0
    def test_process_iv_curves_conflicting_inputs(self):
        self._make_mocked_api()
        module = Module(api=self.mocked_api)

        with self.assertRaises(ValueError) as e:
            module.process_iv_curves(file_path="fake_file_path.xlsx",
                                     iv_curve_data={
                                         "temperature":
                                         25,
                                         "irradiance":
                                         1000,
                                         "data_points": [{
                                             "current": 1.25,
                                             "voltage": 20.0
                                         }]
                                     })
        self.assertEqual(e.exception.args[0],
                         "Only one input option may be specified.")
Example #3
0
    def test_process_iv_curves_with_file(self):
        self._make_mocked_api()
        module = Module(api=self.mocked_api)

        data = module.process_iv_curves(
            file_path="test_data/test_parse_full_iv_curves_template.xlsx")
        self.assertEqual(data, [{
            "temperature": 25,
            "irradiance": 1000,
            "short_circuit_current": 9.43,
            "open_circuit_voltage": 46.39,
            "mpp_current": 8.9598,
            "mpp_voltage": 38.1285,
            "max_power": 341.6237
        }, {
            "temperature": 25,
            "irradiance": 1000,
            "short_circuit_current": 9.43,
            "open_circuit_voltage": 46.39,
            "mpp_current": 8.9598,
            "mpp_voltage": 38.1285,
            "max_power": 341.6237
        }])
Example #4
0
    def test_process_iv_curves_with_file(self):
        self._make_mocked_api()
        module = Module(api=self.mocked_api)

        data = module.process_iv_curves(
            iv_curve_data=[{
                "temperature": 25,
                "irradiance": 1000,
                "data_points": [{
                    "current": 1.25,
                    "voltage": 20.0
                }]
            }, {
                "temperature": 25,
                "irradiance": 1000,
                "data_points": [{
                    "current": 1.25,
                    "voltage": 20.0
                }]
            }])
        self.assertEqual(data, [{
            "temperature": 25,
            "irradiance": 1000,
            "short_circuit_current": 9.43,
            "open_circuit_voltage": 46.39,
            "mpp_current": 8.9598,
            "mpp_voltage": 38.1285,
            "max_power": 341.6237
        }, {
            "temperature": 25,
            "irradiance": 1000,
            "short_circuit_current": 9.43,
            "open_circuit_voltage": 46.39,
            "mpp_current": 8.9598,
            "mpp_voltage": 38.1285,
            "max_power": 341.6237
        }])