Hello,
I am trying to run a code and I am not sure why I am getting the following error. I am trying to just solve for the 'p_nom_opt' for the generators.
Any help would be greatly appreciated. Apologies for the simple question, I am fairly new to Python and have limited Electrical Engineering knowledge.
network.lopf(network.snapshots[0:60],solver_name="glpk",keep_files=True)
INFO:pypsa.pf:Slack bus for sub-network 0 is HiepHoa
INFO:pypsa.opf:Performed preliminary steps
INFO:pypsa.opf:Building pyomo model using `angles` formulation
INFO:pypsa.opf:Solving model using glpk
-----------------------------------------------------
AssertionError Traceback (most recent call last)
<ipython-input-6-bbaf404c21f3> in <module>()
----> 1 network.lopf(network.snapshots[0:60],solver_name="glpk",keep_files=True)
~\Anaconda3\envs\pypsa\lib\site-packages\pypsa\opf.py in network_lopf(network, snapshots, solver_name, solver_io, skip_pre, extra_functionality, solver_options, keep_files, formulation, ptdf_tolerance, free_memory)
1483 network_lopf_prepare_solver(network, solver_name=solver_name, solver_io=solver_io)
1484
-> 1485 return network_lopf_solve(network, snapshots, formulation=formulation, solver_options=solver_options, keep_files=keep_files, free_memory=free_memory)
~\Anaconda3\envs\pypsa\lib\site-packages\pypsa\opf.py in network_lopf_solve(network, snapshots, formulation, solver_options, keep_files, free_memory)
1408 network.results = network.opt.solve(*args, suffixes=["dual"], keepfiles=keep_files, options=solver_options)
1409 else:
-> 1410 network.results = network.opt.solve(*args, suffixes=["dual"], keepfiles=keep_files, options=solver_options)
1411
1412 if logger.isEnabledFor(logging.INFO):
~\Anaconda3\envs\pypsa\lib\site-packages\pyomo\opt\base\solvers.py in solve(self, *args, **kwds)
594 initial_time = time.time()
595
--> 596 self._presolve(*args, **kwds)
597
598 presolve_completion_time = time.time()
~\Anaconda3\envs\pypsa\lib\site-packages\pyomo\opt\solver\shellcmd.py in _presolve(self, *args, **kwds)
194 self._keepfiles = kwds.pop("keepfiles", False)
195
--> 196 OptSolver._presolve(self, *args, **kwds)
197
198 #
~\Anaconda3\envs\pypsa\lib\site-packages\pyomo\opt\base\solvers.py in _presolve(self, *args, **kwds)
691 self._problem_format,
692 self._valid_problem_formats,
--> 693 **kwds)
694 total_time = time.time() - write_start_time
695 if self._report_timing:
~\Anaconda3\envs\pypsa\lib\site-packages\pyomo\opt\base\solvers.py in _convert_problem(self, args, problem_format, valid_problem_formats, **kwds)
762 valid_problem_formats,
763 self.has_capability,
--> 764 **kwds)
765
766 def _default_results_format(self, prob_format):
~\Anaconda3\envs\pypsa\lib\site-packages\pyomo\opt\base\convert.py in convert_problem(args, target_problem_type, valid_problem_types, has_capability, **kwds)
108 tmpkw = kwds
109 tmpkw['capabilities'] = has_capability
--> 110 problem_files, symbol_map = converter.apply(*tmp, **tmpkw)
111 return problem_files, ptype, symbol_map
112
~\Anaconda3\envs\pypsa\lib\site-packages\pyomo\solvers\plugins\converter\model.py in apply(self, *args, **kwds)
94 format=ProblemFormat.cpxlp,
95 solver_capability=capabilities,
---> 96 io_options=io_options)
97 return (problem_filename,), symbol_map_id
98 else:
~\Anaconda3\envs\pypsa\lib\site-packages\pyomo\core\base\block.py in write(self, filename, format, solver_capability, io_options)
1645 filename,
1646 solver_capability,
-> 1647 io_options)
1648 smap_id = id(smap)
1649 if not hasattr(self, 'solutions'):
~\Anaconda3\envs\pypsa\lib\site-packages\pyomo\repn\plugins\cpxlp.py in __call__(self, model, output_filename, solver_capability, io_options)
174 skip_trivial_constraints=skip_trivial_constraints,
175 force_objective_constant=force_objective_constant,
--> 176 include_all_variable_bounds=include_all_variable_bounds)
177
178 self._referenced_variable_ids.clear()
~\Anaconda3\envs\pypsa\lib\site-packages\pyomo\repn\plugins\cpxlp.py in _print_model_LP(self, model, output_file, solver_capability, labeler, output_fixed_variable_bounds, file_determinism, row_order, column_order, skip_trivial_constraints, force_objective_constant, include_all_variable_bounds)
735 if constraint_data.equality:
736 assert value(constraint_data.lower) == \
--> 737 value(constraint_data.upper)
738 label = 'c_e_' + con_symbol + '_'
739 alias_symbol_func(symbol_map, constraint_data, label)