diff --git a/models.py b/models.py index 2d816ee..bb6f14d 100644 --- a/models.py +++ b/models.py @@ -39,8 +39,10 @@ class ModelTypes(Enum): STATIONS = "Stations" class ModelProperties(Enum): - FREQ = "FREQ" PU = "PU" + FREQ = "FREQ" + ANGLE = "ANGLE" + ANGLED = "ANGLED" class LoggingLevels(IntEnum): NOTSET=0 @@ -141,7 +143,7 @@ class ExportSettings(BaseModel): class PublicationDefination(BaseModel): bus_subsystems: List[int] = [ 0,] - model_type : ModelTypes = "Buses" + model_type : ModelTypes = "buses" model_properties : List[ModelProperties] = ["FREQ", "PU"] class HelicsSettings(BaseModel): diff --git a/pyproject.toml b/pyproject.toml index 2eb07ae..e84d51e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -56,3 +56,8 @@ path = "pypsse/__init__.py" include = [ "/pypsse", ] + +[tool.hatch.build.targets.wheel] +packages = [ + "pypsse" +] \ No newline at end of file diff --git a/pypsse/models.py b/pypsse/models.py index c6cd10c..24d160f 100644 --- a/pypsse/models.py +++ b/pypsse/models.py @@ -46,8 +46,10 @@ class ModelTypes(Enum): class ModelProperties(Enum): - FREQ = "FREQ" PU = "PU" + FREQ = "FREQ" + ANGLE = "ANGLE" + ANGLED = "ANGLED" class LoggingLevels(IntEnum): diff --git a/pypsse/modes/snap.py b/pypsse/modes/snap.py index 9893b6b..d59e166 100644 --- a/pypsse/modes/snap.py +++ b/pypsse/modes/snap.py @@ -59,11 +59,6 @@ def init(self, bus_subsystems): else: sim_step = self.settings.simulation.psse_solver_timestep.total_seconds() - for mdl in self.settings["Simulation"]["User models"]: - dll_path = os.path.join(self.settings["Simulation"]["Project Path"], 'Case_study', mdl) - self.PSSE.addmodellibrary(dll_path) - self.logger.debug('User defined library added: {}'.format(mdl)) - self.PSSE.dynamics_solution_param_2( [60, self._i, self._i, self._i, self._i, self._i, self._i, self._i], [0.4, self._f, sim_step, self._f, self._f, self._f, self._f, self._f] diff --git a/pypsse/utils/dynamic_utils.py b/pypsse/utils/dynamic_utils.py index 3fe5604..9adc370 100644 --- a/pypsse/utils/dynamic_utils.py +++ b/pypsse/utils/dynamic_utils.py @@ -12,14 +12,17 @@ def disable_generation_for_coupled_buses(self): sub_data = pd.read_csv(self.settings.simulation.subscriptions_file) sub_data = sub_data[sub_data['element_type'] == 'Load'] generators = {} + generator_list = {} + + for gen_bus, gen_id in self.raw_data.generators: + if gen_bus not in generator_list: + generator_list[gen_bus] = [] + generator_list[gen_bus].append(gen_id) + for ix, row in sub_data.iterrows(): bus = row['bus'] - for gen_bus, gen_id in self.raw_data.generators: - if gen_bus not in generators: - generators[bus] = [gen_id] - else: - generators[bus].append(gen_id) - + generators[bus] = generator_list[bus] + for bus_id, machines in generators.items(): for machine in machines: intgar = [0, self._i, self._i, self._i, self._i, self._i] @@ -29,6 +32,7 @@ def disable_generation_for_coupled_buses(self): ] self.PSSE.machine_chng_2(bus_id, machine, intgar, realar) self.logger.info(f"Machine disabled: {bus_id}_{machine}") + return def disable_load_models_for_coupled_buses(self):