def construct_motion_object(self):
        """ Constructs an RegularPistonWaveGen object from the data currently introduced on the widget. """
        _cmo_elevation = None
        if self.awas_elevation_selector.currentIndex() == 0:
            _cmo_elevation = AWASWaveOrder.FIRST_ORDER
        elif self.awas_elevation_selector.currentIndex() == 1:
            _cmo_elevation = AWASWaveOrder.SECOND_ORDER
        else:
            _cmo_elevation = AWASWaveOrder.FIRST_ORDER

        _cmo_savedata = None
        if self.awas_savedata_selector.currentIndex() == 0:
            _cmo_savedata = AWASSaveMethod.BY_PART
        elif self.awas_savedata_selector.currentIndex() == 1:
            _cmo_savedata = AWASSaveMethod.MORE_INFO
        elif self.awas_savedata_selector.currentIndex() == 2:
            _cmo_savedata = AWASSaveMethod.BY_STEP
        else:
            _cmo_savedata = AWASSaveMethod.BY_PART

        _cmo_correction = AWASCorrection(
            enabled=self.awas_correction_enabled.isChecked(),
            coefstroke=float(self.awas_correction_coefstroke_input.text()),
            coefperiod=float(self.awas_correction_coefperiod_input.text()),
            powerfunc=float(self.awas_correction_powerfunc_input.text()))

        awas_object = AWAS(enabled=self.awas_enabled.isChecked(),
                           startawas=float(self.awas_startawas_input.text()),
                           swl=float(self.awas_swl_input.text()),
                           elevation=_cmo_elevation,
                           gaugex=float(self.awas_gaugex_input.text()),
                           gaugey=float(self.awas_gaugey_input.text()),
                           gaugezmin=float(self.awas_gaugezmin_input.text()),
                           gaugezmax=float(self.awas_gaugezmax_input.text()),
                           gaugedp=float(self.awas_gaugedp_input.text()),
                           coefmasslimit=float(
                               self.awas_coefmasslimit_input.text()),
                           savedata=_cmo_savedata,
                           limitace=float(self.awas_limitace_input.text()),
                           correction=_cmo_correction)

        return RegularPistonWaveGen(
            wave_order=self.wave_order_selector.currentIndex() + 1,
            start=0,
            duration=float(self.duration_input.text()),
            depth=float(self.depth_input.text()),
            piston_dir=[
                float(self.piston_dir_x.text()),
                float(self.piston_dir_y.text()),
                float(self.piston_dir_z.text())
            ],
            wave_height=float(self.wave_height_input.text()),
            wave_period=float(self.wave_period_input.text()),
            phase=float(self.phase_input.text()),
            ramp=float(self.ramp_input.text()),
            disksave_periods=int(self.disksave_periods.text()),
            disksave_periodsteps=int(self.disksave_periodsteps.text()),
            disksave_xpos=float(self.disksave_xpos.text()),
            disksave_zpos=float(self.disksave_zpos.text()),
            awas=awas_object)
 def __init__(self, wave_order=1, start=0, duration=0, depth=0, wave_height=0.5,
              wave_period=1, gainstroke=1.0, spectrum=IrregularSpectrum.JONSWAP,
              discretization=IrregularDiscretization.STRETCHED,
              peak_coef=0.1, waves=50, randomseed=randint(0, 9999), serieini=0, ramptime=0,
              serieini_autofit=True, savemotion_time=30, savemotion_timedt=0.05, savemotion_xpos=2,
              savemotion_zpos=-0.15, saveserie_timemin=0, saveserie_timemax=1300, saveserie_timedt=0.05,
              saveserie_xpos=0, saveseriewaves_timemin=0, saveseriewaves_timemax=1000, saveseriewaves_xpos=2,
              piston_dir=None, awas=None):
     WaveGen.__init__(self, wave_order, start, duration, depth, wave_height, wave_period, gainstroke)
     self.type = MotionType.IRREGULAR_PISTON_WAVE_GENERATOR
     self.spectrum = spectrum
     self.discretization = discretization
     self.peak_coef = peak_coef
     self.waves = waves
     self.randomseed = randomseed
     self.serieini = serieini
     self.serieini_autofit = serieini_autofit
     self.ramptime = ramptime
     self.savemotion_time = savemotion_time
     self.savemotion_timedt = savemotion_timedt
     self.savemotion_xpos = savemotion_xpos
     self.savemotion_zpos = savemotion_zpos
     self.saveserie_timemin = saveserie_timemin
     self.saveserie_timemax = saveserie_timemax
     self.saveserie_timedt = saveserie_timedt
     self.saveserie_xpos = saveserie_xpos
     self.saveseriewaves_timemin = saveseriewaves_timemin
     self.saveseriewaves_timemax = saveseriewaves_timemax
     self.saveseriewaves_xpos = saveseriewaves_xpos
     self.piston_dir = piston_dir or [1, 0, 0]
     self.awas = AWAS() if awas is None else awas
 def __init__(self,
              wave_order=2,
              start=0,
              duration=0,
              depth=0,
              wave_height=0.5,
              wave_period=1,
              gainstroke=1.0,
              phase=0,
              ramp=0,
              disksave_periods=24,
              disksave_periodsteps=20,
              disksave_xpos=2,
              disksave_zpos=-0.15,
              piston_dir=None,
              awas=None):
     WaveGen.__init__(self, wave_order, start, duration, depth, wave_height,
                      wave_period, gainstroke)
     self.type = MotionType.REGULAR_PISTON_WAVE_GENERATOR
     self.phase = phase
     self.ramp = ramp
     self.disksave_periods = disksave_periods
     self.disksave_periodsteps = disksave_periodsteps
     self.disksave_xpos = disksave_xpos
     self.disksave_zpos = disksave_zpos
     self.piston_dir = piston_dir or [1, 0, 0]
     self.awas = AWAS() if awas is None else awas
