ltbams 1.0.4__tar.gz → 1.0.6__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (202) hide show
  1. {ltbams-1.0.4/ltbams.egg-info → ltbams-1.0.6}/PKG-INFO +3 -3
  2. {ltbams-1.0.4 → ltbams-1.0.6}/README.md +2 -2
  3. {ltbams-1.0.4 → ltbams-1.0.6}/ams/_version.py +3 -3
  4. {ltbams-1.0.4 → ltbams-1.0.6}/ams/io/matpower.py +7 -0
  5. {ltbams-1.0.4 → ltbams-1.0.6}/ams/models/cost.py +2 -0
  6. {ltbams-1.0.4 → ltbams-1.0.6}/ams/opt/exprcalc.py +3 -1
  7. {ltbams-1.0.4 → ltbams-1.0.6}/ams/routines/__init__.py +1 -0
  8. {ltbams-1.0.4 → ltbams-1.0.6}/ams/routines/dcopf.py +9 -5
  9. ltbams-1.0.6/ams/routines/dcopf2.py +95 -0
  10. {ltbams-1.0.4 → ltbams-1.0.6}/ams/routines/ed.py +2 -3
  11. {ltbams-1.0.4 → ltbams-1.0.6}/ams/routines/routine.py +2 -0
  12. {ltbams-1.0.4 → ltbams-1.0.6}/ams/routines/uc.py +4 -6
  13. {ltbams-1.0.4 → ltbams-1.0.6}/ams/shared.py +1 -1
  14. {ltbams-1.0.4 → ltbams-1.0.6}/ams/system.py +7 -0
  15. {ltbams-1.0.4 → ltbams-1.0.6}/docs/source/conf.py +1 -1
  16. {ltbams-1.0.4 → ltbams-1.0.6}/docs/source/examples/index.rst +2 -5
  17. {ltbams-1.0.4 → ltbams-1.0.6}/docs/source/release-notes.rst +13 -0
  18. {ltbams-1.0.4 → ltbams-1.0.6/ltbams.egg-info}/PKG-INFO +3 -3
  19. {ltbams-1.0.4 → ltbams-1.0.6}/ltbams.egg-info/SOURCES.txt +2 -0
  20. {ltbams-1.0.4 → ltbams-1.0.6}/tests/test_case.py +27 -0
  21. {ltbams-1.0.4 → ltbams-1.0.6}/tests/test_io.py +9 -0
  22. ltbams-1.0.6/tests/test_rtn_dcopf2.py +103 -0
  23. {ltbams-1.0.4 → ltbams-1.0.6}/CONTRIBUTING.rst +0 -0
  24. {ltbams-1.0.4 → ltbams-1.0.6}/LICENSE +0 -0
  25. {ltbams-1.0.4 → ltbams-1.0.6}/MANIFEST.in +0 -0
  26. {ltbams-1.0.4 → ltbams-1.0.6}/ams/__init__.py +0 -0
  27. {ltbams-1.0.4 → ltbams-1.0.6}/ams/__main__.py +0 -0
  28. {ltbams-1.0.4 → ltbams-1.0.6}/ams/cases/5bus/pjm5bus_demo.xlsx +0 -0
  29. {ltbams-1.0.4 → ltbams-1.0.6}/ams/cases/5bus/pjm5bus_jumper.xlsx +0 -0
  30. {ltbams-1.0.4 → ltbams-1.0.6}/ams/cases/5bus/pjm5bus_uced.json +0 -0
  31. {ltbams-1.0.4 → ltbams-1.0.6}/ams/cases/5bus/pjm5bus_uced.xlsx +0 -0
  32. {ltbams-1.0.4 → ltbams-1.0.6}/ams/cases/5bus/pjm5bus_uced_esd1.xlsx +0 -0
  33. {ltbams-1.0.4 → ltbams-1.0.6}/ams/cases/5bus/pjm5bus_uced_ev.xlsx +0 -0
  34. {ltbams-1.0.4 → ltbams-1.0.6}/ams/cases/ieee123/ieee123.xlsx +0 -0
  35. {ltbams-1.0.4 → ltbams-1.0.6}/ams/cases/ieee123/ieee123_regcv1.xlsx +0 -0
  36. {ltbams-1.0.4 → ltbams-1.0.6}/ams/cases/ieee14/ieee14.json +0 -0
  37. {ltbams-1.0.4 → ltbams-1.0.6}/ams/cases/ieee14/ieee14.raw +0 -0
  38. {ltbams-1.0.4 → ltbams-1.0.6}/ams/cases/ieee14/ieee14_conn.xlsx +0 -0
  39. {ltbams-1.0.4 → ltbams-1.0.6}/ams/cases/ieee14/ieee14_uced.xlsx +0 -0
  40. {ltbams-1.0.4 → ltbams-1.0.6}/ams/cases/ieee39/ieee39.xlsx +0 -0
  41. {ltbams-1.0.4 → ltbams-1.0.6}/ams/cases/ieee39/ieee39_uced.xlsx +0 -0
  42. {ltbams-1.0.4 → ltbams-1.0.6}/ams/cases/ieee39/ieee39_uced_esd1.xlsx +0 -0
  43. {ltbams-1.0.4 → ltbams-1.0.6}/ams/cases/ieee39/ieee39_uced_pvd1.xlsx +0 -0
  44. {ltbams-1.0.4 → ltbams-1.0.6}/ams/cases/ieee39/ieee39_uced_vis.xlsx +0 -0
  45. {ltbams-1.0.4 → ltbams-1.0.6}/ams/cases/matpower/benchmark.json +0 -0
  46. {ltbams-1.0.4 → ltbams-1.0.6}/ams/cases/matpower/case118.m +0 -0
  47. {ltbams-1.0.4 → ltbams-1.0.6}/ams/cases/matpower/case14.m +0 -0
  48. {ltbams-1.0.4 → ltbams-1.0.6}/ams/cases/matpower/case300.m +0 -0
  49. {ltbams-1.0.4 → ltbams-1.0.6}/ams/cases/matpower/case39.m +0 -0
  50. {ltbams-1.0.4 → ltbams-1.0.6}/ams/cases/matpower/case5.m +0 -0
  51. {ltbams-1.0.4 → ltbams-1.0.6}/ams/cases/matpower/case_ACTIVSg2000.m +0 -0
  52. {ltbams-1.0.4 → ltbams-1.0.6}/ams/cases/npcc/npcc.m +0 -0
  53. {ltbams-1.0.4 → ltbams-1.0.6}/ams/cases/npcc/npcc_uced.xlsx +0 -0
  54. {ltbams-1.0.4 → ltbams-1.0.6}/ams/cases/pglib/pglib_opf_case39_epri__api.m +0 -0
  55. {ltbams-1.0.4 → ltbams-1.0.6}/ams/cases/wecc/wecc.m +0 -0
  56. {ltbams-1.0.4 → ltbams-1.0.6}/ams/cases/wecc/wecc_uced.xlsx +0 -0
  57. {ltbams-1.0.4 → ltbams-1.0.6}/ams/cli.py +0 -0
  58. {ltbams-1.0.4 → ltbams-1.0.6}/ams/core/__init__.py +0 -0
  59. {ltbams-1.0.4 → ltbams-1.0.6}/ams/core/documenter.py +0 -0
  60. {ltbams-1.0.4 → ltbams-1.0.6}/ams/core/matprocessor.py +0 -0
  61. {ltbams-1.0.4 → ltbams-1.0.6}/ams/core/model.py +0 -0
  62. {ltbams-1.0.4 → ltbams-1.0.6}/ams/core/param.py +0 -0
  63. {ltbams-1.0.4 → ltbams-1.0.6}/ams/core/service.py +0 -0
  64. {ltbams-1.0.4 → ltbams-1.0.6}/ams/core/symprocessor.py +0 -0
  65. {ltbams-1.0.4 → ltbams-1.0.6}/ams/core/var.py +0 -0
  66. {ltbams-1.0.4 → ltbams-1.0.6}/ams/extension/__init__.py +0 -0
  67. {ltbams-1.0.4 → ltbams-1.0.6}/ams/extension/eva.py +0 -0
  68. {ltbams-1.0.4 → ltbams-1.0.6}/ams/interface.py +0 -0
  69. {ltbams-1.0.4 → ltbams-1.0.6}/ams/io/__init__.py +0 -0
  70. {ltbams-1.0.4 → ltbams-1.0.6}/ams/io/json.py +0 -0
  71. {ltbams-1.0.4 → ltbams-1.0.6}/ams/io/psse.py +0 -0
  72. {ltbams-1.0.4 → ltbams-1.0.6}/ams/io/pypower.py +0 -0
  73. {ltbams-1.0.4 → ltbams-1.0.6}/ams/io/xlsx.py +0 -0
  74. {ltbams-1.0.4 → ltbams-1.0.6}/ams/main.py +0 -0
  75. {ltbams-1.0.4 → ltbams-1.0.6}/ams/models/__init__.py +0 -0
  76. {ltbams-1.0.4 → ltbams-1.0.6}/ams/models/area.py +0 -0
  77. {ltbams-1.0.4 → ltbams-1.0.6}/ams/models/bus.py +0 -0
  78. {ltbams-1.0.4 → ltbams-1.0.6}/ams/models/distributed/__init__.py +0 -0
  79. {ltbams-1.0.4 → ltbams-1.0.6}/ams/models/distributed/esd1.py +0 -0
  80. {ltbams-1.0.4 → ltbams-1.0.6}/ams/models/distributed/ev.py +0 -0
  81. {ltbams-1.0.4 → ltbams-1.0.6}/ams/models/distributed/pvd1.py +0 -0
  82. {ltbams-1.0.4 → ltbams-1.0.6}/ams/models/group.py +0 -0
  83. {ltbams-1.0.4 → ltbams-1.0.6}/ams/models/info.py +0 -0
  84. {ltbams-1.0.4 → ltbams-1.0.6}/ams/models/line.py +0 -0
  85. {ltbams-1.0.4 → ltbams-1.0.6}/ams/models/renewable/__init__.py +0 -0
  86. {ltbams-1.0.4 → ltbams-1.0.6}/ams/models/renewable/regc.py +0 -0
  87. {ltbams-1.0.4 → ltbams-1.0.6}/ams/models/reserve.py +0 -0
  88. {ltbams-1.0.4 → ltbams-1.0.6}/ams/models/shunt.py +0 -0
  89. {ltbams-1.0.4 → ltbams-1.0.6}/ams/models/static/__init__.py +0 -0
  90. {ltbams-1.0.4 → ltbams-1.0.6}/ams/models/static/gen.py +0 -0
  91. {ltbams-1.0.4 → ltbams-1.0.6}/ams/models/static/pq.py +0 -0
  92. {ltbams-1.0.4 → ltbams-1.0.6}/ams/models/timeslot.py +0 -0
  93. {ltbams-1.0.4 → ltbams-1.0.6}/ams/models/zone.py +0 -0
  94. {ltbams-1.0.4 → ltbams-1.0.6}/ams/opt/__init__.py +0 -0
  95. {ltbams-1.0.4 → ltbams-1.0.6}/ams/opt/constraint.py +0 -0
  96. {ltbams-1.0.4 → ltbams-1.0.6}/ams/opt/expression.py +0 -0
  97. {ltbams-1.0.4 → ltbams-1.0.6}/ams/opt/objective.py +0 -0
  98. {ltbams-1.0.4 → ltbams-1.0.6}/ams/opt/omodel.py +0 -0
  99. {ltbams-1.0.4 → ltbams-1.0.6}/ams/opt/optzbase.py +0 -0
  100. {ltbams-1.0.4 → ltbams-1.0.6}/ams/opt/param.py +0 -0
  101. {ltbams-1.0.4 → ltbams-1.0.6}/ams/opt/var.py +0 -0
  102. {ltbams-1.0.4 → ltbams-1.0.6}/ams/pypower/__init__.py +0 -0
  103. {ltbams-1.0.4 → ltbams-1.0.6}/ams/pypower/_compat.py +0 -0
  104. {ltbams-1.0.4 → ltbams-1.0.6}/ams/pypower/core/__init__.py +0 -0
  105. {ltbams-1.0.4 → ltbams-1.0.6}/ams/pypower/core/pips.py +0 -0
  106. {ltbams-1.0.4 → ltbams-1.0.6}/ams/pypower/core/ppoption.py +0 -0
  107. {ltbams-1.0.4 → ltbams-1.0.6}/ams/pypower/core/ppver.py +0 -0
  108. {ltbams-1.0.4 → ltbams-1.0.6}/ams/pypower/core/solver.py +0 -0
  109. {ltbams-1.0.4 → ltbams-1.0.6}/ams/pypower/eps.py +0 -0
  110. {ltbams-1.0.4 → ltbams-1.0.6}/ams/pypower/idx.py +0 -0
  111. {ltbams-1.0.4 → ltbams-1.0.6}/ams/pypower/io.py +0 -0
  112. {ltbams-1.0.4 → ltbams-1.0.6}/ams/pypower/make/__init__.py +0 -0
  113. {ltbams-1.0.4 → ltbams-1.0.6}/ams/pypower/make/matrices.py +0 -0
  114. {ltbams-1.0.4 → ltbams-1.0.6}/ams/pypower/make/pdv.py +0 -0
  115. {ltbams-1.0.4 → ltbams-1.0.6}/ams/pypower/routines/__init__.py +0 -0
  116. {ltbams-1.0.4 → ltbams-1.0.6}/ams/pypower/routines/cpf.py +0 -0
  117. {ltbams-1.0.4 → ltbams-1.0.6}/ams/pypower/routines/cpf_callbacks.py +0 -0
  118. {ltbams-1.0.4 → ltbams-1.0.6}/ams/pypower/routines/opf.py +0 -0
  119. {ltbams-1.0.4 → ltbams-1.0.6}/ams/pypower/routines/opffcns.py +0 -0
  120. {ltbams-1.0.4 → ltbams-1.0.6}/ams/pypower/routines/pflow.py +0 -0
  121. {ltbams-1.0.4 → ltbams-1.0.6}/ams/pypower/toggle.py +0 -0
  122. {ltbams-1.0.4 → ltbams-1.0.6}/ams/pypower/utils.py +0 -0
  123. {ltbams-1.0.4 → ltbams-1.0.6}/ams/report.py +0 -0
  124. {ltbams-1.0.4 → ltbams-1.0.6}/ams/routines/acopf.py +0 -0
  125. {ltbams-1.0.4 → ltbams-1.0.6}/ams/routines/cpf.py +0 -0
  126. {ltbams-1.0.4 → ltbams-1.0.6}/ams/routines/dcpf.py +0 -0
  127. {ltbams-1.0.4 → ltbams-1.0.6}/ams/routines/dcpf0.py +0 -0
  128. {ltbams-1.0.4 → ltbams-1.0.6}/ams/routines/dopf.py +0 -0
  129. {ltbams-1.0.4 → ltbams-1.0.6}/ams/routines/pflow.py +0 -0
  130. {ltbams-1.0.4 → ltbams-1.0.6}/ams/routines/pflow0.py +0 -0
  131. {ltbams-1.0.4 → ltbams-1.0.6}/ams/routines/rted.py +0 -0
  132. {ltbams-1.0.4 → ltbams-1.0.6}/ams/routines/type.py +0 -0
  133. {ltbams-1.0.4 → ltbams-1.0.6}/ams/utils/__init__.py +0 -0
  134. {ltbams-1.0.4 → ltbams-1.0.6}/ams/utils/misc.py +0 -0
  135. {ltbams-1.0.4 → ltbams-1.0.6}/ams/utils/paths.py +0 -0
  136. {ltbams-1.0.4 → ltbams-1.0.6}/docs/Makefile +0 -0
  137. {ltbams-1.0.4 → ltbams-1.0.6}/docs/make.bat +0 -0
  138. {ltbams-1.0.4 → ltbams-1.0.6}/docs/source/_templates/autosummary/base.rst +0 -0
  139. {ltbams-1.0.4 → ltbams-1.0.6}/docs/source/_templates/autosummary/class.rst +0 -0
  140. {ltbams-1.0.4 → ltbams-1.0.6}/docs/source/_templates/autosummary/module.rst +0 -0
  141. {ltbams-1.0.4 → ltbams-1.0.6}/docs/source/_templates/autosummary/module_toctree.rst +0 -0
  142. {ltbams-1.0.4 → ltbams-1.0.6}/docs/source/api.rst +0 -0
  143. {ltbams-1.0.4 → ltbams-1.0.6}/docs/source/genmodelref.py +0 -0
  144. {ltbams-1.0.4 → ltbams-1.0.6}/docs/source/genroutineref.py +0 -0
  145. {ltbams-1.0.4 → ltbams-1.0.6}/docs/source/getting_started/copyright.rst +0 -0
  146. {ltbams-1.0.4 → ltbams-1.0.6}/docs/source/getting_started/formats/index.rst +0 -0
  147. {ltbams-1.0.4 → ltbams-1.0.6}/docs/source/getting_started/formats/matpower.rst +0 -0
  148. {ltbams-1.0.4 → ltbams-1.0.6}/docs/source/getting_started/formats/psse.rst +0 -0
  149. {ltbams-1.0.4 → ltbams-1.0.6}/docs/source/getting_started/formats/pypower.rst +0 -0
  150. {ltbams-1.0.4 → ltbams-1.0.6}/docs/source/getting_started/formats/xlsx.png +0 -0
  151. {ltbams-1.0.4 → ltbams-1.0.6}/docs/source/getting_started/formats/xlsx.rst +0 -0
  152. {ltbams-1.0.4 → ltbams-1.0.6}/docs/source/getting_started/index.rst +0 -0
  153. {ltbams-1.0.4 → ltbams-1.0.6}/docs/source/getting_started/install.rst +0 -0
  154. {ltbams-1.0.4 → ltbams-1.0.6}/docs/source/getting_started/overview.rst +0 -0
  155. {ltbams-1.0.4 → ltbams-1.0.6}/docs/source/getting_started/testcase.rst +0 -0
  156. {ltbams-1.0.4 → ltbams-1.0.6}/docs/source/getting_started/verification.rst +0 -0
  157. {ltbams-1.0.4 → ltbams-1.0.6}/docs/source/images/curent.ico +0 -0
  158. {ltbams-1.0.4 → ltbams-1.0.6}/docs/source/images/dcopf_time.png +0 -0
  159. {ltbams-1.0.4 → ltbams-1.0.6}/docs/source/images/sponsors/CURENT_Logo_NameOnTrans.png +0 -0
  160. {ltbams-1.0.4 → ltbams-1.0.6}/docs/source/images/sponsors/CURENT_Logo_Transparent.png +0 -0
  161. {ltbams-1.0.4 → ltbams-1.0.6}/docs/source/images/sponsors/CURENT_Logo_Transparent_Name.png +0 -0
  162. {ltbams-1.0.4 → ltbams-1.0.6}/docs/source/images/sponsors/doe.png +0 -0
  163. {ltbams-1.0.4 → ltbams-1.0.6}/docs/source/index.rst +0 -0
  164. {ltbams-1.0.4 → ltbams-1.0.6}/docs/source/modeling/example.rst +0 -0
  165. {ltbams-1.0.4 → ltbams-1.0.6}/docs/source/modeling/index.rst +0 -0
  166. {ltbams-1.0.4 → ltbams-1.0.6}/docs/source/modeling/model.rst +0 -0
  167. {ltbams-1.0.4 → ltbams-1.0.6}/docs/source/modeling/routine.rst +0 -0
  168. {ltbams-1.0.4 → ltbams-1.0.6}/docs/source/modeling/system.rst +0 -0
  169. {ltbams-1.0.4 → ltbams-1.0.6}/ltbams.egg-info/dependency_links.txt +0 -0
  170. {ltbams-1.0.4 → ltbams-1.0.6}/ltbams.egg-info/entry_points.txt +0 -0
  171. {ltbams-1.0.4 → ltbams-1.0.6}/ltbams.egg-info/requires.txt +0 -0
  172. {ltbams-1.0.4 → ltbams-1.0.6}/ltbams.egg-info/top_level.txt +0 -0
  173. {ltbams-1.0.4 → ltbams-1.0.6}/pyproject.toml +0 -0
  174. {ltbams-1.0.4 → ltbams-1.0.6}/requirements-dev.txt +0 -0
  175. {ltbams-1.0.4 → ltbams-1.0.6}/requirements.txt +0 -0
  176. {ltbams-1.0.4 → ltbams-1.0.6}/setup.cfg +0 -0
  177. {ltbams-1.0.4 → ltbams-1.0.6}/setup.py +0 -0
  178. {ltbams-1.0.4 → ltbams-1.0.6}/tests/__init__.py +0 -0
  179. {ltbams-1.0.4 → ltbams-1.0.6}/tests/test_1st_system.py +0 -0
  180. {ltbams-1.0.4 → ltbams-1.0.6}/tests/test_addressing.py +0 -0
  181. {ltbams-1.0.4 → ltbams-1.0.6}/tests/test_andes_mats.py +0 -0
  182. {ltbams-1.0.4 → ltbams-1.0.6}/tests/test_cli.py +0 -0
  183. {ltbams-1.0.4 → ltbams-1.0.6}/tests/test_export_csv.py +0 -0
  184. {ltbams-1.0.4 → ltbams-1.0.6}/tests/test_group.py +0 -0
  185. {ltbams-1.0.4 → ltbams-1.0.6}/tests/test_interface.py +0 -0
  186. {ltbams-1.0.4 → ltbams-1.0.6}/tests/test_jumper.py +0 -0
  187. {ltbams-1.0.4 → ltbams-1.0.6}/tests/test_known_good.py +0 -0
  188. {ltbams-1.0.4 → ltbams-1.0.6}/tests/test_matp.py +0 -0
  189. {ltbams-1.0.4 → ltbams-1.0.6}/tests/test_model.py +0 -0
  190. {ltbams-1.0.4 → ltbams-1.0.6}/tests/test_omodel.py +0 -0
  191. {ltbams-1.0.4 → ltbams-1.0.6}/tests/test_paths.py +0 -0
  192. {ltbams-1.0.4 → ltbams-1.0.6}/tests/test_report.py +0 -0
  193. {ltbams-1.0.4 → ltbams-1.0.6}/tests/test_repr.py +0 -0
  194. {ltbams-1.0.4 → ltbams-1.0.6}/tests/test_routine.py +0 -0
  195. {ltbams-1.0.4 → ltbams-1.0.6}/tests/test_rtn_dcopf.py +0 -0
  196. {ltbams-1.0.4 → ltbams-1.0.6}/tests/test_rtn_dcpf.py +0 -0
  197. {ltbams-1.0.4 → ltbams-1.0.6}/tests/test_rtn_ed.py +0 -0
  198. {ltbams-1.0.4 → ltbams-1.0.6}/tests/test_rtn_pflow.py +0 -0
  199. {ltbams-1.0.4 → ltbams-1.0.6}/tests/test_rtn_rted.py +0 -0
  200. {ltbams-1.0.4 → ltbams-1.0.6}/tests/test_rtn_uc.py +0 -0
  201. {ltbams-1.0.4 → ltbams-1.0.6}/tests/test_service.py +0 -0
  202. {ltbams-1.0.4 → ltbams-1.0.6}/versioneer.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ltbams
