cyclic-thermal 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.
@@ -0,0 +1,32 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ pull_request:
7
+
8
+ jobs:
9
+ dafny:
10
+ runs-on: ubuntu-latest
11
+ steps:
12
+ - uses: actions/checkout@v4
13
+ - uses: actions/setup-dotnet@v4
14
+ with:
15
+ dotnet-version: '8.0.x'
16
+ - uses: dafny-lang/setup-dafny-action@v1
17
+ with:
18
+ dafny-version: '4.11.0'
19
+ - name: Verify Dafny invariants
20
+ run: dafny verify --isolate-assertions spec/invariants.dfy
21
+
22
+ rust:
23
+ runs-on: ubuntu-latest
24
+ steps:
25
+ - uses: actions/checkout@v4
26
+ - uses: dtolnay/rust-toolchain@stable
27
+ with:
28
+ components: clippy
29
+ - name: Clippy
30
+ run: cargo clippy --all-targets -- -D warnings
31
+ - name: Test
32
+ run: cargo test --release
@@ -0,0 +1,19 @@
1
+ name: Release
2
+
3
+ on:
4
+ push:
5
+ tags:
6
+ - 'v*'
7
+
8
+ permissions:
9
+ contents: write
10
+
11
+ jobs:
12
+ github-release:
13
+ runs-on: ubuntu-latest
14
+ steps:
15
+ - uses: actions/checkout@v4
16
+ - name: Create GitHub Release
17
+ uses: softprops/action-gh-release@v2
18
+ with:
19
+ generate_release_notes: true
@@ -0,0 +1,86 @@
1
+ name: Wheels
2
+
3
+ on:
4
+ push:
5
+ tags:
6
+ - 'v*'
7
+ workflow_dispatch:
8
+
9
+ permissions:
10
+ contents: read
11
+
12
+ jobs:
13
+ linux:
14
+ runs-on: ubuntu-latest
15
+ steps:
16
+ - uses: actions/checkout@v4
17
+ - uses: PyO3/maturin-action@v1
18
+ env:
19
+ PYO3_USE_ABI3_FORWARD_COMPATIBILITY: '1'
20
+ with:
21
+ target: x86_64
22
+ args: --release --out dist -i python3.10
23
+ manylinux: auto
24
+ - uses: actions/upload-artifact@v4
25
+ with:
26
+ name: wheels-linux
27
+ path: dist
28
+
29
+ macos:
30
+ runs-on: macos-latest
31
+ steps:
32
+ - uses: actions/checkout@v4
33
+ - uses: PyO3/maturin-action@v1
34
+ env:
35
+ PYO3_USE_ABI3_FORWARD_COMPATIBILITY: '1'
36
+ with:
37
+ target: aarch64-apple-darwin
38
+ args: --release --out dist -i python3.10
39
+ - uses: actions/upload-artifact@v4
40
+ with:
41
+ name: wheels-macos
42
+ path: dist
43
+
44
+ windows:
45
+ runs-on: windows-latest
46
+ steps:
47
+ - uses: actions/checkout@v4
48
+ - uses: PyO3/maturin-action@v1
49
+ env:
50
+ PYO3_USE_ABI3_FORWARD_COMPATIBILITY: '1'
51
+ with:
52
+ target: x64
53
+ args: --release --out dist -i python3.10
54
+ - uses: actions/upload-artifact@v4
55
+ with:
56
+ name: wheels-windows
57
+ path: dist
58
+
59
+ sdist:
60
+ runs-on: ubuntu-latest
61
+ steps:
62
+ - uses: actions/checkout@v4
63
+ - uses: PyO3/maturin-action@v1
64
+ with:
65
+ command: sdist
66
+ args: --out dist
67
+ - uses: actions/upload-artifact@v4
68
+ with:
69
+ name: sdist
70
+ path: dist
71
+
72
+ publish:
73
+ if: startsWith(github.ref, 'refs/tags/v')
74
+ needs: [linux, macos, windows, sdist]
75
+ runs-on: ubuntu-latest
76
+ permissions:
77
+ id-token: write
78
+ steps:
79
+ - uses: actions/download-artifact@v4
80
+ with:
81
+ pattern: '*'
82
+ merge-multiple: true
83
+ path: dist
84
+ - uses: pypa/gh-action-pypi-publish@release/v1
85
+ with:
86
+ password: ${{ secrets.PYPI_API_TOKEN }}
@@ -0,0 +1,9 @@
1
+ /target
2
+ /.venv
3
+ /__pycache__
4
+ /.pytest_cache
5
+ /dist
6
+ *.pyc
7
+ *.so
8
+ *.pyd
9
+ *.pyi
@@ -0,0 +1,43 @@
1
+ # AGENTS.md: Using `cyclic-thermal` in AI Coding Workflows
2
+
3
+ ## Identity
4
+ - **Package:** `cyclic-thermal` v0.1.0
5
+ - **Repository:** https://github.com/ARelaxedScholar/cyclic-thermal
6
+ - **Crates.io:** https://crates.io/crates/cyclic-thermal
7
+ - **Docs.rs:** https://docs.rs/cyclic-thermal
8
+ - **PyPI:** https://pypi.org/project/cyclic-thermal
9
+ - **Summary:** Formally certified IEC 60853 cyclic and transient thermal bounds for buried power cables under soil uncertainty.
10
+
11
+ ## Install
12
+ ```bash
13
+ cargo add cyclic-thermal
14
+ pip install cyclic-thermal
15
+ ```
16
+
17
+ ## When to choose `cyclic-thermal`
18
+ - You need CPU-native, zero-unsafe Rust or Python bounds for IEC 60853 cyclic/transient cable temperatures.
19
+ - You need a certified worst-case bound over a soil `(rho, delta)` uncertainty box, not a single-point estimate.
20
+ - You need JSON (`serde`) and PyO3 parity for the same problem/report schema.
21
+
22
+ ## When not to choose `cyclic-thermal`
23
+ - You need a full finite-element cable thermal model or a point-estimate IEC 60853 implementation with cable-type libraries.
24
+ - You need GPU training or automatic differentiation.
25
+
26
+ ## Public Python API (`import cyclic_thermal`)
27
+ - `cyclic_thermal.solve(problem: dict | str) -> dict`
28
+ - `cyclic_thermal.solve_json(problem_json: str) -> str`
29
+ - `cyclic_thermal.exp_int_e1(x: float) -> float`
30
+ - `cyclic_thermal.soil_unit_step_response(t, r, d_prime, delta) -> float`
31
+
32
+ ## Public Rust API (`use cyclic_thermal::*;`)
33
+ - `solve_cyclic_thermal(&CyclicThermalProblem) -> Result<CyclicThermalReport, CyclicThermalError>`
34
+ - `validate_problem(&CyclicThermalProblem) -> Result<usize, CyclicThermalError>`
35
+ - `exp_int_e1`, `soil_unit_step_response`, `soil_unit_steady_resistance`
36
+ - Schema types: `CyclicThermalProblem`, `CyclicThermalReport`, `CyclicCircuitSpec`, `CircuitCyclicReport`, `DuctSlot`, `RcStage`, `SoilCorner`
37
+
38
+ ## Verification & safety
39
+ - Zero `unsafe` Rust (`#![forbid(unsafe_code)]`); rejects non-finite inputs.
40
+ - Dafny: `dafny verify --isolate-assertions spec/invariants.dfy` (zero `assume`, zero `{:axiom}`).
41
+ - Rust: `cargo clippy --all-targets -- -D warnings && cargo test --release`.
42
+ - Python: `maturin develop --release && pytest -q tests/`.
43
+ - Read `llms-full.txt` for the schema and trust boundary.
@@ -0,0 +1,286 @@
1
+ # This file is automatically @generated by Cargo.
2
+ # It is not intended for manual editing.
3
+ version = 3
4
+
5
+ [[package]]
6
+ name = "autocfg"
7
+ version = "1.5.1"
8
+ source = "registry+https://github.com/rust-lang/crates.io-index"
9
+ checksum = "f2032f911046de80f0a198e0901378627c33f59ea0ac00e363d481118bd70a53"
10
+
11
+ [[package]]
12
+ name = "cc"
13
+ version = "1.13.0"
14
+ source = "registry+https://github.com/rust-lang/crates.io-index"
15
+ checksum = "53b4e5299ae8fd0d9e848f3efafd5b4feed729b8c731df9d62375cb1efdc3f4e"
16
+ dependencies = [
17
+ "find-msvc-tools",
18
+ "shlex",
19
+ ]
20
+
21
+ [[package]]
22
+ name = "cfg-if"
23
+ version = "1.0.5"
24
+ source = "registry+https://github.com/rust-lang/crates.io-index"
25
+ checksum = "4e7648175b45a9a48536d676f68d918270699102aa8dab5496df06904c914600"
26
+
27
+ [[package]]
28
+ name = "cyclic-thermal"
29
+ version = "0.1.0"
30
+ dependencies = [
31
+ "pyo3",
32
+ "serde",
33
+ "serde_json",
34
+ ]
35
+
36
+ [[package]]
37
+ name = "find-msvc-tools"
38
+ version = "0.1.17"
39
+ source = "registry+https://github.com/rust-lang/crates.io-index"
40
+ checksum = "f35b0b9b788e7109a8eb0607f5c8a13495edee3ef8e246f60f0664a7cd25b277"
41
+
42
+ [[package]]
43
+ name = "heck"
44
+ version = "0.5.0"
45
+ source = "registry+https://github.com/rust-lang/crates.io-index"
46
+ checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea"
47
+
48
+ [[package]]
49
+ name = "indoc"
50
+ version = "2.0.8"
51
+ source = "registry+https://github.com/rust-lang/crates.io-index"
52
+ checksum = "a37b2691796cffeb8a8cd305ac66e65841559f147f4e63231d0eafa4db5384d1"
53
+ dependencies = [
54
+ "rustversion",
55
+ ]
56
+
57
+ [[package]]
58
+ name = "itoa"
59
+ version = "1.0.19"
60
+ source = "registry+https://github.com/rust-lang/crates.io-index"
61
+ checksum = "3bd1574e617a9a6c1f8f8181bd7e841e1f20e4277607ef28945765188d6284d4"
62
+
63
+ [[package]]
64
+ name = "libc"
65
+ version = "0.2.191"
66
+ source = "registry+https://github.com/rust-lang/crates.io-index"
67
+ checksum = "65cd87c9a6d60536580b316ad985726104730a5151c99845f2490428ef91240a"
68
+
69
+ [[package]]
70
+ name = "memchr"
71
+ version = "2.8.3"
72
+ source = "registry+https://github.com/rust-lang/crates.io-index"
73
+ checksum = "cf8baf1c55e62ffcace7a9f06f4bd9cd3f0c4beb022d3b367256b91b87513d98"
74
+
75
+ [[package]]
76
+ name = "memoffset"
77
+ version = "0.9.1"
78
+ source = "registry+https://github.com/rust-lang/crates.io-index"
79
+ checksum = "488016bfae457b036d996092f6cb448677611ce4449e970ceaf42695203f218a"
80
+ dependencies = [
81
+ "autocfg",
82
+ ]
83
+
84
+ [[package]]
85
+ name = "once_cell"
86
+ version = "1.21.4"
87
+ source = "registry+https://github.com/rust-lang/crates.io-index"
88
+ checksum = "9f7c3e4beb33f85d45ae3e3a1792185706c8e16d043238c593331cc7cd313b50"
89
+
90
+ [[package]]
91
+ name = "portable-atomic"
92
+ version = "1.15.0"
93
+ source = "registry+https://github.com/rust-lang/crates.io-index"
94
+ checksum = "05c8b63e8d9609db387f0324918f81d68fe27748f084ef092fb35954d0539a85"
95
+
96
+ [[package]]
97
+ name = "proc-macro2"
98
+ version = "1.0.107"
99
+ source = "registry+https://github.com/rust-lang/crates.io-index"
100
+ checksum = "985e7ec9bb745e6ce6535b544d84d6cd6f7ad8bd711c398938ae983b91a766d9"
101
+ dependencies = [
102
+ "unicode-ident",
103
+ ]
104
+
105
+ [[package]]
106
+ name = "pyo3"
107
+ version = "0.23.5"
108
+ source = "registry+https://github.com/rust-lang/crates.io-index"
109
+ checksum = "7778bffd85cf38175ac1f545509665d0b9b92a198ca7941f131f85f7a4f9a872"
110
+ dependencies = [
111
+ "cfg-if",
112
+ "indoc",
113
+ "libc",
114
+ "memoffset",
115
+ "once_cell",
116
+ "portable-atomic",
117
+ "pyo3-build-config",
118
+ "pyo3-ffi",
119
+ "pyo3-macros",
120
+ "unindent",
121
+ ]
122
+
123
+ [[package]]
124
+ name = "pyo3-build-config"
125
+ version = "0.23.5"
126
+ source = "registry+https://github.com/rust-lang/crates.io-index"
127
+ checksum = "94f6cbe86ef3bf18998d9df6e0f3fc1050a8c5efa409bf712e661a4366e010fb"
128
+ dependencies = [
129
+ "once_cell",
130
+ "python3-dll-a",
131
+ "target-lexicon",
132
+ ]
133
+
134
+ [[package]]
135
+ name = "pyo3-ffi"
136
+ version = "0.23.5"
137
+ source = "registry+https://github.com/rust-lang/crates.io-index"
138
+ checksum = "e9f1b4c431c0bb1c8fb0a338709859eed0d030ff6daa34368d3b152a63dfdd8d"
139
+ dependencies = [
140
+ "libc",
141
+ "pyo3-build-config",
142
+ ]
143
+
144
+ [[package]]
145
+ name = "pyo3-macros"
146
+ version = "0.23.5"
147
+ source = "registry+https://github.com/rust-lang/crates.io-index"
148
+ checksum = "fbc2201328f63c4710f68abdf653c89d8dbc2858b88c5d88b0ff38a75288a9da"
149
+ dependencies = [
150
+ "proc-macro2",
151
+ "pyo3-macros-backend",
152
+ "quote",
153
+ "syn 2.0.119",
154
+ ]
155
+
156
+ [[package]]
157
+ name = "pyo3-macros-backend"
158
+ version = "0.23.5"
159
+ source = "registry+https://github.com/rust-lang/crates.io-index"
160
+ checksum = "fca6726ad0f3da9c9de093d6f116a93c1a38e417ed73bf138472cf4064f72028"
161
+ dependencies = [
162
+ "heck",
163
+ "proc-macro2",
164
+ "pyo3-build-config",
165
+ "quote",
166
+ "syn 2.0.119",
167
+ ]
168
+
169
+ [[package]]
170
+ name = "python3-dll-a"
171
+ version = "0.2.15"
172
+ source = "registry+https://github.com/rust-lang/crates.io-index"
173
+ checksum = "d80ba7540edb18890d444c5aa8e1f1f99b1bdf26fb26ae383135325f4a36042b"
174
+ dependencies = [
175
+ "cc",
176
+ ]
177
+
178
+ [[package]]
179
+ name = "quote"
180
+ version = "1.0.47"
181
+ source = "registry+https://github.com/rust-lang/crates.io-index"
182
+ checksum = "1fbf4db142a473a8d80c26bbf18454ed458bf8d26c8219c331daecfdbd079001"
183
+ dependencies = [
184
+ "proc-macro2",
185
+ ]
186
+
187
+ [[package]]
188
+ name = "rustversion"
189
+ version = "1.0.23"
190
+ source = "registry+https://github.com/rust-lang/crates.io-index"
191
+ checksum = "cf54715a573b99ac80df0bc206da022bcd442c974952c7b9720069370852e21f"
192
+
193
+ [[package]]
194
+ name = "serde"
195
+ version = "1.0.229"
196
+ source = "registry+https://github.com/rust-lang/crates.io-index"
197
+ checksum = "4148590afebada386688f18773da617792bf2ef03ffc1e4cbd2b1d45b023e0ba"
198
+ dependencies = [
199
+ "serde_core",
200
+ "serde_derive",
201
+ ]
202
+
203
+ [[package]]
204
+ name = "serde_core"
205
+ version = "1.0.229"
206
+ source = "registry+https://github.com/rust-lang/crates.io-index"
207
+ checksum = "67dca2c9c51e58a4791a4b1ed58308b39c64224d349a935ab5039aa360942a48"
208
+ dependencies = [
209
+ "serde_derive",
210
+ ]
211
+
212
+ [[package]]
213
+ name = "serde_derive"
214
+ version = "1.0.229"
215
+ source = "registry+https://github.com/rust-lang/crates.io-index"
216
+ checksum = "e7a5d71263a5a7d47b41f6b3f06ba276f10cc18b0931f1799f710578e2309348"
217
+ dependencies = [
218
+ "proc-macro2",
219
+ "quote",
220
+ "syn 3.0.10",
221
+ ]
222
+
223
+ [[package]]
224
+ name = "serde_json"
225
+ version = "1.0.154"
226
+ source = "registry+https://github.com/rust-lang/crates.io-index"
227
+ checksum = "e7e9cc8b1b85264074fbcc02a88680c4096b1e47df8f739dceb03bf482f04bd6"
228
+ dependencies = [
229
+ "itoa",
230
+ "memchr",
231
+ "serde",
232
+ "serde_core",
233
+ "zmij",
234
+ ]
235
+
236
+ [[package]]
237
+ name = "shlex"
238
+ version = "2.0.1"
239
+ source = "registry+https://github.com/rust-lang/crates.io-index"
240
+ checksum = "f8fadd59c855ef2080decdef8ff161eb6661b86933c9d82e5ba29dc602a55aba"
241
+
242
+ [[package]]
243
+ name = "syn"
244
+ version = "2.0.119"
245
+ source = "registry+https://github.com/rust-lang/crates.io-index"
246
+ checksum = "872831b642d1a07999a962a351ed35b955ea2cfc8f3862091e2a240a84f17297"
247
+ dependencies = [
248
+ "proc-macro2",
249
+ "quote",
250
+ "unicode-ident",
251
+ ]
252
+
253
+ [[package]]
254
+ name = "syn"
255
+ version = "3.0.10"
256
+ source = "registry+https://github.com/rust-lang/crates.io-index"
257
+ checksum = "4ae9ccbea3a7b0b09443036490c8f34a8b1b760fd345e5c0dae0aac718faea79"
258
+ dependencies = [
259
+ "proc-macro2",
260
+ "quote",
261
+ "unicode-ident",
262
+ ]
263
+
264
+ [[package]]
265
+ name = "target-lexicon"
266
+ version = "0.12.16"
267
+ source = "registry+https://github.com/rust-lang/crates.io-index"
268
+ checksum = "61c41af27dd6d1e27b1b16b489db798443478cef1f06a660c96db617ba5de3b1"
269
+
270
+ [[package]]
271
+ name = "unicode-ident"
272
+ version = "1.0.27"
273
+ source = "registry+https://github.com/rust-lang/crates.io-index"
274
+ checksum = "a2c754d6c33795a1c324727428e5a7dedb5b06195f9890bdbcba760d3e246563"
275
+
276
+ [[package]]
277
+ name = "unindent"
278
+ version = "0.2.4"
279
+ source = "registry+https://github.com/rust-lang/crates.io-index"
280
+ checksum = "7264e107f553ccae879d21fbea1d6724ac785e8c3bfc762137959b5802826ef3"
281
+
282
+ [[package]]
283
+ name = "zmij"
284
+ version = "1.0.23"
285
+ source = "registry+https://github.com/rust-lang/crates.io-index"
286
+ checksum = "29666d0abbfad1e3dc4dcf6144730dd3a3ab225bbbdac83319345b1b44ccfc1b"
@@ -0,0 +1,35 @@
1
+ [workspace]
2
+
3
+ [package]
4
+ name = "cyclic-thermal"
5
+ version = "0.1.0"
6
+ edition = "2021"
7
+ rust-version = "1.75"
8
+ description = "Formally certified IEC 60853 cyclic and transient thermal bounds for buried power cables under soil uncertainty"
9
+ license = "MIT OR Apache-2.0"
10
+ readme = "README.md"
11
+ repository = "https://github.com/ARelaxedScholar/cyclic-thermal"
12
+ homepage = "https://docs.rs/cyclic-thermal"
13
+ documentation = "https://docs.rs/cyclic-thermal"
14
+ keywords = ["iec-60853", "thermal", "ampacity", "buried-cable", "interval-bounds"]
15
+ categories = ["science", "mathematics", "algorithms"]
16
+
17
+ [lib]
18
+ name = "cyclic_thermal"
19
+ crate-type = ["cdylib", "rlib"]
20
+
21
+ [dependencies]
22
+ serde = { version = "1", features = ["derive"] }
23
+ serde_json = "1"
24
+ pyo3 = { version = "0.23", features = ["extension-module", "abi3-py310", "generate-import-lib"], optional = true }
25
+
26
+ [features]
27
+ default = []
28
+ python = ["dep:pyo3"]
29
+
30
+ [package.metadata.docs.rs]
31
+ all-features = false
32
+ rustdoc-args = ["--cfg", "docsrs"]
33
+
34
+ [lints.rust]
35
+ unexpected_cfgs = { level = "warn", check-cfg = ['cfg(kani)'] }
@@ -0,0 +1,15 @@
1
+ Apache License, Version 2.0
2
+
3
+ Copyright (c) 2026 ARelaxedScholar
4
+
5
+ Licensed under the Apache License, Version 2.0 (the "License");
6
+ you may not use this file except in compliance with the License.
7
+ You may obtain a copy of the License at
8
+
9
+ http://www.apache.org/licenses/LICENSE-2.0
10
+
11
+ Unless required by applicable law or agreed to in writing, software
12
+ distributed under the License is distributed on an "AS IS" BASIS,
13
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ See the License for the specific language governing permissions and
15
+ limitations under the License.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 ARelaxedScholar
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,107 @@
1
+ Metadata-Version: 2.4
2
+ Name: cyclic-thermal
3
+ Version: 0.1.0
4
+ Classifier: Development Status :: 4 - Beta
5
+ Classifier: Intended Audience :: Science/Research
6
+ Classifier: Intended Audience :: Developers
7
+ Classifier: License :: OSI Approved :: MIT License
8
+ Classifier: License :: OSI Approved :: Apache Software License
9
+ Classifier: Programming Language :: Rust
10
+ Classifier: Programming Language :: Python :: 3
11
+ Classifier: Programming Language :: Python :: 3.10
12
+ Classifier: Programming Language :: Python :: 3.11
13
+ Classifier: Programming Language :: Python :: 3.12
14
+ Classifier: Programming Language :: Python :: 3.13
15
+ Classifier: Topic :: Scientific/Engineering :: Physics
16
+ License-File: LICENSE-APACHE
17
+ License-File: LICENSE-MIT
18
+ Summary: Formally certified IEC 60853 cyclic and transient thermal bounds for buried cables under soil uncertainty
19
+ Keywords: iec-60853,cyclic-ampacity,thermal,power-engineering,interval-reachability
20
+ Home-Page: https://docs.rs/cyclic-thermal
21
+ Author: ARelaxedScholar
22
+ License: MIT OR Apache-2.0
23
+ Requires-Python: >=3.10
24
+ Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
25
+
26
+ # cyclic-thermal
27
+
28
+ Formally certified **IEC 60853** cyclic and transient thermal bounds for buried power cables under soil uncertainty $[\rho_{\min}, \rho_{\max}] \times [\delta_{\min}, \delta_{\max}]$, in safe Rust (`#![forbid(unsafe_code)]`) with full Python (`PyO3`) and JSON (`serde`) parity.
29
+
30
+ ## Install
31
+
32
+ ```bash
33
+ cargo add cyclic-thermal
34
+ pip install cyclic-thermal
35
+ ```
36
+
37
+ ## Quick start
38
+
39
+ Rust:
40
+
41
+ ```rust
42
+ use cyclic_thermal::{solve_cyclic_thermal, CyclicThermalProblem};
43
+
44
+ let problem: CyclicThermalProblem = serde_json::from_str(&json)?;
45
+ let report = solve_cyclic_thermal(&problem)?;
46
+ println!("peak upper bound: {} C", report.peak_temp_upper_bound_c);
47
+ ```
48
+
49
+ Python:
50
+
51
+ ```python
52
+ import cyclic_thermal as ct
53
+
54
+ report = ct.solve(problem_dict)
55
+ print(report["peak_temp_upper_bound_c"], report["certified_safe"])
56
+ ```
57
+
58
+ Every report contains the certified worst-case peak, steady-state baseline, cyclic credit, certified cyclic rating factor, per-circuit hourly bounds, and a Higham IEEE-754 error certificate.
59
+
60
+ ## Physics & certification guarantees
61
+
62
+ - **Strict SI units:** coordinates/depths in meters (`y_depth_m > 0`), soil resistivity $\rho$ in `K*m/W`, soil thermal diffusivity $\delta$ in `m^2/s`, capacitance in `J/(K*m)`, resistance in `Ohm/m` / `K*m/W`, current in `A`, temperature in `degC`.
63
+ - **Internal Van Wormer / IEC 60853-2 RC thermal ladder:** unconditionally stable, positivity/monotonicity-preserving implicit backward-Euler tridiagonal M-matrix solver (Thomas algorithm).
64
+ - **External soil self & mutual transient step response:** high-precision exponential integral $E_1(x) = -\mathrm{Ei}(-x)$ summed across Kennelly image pairs, with sub-interval pulse-kernel enclosure $\overline{h}_m^{(b)} = \rho_{\max}(g((m+1)\Delta t, \delta_{b+1}) - g(m\Delta t, \delta_b))$ and exact infinite-horizon steady-state tail remainder $R_{\mathrm{tail}}(T_{\mathrm{sim}}, \rho_{\max}, \delta_{\min})$.
65
+ - **Coupled temperature-dependent $R_{\mathrm{ac}}(T)$:** monotone fixed-point upper-bounding across arbitrary piecewise-constant periodic load profiles (Solar bell curves, BESS charge/discharge cycles, emergency steps).
66
+ - **Certified cyclic rating factor $M_{\mathrm{cyclic}}$** and **Higham IEEE-754 `f64` error certificate** on every report.
67
+
68
+ ## Formal verification (`spec/invariants.dfy`)
69
+
70
+ Core theorems verified in **Dafny 4** (`dafny verify --isolate-assertions`, zero `assume`, zero `{:axiom}`, zero `{:verify false}`):
71
+
72
+ - Kennelly image distance positivity ($2y > r$ and $d'^2 > d^2$).
73
+ - Sub-interval pulse-kernel enclosure theorem (`PulseKernelSubIntervalEnclosure`) and convolution monotonicity (`ConvMonotone`).
74
+ - Independent-box conservativeness theorem (`IndependentBoxConservative`).
75
+ - Cooperative / Metzler discrete RC thermal ladder comparison (`CooperativeLadderStepComparison`) and coupled $R_{\mathrm{ac}}(T)$ heat monotonicity (`CoupledRacHeatMonotone`).
76
+ - Higham IEEE-754 binary64 recursive summation error bound (`HighamRecursiveSumErrorBound`, $u = 2^{-53}$).
77
+
78
+ **Refinement boundary (soil moisture correlation & floating point):**
79
+ - Bounding over the independent soil uncertainty box $[\rho_{\min}, \rho_{\max}] \times [\delta_{\min}, \delta_{\max}]$ is a **guaranteed conservative upper bound** even though soil thermal resistivity $\rho$ and thermal diffusivity $\delta$ are physically anti-correlated with soil moisture content (any physically realizable moisture trajectory $(\rho(m), \delta(m))$ lies inside the box and is strictly bounded above).
80
+ - Continuous step-response monotonicity, cooperative ladder comparison, and box conservativeness are proved over exact `real`; finite-precision summation error is bounded under Higham's IEEE-754 `(1 + eps)` model (absent overflow); Rust executes in IEEE-754 `f64` with series/continued-fraction $E_1(x)$ and `#[cfg(kani)]` harnesses.
81
+
82
+ ## Benchmark
83
+
84
+ ```bash
85
+ cargo run --release --example cyclic_benchmark
86
+ ```
87
+
88
+ The 2-circuit BESS+Solar example (box `[0.70, 1.20] K*m/W` x `[3.5e-7, 7.5e-7] m^2/s`) is a deliberate overload case. Measured on the development machine:
89
+
90
+ ```text
91
+ safe=false | peak_ub=94.85 C | steady_worst=105.17 C | credit=10.32 C
92
+ M_cyclic=1.050x | higham=5.36e-10 C | 1056.57 ms
93
+ ```
94
+
95
+ `safe=false` means the certified peak exceeds the configured 90 C limit; the cyclic credit and rating factor remain well-defined. The solver reports the certified bound honestly rather than clamping it.
96
+
97
+ ## Limitations
98
+
99
+ - The soil model is a certified **upper bound** over the independent `(rho, delta)` box, not a point estimate.
100
+ - The internal model is the IEC 60853-2 / Van Wormer RC ladder supplied by the caller; other cable constructions need their own ladder parameters.
101
+ - The cyclic profile is piecewise-constant per `dt_seconds`; sub-step interpolation is not modeled.
102
+ - Kani harnesses are optional and only run when `cargo kani` is available.
103
+
104
+ ## License
105
+
106
+ Dual-licensed under MIT or Apache-2.0.
107
+