예제 #4
0
    def construct_motion_object(self):
        """ Constructs an object from the data introduced in the widget. """
        _cmo_elevation = None
        if self.awas_elevation_selector.currentIndex() == 0:
            _cmo_elevation = AWASWaveOrder.FIRST_ORDER
        elif self.awas_elevation_selector.currentIndex() == 1:
            _cmo_elevation = AWASWaveOrder.SECOND_ORDER
        else:
            _cmo_elevation = AWASWaveOrder.FIRST_ORDER

        _cmo_savedata = None
        if self.awas_savedata_selector.currentIndex() == 0:
            _cmo_savedata = AWASSaveMethod.BY_PART
        elif self.awas_savedata_selector.currentIndex() == 1:
            _cmo_savedata = AWASSaveMethod.MORE_INFO
        elif self.awas_savedata_selector.currentIndex() == 2:
            _cmo_savedata = AWASSaveMethod.BY_STEP
        else:
            _cmo_savedata = AWASSaveMethod.BY_PART

        _cmo_correction = AWASCorrection(
            enabled=self.awas_correction_enabled.isChecked(),
            coefstroke=float(self.awas_correction_coefstroke_input.text()),
            coefperiod=float(self.awas_correction_coefperiod_input.text()),
            powerfunc=float(self.awas_correction_powerfunc_input.text()))

        awas_object = AWAS(enabled=self.awas_enabled.isChecked(),
                           startawas=float(self.awas_startawas_input.text()),
                           swl=float(self.awas_swl_input.text()),
                           elevation=_cmo_elevation,
                           gaugex=float(self.awas_gaugex_input.text()),
                           gaugey=float(self.awas_gaugey_input.text()),
                           gaugezmin=float(self.awas_gaugezmin_input.text()),
                           gaugezmax=float(self.awas_gaugezmax_input.text()),
                           gaugedp=float(self.awas_gaugedp_input.text()),
                           coefmasslimit=float(
                               self.awas_coefmasslimit_input.text()),
                           savedata=_cmo_savedata,
                           limitace=float(self.awas_limitace_input.text()),
                           correction=_cmo_correction)

        return IrregularPistonWaveGen(
            wave_order=self.wave_order_selector.currentIndex() + 1,
            start=0,
            duration=float(self.duration_input.text()),
            depth=float(self.depth_input.text()),
            piston_dir=[
                float(self.piston_dir_x.text()),
                float(self.piston_dir_y.text()),
                float(self.piston_dir_z.text())
            ],
            wave_height=float(self.wave_height_input.text()),
            wave_period=float(self.wave_period_input.text()),
            spectrum={
                0: IrregularSpectrum.JONSWAP,
                1: IrregularSpectrum.PIERSON_MOSKOWITZ
            }[self.spectrum_selector.currentIndex()],
            discretization={
                0: IrregularDiscretization.REGULAR,
                1: IrregularDiscretization.RANDOM,
                2: IrregularDiscretization.STRETCHED,
                3: IrregularDiscretization.COSSTRETCHED
            }[self.discretization_selector.currentIndex()],
            peak_coef=float(self.peak_coef_input.text()),
            waves=float(self.waves_input.text()),
            randomseed=float(self.randomseed_input.text()),
            serieini=float(self.serieini_input.text()),
            ramptime=float(self.ramptime_input.text()),
            serieini_autofit=self.serieini_autofit.isChecked(),
            savemotion_time=str(self.savemotion_time_input.text()),
            savemotion_timedt=str(self.savemotion_timedt_input.text()),
            savemotion_xpos=str(self.savemotion_xpos_input.text()),
            savemotion_zpos=str(self.savemotion_zpos_input.text()),
            saveserie_timemin=str(self.saveserie_timemin_input.text()),
            saveserie_timemax=str(self.saveserie_timemax_input.text()),
            saveserie_timedt=str(self.saveserie_timedt_input.text()),
            saveserie_xpos=str(self.saveserie_xpos_input.text()),
            saveseriewaves_timemin=str(
                self.saveseriewaves_timemin_input.text()),
            saveseriewaves_timemax=str(
                self.saveseriewaves_timemax_input.text()),
            saveseriewaves_xpos=str(self.saveseriewaves_xpos_input.text()),
            awas=awas_object)