Beispiel #1
0
    def test_serialization(self):
        s = TestRocSkim.skim

        ser = s.serialize()
        assert 'timeseries' in ser
        deser = Skim.deserialize(ser)
        s2 = Skim.new_from_dict(deser)
        ser2 = s2.serialize()
        ser.pop('id')
        ser2.pop('id')
        assert ser == ser2
Beispiel #2
0
    def test_weather_elements(self, sample_model_fcn2):
        self.sc, self.model = ROCTests.mk_objs(sample_model_fcn2)

        self.reset_and_release()

        skim = Skim(speed=2.0,
                    storage=2000.0,
                    swath_width=150,
                    group='A',
                    throughput=0.75,
                    nameplate_pump=100.0,
                    skim_efficiency_type='meh',
                    recovery=0.75,
                    recovery_ef=0.75,
                    decant=0.75,
                    decant_pump=150.0,
                    discharge_pump=1000.0,
                    rig_time=timedelta(minutes=30),
                    timeseries=[(datetime(2012, 9, 15, 12, 0),
                                 datetime(2012, 9, 16, 1, 0))],
                    transit_time=timedelta(hours=2))

        self.model.weatherers.append(skim)

        self.model.rewind()

        self.model.step()
        self.model.step()
        self.model.step()
        self.model.step()
Beispiel #3
0
    def test_serialization(self):
        s = TestRocSkim.skim

        ser = s.serialize()

        s2 = Skim.deserialize(ser)

        assert s == s2
Beispiel #4
0
    def test_serialization(self):
        s = TestRocSkim.skim

        ser = s.serialize()

        s2 = Skim.deserialize(ser)


        assert s == s2
Beispiel #5
0
class TestRocSkim(ROCTests):
    skim = Skim(speed=2.0,
                storage=2000.0,
                swath_width=150,
                group='A',
                throughput=0.75,
                nameplate_pump=100.0,
                skim_efficiency_type='meh',
                recovery=0.75,
                recovery_ef=0.75,
                decant=0.75,
                decant_pump=150.0,
                discharge_pump=1000.0,
                rig_time=timedelta(minutes=30).total_seconds(),
                timeseries=[(datetime(2012, 9, 15, 12, 0),
                             datetime(2012, 9, 16, 1, 0))],
                transit_time=timedelta(hours=2).total_seconds())

    def test_prepare_for_model_run(self, sample_model_fcn2):
        self.sc, self.model = ROCTests.mk_objs(sample_model_fcn2)

        self.reset_and_release()
        self.skim.prepare_for_model_run(self.sc)

    def test_prepare_for_model_step(self, sample_model_fcn2):
        self.sc, self.model = ROCTests.mk_objs(sample_model_fcn2)

        self.reset_and_release()

        self.skim.prepare_for_model_run(self.sc)
        self.skim.prepare_for_model_step(self.sc, time_step, active_start)

        assert self.skim._active is True

    def test_weather_elements(self, sample_model_fcn2):
        self.sc, self.model = ROCTests.mk_objs(sample_model_fcn2)

        self.reset_and_release()

        skim = Skim(speed=2.0,
                    storage=2000.0,
                    swath_width=150,
                    group='A',
                    throughput=0.75,
                    nameplate_pump=100.0,
                    skim_efficiency_type='meh',
                    recovery=0.75,
                    recovery_ef=0.75,
                    decant=0.75,
                    decant_pump=150.0,
                    discharge_pump=1000.0,
                    rig_time=timedelta(minutes=30),
                    timeseries=[(datetime(2012, 9, 15, 12, 0),
                                 datetime(2012, 9, 16, 1, 0))],
                    transit_time=timedelta(hours=2))

        self.model.weatherers.append(skim)

        self.model.rewind()

        self.model.step()
        self.model.step()
        self.model.step()
        self.model.step()

    def test_serialization(self):
        s = TestRocSkim.skim

        ser = s.serialize()

        s2 = Skim.deserialize(ser)


        assert s == s2

    def test_model_save(self, sample_model_fcn2):
        s = TestRocSkim.skim

        self.sc, self.model = ROCTests.mk_objs(sample_model_fcn2)

        self.model.weatherers.append(s)
        self.model.save('.')

    def test_model_load(self):
        _m = load('Model.zip')