pear-sim 0.1.0__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 (417) hide show
  1. pear_sim-0.1.0/.gitattributes +12 -0
  2. pear_sim-0.1.0/.github/workflows/ci.yml +214 -0
  3. pear_sim-0.1.0/.github/workflows/numerical-evidence.yml +105 -0
  4. pear_sim-0.1.0/.github/workflows/release.yml +77 -0
  5. pear_sim-0.1.0/.gitignore +18 -0
  6. pear_sim-0.1.0/AGENTS.md +85 -0
  7. pear_sim-0.1.0/CHANGELOG.md +198 -0
  8. pear_sim-0.1.0/CLAUDE.md +76 -0
  9. pear_sim-0.1.0/CODE_OF_CONDUCT.md +11 -0
  10. pear_sim-0.1.0/CONTRIBUTING.md +57 -0
  11. pear_sim-0.1.0/LICENSE +201 -0
  12. pear_sim-0.1.0/NOTICE +4 -0
  13. pear_sim-0.1.0/PKG-INFO +417 -0
  14. pear_sim-0.1.0/README.md +381 -0
  15. pear_sim-0.1.0/SECURITY.md +29 -0
  16. pear_sim-0.1.0/docs/README.md +26 -0
  17. pear_sim-0.1.0/docs/adr/0001-system-level-kernel.md +110 -0
  18. pear_sim-0.1.0/docs/adr/0002-cross-platform.md +166 -0
  19. pear_sim-0.1.0/docs/adr/0003-pear-sim-naming.md +38 -0
  20. pear_sim-0.1.0/docs/agent-interface.md +126 -0
  21. pear_sim-0.1.0/docs/api.md +60 -0
  22. pear_sim-0.1.0/docs/architecture.md +516 -0
  23. pear_sim-0.1.0/docs/batch.md +141 -0
  24. pear_sim-0.1.0/docs/benchmark-harness.md +54 -0
  25. pear_sim-0.1.0/docs/component-roadmap.md +230 -0
  26. pear_sim-0.1.0/docs/design-spec.md +78 -0
  27. pear_sim-0.1.0/docs/images/report-buck.png +0 -0
  28. pear_sim-0.1.0/docs/m2-agent-evidence.md +201 -0
  29. pear_sim-0.1.0/docs/m2-boost-boundary-evidence.md +179 -0
  30. pear_sim-0.1.0/docs/m2-numerical-evidence.md +217 -0
  31. pear_sim-0.1.0/docs/m3-complementary-pwm.md +70 -0
  32. pear_sim-0.1.0/docs/m3-spwm.md +125 -0
  33. pear_sim-0.1.0/docs/model-format.md +1591 -0
  34. pear_sim-0.1.0/docs/rust-core.md +83 -0
  35. pear_sim-0.1.0/docs/sensitivity.md +114 -0
  36. pear_sim-0.1.0/docs/stability-analysis.md +110 -0
  37. pear_sim-0.1.0/docs/topology-comparison.md +119 -0
  38. pear_sim-0.1.0/docs/topology-library.md +101 -0
  39. pear_sim-0.1.0/docs/universality.md +74 -0
  40. pear_sim-0.1.0/docs/validation-plan.md +493 -0
  41. pear_sim-0.1.0/evals/mcp/README.md +43 -0
  42. pear_sim-0.1.0/evals/mcp/checks.py +242 -0
  43. pear_sim-0.1.0/evals/mcp/run.py +213 -0
  44. pear_sim-0.1.0/evals/mcp/stories.yaml +140 -0
  45. pear_sim-0.1.0/evals/mcp/stories2.yaml +108 -0
  46. pear_sim-0.1.0/evals/mcp/tasks.yaml +73 -0
  47. pear_sim-0.1.0/examples/batch_buck_losses.json +20 -0
  48. pear_sim-0.1.0/examples/boost.yaml +35 -0
  49. pear_sim-0.1.0/examples/buck.yaml +51 -0
  50. pear_sim-0.1.0/examples/buck_ccm_wca.yaml +140 -0
  51. pear_sim-0.1.0/examples/buck_closed_loop.yaml +52 -0
  52. pear_sim-0.1.0/examples/buck_closed_loop_antiwindup.yaml +187 -0
  53. pear_sim-0.1.0/examples/buck_closed_loop_signals.yaml +121 -0
  54. pear_sim-0.1.0/examples/buck_compare_profile.json +35 -0
  55. pear_sim-0.1.0/examples/buck_dcm.yaml +42 -0
  56. pear_sim-0.1.0/examples/buck_expectations.json +41 -0
  57. pear_sim-0.1.0/examples/buck_model_meta.yaml +65 -0
  58. pear_sim-0.1.0/examples/buck_parameter_sweep.json +23 -0
  59. pear_sim-0.1.0/examples/buck_with_loss_cards.yaml +127 -0
  60. pear_sim-0.1.0/examples/campaigns/campaign_a_corners.json +34 -0
  61. pear_sim-0.1.0/examples/campaigns/campaign_b_gate_set.json +55 -0
  62. pear_sim-0.1.0/examples/campaigns/campaign_c_ldo_crosscheck.json +34 -0
  63. pear_sim-0.1.0/examples/campaigns/campaign_d_boundary.json +30 -0
  64. pear_sim-0.1.0/examples/comparison_requests/buck_vs_boost.json +13 -0
  65. pear_sim-0.1.0/examples/dab_phase_shift.yaml +126 -0
  66. pear_sim-0.1.0/examples/dc_drive_hbridge.yaml +77 -0
  67. pear_sim-0.1.0/examples/design_specs/isolated_aux.yaml +41 -0
  68. pear_sim-0.1.0/examples/grid_following_converter.yaml +111 -0
  69. pear_sim-0.1.0/examples/halfwave_rectifier.yaml +34 -0
  70. pear_sim-0.1.0/examples/inverter_signal_svpwm.yaml +63 -0
  71. pear_sim-0.1.0/examples/inverter_three_phase_floating_neutral.yaml +94 -0
  72. pear_sim-0.1.0/examples/inverter_three_phase_six_step.yaml +54 -0
  73. pear_sim-0.1.0/examples/inverter_three_phase_spwm.yaml +95 -0
  74. pear_sim-0.1.0/examples/inverter_three_phase_svpwm.yaml +183 -0
  75. pear_sim-0.1.0/examples/inverting_buck_boost.yaml +36 -0
  76. pear_sim-0.1.0/examples/llc_resonant.yaml +90 -0
  77. pear_sim-0.1.0/examples/npc5_three_phase.yaml +108 -0
  78. pear_sim-0.1.0/examples/npc_midpoint_expectations.json +28 -0
  79. pear_sim-0.1.0/examples/npc_three_phase.yaml +184 -0
  80. pear_sim-0.1.0/examples/npc_three_phase_lc_filter.yaml +107 -0
  81. pear_sim-0.1.0/examples/npc_three_phase_midpoint.yaml +105 -0
  82. pear_sim-0.1.0/examples/pmsm_foc_current_control.yaml +202 -0
  83. pear_sim-0.1.0/examples/pmsm_inverter_drive.yaml +112 -0
  84. pear_sim-0.1.0/examples/pmsm_saturating_flux_map.yaml +571 -0
  85. pear_sim-0.1.0/examples/pmsm_torque_test.yaml +107 -0
  86. pear_sim-0.1.0/examples/rectifier_12pulse_yyd.yaml +164 -0
  87. pear_sim-0.1.0/examples/rectifier_6pulse_transformer.yaml +113 -0
  88. pear_sim-0.1.0/examples/rl_sat_inductor.yaml +34 -0
  89. pear_sim-0.1.0/examples/sensitivity_buck_morris.json +17 -0
  90. pear_sim-0.1.0/examples/sensitivity_buck_sobol.json +17 -0
  91. pear_sim-0.1.0/examples/sync_buck_mosfet.yaml +59 -0
  92. pear_sim-0.1.0/examples/synchronous_buck_complementary.yaml +52 -0
  93. pear_sim-0.1.0/examples/synrm_torque_test.yaml +142 -0
  94. pear_sim-0.1.0/examples/thyristor_phase_controlled.yaml +75 -0
  95. pear_sim-0.1.0/examples/traction_inverter_liquid_cooled.yaml +199 -0
  96. pear_sim-0.1.0/examples/transformer_rl.yaml +33 -0
  97. pear_sim-0.1.0/examples/weak_grid_three_phase.yaml +61 -0
  98. pear_sim-0.1.0/library/topologies/boost.yaml +65 -0
  99. pear_sim-0.1.0/library/topologies/buck.yaml +68 -0
  100. pear_sim-0.1.0/library/topologies/buck_boost_inverting.yaml +71 -0
  101. pear_sim-0.1.0/library/topologies/buck_synchronous.yaml +105 -0
  102. pear_sim-0.1.0/library/topologies/dab.yaml +137 -0
  103. pear_sim-0.1.0/library/topologies/flyback.yaml +55 -0
  104. pear_sim-0.1.0/library/topologies/forward.yaml +42 -0
  105. pear_sim-0.1.0/library/topologies/inverter_2l_3ph.yaml +148 -0
  106. pear_sim-0.1.0/library/topologies/inverter_3l_npc.yaml +570 -0
  107. pear_sim-0.1.0/library/topologies/llc_half_bridge.yaml +121 -0
  108. pear_sim-0.1.0/library/topologies/rectifier_12pulse.yaml +597 -0
  109. pear_sim-0.1.0/library/topologies/rectifier_6pulse.yaml +265 -0
  110. pear_sim-0.1.0/library/topologies/rectifier_thyristor_1ph_halfwave.yaml +100 -0
  111. pear_sim-0.1.0/packaging/pear-sim-mcp/README.md +12 -0
  112. pear_sim-0.1.0/packaging/pear-sim-mcp/pyproject.toml +25 -0
  113. pear_sim-0.1.0/pyproject.toml +79 -0
  114. pear_sim-0.1.0/rust/pear-sim-core/Cargo.lock +269 -0
  115. pear_sim-0.1.0/rust/pear-sim-core/Cargo.toml +19 -0
  116. pear_sim-0.1.0/rust/pear-sim-core/pyproject.toml +15 -0
  117. pear_sim-0.1.0/rust/pear-sim-core/src/brent.rs +88 -0
  118. pear_sim-0.1.0/rust/pear-sim-core/src/extrema.rs +188 -0
  119. pear_sim-0.1.0/rust/pear-sim-core/src/lib.rs +303 -0
  120. pear_sim-0.1.0/rust/pear-sim-core/src/observe.rs +183 -0
  121. pear_sim-0.1.0/rust/pear-sim-core/src/rk45.rs +476 -0
  122. pear_sim-0.1.0/schema/boost-boundary-evidence.schema.json +512 -0
  123. pear_sim-0.1.0/schema/compare-profile.schema.json +202 -0
  124. pear_sim-0.1.0/schema/cross-platform-evidence.schema.json +128 -0
  125. pear_sim-0.1.0/schema/design-spec.schema.json +41 -0
  126. pear_sim-0.1.0/schema/expectations.schema.json +77 -0
  127. pear_sim-0.1.0/schema/inverting-buck-boost-boundary-evidence.schema.json +947 -0
  128. pear_sim-0.1.0/schema/model.schema.json +1101 -0
  129. pear_sim-0.1.0/schema/numerical-profile.schema.json +76 -0
  130. pear_sim-0.1.0/schema/parameter-sweep-evidence.schema.json +598 -0
  131. pear_sim-0.1.0/schema/parameter-sweep-request.schema.json +83 -0
  132. pear_sim-0.1.0/schema/parameter-sweep-summary.schema.json +270 -0
  133. pear_sim-0.1.0/schema/platform-evidence.schema.json +190 -0
  134. pear_sim-0.1.0/schema/run-comparison.schema.json +357 -0
  135. pear_sim-0.1.0/schema/stability-evidence.schema.json +83 -0
  136. pear_sim-0.1.0/schema/stability-request.schema.json +78 -0
  137. pear_sim-0.1.0/schema/topology-entry.schema.json +172 -0
  138. pear_sim-0.1.0/scripts/rust_parity.py +208 -0
  139. pear_sim-0.1.0/server.json +16 -0
  140. pear_sim-0.1.0/src/pear_sim/__init__.py +7 -0
  141. pear_sim-0.1.0/src/pear_sim/_jsonutil.py +69 -0
  142. pear_sim-0.1.0/src/pear_sim/analysis/__init__.py +1 -0
  143. pear_sim-0.1.0/src/pear_sim/analysis/ac_sweep.py +268 -0
  144. pear_sim-0.1.0/src/pear_sim/analysis/analytic_checks.py +610 -0
  145. pear_sim-0.1.0/src/pear_sim/analysis/confidence.py +246 -0
  146. pear_sim-0.1.0/src/pear_sim/analysis/gate_drive.py +705 -0
  147. pear_sim-0.1.0/src/pear_sim/analysis/gradient/__init__.py +64 -0
  148. pear_sim-0.1.0/src/pear_sim/analysis/gradient/design_vector.py +174 -0
  149. pear_sim-0.1.0/src/pear_sim/analysis/gradient/engine.py +879 -0
  150. pear_sim-0.1.0/src/pear_sim/analysis/gradient/losses.py +256 -0
  151. pear_sim-0.1.0/src/pear_sim/analysis/gradient/sequence.py +556 -0
  152. pear_sim-0.1.0/src/pear_sim/analysis/harmonics.py +381 -0
  153. pear_sim-0.1.0/src/pear_sim/analysis/losses_thermal.py +606 -0
  154. pear_sim-0.1.0/src/pear_sim/analysis/mode_coverage.py +608 -0
  155. pear_sim-0.1.0/src/pear_sim/analysis/npc_modulation.py +519 -0
  156. pear_sim-0.1.0/src/pear_sim/analysis/pll.py +165 -0
  157. pear_sim-0.1.0/src/pear_sim/analysis/reference_frames.py +176 -0
  158. pear_sim-0.1.0/src/pear_sim/analysis/resonance.py +288 -0
  159. pear_sim-0.1.0/src/pear_sim/analysis/settling.py +37 -0
  160. pear_sim-0.1.0/src/pear_sim/analysis/small_signal.py +430 -0
  161. pear_sim-0.1.0/src/pear_sim/analysis/steady_state.py +366 -0
  162. pear_sim-0.1.0/src/pear_sim/analysis/three_phase_modulation.py +915 -0
  163. pear_sim-0.1.0/src/pear_sim/analytic_checks.py +7 -0
  164. pear_sim-0.1.0/src/pear_sim/api/__init__.py +6 -0
  165. pear_sim-0.1.0/src/pear_sim/api/capabilities.py +1046 -0
  166. pear_sim-0.1.0/src/pear_sim/api/cli.py +1198 -0
  167. pear_sim-0.1.0/src/pear_sim/api/doctor.py +139 -0
  168. pear_sim-0.1.0/src/pear_sim/api/facade.py +279 -0
  169. pear_sim-0.1.0/src/pear_sim/benchmark_harness.py +7 -0
  170. pear_sim-0.1.0/src/pear_sim/benchmark_report.py +7 -0
  171. pear_sim-0.1.0/src/pear_sim/benchmarks/__init__.py +119 -0
  172. pear_sim-0.1.0/src/pear_sim/benchmarks/_shared.py +74 -0
  173. pear_sim-0.1.0/src/pear_sim/benchmarks/affine.py +86 -0
  174. pear_sim-0.1.0/src/pear_sim/benchmarks/boost_boundary.py +1421 -0
  175. pear_sim-0.1.0/src/pear_sim/benchmarks/buck_boundary.py +1332 -0
  176. pear_sim-0.1.0/src/pear_sim/benchmarks/inverting_buck_boost_boundary.py +1851 -0
  177. pear_sim-0.1.0/src/pear_sim/canonical_topologies.py +7 -0
  178. pear_sim-0.1.0/src/pear_sim/capabilities.py +7 -0
  179. pear_sim-0.1.0/src/pear_sim/circuit.py +7 -0
  180. pear_sim-0.1.0/src/pear_sim/cli.py +7 -0
  181. pear_sim-0.1.0/src/pear_sim/contracts.py +7 -0
  182. pear_sim-0.1.0/src/pear_sim/controls.py +7 -0
  183. pear_sim-0.1.0/src/pear_sim/core/__init__.py +1 -0
  184. pear_sim-0.1.0/src/pear_sim/core/circuit.py +1941 -0
  185. pear_sim-0.1.0/src/pear_sim/core/metrics.py +802 -0
  186. pear_sim-0.1.0/src/pear_sim/core/rust_backend.py +304 -0
  187. pear_sim-0.1.0/src/pear_sim/core/scheduling.py +1431 -0
  188. pear_sim-0.1.0/src/pear_sim/core/solver.py +2075 -0
  189. pear_sim-0.1.0/src/pear_sim/core/svpwm.py +166 -0
  190. pear_sim-0.1.0/src/pear_sim/design/__init__.py +27 -0
  191. pear_sim-0.1.0/src/pear_sim/design/design-spec.schema.json +41 -0
  192. pear_sim-0.1.0/src/pear_sim/design/errors.py +20 -0
  193. pear_sim-0.1.0/src/pear_sim/design/spec.py +579 -0
  194. pear_sim-0.1.0/src/pear_sim/errors.py +33 -0
  195. pear_sim-0.1.0/src/pear_sim/evidence/__init__.py +3 -0
  196. pear_sim-0.1.0/src/pear_sim/evidence/batch.py +783 -0
  197. pear_sim-0.1.0/src/pear_sim/evidence/benchmark_harness.py +655 -0
  198. pear_sim-0.1.0/src/pear_sim/evidence/efficiency_map.py +295 -0
  199. pear_sim-0.1.0/src/pear_sim/evidence/evidence_io.py +202 -0
  200. pear_sim-0.1.0/src/pear_sim/evidence/expectations.py +598 -0
  201. pear_sim-0.1.0/src/pear_sim/evidence/numerical_evidence.py +1795 -0
  202. pear_sim-0.1.0/src/pear_sim/evidence/parallel_points.py +93 -0
  203. pear_sim-0.1.0/src/pear_sim/evidence/parameter_sweep.py +1727 -0
  204. pear_sim-0.1.0/src/pear_sim/evidence/parameter_sweep_worker.py +172 -0
  205. pear_sim-0.1.0/src/pear_sim/evidence/perturbation_campaign.py +906 -0
  206. pear_sim-0.1.0/src/pear_sim/evidence/perturbation_campaign_worker.py +56 -0
  207. pear_sim-0.1.0/src/pear_sim/evidence/platform_evidence.py +1703 -0
  208. pear_sim-0.1.0/src/pear_sim/evidence/run_compare.py +1561 -0
  209. pear_sim-0.1.0/src/pear_sim/evidence/sensitivity.py +488 -0
  210. pear_sim-0.1.0/src/pear_sim/evidence/stability.py +327 -0
  211. pear_sim-0.1.0/src/pear_sim/evidence/sweep.py +992 -0
  212. pear_sim-0.1.0/src/pear_sim/evidence/tolerance_corners.py +388 -0
  213. pear_sim-0.1.0/src/pear_sim/evidence/worker_pool.py +279 -0
  214. pear_sim-0.1.0/src/pear_sim/evidence_io.py +7 -0
  215. pear_sim-0.1.0/src/pear_sim/gate_drive.py +7 -0
  216. pear_sim-0.1.0/src/pear_sim/harmonics.py +7 -0
  217. pear_sim-0.1.0/src/pear_sim/io.py +7 -0
  218. pear_sim-0.1.0/src/pear_sim/limits.py +52 -0
  219. pear_sim-0.1.0/src/pear_sim/mcp/__init__.py +1 -0
  220. pear_sim-0.1.0/src/pear_sim/mcp/server.py +451 -0
  221. pear_sim-0.1.0/src/pear_sim/mcp/tools.py +1151 -0
  222. pear_sim-0.1.0/src/pear_sim/mcp/worker.py +149 -0
  223. pear_sim-0.1.0/src/pear_sim/mcp/workspace.py +123 -0
  224. pear_sim-0.1.0/src/pear_sim/metrics.py +7 -0
  225. pear_sim-0.1.0/src/pear_sim/mode_coverage.py +7 -0
  226. pear_sim-0.1.0/src/pear_sim/model.py +7 -0
  227. pear_sim-0.1.0/src/pear_sim/numerical_evidence.py +7 -0
  228. pear_sim-0.1.0/src/pear_sim/numerical_report.py +7 -0
  229. pear_sim-0.1.0/src/pear_sim/oracle/__init__.py +1 -0
  230. pear_sim-0.1.0/src/pear_sim/oracle/ngspice.py +267 -0
  231. pear_sim-0.1.0/src/pear_sim/parameter_sweep.py +7 -0
  232. pear_sim-0.1.0/src/pear_sim/parameter_sweep_worker.py +7 -0
  233. pear_sim-0.1.0/src/pear_sim/platform_evidence.py +7 -0
  234. pear_sim-0.1.0/src/pear_sim/render.py +7 -0
  235. pear_sim-0.1.0/src/pear_sim/report.py +7 -0
  236. pear_sim-0.1.0/src/pear_sim/report_svg.py +7 -0
  237. pear_sim-0.1.0/src/pear_sim/reporting/__init__.py +1 -0
  238. pear_sim-0.1.0/src/pear_sim/reporting/benchmark_report.py +1034 -0
  239. pear_sim-0.1.0/src/pear_sim/reporting/numerical_report.py +358 -0
  240. pear_sim-0.1.0/src/pear_sim/reporting/perturbation_report.py +413 -0
  241. pear_sim-0.1.0/src/pear_sim/reporting/render.py +1837 -0
  242. pear_sim-0.1.0/src/pear_sim/reporting/render_bridge.py +647 -0
  243. pear_sim-0.1.0/src/pear_sim/reporting/report.py +3122 -0
  244. pear_sim-0.1.0/src/pear_sim/reporting/report_svg.py +695 -0
  245. pear_sim-0.1.0/src/pear_sim/review/__init__.py +3 -0
  246. pear_sim-0.1.0/src/pear_sim/review/packets.py +962 -0
  247. pear_sim-0.1.0/src/pear_sim/review/review_annotations.py +319 -0
  248. pear_sim-0.1.0/src/pear_sim/review/review_errors.py +33 -0
  249. pear_sim-0.1.0/src/pear_sim/review_annotations.py +7 -0
  250. pear_sim-0.1.0/src/pear_sim/review_errors.py +7 -0
  251. pear_sim-0.1.0/src/pear_sim/run/__init__.py +1 -0
  252. pear_sim-0.1.0/src/pear_sim/run/contracts.py +576 -0
  253. pear_sim-0.1.0/src/pear_sim/run/io.py +720 -0
  254. pear_sim-0.1.0/src/pear_sim/run_compare.py +7 -0
  255. pear_sim-0.1.0/src/pear_sim/scheduling.py +7 -0
  256. pear_sim-0.1.0/src/pear_sim/solver.py +7 -0
  257. pear_sim-0.1.0/src/pear_sim/spec/__init__.py +1 -0
  258. pear_sim-0.1.0/src/pear_sim/spec/canonical_topologies.py +485 -0
  259. pear_sim-0.1.0/src/pear_sim/spec/controls.py +1209 -0
  260. pear_sim-0.1.0/src/pear_sim/spec/device_cards.py +718 -0
  261. pear_sim-0.1.0/src/pear_sim/spec/machines.py +896 -0
  262. pear_sim-0.1.0/src/pear_sim/spec/model.py +1665 -0
  263. pear_sim-0.1.0/src/pear_sim/spec/model.schema.json +1101 -0
  264. pear_sim-0.1.0/src/pear_sim/spec/parameter_envelope.py +375 -0
  265. pear_sim-0.1.0/src/pear_sim/spec/perturbation.py +540 -0
  266. pear_sim-0.1.0/src/pear_sim/spec/signal_graph.py +1068 -0
  267. pear_sim-0.1.0/src/pear_sim/spec/signals.py +140 -0
  268. pear_sim-0.1.0/src/pear_sim/spec/subcircuits.py +510 -0
  269. pear_sim-0.1.0/src/pear_sim/spec/units.py +147 -0
  270. pear_sim-0.1.0/src/pear_sim/spec/waveforms.py +259 -0
  271. pear_sim-0.1.0/src/pear_sim/sweep.py +7 -0
  272. pear_sim-0.1.0/src/pear_sim/three_phase_modulation.py +7 -0
  273. pear_sim-0.1.0/src/pear_sim/topology/__init__.py +31 -0
  274. pear_sim-0.1.0/src/pear_sim/topology/comparison.py +784 -0
  275. pear_sim-0.1.0/src/pear_sim/topology/library.py +357 -0
  276. pear_sim-0.1.0/src/pear_sim/topology/topology-entry.schema.json +172 -0
  277. pear_sim-0.1.0/src/pear_sim/units.py +7 -0
  278. pear_sim-0.1.0/src/pear_sim/validation_status.json +161 -0
  279. pear_sim-0.1.0/tests/__init__.py +1 -0
  280. pear_sim-0.1.0/tests/data/buck_resolved_golden.json +183 -0
  281. pear_sim-0.1.0/tests/reference/__init__.py +1 -0
  282. pear_sim-0.1.0/tests/reference/buck_dcm_oracle.py +421 -0
  283. pear_sim-0.1.0/tests/test_ac_sweep_switched.py +141 -0
  284. pear_sim-0.1.0/tests/test_active_set_scale.py +263 -0
  285. pear_sim-0.1.0/tests/test_affine_benchmark_primitives.py +87 -0
  286. pear_sim-0.1.0/tests/test_agent_contract.py +406 -0
  287. pear_sim-0.1.0/tests/test_analytic_checks.py +261 -0
  288. pear_sim-0.1.0/tests/test_api_facade.py +97 -0
  289. pear_sim-0.1.0/tests/test_arch_matrices.py +46 -0
  290. pear_sim-0.1.0/tests/test_batch.py +282 -0
  291. pear_sim-0.1.0/tests/test_benchmark_harness.py +174 -0
  292. pear_sim-0.1.0/tests/test_benchmark_report.py +543 -0
  293. pear_sim-0.1.0/tests/test_boost.py +21 -0
  294. pear_sim-0.1.0/tests/test_boost_boundary_benchmark.py +451 -0
  295. pear_sim-0.1.0/tests/test_boost_sweep_runner.py +222 -0
  296. pear_sim-0.1.0/tests/test_buck.py +28 -0
  297. pear_sim-0.1.0/tests/test_buck_boundary_benchmark.py +458 -0
  298. pear_sim-0.1.0/tests/test_buck_boundary_convergence.py +84 -0
  299. pear_sim-0.1.0/tests/test_buck_dcm_oracle.py +258 -0
  300. pear_sim-0.1.0/tests/test_capabilities.py +160 -0
  301. pear_sim-0.1.0/tests/test_cli_explain.py +291 -0
  302. pear_sim-0.1.0/tests/test_cli_m2.py +406 -0
  303. pear_sim-0.1.0/tests/test_cli_m24.py +288 -0
  304. pear_sim-0.1.0/tests/test_closed_loop_control.py +321 -0
  305. pear_sim-0.1.0/tests/test_coincident_events.py +133 -0
  306. pear_sim-0.1.0/tests/test_complementary_pwm.py +365 -0
  307. pear_sim-0.1.0/tests/test_conduction_drops.py +328 -0
  308. pear_sim-0.1.0/tests/test_confidence_card.py +86 -0
  309. pear_sim-0.1.0/tests/test_constant_guard_livelock.py +89 -0
  310. pear_sim-0.1.0/tests/test_contracts.py +169 -0
  311. pear_sim-0.1.0/tests/test_coupled_inductors.py +304 -0
  312. pear_sim-0.1.0/tests/test_coupled_winding_reduction.py +238 -0
  313. pear_sim-0.1.0/tests/test_dcm_reduction.py +414 -0
  314. pear_sim-0.1.0/tests/test_dense_polynomials.py +109 -0
  315. pear_sim-0.1.0/tests/test_design_spec.py +168 -0
  316. pear_sim-0.1.0/tests/test_double_exponential_waveform.py +151 -0
  317. pear_sim-0.1.0/tests/test_dq_current_control.py +181 -0
  318. pear_sim-0.1.0/tests/test_driven_speed.py +195 -0
  319. pear_sim-0.1.0/tests/test_efficiency_map.py +135 -0
  320. pear_sim-0.1.0/tests/test_evidence.py +386 -0
  321. pear_sim-0.1.0/tests/test_evidence_io.py +188 -0
  322. pear_sim-0.1.0/tests/test_evidence_schemas.py +214 -0
  323. pear_sim-0.1.0/tests/test_floating_neutral.py +241 -0
  324. pear_sim-0.1.0/tests/test_floating_node_memo.py +106 -0
  325. pear_sim-0.1.0/tests/test_flux_maps.py +258 -0
  326. pear_sim-0.1.0/tests/test_gate_drive.py +258 -0
  327. pear_sim-0.1.0/tests/test_gradient_backend_buck.py +312 -0
  328. pear_sim-0.1.0/tests/test_gradient_building_blocks.py +431 -0
  329. pear_sim-0.1.0/tests/test_gradient_llc_dab.py +235 -0
  330. pear_sim-0.1.0/tests/test_gradient_losses.py +194 -0
  331. pear_sim-0.1.0/tests/test_gradient_saltation.py +243 -0
  332. pear_sim-0.1.0/tests/test_half_bridge_golden.py +248 -0
  333. pear_sim-0.1.0/tests/test_harmonic_binding.py +143 -0
  334. pear_sim-0.1.0/tests/test_harmonic_report.py +252 -0
  335. pear_sim-0.1.0/tests/test_harmonics.py +134 -0
  336. pear_sim-0.1.0/tests/test_inverter.py +45 -0
  337. pear_sim-0.1.0/tests/test_inverting_buck_boost_boundary.py +492 -0
  338. pear_sim-0.1.0/tests/test_inverting_buck_boost_sweep_runner.py +541 -0
  339. pear_sim-0.1.0/tests/test_io_bundle.py +84 -0
  340. pear_sim-0.1.0/tests/test_lean_evidence_mode.py +187 -0
  341. pear_sim-0.1.0/tests/test_liquid_cooling.py +202 -0
  342. pear_sim-0.1.0/tests/test_losses_thermal.py +352 -0
  343. pear_sim-0.1.0/tests/test_machine_energy_audit.py +76 -0
  344. pear_sim-0.1.0/tests/test_machine_signals.py +243 -0
  345. pear_sim-0.1.0/tests/test_mcp_worker_timeout.py +54 -0
  346. pear_sim-0.1.0/tests/test_measurement_chain.py +217 -0
  347. pear_sim-0.1.0/tests/test_mode_coverage.py +234 -0
  348. pear_sim-0.1.0/tests/test_mode_plans.py +137 -0
  349. pear_sim-0.1.0/tests/test_model_format_characterization.py +260 -0
  350. pear_sim-0.1.0/tests/test_model_meta.py +150 -0
  351. pear_sim-0.1.0/tests/test_multiwinding_transformer.py +226 -0
  352. pear_sim-0.1.0/tests/test_ngspice_oracle.py +240 -0
  353. pear_sim-0.1.0/tests/test_npc5.py +114 -0
  354. pear_sim-0.1.0/tests/test_npc_midpoint.py +103 -0
  355. pear_sim-0.1.0/tests/test_npc_modulator.py +345 -0
  356. pear_sim-0.1.0/tests/test_numerical_evidence.py +435 -0
  357. pear_sim-0.1.0/tests/test_numerical_report.py +93 -0
  358. pear_sim-0.1.0/tests/test_oracle_record_provenance.py +105 -0
  359. pear_sim-0.1.0/tests/test_packaging.py +30 -0
  360. pear_sim-0.1.0/tests/test_parallel_points.py +128 -0
  361. pear_sim-0.1.0/tests/test_parameter_envelope.py +193 -0
  362. pear_sim-0.1.0/tests/test_parameter_sweep.py +919 -0
  363. pear_sim-0.1.0/tests/test_parameter_sweep_evidence_schema.py +217 -0
  364. pear_sim-0.1.0/tests/test_perturbation_campaign.py +237 -0
  365. pear_sim-0.1.0/tests/test_perturbation_events.py +293 -0
  366. pear_sim-0.1.0/tests/test_perturbation_regression.py +81 -0
  367. pear_sim-0.1.0/tests/test_pi_block.py +116 -0
  368. pear_sim-0.1.0/tests/test_platform_evidence.py +874 -0
  369. pear_sim-0.1.0/tests/test_pmsm_machine.py +349 -0
  370. pear_sim-0.1.0/tests/test_public_hygiene.py +104 -0
  371. pear_sim-0.1.0/tests/test_pwm_scheduler.py +269 -0
  372. pear_sim-0.1.0/tests/test_rc.py +35 -0
  373. pear_sim-0.1.0/tests/test_rectifier_12pulse.py +179 -0
  374. pear_sim-0.1.0/tests/test_reference_frames.py +123 -0
  375. pear_sim-0.1.0/tests/test_render.py +336 -0
  376. pear_sim-0.1.0/tests/test_report.py +1271 -0
  377. pear_sim-0.1.0/tests/test_resonance.py +198 -0
  378. pear_sim-0.1.0/tests/test_review.py +238 -0
  379. pear_sim-0.1.0/tests/test_rl_rlc.py +95 -0
  380. pear_sim-0.1.0/tests/test_run_compare.py +717 -0
  381. pear_sim-0.1.0/tests/test_rust_core.py +238 -0
  382. pear_sim-0.1.0/tests/test_salient_machine.py +337 -0
  383. pear_sim-0.1.0/tests/test_sat_inductor.py +193 -0
  384. pear_sim-0.1.0/tests/test_schema_enforcement.py +77 -0
  385. pear_sim-0.1.0/tests/test_sensitivity.py +228 -0
  386. pear_sim-0.1.0/tests/test_signal_layer.py +654 -0
  387. pear_sim-0.1.0/tests/test_signal_svpwm_bridge.py +112 -0
  388. pear_sim-0.1.0/tests/test_signal_units.py +67 -0
  389. pear_sim-0.1.0/tests/test_spwm_inverter.py +240 -0
  390. pear_sim-0.1.0/tests/test_spwm_model.py +377 -0
  391. pear_sim-0.1.0/tests/test_spwm_scheduler.py +339 -0
  392. pear_sim-0.1.0/tests/test_srf_pll.py +165 -0
  393. pear_sim-0.1.0/tests/test_stability_analysis.py +523 -0
  394. pear_sim-0.1.0/tests/test_subcircuits.py +432 -0
  395. pear_sim-0.1.0/tests/test_svpwm_injection.py +127 -0
  396. pear_sim-0.1.0/tests/test_svpwm_sector.py +128 -0
  397. pear_sim-0.1.0/tests/test_sweep_runner.py +195 -0
  398. pear_sim-0.1.0/tests/test_three_phase_modulation.py +286 -0
  399. pear_sim-0.1.0/tests/test_thyristor.py +239 -0
  400. pear_sim-0.1.0/tests/test_time_metrics.py +207 -0
  401. pear_sim-0.1.0/tests/test_tolerance_corners.py +160 -0
  402. pear_sim-0.1.0/tests/test_topology_comparison.py +372 -0
  403. pear_sim-0.1.0/tests/test_topology_library.py +253 -0
  404. pear_sim-0.1.0/tests/test_torque_controller.py +238 -0
  405. pear_sim-0.1.0/tests/test_units.py +246 -0
  406. pear_sim-0.1.0/tests/test_val005_inverter.py +134 -0
  407. pear_sim-0.1.0/tests/test_waveform_sources.py +472 -0
  408. pear_sim-0.1.0/tests/test_worker_pool.py +229 -0
  409. pear_sim-0.1.0/uv.lock +1328 -0
  410. pear_sim-0.1.0/validation/README.md +74 -0
  411. pear_sim-0.1.0/validation/manifest.json +496 -0
  412. pear_sim-0.1.0/validation/oracle-records/README.md +14 -0
  413. pear_sim-0.1.0/validation/oracle-records/ngspice-pwl-ramp.json +19 -0
  414. pear_sim-0.1.0/validation/oracle-records/ngspice-rc-sine.json +19 -0
  415. pear_sim-0.1.0/validation/oracle-records/ngspice-rc-step.json +19 -0
  416. pear_sim-0.1.0/validation/oracle-records/ngspice-rlc-step.json +24 -0
  417. pear_sim-0.1.0/validation/status.json +161 -0
