Exemple #1
0
    def serialize(self, path):
        """Serialize a PyDssScenario to a directory.

        Parameters
        ----------
        path : str
            full path to scenario

        """
        os.makedirs(path, exist_ok=True)
        for name in self._SCENARIO_DIRECTORIES:
            os.makedirs(os.path.join(path, name), exist_ok=True)

        for controller_type, controllers in self.controllers.items():
            filename = os.path.join(path, "pyControllerList",
                                    filename_from_enum(controller_type))
            dump_data(controllers, filename)

        for mode, exports in self.exports.items():
            dump_data(
                exports,
                os.path.join(path, "ExportLists", filename_from_enum(mode)))

        for visualization_type, visualizations in self.visualizations.items():
            filename = os.path.join(path, "pyPlotList",
                                    filename_from_enum(visualization_type))
            dump_data(visualizations, filename)

        dump_data(
            load_data(DEFAULT_MONTE_CARLO_SETTINGS_FILE),
            os.path.join(path, "Monte_Carlo", MONTE_CARLO_SETTINGS_FILENAME))

        dump_data(load_data(DEFAULT_SUBSCRIPTIONS_FILE),
                  os.path.join(path, "ExportLists", SUBSCRIPTIONS_FILENAME))
Exemple #2
0
    def load_export_config_from_mode(export_mode):
        """Load a default export config from a type.

        Parameters
        ----------
        export_mode : ExportMode

        Returns
        -------
        dict

        """
        path = os.path.join(
            os.path.dirname(getattr(PyDSS, "__path__")[0]),
            "PyDSS",
            "defaults",
            "ExportLists",
            filename_from_enum(export_mode),
        )

        return load_data(path)
Exemple #3
0
    def load_controller_config_from_type(controller_type):
        """Load a default controller config from a type.

        Parameters
        ----------
        controller_type : ControllerType

        Returns
        -------
        dict

        """

        path = os.path.join(
            os.path.dirname(getattr(PyDSS, "__path__")[0]),
            "PyDSS",
            "defaults",
            "pyControllerList",
            filename_from_enum(controller_type),
        )

        return load_data(path)
Exemple #4
0
    def load_visualization_config_from_type(visualization_type):
        """Load a default visualization config from a type.

        Parameters
        ----------
        visualization_type : VisualizationType

        Returns
        -------
        dict

        """

        path = os.path.join(
            os.path.dirname(getattr(PyDSS, "__path__")[0]),
            "PyDSS",
            "defaults",
            "pyPlotList",
            filename_from_enum(visualization_type),
        )

        return load_data(path)