3
- Version: 1.0.4
3
+ Version: 1.0.6
4
4
  Summary: Python software for scheduling modeling and co-simulation with dynamics.
5
5
  Home-page: https://github.com/CURENT/ams
6
6
  Author: Jinning Wang
@@ -37,7 +37,7 @@ Python Software for Power System Scheduling Modeling and Co-Simulation with Dyna
37
37
  [![Project Status: Active – The project has reached a stable, usable state and is being actively developed.](https://www.repostatus.org/badges/latest/active.svg)](https://www.repostatus.org/#active)
38
38
  [![codecov](https://codecov.io/gh/CURENT/ams/graph/badge.svg?token=RZI5GLLBQH)](https://codecov.io/gh/CURENT/ams)
39
39
 
40
- ![GitHub Tag](https://img.shields.io/github/v/tag/CURENT/ams)
40
+ [![GitHub Tag](https://img.shields.io/github/v/tag/CURENT/ams)](https://github.com/CURENT/ams/tags)
41
41
  ![GitHub commits since latest release (branch)](https://img.shields.io/github/commits-since/curent/ams/latest/develop)
42
42
  [![GitHub last commit (master)](https://img.shields.io/github/last-commit/CURENT/ams/master?label=last%20commit%20to%20master)](https://github.com/CURENT/ams/commits/master/)
43
43
  [![GitHub last commit (develop)](https://img.shields.io/github/last-commit/CURENT/ams/develop?label=last%20commit%20to%20develop)](https://github.com/CURENT/ams/commits/develop/)
@@ -152,7 +152,7 @@ pip install git+https://github.com/CURENT/ams.git
152
152
  - `cvxpy` is distributed with the open source solvers CLARABEL, OSQP, and SCS, but MIP-capable solvers need separate installation
153
153
  - `cvxpy` versions **below 1.5** are incompatible with `numpy` versions **2.0 and above**
154
154
  - If the solver `SCIP` encounters an import error caused by a missing `libscip.9.1.dylib`, try reinstalling its Python interface by running `pip install pyscipopt --no-binary scip --force`
155
- - `kvxopt` is recommended to install via `conda` as sometimes ``pip`` struggles to set the correct path for compiled libraries
155
+ - `kvxopt` is recommended to install via `conda` as sometimes ``pip`` struggles to set the correct path for compiled libraries, more detailes can be found in this closed issue [Bug with dependency kvxopt 1.3.2.0](https://github.com/CURENT/andes/issues/508)
156
156
  - Versions **1.0.0** and **1.0.1** are only available on PyPI
157
157
  - Version **0.9.9** has known issues and has been yanked from PyPI
158
158
 
@@ -9,7 +9,7 @@ Python Software for Power System Scheduling Modeling and Co-Simulation with Dyna
9
9
  [![Project Status: Active – The project has reached a stable, usable state and is being actively developed.](https://www.repostatus.org/badges/latest/active.svg)](https://www.repostatus.org/#active)
10
10
  [![codecov](https://codecov.io/gh/CURENT/ams/graph/badge.svg?token=RZI5GLLBQH)](https://codecov.io/gh/CURENT/ams)
11
11
 
12
- ![GitHub Tag](https://img.shields.io/github/v/tag/CURENT/ams)
12
+ [![GitHub Tag](https://img.shields.io/github/v/tag/CURENT/ams)](https://github.com/CURENT/ams/tags)
13
13
  ![GitHub commits since latest release (branch)](https://img.shields.io/github/commits-since/curent/ams/latest/develop)
14
14
  [![GitHub last commit (master)](https://img.shields.io/github/last-commit/CURENT/ams/master?label=last%20commit%20to%20master)](https://github.com/CURENT/ams/commits/master/)
15
15
  [![GitHub last commit (develop)](https://img.shields.io/github/last-commit/CURENT/ams/develop?label=last%20commit%20to%20develop)](https://github.com/CURENT/ams/commits/develop/)
@@ -124,7 +124,7 @@ pip install git+https://github.com/CURENT/ams.git
124
124
  - `cvxpy` is distributed with the open source solvers CLARABEL, OSQP, and SCS, but MIP-capable solvers need separate installation
125
125
  - `cvxpy` versions **below 1.5** are incompatible with `numpy` versions **2.0 and above**
126
126
  - If the solver `SCIP` encounters an import error caused by a missing `libscip.9.1.dylib`, try reinstalling its Python interface by running `pip install pyscipopt --no-binary scip --force`
127
- - `kvxopt` is recommended to install via `conda` as sometimes ``pip`` struggles to set the correct path for compiled libraries
127
+ - `kvxopt` is recommended to install via `conda` as sometimes ``pip`` struggles to set the correct path for compiled libraries, more detailes can be found in this closed issue [Bug with dependency kvxopt 1.3.2.0](https://github.com/CURENT/andes/issues/508)
128
128
  - Versions **1.0.0** and **1.0.1** are only available on PyPI
129
129
  - Version **0.9.9** has known issues and has been yanked from PyPI
130
130
 
@@ -8,11 +8,11 @@ import json
8
8
 
9
9
  version_json = '''
10
10
  {
11
- "date": "2025-04-05T23:02:48-0400",
11
+ "date": "2025-04-10T23:17:16-0400",
12
12
  "dirty": false,
13
13
  "error": null,
14
- "full-revisionid": "af7a4e10ba2e35c4180562cf62f69ba5523c6725",
15
- "version": "1.0.4"
14
+ "full-revisionid": "3dbdbfee9ce8361b7975c9333179b88c01560137",
15
+ "version": "1.0.6"
16
16
  }
17
17
  ''' # END VERSION_JSON
18
18
 
@@ -203,6 +203,13 @@ def mpc2system(mpc: dict, system) -> bool:
203
203
  gcost_idx = 0
204
204
  gen_idx = np.arange(mpc['gen'].shape[0]) + 1
205
205
  mpc_cost = mpc['gencost']
206
+ if mpc_cost[0, 0] == 1:
207
+ logger.warning("Type 1 gencost detected. "
208
+ "This is not supported in AMS. "
209
+ "Default type 2 cost parameters will be used as a fallback."
210
+ "It is recommended to manually convert the gencost data to type 2.")
211
+ mpc_cost = np.repeat(np.array([[2, 0, 0, 3, 0, 0, 0]]),
212
+ mpc_cost.shape[0], axis=0)
206
213
  for data, gen in zip(mpc_cost, gen_idx):
207
214
  # NOTE: only type 2 costs are supported for now
208
215
  # type startup shutdown n c2 c1 c0
@@ -100,6 +100,7 @@ class SRCost(ModelData, Model):
100
100
  def __init__(self, system, config):
101
101
  ModelData.__init__(self)
102
102
  Model.__init__(self, system, config)
103
+ self.group = 'Cost'
103
104
  self.gen = IdxParam(info="static generator index",
104
105
  model='StaticGen',
105
106
  mandatory=True,)
@@ -116,6 +117,7 @@ class NSRCost(ModelData, Model):
116
117
  def __init__(self, system, config):
117
118
  ModelData.__init__(self)
118
119
  Model.__init__(self, system, config)
120
+ self.group = 'Cost'
119
121
  self.gen = IdxParam(info="static generator index",
120
122
  model='StaticGen',
121
123
  mandatory=True,)
@@ -8,6 +8,8 @@ import re
8
8
 
9
9
  import numpy as np
10
10
 
11
+ from ams.shared import sps # NOQA
12
+
11
13
  import cvxpy as cp
12
14
 
13
15
  from ams.utils import pretty_long_message
@@ -68,7 +70,7 @@ class ExpressionCalc(OptzBase):
68
70
  msg = f" - Expression <{self.name}>: {self.code}"
69
71
  logger.debug(pretty_long_message(msg, _prefix, max_length=_max_length))
70
72
  try:
71
- local_vars = {'self': self, 'np': np, 'cp': cp}
73
+ local_vars = {'self': self, 'np': np, 'cp': cp, 'sps': sps}
72
74
  self.optz = self._evaluate_expression(self.code, local_vars=local_vars)
73
75
  except Exception as e:
74
76
  raise Exception(f"Error in evaluating ExpressionCalc <{self.name}>.\n{e}")
@@ -11,6 +11,7 @@ all_routines = OrderedDict([
11
11
  ('cpf', ['CPF']),
12
12
  ('acopf', ['ACOPF']),
13
13
  ('dcopf', ['DCOPF']),
14
+ ('dcopf2', ['DCOPF2']),
14
15
  ('ed', ['ED', 'EDDG', 'EDES']),
15
16
  ('rted', ['RTED', 'RTEDDG', 'RTEDES', 'RTEDVIS']),
16
17
  ('uc', ['UC', 'UCDG', 'UCES']),
@@ -19,13 +19,17 @@ class DCOPF(DCPFBase):
19
19
  """
20
20
  DC optimal power flow (DCOPF).
21
21
 
22
- The nodal price is calculated as ``pi`` in ``pic``.
22
+ Notes
23
+ -----
24
+ 1. The nodal price is calculated as ``pi`` in ``pic``.
25
+ 2. Devices online status of ``StaticGen``, ``StaticLoad``, and ``Shunt`` are considered in the connectivity
26
+ matrices ``Cft``, ``Cg``, ``Cl``, and ``Csh``.
23
27
 
24
28
  References
25
29
  ----------
26
- 1. R. D. Zimmerman, C. E. Murillo-Sanchez, and R. J. Thomas, “MATPOWER: Steady-State Operations, Planning, and
27
- Analysis Tools for Power Systems Research and Education,” IEEE Trans. Power Syst., vol. 26, no. 1, pp. 12–19,
28
- Feb. 2011
30
+ 1. R. D. Zimmerman, C. E. Murillo-Sanchez, and R. J. Thomas, “MATPOWER: Steady-State
31
+ Operations, Planning, and Analysis Tools for Power Systems Research and Education,” IEEE
32
+ Trans. Power Syst., vol. 26, no. 1, pp. 12-19, Feb. 2011
29
33
  """
30
34
 
31
35
  def __init__(self, system, config):
@@ -153,7 +157,7 @@ class DCOPF(DCPFBase):
153
157
  Parameters
154
158
  ----------
155
159
  kloss : float, optional
156
- The loss factor for the conversion. Defaults to 1.2.
160
+ The loss factor for the conversion. Defaults to 1.0.
157
161
  """
158
162
  exec_time = self.exec_time
159
163
  if self.exec_time == 0 or self.exit_code != 0:
@@ -0,0 +1,95 @@
1
+ """
2
+ DCOPF routines.
3
+ """
4
+ import logging
5
+
6
+ import numpy as np
7
+ from ams.core.param import RParam
8
+ from ams.core.service import NumOp
9
+
10
+ from ams.routines.dcopf import DCOPF
11
+ from ams.opt import ExpressionCalc
12
+
13
+ from ams.shared import sps
14
+
15
+
16
+ logger = logging.getLogger(__name__)
17
+
18
+
19
+ class DCOPF2(DCOPF):
20
+ """
21
+ DC optimal power flow (DCOPF) using PTDF.
22
+ For large cases, it is recommended to build the PTDF first, especially when incremental
23
+ build is necessary.
24
+
25
+ Notes
26
+ -----
27
+ 1. This routine requires PTDF matrix.
28
+ 2. Nodal price ``pi`` is calculated with three parts.
29
+ 3. Bus angle ``aBus`` is calculated after solving the problem.
30
+ """
31
+
32
+ def __init__(self, system, config):
33
+ DCOPF.__init__(self, system, config)
34
+ self.info = 'DCOPF using PTDF'
35
+ self.type = 'DCED'
36
+
37
+ # NOTE: in this way, we still follow the implementation that devices
38
+ # connectivity status is considered in connection matrix
39
+ self.ued = NumOp(u=self.Cl,
40
+ name='ued', tex_name=r'u_{e,d}',
41
+ info='Effective load connection status',
42
+ fun=np.sum, args=dict(axis=0),
43
+ no_parse=True)
44
+ self.uesh = NumOp(u=self.Csh,
45
+ name='uesh', tex_name=r'u_{e,sh}',
46
+ info='Effective shunt connection status',
47
+ fun=np.sum, args=dict(axis=0),
48
+ no_parse=True)
49
+
50
+ self.PTDF = RParam(info='PTDF',
51
+ name='PTDF', tex_name=r'P_{TDF}',
52
+ model='mats', src='PTDF',
53
+ no_parse=True, sparse=True)
54
+
55
+ # --- rewrite Expression plf: line flow---
56
+ self.plf.e_str = 'PTDF @ (Cg@pg - Cl@pd - Csh@gsh - Pbusinj)'
57
+
58
+ # --- rewrite nodal price ---
59
+ self.Cft = RParam(info='Line connection matrix',
60
+ name='Cft', tex_name=r'C_{ft}',
61
+ model='mats', src='Cft',
62
+ no_parse=True, sparse=True,)
63
+ self.pilb = ExpressionCalc(info='Congestion price, dual of <plflb>',
64
+ name='pilb',
65
+ model='Line', src=None,
66
+ e_str='plflb.dual_variables[0]')
67
+ self.piub = ExpressionCalc(info='Congestion price, dual of <plfub>',
68
+ name='piub',
69
+ model='Line', src=None,
70
+ e_str='plfub.dual_variables[0]')
71
+ self.pib = ExpressionCalc(info='Energy price, dual of <pb>',
72
+ name='pib',
73
+ model='Bus', src=None,
74
+ e_str='pb.dual_variables[0]')
75
+ pi = 'pb.dual_variables[0] + Cft@(plfub.dual_variables[0] - plflb.dual_variables[0])'
76
+ self.pi.e_str = pi
77
+
78
+ def _post_solve(self):
79
+ """Calculate aBus"""
80
+ super()._post_solve()
81
+ sys = self.system
82
+ Pbus = sys.mats.Cg._v @ self.pg.v
83
+ Pbus -= sys.mats.Cl._v @ self.pd.v
84
+ Pbus -= sys.mats.Csh._v @ self.gsh.v
85
+ Pbus -= self.Pbusinj.v
86
+ aBus = sps.linalg.spsolve(sys.mats.Bbus._v, Pbus)
87
+ slack0_uid = sys.Bus.idx2uid(sys.Slack.bus.v[0])
88
+ self.aBus.v = aBus - aBus[slack0_uid]
89
+ return super()._post_solve()
90
+
91
+ def init(self, **kwargs):
92
+ if self.system.mats.PTDF._v is None:
93
+ logger.warning('PTDF is not available, build it now')
94
+ self.system.mats.build_ptdf()
95
+ return super().init(**kwargs)
@@ -109,8 +109,7 @@ class MPBase:
109
109
  class ED(RTED, MPBase, SRBase):
110
110
  """
111
111
  DC-based multi-period economic dispatch (ED).
112
- Dispath interval ``config.t`` (:math:`T_{cfg}`) is introduced,
113
- 1 [Hour] by default.
112
+ Dispath interval ``config.t`` (:math:``T_{cfg}``) is introduced, 1 [Hour] by default.
114
113
 
115
114
  ED extends DCOPF as follows:
116
115
 
@@ -124,7 +123,7 @@ class ED(RTED, MPBase, SRBase):
124
123
 
125
124
  2. The tie-line flow is not implemented in this model.
126
125
 
127
- 3. `EDTSlot.ug` is used instead of `StaticGen.u` for generator commitment.
126
+ 3. ``EDTSlot.ug`` is used instead of ``StaticGen.u`` for generator commitment.
128
127
  """
129
128
 
130
129
  def __init__(self, system, config):
@@ -585,6 +585,8 @@ class RoutineBase:
585
585
  True to rebuild the system matrices. Set to False to speed up the process
586
586
  if no system matrices are changed.
587
587
  """
588
+ if not self.initialized:
589
+ return self.init()
588
590
  t0, _ = elapsed()
589
591
  re_finalize = False
590
592
  # sanitize input
@@ -70,17 +70,15 @@ class UC(DCOPF, RTEDBase, MPBase, SRBase, NSRBase):
70
70
  Notes
71
71
  -----
72
72
  1. Formulations has been adjusted with interval ``config.t``
73
-
74
- 3. The tie-line flow has not been implemented in formulations.
73
+ 2. The tie-line flow has not been implemented in formulations.
75
74
 
76
75
  References
77
76
  ----------
78
77
  1. Huang, Y., Pardalos, P. M., & Zheng, Q. P. (2017). Electrical power unit commitment: deterministic and
79
- two-stage stochastic programming models and algorithms. Springer.
80
-
78
+ two-stage stochastic programming models and algorithms. Springer.
81
79
  2. D. A. Tejada-Arango, S. Lumbreras, P. Sánchez-Martín and A. Ramos, "Which Unit-Commitment Formulation
82
- is Best? A Comparison Framework," in IEEE Transactions on Power Systems, vol. 35, no. 4, pp. 2926-2936,
83
- July 2020, doi: 10.1109/TPWRS.2019.2962024.
80
+ is Best? A Comparison Framework," in IEEE Transactions on Power Systems, vol. 35, no. 4, pp. 2926-2936,
81
+ July 2020, doi: 10.1109/TPWRS.2019.2962024.
84
82
  """
85
83
 
86
84
  def __init__(self, system, config):
@@ -35,7 +35,7 @@ _prefix = r" - --------------> | " # NOQA
35
35
  _max_length = 80 # NOQA
36
36
 
37
37
  # NOTE: copyright
38
- copyright_msg = 'Copyright (C) 2023-2024 Jinning Wang'
38
+ copyright_msg = 'Copyright (C) 2023-2025 Jinning Wang'
39
39
 
40
40
  # NOTE: copied from CVXPY documentation, last checked on 2024/10/30, v1.5
41
41
  mip_solvers = ['CBC', 'COPT', 'GLPK_MI', 'CPLEX', 'GUROBI',
@@ -422,6 +422,13 @@ class System(andes_System):
422
422
  msg = f"Zero line rates detacted in {adjusted_rate}, "
423
423
  msg += f"adjusted to {default_rate}."
424
424
  logger.info(msg)
425
+ # Line max angle difference
426
+ if np.any(self.Line.amax.v == 0):
427
+ self.Line.amax.v[self.Line.amax.v == 0] = 2 * np.pi
428
+ logger.info("Zero line amax detected, adjusted to 2*pi.")
429
+ if np.any(self.Line.amin.v == 0):
430
+ self.Line.amin.v[self.Line.amin.v == 0] = -2 * np.pi
431
+ logger.info("Zero line amin detected, adjusted to -2*pi.")
425
432
  # === no device addition or removal after this point ===
426
433
  self.calc_pu_coeff() # calculate parameters in system per units
427
434
 
@@ -67,7 +67,7 @@ language = "en"
67
67
 
68
68
  # General information about the project.
69
69
  project = 'AMS'
70
- copyright = '2023-2024, Jinning Wang'
70
+ copyright = '2023-2025, Jinning Wang'
71
71
  author = 'Jinning Wang'
72
72
 
73
73
  version = ams.__version__
@@ -3,10 +3,6 @@
3
3
  Examples
4
4
  ========
5
5
 
6
- .. _`development demos`: https://github.com/CURENT/ams/tree/master/dev/demo
7
-
8
- Refer to the development `development demos`_ for examples prior to preparing this section.
9
-
10
6
  A collection of examples are presented to supplement the tutorial. The
11
7
  examples below are identical to the Jupyter Notebook in the ``examples``
12
8
  folder of the repository
@@ -31,4 +27,5 @@ folder of the repository
31
27
 
32
28
  ../_examples/demo/demo_ESD1.ipynb
33
29
  ../_examples/demo/demo_AGC.ipynb
34
- ../_examples/demo/demo_debug.ipynb
30
+ ../_examples/demo/demo_debug.ipynb
31
+ ../_examples/demo/demo_mat.ipynb
@@ -9,6 +9,19 @@ The APIs before v3.0.0 are in beta and may change without prior notice.
9
9
  v1.0
10
10
  ==========
11
11
 
12
+ v1.0.6 (2024-04-10)
13
+ --------------------
14
+
15
+ - Enhance handling of Type 1 gencost: Automatically fallback to Type 2 gencost
16
+ - Add parameter correction for zero line angle difference
17
+
18
+ v1.0.5 (2024-04-09)
19
+ --------------------
20
+
21
+ - Include sensitivity matrices calculation demo in documentation
22
+ - Add ``DCOPF2``, a PTDF-based DCOPF routine
23
+ - Fix bug when update routine parameters before it is initialized
24
+
12
25
  v1.0.4 (2024-04-05)
13
26
  --------------------
14
27
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ltbams
3
- Version: 1.0.4
3
+ Version: 1.0.6
4
4
  Summary: Python software for scheduling modeling and co-simulation with dynamics.
5
5
  Home-page: https://github.com/CURENT/ams
6
6
  Author: Jinning Wang
@@ -37,7 +37,7 @@ Python Software for Power System Scheduling Modeling and Co-Simulation with Dyna
37
37
  [![Project Status: Active – The project has reached a stable, usable state and is being actively developed.](https://www.repostatus.org/badges/latest/active.svg)](https://www.repostatus.org/#active)
38
38
  [![codecov](https://codecov.io/gh/CURENT/ams/graph/badge.svg?token=RZI5GLLBQH)](https://codecov.io/gh/CURENT/ams)
39
39
 
40
- ![GitHub Tag](https://img.shields.io/github/v/tag/CURENT/ams)
40
+ [![GitHub Tag](https://img.shields.io/github/v/tag/CURENT/ams)](https://github.com/CURENT/ams/tags)
41
41
  ![GitHub commits since latest release (branch)](https://img.shields.io/github/commits-since/curent/ams/latest/develop)
42
42
  [![GitHub last commit (master)](https://img.shields.io/github/last-commit/CURENT/ams/master?label=last%20commit%20to%20master)](https://github.com/CURENT/ams/commits/master/)
43
43
  [![GitHub last commit (develop)](https://img.shields.io/github/last-commit/CURENT/ams/develop?label=last%20commit%20to%20develop)](https://github.com/CURENT/ams/commits/develop/)
@@ -152,7 +152,7 @@ pip install git+https://github.com/CURENT/ams.git
152
152
  - `cvxpy` is distributed with the open source solvers CLARABEL, OSQP, and SCS, but MIP-capable solvers need separate installation
153
153
  - `cvxpy` versions **below 1.5** are incompatible with `numpy` versions **2.0 and above**
154
154
  - If the solver `SCIP` encounters an import error caused by a missing `libscip.9.1.dylib`, try reinstalling its Python interface by running `pip install pyscipopt --no-binary scip --force`
155
- - `kvxopt` is recommended to install via `conda` as sometimes ``pip`` struggles to set the correct path for compiled libraries
155
+ - `kvxopt` is recommended to install via `conda` as sometimes ``pip`` struggles to set the correct path for compiled libraries, more detailes can be found in this closed issue [Bug with dependency kvxopt 1.3.2.0](https://github.com/CURENT/andes/issues/508)
156
156
  - Versions **1.0.0** and **1.0.1** are only available on PyPI
157
157
  - Version **0.9.9** has known issues and has been yanked from PyPI
158
158
 
@@ -116,6 +116,7 @@ ams/routines/__init__.py
116
116
  ams/routines/acopf.py
117
117
  ams/routines/cpf.py
118
118
  ams/routines/dcopf.py
119
+ ams/routines/dcopf2.py
119
120
  ams/routines/dcpf.py
120
121
  ams/routines/dcpf0.py
121
122
  ams/routines/dopf.py
@@ -191,6 +192,7 @@ tests/test_report.py
191
192
  tests/test_repr.py
192
193
  tests/test_routine.py
193
194
  tests/test_rtn_dcopf.py
195
+ tests/test_rtn_dcopf2.py
194
196
  tests/test_rtn_dcpf.py
195
197
  tests/test_rtn_ed.py
196
198
  tests/test_rtn_pflow.py
@@ -264,3 +264,30 @@ class TestCaseInit(unittest.TestCase):
264
264
 
265
265
  self.assertEqual(ss.EDES.exit_code, 0, "Exit code is not 0.")
266
266
  self.assertEqual(ss.UCES.exit_code, 0, "Exit code is not 0.")
267
+
268
+
269
+ class TestCase14(unittest.TestCase):
270
+ """
271
+ Test parameter correction using case14.m
272
+ """
273
+
274
+ def test_parameter_correction(self):
275
+ """
276
+ Test if the parameter correction works.
277
+ """
278
+ mpc = ams.io.matpower.m2mpc(get_case("matpower/case14.m"))
279
+ mpc['branch'][:, 11] = 0.0
280
+ mpc['branch'][:, 12] = 0.0
281
+
282
+ ss = ams.system.System()
283
+ ams.io.matpower.mpc2system(mpc, ss)
284
+ ss.setup()
285
+
286
+ # line rate
287
+ np.testing.assert_array_less(0.0, ss.Line.rate_a.v)
288
+ np.testing.assert_array_less(0.0, ss.Line.rate_b.v)
289
+ np.testing.assert_array_less(0.0, ss.Line.rate_c.v)
290
+
291
+ # line angle difference
292
+ np.testing.assert_array_less(0.0, ss.Line.amax.v)
293
+ np.testing.assert_array_less(ss.Line.amin.v, 0.0)
@@ -30,3 +30,12 @@ class TestMATPOWER(unittest.TestCase):
30
30
  # In case14.m, the gencost has type 2 cost model, with 3 parameters.
31
31
  np.testing.assert_array_less(np.zeros(system14.StaticGen.n),
32
32
  system14.GCost.c2.v,)
33
+
34
+ def test_gencost1(self):
35
+ """Test when gencost is type 1."""
36
+ mpcgc1 = self.mpc14.copy()
37
+ mpcgc1['gencost'] = np.repeat(np.array([[1, 0, 0, 3, 0.01, 40, 0]]), 5, axis=0)
38
+
39
+ system = ams.system.System()
40
+ ams.io.matpower.mpc2system(mpcgc1, system)
41
+ self.assertEqual(system.GCost.n, 5)
@@ -0,0 +1,103 @@
1
+ import unittest
2
+ import numpy as np
3
+
4
+ import ams
5
+
6
+
7
+ class TestDCOPF2(unittest.TestCase):
8
+ """
9
+ Test routine `DCOPF2`.
10
+ """
11
+
12
+ def setUp(self) -> None:
13
+ self.ss = ams.load(ams.get_case("5bus/pjm5bus_demo.xlsx"),
14
+ setup=True, default_config=True, no_output=True)
15
+ # decrease load first
16
+ self.ss.PQ.set(src='p0', attr='v', idx=['PQ_1', 'PQ_2'], value=[0.3, 0.3])
17
+ # build PTDF
18
+ self.ss.mats.build_ptdf()
19
+
20
+ def test_init(self):
21
+ """
22
+ Test initialization.
23
+ """
24
+ self.ss.DCOPF2.init()
25
+ self.assertTrue(self.ss.DCOPF2.initialized, "DCOPF2 initialization failed!")
26
+
27
+ def test_trip_gen(self):
28
+ """
29
+ Test generator tripping.
30
+ """
31
+ stg = 'PV_1'
32
+ self.ss.StaticGen.set(src='u', idx=stg, attr='v', value=0)
33
+
34
+ self.ss.DCOPF2.update()
35
+ self.ss.DCOPF2.run(solver='CLARABEL')
36
+ self.assertTrue(self.ss.DCOPF2.converged, "DCOPF2 did not converge under generator trip!")
37
+ self.assertAlmostEqual(self.ss.DCOPF2.get(src='pg', attr='v', idx=stg),
38
+ 0, places=6,
39
+ msg="Generator trip does not take effect!")
40
+
41
+ self.ss.StaticGen.set(src='u', idx=stg, attr='v', value=1) # reset
42
+
43
+ def test_trip_line(self):
44
+ """
45
+ Test line tripping.
46
+ """
47
+ self.ss.Line.set(src='u', attr='v', idx='Line_3', value=0)
48
+
49
+ self.ss.DCOPF2.update()
50
+ self.ss.DCOPF2.run(solver='CLARABEL')
51
+ self.assertTrue(self.ss.DCOPF2.converged, "DCOPF2 did not converge under line trip!")
52
+ self.assertAlmostEqual(self.ss.DCOPF2.get(src='plf', attr='v', idx='Line_3'),
53
+ 0, places=6,
54
+ msg="Line trip does not take effect!")
55
+
56
+ self.ss.Line.alter(src='u', idx='Line_3', value=1) # reset
57
+
58
+ def test_set_load(self):
59
+ """
60
+ Test setting and tripping load.
61
+ """
62
+ # --- run DCOPF2 ---
63
+ self.ss.DCOPF2.run(solver='CLARABEL')
64
+ pgs = self.ss.DCOPF2.pg.v.sum()
65
+
66
+ # --- set load ---
67
+ self.ss.PQ.set(src='p0', attr='v', idx='PQ_1', value=0.1)
68
+ self.ss.DCOPF2.update()
69
+
70
+ self.ss.DCOPF2.run(solver='CLARABEL')
71
+ pgs_pqt = self.ss.DCOPF2.pg.v.sum()
72
+ self.assertLess(pgs_pqt, pgs, "Load set does not take effect!")
73
+
74
+ # --- trip load ---
75
+ self.ss.PQ.set(src='u', attr='v', idx='PQ_2', value=0)
76
+ self.ss.DCOPF2.update()
77
+
78
+ self.ss.DCOPF2.run(solver='CLARABEL')
79
+ pgs_pqt2 = self.ss.DCOPF2.pg.v.sum()
80
+ self.assertLess(pgs_pqt2, pgs_pqt, "Load trip does not take effect!")
81
+
82
+ def test_dc2ac(self):
83
+ """
84
+ Test `DCOPF2.dc2ac()` method.
85
+ """
86
+ self.ss.DCOPF2.run(solver='CLARABEL')
87
+ self.ss.DCOPF2.dc2ac()
88
+ self.assertTrue(self.ss.DCOPF2.converted, "AC conversion failed!")
89
+ self.assertTrue(self.ss.DCOPF2.exec_time > 0, "Execution time is not greater than 0.")
90
+
91
+ stg_idx = self.ss.StaticGen.get_all_idxes()
92
+ pg_dcopf = self.ss.DCOPF2.get(src='pg', attr='v', idx=stg_idx)
93
+ pg_acopf = self.ss.ACOPF.get(src='pg', attr='v', idx=stg_idx)
94
+ np.testing.assert_almost_equal(pg_dcopf, pg_acopf, decimal=3)
95
+
96
+ bus_idx = self.ss.Bus.get_all_idxes()
97
+ v_dcopf = self.ss.DCOPF2.get(src='vBus', attr='v', idx=bus_idx)
98
+ v_acopf = self.ss.ACOPF.get(src='vBus', attr='v', idx=bus_idx)
99
+ np.testing.assert_almost_equal(v_dcopf, v_acopf, decimal=3)
100
+
101
+ a_dcopf = self.ss.DCOPF2.get(src='aBus', attr='v', idx=bus_idx)
102
+ a_acopf = self.ss.ACOPF.get(src='aBus', attr='v', idx=bus_idx)
103
+ np.testing.assert_almost_equal(a_dcopf, a_acopf, decimal=3)
File without changes
File without changes
File without changes
File without changes
File without changes