@@ -0,0 +1,12 @@
1
+ * text=auto
2
+
3
+ # Source and evidence inputs must have byte-stable working-tree line endings on
4
+ # macOS, Linux, and Windows because raw source SHA-256 is part of the evidence binding.
5
+ *.json text eol=lf
6
+ *.md text eol=lf
7
+ *.py text eol=lf
8
+ *.svg text eol=lf
9
+ *.toml text eol=lf
10
+ *.yaml text eol=lf
11
+ *.yml text eol=lf
12
+ *.lock text eol=lf
@@ -0,0 +1,214 @@
1
+ name: ci
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ pull_request:
7
+
8
+ permissions:
9
+ contents: read
10
+
11
+ env:
12
+ PEAR_SIM_UV_VERSION: "0.11.28"
13
+
14
+ concurrency:
15
+ group: ci-${{ github.workflow }}-${{ github.ref }}
16
+ cancel-in-progress: true
17
+
18
+ jobs:
19
+ test:
20
+ timeout-minutes: 45
21
+ strategy:
22
+ fail-fast: false
23
+ matrix:
24
+ os: [ubuntu-24.04]
25
+ python-version: ["3.11.15", "3.13.13"]
26
+ runs-on: ${{ matrix.os }}
27
+ steps:
28
+ - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
29
+ - uses: astral-sh/setup-uv@11f9893b081a58869d3b5fccaea48c9e9e46f990 # v8.3.2
30
+ with:
31
+ version: ${{ env.PEAR_SIM_UV_VERSION }}
32
+ python-version: ${{ matrix.python-version }}
33
+ enable-cache: true
34
+ - name: Install locked environment
35
+ run: uv sync --locked --extra dev
36
+ - name: Unit and converter tests
37
+ run: uv run pytest
38
+ - name: Static checks
39
+ run: uv run ruff check .
40
+ - name: CLI smoke test
41
+ run: uv run pear-sim simulate examples/buck.yaml --out runs/buck --json
42
+ - name: Complementary PWM and human-report smoke
43
+ run: |
44
+ uv run pear-sim render examples/synchronous_buck_complementary.yaml --out artifacts/synchronous-buck --json
45
+ uv run pear-sim simulate examples/synchronous_buck_complementary.yaml --out runs/synchronous-buck --json
46
+ uv run pear-sim report runs/synchronous-buck --out reports/synchronous-buck --schematic artifacts/synchronous-buck/schematic.svg --json
47
+ - name: Three-phase SPWM, harmonics, and human-report smoke
48
+ run: |
49
+ uv run pear-sim render examples/inverter_three_phase_spwm.yaml --out artifacts/inverter-spwm --json
50
+ uv run pear-sim simulate examples/inverter_three_phase_spwm.yaml --out runs/inverter-spwm --json
51
+ uv run pear-sim report runs/inverter-spwm --out reports/inverter-spwm --schematic artifacts/inverter-spwm/schematic.svg --json
52
+ - name: Verified-run comparison smoke
53
+ run: >-
54
+ uv run pear-sim compare runs/buck runs/buck
55
+ --profile examples/buck_compare_profile.json
56
+ --out comparisons/buck-self --json
57
+ - name: Bounded parameter-sweep smoke
58
+ run: >-
59
+ uv run pear-sim sweep parameter examples/buck.yaml
60
+ --request examples/buck_parameter_sweep.json
61
+ --out sweeps/buck-parameter --json
62
+ - name: Canonical boost boundary evidence smoke
63
+ run: >-
64
+ uv run pear-sim sweep boost-boundary examples/boost.yaml
65
+ --ratios 0.9,1,1.1 --out sweeps/boost-boundary --json
66
+ - name: Canonical inverting buck-boost boundary evidence smoke
67
+ run: >-
68
+ uv run pear-sim sweep inverting-buck-boost-boundary
69
+ examples/inverting_buck_boost.yaml
70
+ --ratios 0.9,1,1.1 --out sweeps/inverting-buck-boost-boundary --json
71
+
72
+
73
+ test-other-os:
74
+ # Windows, macOS and ARM minutes are free on public repositories and billed
75
+ # extra (or unavailable) on private ones, so these platforms run once the
76
+ # repo is public.
77
+ if: ${{ !github.event.repository.private }}
78
+ timeout-minutes: 45
79
+ strategy:
80
+ fail-fast: false
81
+ matrix:
82
+ os: [windows-2025, macos-15, ubuntu-24.04-arm]
83
+ python-version: ["3.13.13"]
84
+ runs-on: ${{ matrix.os }}
85
+ steps:
86
+ - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
87
+ - uses: astral-sh/setup-uv@11f9893b081a58869d3b5fccaea48c9e9e46f990 # v8.3.2
88
+ with:
89
+ version: ${{ env.PEAR_SIM_UV_VERSION }}
90
+ python-version: ${{ matrix.python-version }}
91
+ enable-cache: true
92
+ - name: Install locked environment
93
+ run: uv sync --locked --extra dev
94
+ - name: Unit and converter tests
95
+ run: uv run pytest
96
+ - name: Static checks
97
+ run: uv run ruff check .
98
+ - name: CLI smoke test
99
+ run: uv run pear-sim simulate examples/buck.yaml --out runs/buck --json
100
+ - name: Complementary PWM and human-report smoke
101
+ run: |
102
+ uv run pear-sim render examples/synchronous_buck_complementary.yaml --out artifacts/synchronous-buck --json
103
+ uv run pear-sim simulate examples/synchronous_buck_complementary.yaml --out runs/synchronous-buck --json
104
+ uv run pear-sim report runs/synchronous-buck --out reports/synchronous-buck --schematic artifacts/synchronous-buck/schematic.svg --json
105
+ - name: Three-phase SPWM, harmonics, and human-report smoke
106
+ run: |
107
+ uv run pear-sim render examples/inverter_three_phase_spwm.yaml --out artifacts/inverter-spwm --json
108
+ uv run pear-sim simulate examples/inverter_three_phase_spwm.yaml --out runs/inverter-spwm --json
109
+ uv run pear-sim report runs/inverter-spwm --out reports/inverter-spwm --schematic artifacts/inverter-spwm/schematic.svg --json
110
+ - name: Verified-run comparison smoke
111
+ run: >-
112
+ uv run pear-sim compare runs/buck runs/buck
113
+ --profile examples/buck_compare_profile.json
114
+ --out comparisons/buck-self --json
115
+ - name: Bounded parameter-sweep smoke
116
+ run: >-
117
+ uv run pear-sim sweep parameter examples/buck.yaml
118
+ --request examples/buck_parameter_sweep.json
119
+ --out sweeps/buck-parameter --json
120
+ - name: Canonical boost boundary evidence smoke
121
+ run: >-
122
+ uv run pear-sim sweep boost-boundary examples/boost.yaml
123
+ --ratios 0.9,1,1.1 --out sweeps/boost-boundary --json
124
+ - name: Canonical inverting buck-boost boundary evidence smoke
125
+ run: >-
126
+ uv run pear-sim sweep inverting-buck-boost-boundary
127
+ examples/inverting_buck_boost.yaml
128
+ --ratios 0.9,1,1.1 --out sweeps/inverting-buck-boost-boundary --json
129
+
130
+ examples:
131
+ # Every shipped example must still load and run: examples are documentation
132
+ # that agents copy, and an example that rots silently teaches the wrong format.
133
+ timeout-minutes: 20
134
+ runs-on: ubuntu-24.04
135
+ steps:
136
+ - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
137
+ - uses: astral-sh/setup-uv@11f9893b081a58869d3b5fccaea48c9e9e46f990 # v8.3.2
138
+ with:
139
+ version: ${{ env.PEAR_SIM_UV_VERSION }}
140
+ python-version: "3.13.13"
141
+ enable-cache: true
142
+ - name: Install locked environment
143
+ run: uv sync --locked --extra dev
144
+ - name: Lint and run every example
145
+ run: |
146
+ for model in examples/*.yaml; do
147
+ name=$(basename "$model" .yaml)
148
+ uv run pear-sim lint "$model"
149
+ uv run pear-sim simulate "$model" --out "runs/$name" --lean > /dev/null
150
+ done
151
+
152
+ rust-core:
153
+ # The optional compiled kernel (rust/pear-sim-core): build it, then check
154
+ # it against SciPy, the exact solution and the reference engine on every
155
+ # example it supports.
156
+ timeout-minutes: 30
157
+ runs-on: ubuntu-24.04
158
+ steps:
159
+ - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
160
+ - uses: astral-sh/setup-uv@11f9893b081a58869d3b5fccaea48c9e9e46f990 # v8.3.2
161
+ with:
162
+ version: ${{ env.PEAR_SIM_UV_VERSION }}
163
+ python-version: "3.13.13"
164
+ enable-cache: true
165
+ - name: Install locked environment
166
+ run: uv sync --locked --extra dev
167
+ - name: Build the kernel
168
+ run: uvx --from "maturin==1.16.0" maturin build --release --locked -m rust/pear-sim-core/Cargo.toml -o rust-dist
169
+ - name: Install the kernel
170
+ run: uv pip install rust-dist/*.whl
171
+ - name: Kernel tests
172
+ run: uv run --no-sync pytest tests/test_rust_core.py "tests/test_batch.py::test_rust_batch_ranks_like_the_reference_engine" "tests/test_sensitivity.py::test_sensitivity_on_the_compiled_kernel_matches_the_reference"
173
+ - name: Every supported example on both engines
174
+ run: |
175
+ uv run --no-sync python scripts/rust_parity.py --tolerance 1e-12 --mode lean
176
+ uv run --no-sync python scripts/rust_parity.py --tolerance 1e-12 --mode full
177
+
178
+ ngspice-oracle:
179
+ # Independent-engine evidence: the differential tests skip silently when no
180
+ # ngspice binary is present, so this job installs one and makes them run.
181
+ timeout-minutes: 15
182
+ runs-on: ubuntu-24.04
183
+ steps:
184
+ - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
185
+ - uses: astral-sh/setup-uv@11f9893b081a58869d3b5fccaea48c9e9e46f990 # v8.3.2
186
+ with:
187
+ version: ${{ env.PEAR_SIM_UV_VERSION }}
188
+ python-version: "3.13.13"
189
+ enable-cache: true
190
+ - name: Install ngspice
191
+ run: sudo apt-get update && sudo apt-get install -y ngspice
192
+ - name: Install locked environment
193
+ run: uv sync --locked --extra dev
194
+ - name: Differential tests against ngspice (none may skip)
195
+ run: uv run pytest tests/test_ngspice_oracle.py -rs | tee ngspice.log && ! grep -q SKIPPED ngspice.log
196
+
197
+ secrets-scan:
198
+ timeout-minutes: 10
199
+ runs-on: ubuntu-24.04
200
+ steps:
201
+ - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
202
+ with:
203
+ fetch-depth: 0
204
+ - name: gitleaks (full history)
205
+ env:
206
+ GH_TOKEN: ${{ github.token }}
207
+ run: |
208
+ # Fallback: the API asset path can work while releases/download returns 504.
209
+ # The checksum below runs on whichever file was obtained — never skip it.
210
+ curl -sSfL --retry 5 --retry-all-errors --retry-delay 5 -o gitleaks.tar.gz https://github.com/gitleaks/gitleaks/releases/download/v8.30.1/gitleaks_8.30.1_linux_x64.tar.gz \
211
+ || gh release download v8.30.1 -R gitleaks/gitleaks -p gitleaks_8.30.1_linux_x64.tar.gz -O gitleaks.tar.gz --clobber
212
+ echo "551f6fc83ea457d62a0d98237cbad105af8d557003051f41f3e7ca7b3f2470eb gitleaks.tar.gz" | sha256sum -c -
213
+ tar -xzf gitleaks.tar.gz gitleaks
214
+ ./gitleaks git --redact --verbose .
@@ -0,0 +1,105 @@
1
+ name: numerical-evidence
2
+
3
+ # Cost policy (2026-07-21): this workflow produces the retained canonical-buck numerical evidence
4
+ # matrix on three OSes (30-minute jobs, macOS at a 10x billing multiplier). It
5
+ # is evidence *production*, not regression — a configured workflow was never a
6
+ # claim that a bundle passed — so it runs only on demand.
7
+ on:
8
+ workflow_dispatch:
9
+
10
+ permissions:
11
+ contents: read
12
+
13
+ concurrency:
14
+ group: numerical-evidence-${{ github.workflow }}-${{ github.ref }}
15
+ cancel-in-progress: true
16
+
17
+ env:
18
+ BLIS_NUM_THREADS: "1"
19
+ MKL_NUM_THREADS: "1"
20
+ NUMEXPR_NUM_THREADS: "1"
21
+ OMP_NUM_THREADS: "1"
22
+ OPENBLAS_NUM_THREADS: "1"
23
+ PYTHONHASHSEED: "0"
24
+ PEAR_SIM_UV_VERSION: "0.11.28"
25
+ VECLIB_MAXIMUM_THREADS: "1"
26
+
27
+ jobs:
28
+ platform-evidence:
29
+ name: m22-${{ matrix.artifact_system }}
30
+ timeout-minutes: 30
31
+ strategy:
32
+ fail-fast: false
33
+ matrix:
34
+ include:
35
+ - os: ubuntu-24.04
36
+ artifact_system: Linux
37
+ - os: macos-15
38
+ artifact_system: macOS
39
+ - os: windows-2025
40
+ artifact_system: Windows
41
+ runs-on: ${{ matrix.os }}
42
+ steps:
43
+ - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
44
+ - uses: astral-sh/setup-uv@11f9893b081a58869d3b5fccaea48c9e9e46f990 # v8.3.2
45
+ with:
46
+ version: ${{ env.PEAR_SIM_UV_VERSION }}
47
+ python-version: "3.12.13"
48
+ enable-cache: true
49
+ - name: Install locked environment
50
+ run: uv sync --locked --extra dev
51
+ - name: Run full canonical-buck numerical evidence profile
52
+ run: uv run pear-sim verify numerics buck-boundary examples/buck_dcm.yaml --profile full-v1 --source-revision "${{ github.sha }}" --out numerical-evidence --json
53
+ - name: Upload native numerical evidence
54
+ if: always()
55
+ uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
56
+ with:
57
+ name: m22-${{ matrix.artifact_system }}
58
+ path: numerical-evidence/
59
+ if-no-files-found: warn
60
+ retention-days: 30
61
+
62
+ aggregate-platforms:
63
+ name: m22-cross-platform-aggregate
64
+ needs: platform-evidence
65
+ if: ${{ always() }}
66
+ runs-on: ubuntu-24.04
67
+ timeout-minutes: 15
68
+ steps:
69
+ - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
70
+ - uses: astral-sh/setup-uv@11f9893b081a58869d3b5fccaea48c9e9e46f990 # v8.3.2
71
+ with:
72
+ version: ${{ env.PEAR_SIM_UV_VERSION }}
73
+ python-version: "3.12.13"
74
+ enable-cache: true
75
+ - name: Install locked environment
76
+ run: uv sync --locked --extra dev
77
+ - name: Download Linux evidence
78
+ if: always()
79
+ uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
80
+ with:
81
+ name: m22-Linux
82
+ path: platform-inputs/Linux
83
+ - name: Download macOS evidence
84
+ if: always()
85
+ uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
86
+ with:
87
+ name: m22-macOS
88
+ path: platform-inputs/Darwin
89
+ - name: Download Windows evidence
90
+ if: always()
91
+ uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
92
+ with:
93
+ name: m22-Windows
94
+ path: platform-inputs/Windows
95
+ - name: Aggregate native platform evidence
96
+ if: always()
97
+ run: uv run pear-sim verify platforms platform-inputs/Linux platform-inputs/Darwin platform-inputs/Windows --require Linux,Darwin,Windows --out cross-platform-evidence --json
98
+ - name: Upload cross-platform aggregate
99
+ if: always()
100
+ uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
101
+ with:
102
+ name: m22-cross-platform
103
+ path: cross-platform-evidence/
104
+ if-no-files-found: warn
105
+ retention-days: 30
@@ -0,0 +1,77 @@
1
+ name: release
2
+
3
+ # Manual: builds both distributions, checks their versions agree, and publishes
4
+ # them to PyPI through trusted publishing. Nothing here runs on push.
5
+ #
6
+ # Each PyPI project has its own GitHub environment: PyPI refuses two pending
7
+ # trusted publishers with the same (repository, workflow, environment), so
8
+ # pear-sim publishes from `pypi` and pear-sim-mcp from `pypi-mcp`. Both
9
+ # environments only deploy from main.
10
+ on:
11
+ workflow_dispatch:
12
+
13
+ permissions:
14
+ contents: read
15
+
16
+ jobs:
17
+ build:
18
+ runs-on: ubuntu-24.04
19
+ permissions:
20
+ contents: read
21
+ steps:
22
+ - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
23
+ - uses: astral-sh/setup-uv@11f9893b081a58869d3b5fccaea48c9e9e46f990 # v8.3.2
24
+ with:
25
+ version: "0.11.28"
26
+ python-version: "3.13.13"
27
+ - name: Versions agree
28
+ run: |
29
+ core=$(uv run --no-project python -c "import tomllib;print(tomllib.load(open('pyproject.toml','rb'))['project']['version'])")
30
+ shim=$(uv run --no-project python -c "import tomllib;print(tomllib.load(open('packaging/pear-sim-mcp/pyproject.toml','rb'))['project']['version'])")
31
+ pin=$(uv run --no-project python -c "import tomllib;print(tomllib.load(open('packaging/pear-sim-mcp/pyproject.toml','rb'))['project']['dependencies'][0])")
32
+ server=$(uv run --no-project python -c "import json;d=json.load(open('server.json'));print(d['version'], d['packages'][0]['version'])")
33
+ test "$core" = "$shim" && test "$pin" = "pear-sim[mcp]==$core" && test "$server" = "$core $core"
34
+ - name: Build
35
+ run: |
36
+ uv build --out-dir dist/core
37
+ uv build packaging/pear-sim-mcp --out-dir dist/mcp
38
+ - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
39
+ with:
40
+ name: dist
41
+ path: dist/
42
+ if-no-files-found: error
43
+
44
+ publish-core:
45
+ needs: build
46
+ runs-on: ubuntu-24.04
47
+ environment: pypi
48
+ permissions:
49
+ id-token: write
50
+ steps:
51
+ - uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
52
+ with:
53
+ name: dist
54
+ path: dist/
55
+ - uses: astral-sh/setup-uv@11f9893b081a58869d3b5fccaea48c9e9e46f990 # v8.3.2
56
+ with:
57
+ version: "0.11.28"
58
+ - name: Publish pear-sim
59
+ run: uv publish dist/core/*
60
+
61
+ # pear-sim-mcp pins pear-sim==<version>, so it goes up only after pear-sim.
62
+ publish-mcp:
63
+ needs: publish-core
64
+ runs-on: ubuntu-24.04
65
+ environment: pypi-mcp
66
+ permissions:
67
+ id-token: write
68
+ steps:
69
+ - uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
70
+ with:
71
+ name: dist
72
+ path: dist/
73
+ - uses: astral-sh/setup-uv@11f9893b081a58869d3b5fccaea48c9e9e46f990 # v8.3.2
74
+ with:
75
+ version: "0.11.28"
76
+ - name: Publish pear-sim-mcp
77
+ run: uv publish dist/mcp/*
@@ -0,0 +1,18 @@
1
+ .DS_Store
2
+ .venv/
3
+ __pycache__/
4
+ *.py[cod]
5
+ .pytest_cache/
6
+ .ruff_cache/
7
+ .coverage
8
+ htmlcov/
9
+ dist/
10
+ build/
11
+ *.egg-info/
12
+ runs/
13
+ dist/
14
+ .pear-sim/
15
+ evals/mcp/results/
16
+ rust/pear-sim-core/target/
17
+ rust/pear-sim-core/dist/
18
+ rust-dist/
@@ -0,0 +1,85 @@
1
+ # PEARSim agent guide
2
+
3
+ This repository is an executable early alpha of a clean-room, headless power-electronics simulator. Preserve correctness, diagnostics, and reproducibility before adding breadth or performance shortcuts.
4
+
5
+ ## Local workflow
6
+
7
+ No Docker is required.
8
+
9
+ ```bash
10
+ uv sync --locked --extra dev
11
+ uv run pytest
12
+ uv run ruff check .
13
+ uv run pear-sim lint examples/buck.yaml --json
14
+ uv run pear-sim simulate examples/buck.yaml --out runs/buck --json
15
+ ```
16
+
17
+ On Windows PowerShell the same `uv` commands apply. A standard `venv` plus `pip install -e ".[dev]"` is an acceptable fallback.
18
+
19
+ ## Source map
20
+
21
+ - `src/pear_sim/spec/model.py`: model loading, parameter resolution, semantic validation.
22
+ - `src/pear_sim/spec/units.py`: supported engineering units and dimensional checks.
23
+ - `src/pear_sim/core/circuit.py`: circuit stamping, topology compilation, diode active set, probes, and power balance.
24
+ - `src/pear_sim/core/solver.py`: PWM event queue, hybrid integration, natural events, and result sampling.
25
+ - `src/pear_sim/analysis/harmonics.py`: opt-in event-aligned dense-output Fourier/THD observation.
26
+ - `src/pear_sim/analysis/three_phase_modulation.py`: strict SPWM command/event mapping and bounded human projection.
27
+ - `src/pear_sim/analysis/mode_coverage.py`: conservative topology recognition and accepted-mode observations.
28
+ - `src/pear_sim/api/capabilities.py`: versioned, fail-closed capability declarations for agent clients.
29
+ - `src/pear_sim/evidence/expectations.py` and `src/pear_sim/evidence/evidence_io.py`: strict KPI expectation evaluation over manifest-verified runs.
30
+ - `src/pear_sim/evidence/benchmark_harness.py`: topology-neutral retained-point execution, fail-closed errors, summaries, and artifact manifests; it must not import production physics or oracle equations.
31
+ - `src/pear_sim/benchmarks/affine.py`: independently tested matrix-exponential primitives for already-derived affine oracle equations; topology matrices remain local to each oracle.
32
+ - `src/pear_sim/benchmarks/buck_boundary.py`: independent periodic canonical-buck CCM/BCM/DCM oracle and comparison gates.
33
+ - `src/pear_sim/benchmarks/boost_boundary.py`: independent periodic canonical-boost CCM/BCM/DCM oracle and comparison gates.
34
+ - `src/pear_sim/benchmarks/inverting_buck_boost_boundary.py`: independent periodic oracle and signed-output gates for the exact canonical ideal inverting buck-boost.
35
+ - `src/pear_sim/evidence/sweep.py`: bounded, retained-run canonical buck, boost, and exact inverting-buck-boost boundary sweep orchestration.
36
+ - `src/pear_sim/evidence/run_compare.py`: fail-closed same-physics/same-measurement comparison of verified run bundles; no fuzzy mappings.
37
+ - `src/pear_sim/evidence/parameter_sweep.py`: bounded, retained one-dimensional parameter experiments with optional expectations evaluation.
38
+ - `src/pear_sim/evidence/batch.py`: many-design screening (Latin hypercube, grid or list), ranking against a declared objective and constraints, full re-run of finalists.
39
+ - `src/pear_sim/evidence/sensitivity.py`: global sensitivity (Morris screening, Sobol indices with bootstrap intervals) on the batch machinery; estimators checked against closed forms.
40
+ - `src/pear_sim/evidence/parallel_points.py`: concurrent point workers with outcomes in declaration order (used by every batch producer).
41
+ - `src/pear_sim/reporting/benchmark_report.py`: deterministic offline human projection of recorded sweep evidence.
42
+ - `src/pear_sim/evidence/numerical_evidence.py`: bounded `full-v1` numerical matrix producer for the exact canonical buck.
43
+ - `src/pear_sim/evidence/platform_evidence.py`: strict native Linux/Darwin/Windows evidence verification and aggregation.
44
+ - `src/pear_sim/reporting/numerical_report.py`: offline presentation-only projection of recorded numerical evidence.
45
+ - `src/pear_sim/reporting/report.py`: bounded, offline human report projection; it must not recompute producer metrics.
46
+ - `src/pear_sim/analysis/steady_state.py`: periodic steady state via Newton shooting on the production cycle map.
47
+ - `src/pear_sim/analysis/small_signal.py`: two-topology state-space averaging, control-to-output Bode, declared-compensator loop-gain margins.
48
+ - `src/pear_sim/evidence/stability.py`: retained stability bundles with blocking convergence/CCM/margin gates.
49
+ - `src/pear_sim/api/cli.py`: stable agent-facing process contract.
50
+ - `schema/model.schema.json`: normative structural schema for `pear-sim/v0.1`.
51
+ - `schema/expectations.schema.json`: structural schema for `pear-sim/expectations/v0.1`.
52
+ - `schema/numerical-profile.schema.json`, `schema/platform-evidence.schema.json`, and
53
+ `schema/cross-platform-evidence.schema.json`: normative canonical-buck numerical and cross-platform evidence structures.
54
+ - `schema/boost-boundary-evidence.schema.json`: closed canonical-boost evidence structures.
55
+ - `schema/inverting-buck-boost-boundary-evidence.schema.json`: closed exact canonical inverting-buck-boost evidence structures.
56
+ - `schema/compare-profile.schema.json` and `schema/run-comparison.schema.json`: verified-run comparison input and evidence structures.
57
+ - `schema/parameter-sweep-request.schema.json`, `schema/parameter-sweep-summary.schema.json`, and `schema/parameter-sweep-evidence.schema.json`: bounded one-dimensional experiment structures.
58
+ - `docs/model-format.md`: current human-readable model contract.
59
+ - `docs/m2-agent-evidence.md`: capability, expectation-evidence, and buck-boundary sweep contract.
60
+ - `docs/m2-numerical-evidence.md`: canonical-buck numerical profile, artifacts, CI, status, and claim boundary.
61
+ - `docs/m2-boost-boundary-evidence.md`: canonical-boost topology, oracle, gates, artifacts, and claim boundary.
62
+ - `docs/benchmark-harness.md`: shared benchmark mechanics, oracle-independence boundary, and requirements for another retained family.
63
+ - `docs/m3-spwm.md`: offline-midpoint SPWM, harmonic, artifact, and claim-boundary contract.
64
+ - `validation/manifest.json`: planned validation claims and gates; a listed case is not automatically implemented.
65
+
66
+ ## Required discipline
67
+
68
+ 1. Do not silently regularize invalid ideal circuits with hidden `gmin`, leakage, or parasitics.
69
+ 2. Keep capacitor voltages and inductor currents continuous across ordinary switch events.
70
+ 3. Scheduled events sharing a timestamp must be applied atomically and deterministically.
71
+ 4. New components require unit checks, documented polarity/equations, a positive test, and an invalid-case test.
72
+ 5. Any model-schema change must update the JSON Schema, `docs/model-format.md`, examples, and tests in the same change.
73
+ 6. Never weaken a validation threshold merely to make a regression pass. Diagnose the numerical or modeling cause.
74
+ 7. Keep GPL/AGPL/mixed-license simulators outside the native runtime; use them only through explicit optional process adapters after license review.
75
+ 8. Do not copy proprietary source, models, icons, manuals, or text from any commercial simulator. Independent-engine evidence uses open engines (ngspice) and closed forms.
76
+
77
+ ## Current claim boundary
78
+
79
+ The machine-readable claim boundary is the capability registry
80
+ (`uv run pear-sim capabilities --json`, source `src/pear_sim/api/capabilities.py`):
81
+ every capability is `supported`, `experimental` or `unsupported`, with its
82
+ scope and evidence. Treat an unknown capability as unsupported, retain
83
+ `fail`/`not_run` evidence instead of hiding it, and keep README limitations and
84
+ the registry accurate as capabilities evolve. Agreement with another simulator
85
+ is verification, not validation against hardware; never describe it otherwise.