oplus/simulation.py
def simulate(
            cls,
            epm_or_path,
            weather_data_or_path,
            base_dir_path,
            simulation_name=None,
            stdout=None,
            stderr=None,
            beat_freq=None
    ):
        """
        Parameters
        ----------
        epm_or_path
        weather_data_or_path
        base_dir_path: simulation dir path
        simulation_name: str, default None
            if provided, simulation will be done in {base_dir_path}/{simulation_name}
            else, simulation will be done in {base_dir_path}
        stdout: stream, default logger.info
            stream where EnergyPlus standard output is redirected
        stderr: stream, default logger.error
            stream where EnergyPlus standard error is redirected
        beat_freq: float, default None
            if provided, subprocess in which EnergyPlus is run will write at given frequency in standard output. May
            be used to monitor subprocess state.

        Returns
        -------
        Simulation instance
        """
        # manage simulation dir path
        if not os.path.isdir(base_dir_path):
            raise NotADirectoryError("Base dir path not found: '%s'" % base_dir_path)
        simulation_dir_path = base_dir_path if simulation_name is None else os.path.join(base_dir_path, simulation_name)

        # make directory if does not exist
        if not os.path.exists(simulation_dir_path):
            os.mkdir(simulation_dir_path)

        # run simulation
        stdout = LoggerStreamWriter(logger_name=__name__, level=logging.INFO) if stdout is None else stdout
        stderr = LoggerStreamWriter(logger_name=__name__, level=logging.ERROR) if stderr is None else stderr
        run_eplus(
            epm_or_path,
            weather_data_or_path,
            simulation_dir_path,
            stdout=stdout,
            stderr=stderr,
            beat_freq=beat_freq
        )

        # return simulation object
        return cls(
            base_dir_path,
            simulation_name=simulation_name
        )
def simulate(
            cls,
            epm_or_path,
            weather_data_or_path,
            base_dir_path,
            simulation_name=None,
            stdout=None,
            stderr=None,
            beat_freq=None
    ):
        """
        Parameters
        ----------
        epm_or_path
        weather_data_or_path
        base_dir_path: simulation dir path
        simulation_name: str, default None
            if provided, simulation will be done in {base_dir_path}/{simulation_name}
            else, simulation will be done in {base_dir_path}
        stdout: stream, default logger.info
            stream where EnergyPlus standard output is redirected
        stderr: stream, default logger.error
            stream where EnergyPlus standard error is redirected
        beat_freq: float, default None
            if provided, subprocess in which EnergyPlus is run will write at given frequency in standard output. May
            be used to monitor subprocess state.

        Returns
        -------
        Simulation instance
        """
        # manage simulation dir path
        if not os.path.isdir(base_dir_path):
            raise NotADirectoryError("Base dir path not found: '%s'" % base_dir_path)
        simulation_dir_path = base_dir_path if simulation_name is None else os.path.join(base_dir_path, simulation_name)

        # make directory if does not exist
        if not os.path.exists(simulation_dir_path):
            os.mkdir(simulation_dir_path)

        # run simulation
        stdout = LoggerStreamWriter(logger_name=__name__, level=logging.INFO) if stdout is None else stdout
        stderr = LoggerStreamWriter(logger_name=__name__, level=logging.ERROR) if stderr is None else stderr
        run_eplus(
            epm_or_path,
            weather_data_or_path,
            simulation_dir_path,
            stdout=stdout,
            stderr=stderr,
            beat_freq=beat_freq
        )

        # return simulation object
        return cls(
            base_dir_path,
            simulation_name=simulation_name
        )
def simulate ( cls , epm_or_path , weather_data_or_path , base_dir_path , simulation_name = None , stdout = None , stderr = None , beat_freq = None ) : # manage simulation dir path if not os . path . isdir ( base_dir_path ) : raise NotADirectoryError ( "Base dir path not found: '%s'" % base_dir_path ) simulation_dir_path = base_dir_path if simulation_name is None else os . path . join ( base_dir_path , simulation_name ) # make directory if does not exist if not os . path . exists ( simulation_dir_path ) : os . mkdir ( simulation_dir_path ) # run simulation stdout = LoggerStreamWriter ( logger_name = __name__ , level = logging . INFO ) if stdout is None else stdout stderr = LoggerStreamWriter ( logger_name = __name__ , level = logging . ERROR ) if stderr is None else stderr run_eplus ( epm_or_path , weather_data_or_path , simulation_dir_path , stdout = stdout , stderr = stderr , beat_freq = beat_freq ) # return simulation object return cls ( base_dir_path , simulation_name = simulation_name )
Parameters
        ----------
        epm_or_path
        weather_data_or_path
        base_dir_path: simulation dir path
        simulation_name: str, default None
            if provided, simulation will be done in {base_dir_path}/{simulation_name}
            else, simulation will be done in {base_dir_path}
        stdout: stream, default logger.info
            stream where EnergyPlus standard output is redirected
        stderr: stream, default logger.error
            stream where EnergyPlus standard error is redirected
        beat_freq: float, default None
            if provided, subprocess in which EnergyPlus is run will write at given frequency in standard output. May
            be used to monitor subprocess state.

        Returns
        -------
        Simulation instance
Parameters ---------- epm_or_path weather_data_or_path base_dir_path : simulation dir path simulation_name : str default None if provided simulation will be done in { base_dir_path } / { simulation_name } else simulation will be done in { base_dir_path } stdout : stream default logger . info stream where EnergyPlus standard output is redirected stderr : stream default logger . error stream where EnergyPlus standard error is redirected beat_freq : float default None if provided subprocess in which EnergyPlus is run will write at given frequency in standard output . May be used to monitor subprocess state .