@tellegen/engine 0.1.0
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.
- package/LICENSE +19 -0
- package/README.md +53 -0
- package/dist/errors.d.ts +7 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +20 -0
- package/dist/errors.js.map +1 -0
- package/dist/generated/contracts.d.ts +225 -0
- package/dist/generated/contracts.d.ts.map +1 -0
- package/dist/generated/contracts.js +8 -0
- package/dist/generated/contracts.js.map +1 -0
- package/dist/host.d.ts +13 -0
- package/dist/host.d.ts.map +1 -0
- package/dist/host.js +95 -0
- package/dist/host.js.map +1 -0
- package/dist/index.d.ts +333 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +393 -0
- package/dist/index.js.map +1 -0
- package/dist/module.d.ts +11 -0
- package/dist/module.d.ts.map +1 -0
- package/dist/module.js +31 -0
- package/dist/module.js.map +1 -0
- package/dist/protocol.d.ts +101 -0
- package/dist/protocol.d.ts.map +1 -0
- package/dist/protocol.js +63 -0
- package/dist/protocol.js.map +1 -0
- package/dist/wasm-pkg/LICENSE +6 -0
- package/dist/wasm-pkg/LICENSE-APACHE +201 -0
- package/dist/wasm-pkg/LICENSE-MIT +19 -0
- package/dist/wasm-pkg/package.json +21 -0
- package/dist/wasm-pkg/tellegen.d.ts +250 -0
- package/dist/wasm-pkg/tellegen.js +959 -0
- package/dist/wasm-pkg/tellegen_bg.wasm +0 -0
- package/dist/wasm-pkg/tellegen_bg.wasm.d.ts +33 -0
- package/dist/worker.d.ts +11 -0
- package/dist/worker.d.ts.map +1 -0
- package/dist/worker.js +47 -0
- package/dist/worker.js.map +1 -0
- package/package.json +43 -0
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright 2026 Samuel Talkington
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
Copyright (c) 2026 Samuel Talkington and contributors
|
|
2
|
+
|
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
4
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
5
|
+
in the Software without restriction, including without limitation the rights
|
|
6
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
7
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
8
|
+
furnished to do so, subject to the following conditions:
|
|
9
|
+
|
|
10
|
+
The above copyright notice and this permission notice shall be included in all
|
|
11
|
+
copies or substantial portions of the Software.
|
|
12
|
+
|
|
13
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
14
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
15
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
16
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
17
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
18
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
19
|
+
SOFTWARE.
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "tellegen-wasm",
|
|
3
|
+
"type": "module",
|
|
4
|
+
"description": "WebAssembly browser adapter for the tellegen power flow engine.",
|
|
5
|
+
"version": "0.1.0",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "https://github.com/eigenergy/tellegen"
|
|
10
|
+
},
|
|
11
|
+
"files": [
|
|
12
|
+
"tellegen_bg.wasm",
|
|
13
|
+
"tellegen.js",
|
|
14
|
+
"tellegen.d.ts"
|
|
15
|
+
],
|
|
16
|
+
"main": "tellegen.js",
|
|
17
|
+
"types": "tellegen.d.ts",
|
|
18
|
+
"sideEffects": [
|
|
19
|
+
"./snippets/*"
|
|
20
|
+
]
|
|
21
|
+
}
|
|
@@ -0,0 +1,250 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* A build-once handle over the engine, exported to JS. Construct once per case (the
|
|
6
|
+
* network is parsed and the model built here); then [`replace_edits`](Study::replace_edits)
|
|
7
|
+
* solves exactly at an absolute edit state and [`preview_replacement`](Study::preview_replacement)
|
|
8
|
+
* returns a first-order linearization toward an absolute edit state — neither re-parses
|
|
9
|
+
* the network, unlike `solve_json` which rebuilds it on every call. This is
|
|
10
|
+
* the path a reactive drag should use.
|
|
11
|
+
*
|
|
12
|
+
* Arguments and results are JSON in the engine's `Study` shapes: edits are a
|
|
13
|
+
* `NetworkEdit[]` (e.g. `[{"kind":"add_load","bus":2,"p_mw":50}]`; the element key
|
|
14
|
+
* also accepts the powerio row uid string `ingest_case` stamps, e.g.
|
|
15
|
+
* `"bus":"buses:1"`), `preview` watches an
|
|
16
|
+
* `Operand[]` (e.g. `[{"Price":"Active"}]`) and returns a `Preview`. `commit` takes the
|
|
17
|
+
* edits plus a `SensRequest[]` of watched cells and returns `{ solution, iterations,
|
|
18
|
+
* sensitivities }` — the committed [`SolveResponse`] plus the requested ∂operand/∂param
|
|
19
|
+
* columns, computed in the *same* solve (no second round-trip). Only in the sensitivity
|
|
20
|
+
* build (preview needs the differentiable path).
|
|
21
|
+
*/
|
|
22
|
+
export class Study {
|
|
23
|
+
free(): void;
|
|
24
|
+
[Symbol.dispose](): void;
|
|
25
|
+
/**
|
|
26
|
+
* Apply a geographic layer (a canonical `.geo.json` from [`parse_geo`] or
|
|
27
|
+
* [`apply_layout`]) onto this study's base network, so a later
|
|
28
|
+
* [`save_package`](Study::save_package) or export carries the coordinates
|
|
29
|
+
* on screen. Locations are metadata the model never reads; nothing
|
|
30
|
+
* re-solves. Returns the apply report JSON.
|
|
31
|
+
*/
|
|
32
|
+
apply_geo(layer_geojson: string): string;
|
|
33
|
+
/**
|
|
34
|
+
* Apply `edits_json` (a `NetworkEdit[]`) at the committed point and exact-re-solve,
|
|
35
|
+
* attaching the `sensitivities_json` cells (a `SensRequest[]`, or empty/blank for
|
|
36
|
+
* none) in the same solve. Advances the committed point. Returns
|
|
37
|
+
* `{ "solution": SolveResponse, "iterations": Iterations, "sensitivities":
|
|
38
|
+
* SensitivityMatrix[] }` — `solution` is the full committed response, and
|
|
39
|
+
* `iterations` / `sensitivities` mirror its convergence trace and the watched
|
|
40
|
+
* columns so the UI renders the ∂LMP/∂d column without a second solve.
|
|
41
|
+
*/
|
|
42
|
+
commit(edits_json: string, sensitivities_json: string): string;
|
|
43
|
+
/**
|
|
44
|
+
* The formulation tag (`"dcopf"` / `"acpf"`).
|
|
45
|
+
*/
|
|
46
|
+
formulation(): string;
|
|
47
|
+
/**
|
|
48
|
+
* Build a study over `network_json` for `formulation` (`"dcopf"` / `"acpf"`, and —
|
|
49
|
+
* in a build that includes them — `"socwr"` / `"acopf"`), solving the base case.
|
|
50
|
+
* Errors on an unknown or not-built formulation.
|
|
51
|
+
*/
|
|
52
|
+
constructor(network_json: string, formulation: string);
|
|
53
|
+
/**
|
|
54
|
+
* First-order preview of `edits_json` (a `NetworkEdit[]`) for the `watched_json`
|
|
55
|
+
* operands (an `Operand[]`), at the committed point, without re-solving. Returns the
|
|
56
|
+
* `Preview` JSON.
|
|
57
|
+
*/
|
|
58
|
+
preview(edits_json: string, watched_json: string): string;
|
|
59
|
+
/**
|
|
60
|
+
* First-order preview for replacing the committed edit set with `edits_json`.
|
|
61
|
+
* This accepts absolute demand delta state and internally previews only the step
|
|
62
|
+
* from the current committed point.
|
|
63
|
+
*/
|
|
64
|
+
preview_replacement(edits_json: string, watched_json: string): string;
|
|
65
|
+
/**
|
|
66
|
+
* Replace the committed edit set with `edits_json` and exact-re-solve, attaching
|
|
67
|
+
* the `sensitivities_json` cells in the same solve. Use this for UI state that stores
|
|
68
|
+
* absolute demand deltas from the base case.
|
|
69
|
+
*/
|
|
70
|
+
replace_edits(edits_json: string, sensitivities_json: string): string;
|
|
71
|
+
/**
|
|
72
|
+
* Serialize this study as a `.pio.json` package: the base network is the payload,
|
|
73
|
+
* the edit log is the study block (one commit per `commit` call, keyed by row uid),
|
|
74
|
+
* and the formulation and solve options ride under `study.app["tellegen"]`. Returns
|
|
75
|
+
* the package JSON, ready to download or hand to [`export_study`].
|
|
76
|
+
*/
|
|
77
|
+
save_package(): string;
|
|
78
|
+
/**
|
|
79
|
+
* The most recent committed solution as `SolveResponse` JSON.
|
|
80
|
+
*/
|
|
81
|
+
solution(): string;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Fill case coordinates from a PowerWorld `.pwd` sibling: substation symbols
|
|
86
|
+
* project to approximate longitude/latitude and join onto buses through the
|
|
87
|
+
* `SubNum` extras key. Returns the refreshed `ingest_case` payload plus a
|
|
88
|
+
* `report`; errors when no bus joined.
|
|
89
|
+
*/
|
|
90
|
+
export function apply_display_geo(network_json: string, bytes: Uint8Array): string;
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* Apply a [`parse_geo`] layer onto a case network: matched bus points land in
|
|
94
|
+
* `Bus.location`, matched routes in `Branch.route` (matching by uid, external
|
|
95
|
+
* id, name, and the unordered endpoint pair — upstream semantics). Returns
|
|
96
|
+
* the refreshed `ingest_case` payload plus a `report` of matched/unmatched
|
|
97
|
+
* counts; errors when nothing matched.
|
|
98
|
+
*/
|
|
99
|
+
export function apply_geo(network_json: string, layer_geojson: string): string;
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* Stamp a computed layout (bus id => `[lon, lat]`) onto a case network with
|
|
103
|
+
* `kind` provenance (`synthetic` or `manual`). Returns the refreshed
|
|
104
|
+
* `ingest_case` payload plus `layer`, the stamped layout as a canonical
|
|
105
|
+
* `.geo.json` document.
|
|
106
|
+
*/
|
|
107
|
+
export function apply_layout(network_json: string, coords_json: string, kind: string): string;
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* The capability matrix as JSON: which `(formulation, operand, parameter)` cells this
|
|
111
|
+
* build supports, so the UI can populate menus and grey out the rest.
|
|
112
|
+
*/
|
|
113
|
+
export function capabilities_json(): string;
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* Export the balanced study state at commit `commit` to a powerio `format`
|
|
117
|
+
* (`matpower`, `psse`, `powerio-json`, ...). Returns `{ text, warnings, format,
|
|
118
|
+
* extension }` as JSON: the serialized case, the writer's fidelity warnings so the
|
|
119
|
+
* frontend can surface them, and the format token and file extension. The package
|
|
120
|
+
* JSON is untrusted; malformed input returns a `JsError`, never a panic.
|
|
121
|
+
*/
|
|
122
|
+
export function export_study(package_json: string, commit: number, format: string): string;
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* A case's coordinates as a canonical `.geo.json` document (one point per
|
|
126
|
+
* located bus, one route per routed branch, provenance preserved). Errors
|
|
127
|
+
* when the case carries none.
|
|
128
|
+
*/
|
|
129
|
+
export function extract_geo(network_json: string): string;
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* Everything the drop panel needs from one parse: counts, total load and
|
|
133
|
+
* capacity, parse warnings, and a `view` of buses and branches in the shape
|
|
134
|
+
* the tellegen API serves, placed at the coordinates the file carries
|
|
135
|
+
* (PowerWorld complete case aux exports). `view` is null when the file has no
|
|
136
|
+
* coordinates.
|
|
137
|
+
*/
|
|
138
|
+
export function ingest_case(text: string, format: string): string;
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* The distribution counterpart of [`ingest_case`]: view a multiconductor case
|
|
142
|
+
* with no solve. `format` is a distribution reader token (`dss`, `bmopf`,
|
|
143
|
+
* `pmd`) parsed by [`powerio_dist`], or `pio` for a `.pio.json` package
|
|
144
|
+
* carrying a multiconductor payload. Returns the drop-panel payload JSON:
|
|
145
|
+
* name, element counts, connected load/generation (kW), parse warnings,
|
|
146
|
+
* coordinate provenance, and the bus/terminal graph the frontend renders (see
|
|
147
|
+
* [`dist`]).
|
|
148
|
+
*
|
|
149
|
+
* Untrusted input: the parse and package restore return error strings (mapped
|
|
150
|
+
* to `JsError` here), so a malformed, truncated, or oversized `.dss`/JSON
|
|
151
|
+
* rejects cleanly and never panics the wasm instance.
|
|
152
|
+
*/
|
|
153
|
+
export function ingest_dist_case(text: string, format: string): string;
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
* Restore a study saved by [`Study::save_package`]. Returns a JSON bundle the frontend
|
|
157
|
+
* reads to rebuild its case, edit sliders, formulation, and solve options in one step.
|
|
158
|
+
* See [`load_package_bundle`] for the shape and the fail-closed contract.
|
|
159
|
+
*/
|
|
160
|
+
export function load_package(package_json: string): string;
|
|
161
|
+
|
|
162
|
+
/**
|
|
163
|
+
* Parse a case file (MATPOWER, PSS/E RAW, PowerWorld aux, PowerModels or
|
|
164
|
+
* egret JSON) and return `{"network": ..., "warnings": [...]}` as JSON.
|
|
165
|
+
*/
|
|
166
|
+
export function parse_case(text: string, format: string): string;
|
|
167
|
+
|
|
168
|
+
/**
|
|
169
|
+
* Decode a PowerWorld `.pwd` display file (binary). Returns the substation
|
|
170
|
+
* symbols at the diagram coordinates the file stores (x east, y north) plus
|
|
171
|
+
* the canvas size, each with the approximate `lon`/`lat` projection
|
|
172
|
+
* (`pwd_mercator_to_lonlat`; hand edited diagrams drift from it). A `.pwd`
|
|
173
|
+
* carries no buses or branches. `format` is "pwd". Pure in-memory parsing,
|
|
174
|
+
* no filesystem, so it runs in the browser.
|
|
175
|
+
*/
|
|
176
|
+
export function parse_display(bytes: Uint8Array, format: string): string;
|
|
177
|
+
|
|
178
|
+
/**
|
|
179
|
+
* Parse a geographic sidecar (buscoords CSV, aliased CSV/JSON records,
|
|
180
|
+
* GeoJSON) from raw dropped bytes; `hint` is the file name ("" to sniff).
|
|
181
|
+
* Returns `{ layer, warnings, n_points, n_routes }` — the layer as its
|
|
182
|
+
* canonical `.geo.json` document, ready for [`apply_geo`]. Untrusted input
|
|
183
|
+
* rejects as a `JsError`, never a panic.
|
|
184
|
+
*/
|
|
185
|
+
export function parse_geo(bytes: Uint8Array, hint: string): string;
|
|
186
|
+
|
|
187
|
+
/**
|
|
188
|
+
* The stateless solve front door: a [`SolveRequest`](tellegen::SolveRequest) JSON
|
|
189
|
+
* in, a [`SolveResponse`](tellegen::SolveResponse) JSON out. One-shot callers only;
|
|
190
|
+
* the reactive hot path is the [`Study`].
|
|
191
|
+
*/
|
|
192
|
+
export function solve_json(network_json: string, request_json: string): string;
|
|
193
|
+
|
|
194
|
+
export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
|
|
195
|
+
|
|
196
|
+
export interface InitOutput {
|
|
197
|
+
readonly memory: WebAssembly.Memory;
|
|
198
|
+
readonly __wbg_study_free: (a: number, b: number) => void;
|
|
199
|
+
readonly apply_display_geo: (a: number, b: number, c: number, d: number) => [number, number, number, number];
|
|
200
|
+
readonly apply_geo: (a: number, b: number, c: number, d: number) => [number, number, number, number];
|
|
201
|
+
readonly apply_layout: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number, number, number];
|
|
202
|
+
readonly capabilities_json: () => [number, number];
|
|
203
|
+
readonly export_study: (a: number, b: number, c: number, d: number, e: number) => [number, number, number, number];
|
|
204
|
+
readonly extract_geo: (a: number, b: number) => [number, number, number, number];
|
|
205
|
+
readonly ingest_case: (a: number, b: number, c: number, d: number) => [number, number, number, number];
|
|
206
|
+
readonly ingest_dist_case: (a: number, b: number, c: number, d: number) => [number, number, number, number];
|
|
207
|
+
readonly load_package: (a: number, b: number) => [number, number, number, number];
|
|
208
|
+
readonly parse_case: (a: number, b: number, c: number, d: number) => [number, number, number, number];
|
|
209
|
+
readonly parse_display: (a: number, b: number, c: number, d: number) => [number, number, number, number];
|
|
210
|
+
readonly parse_geo: (a: number, b: number, c: number, d: number) => [number, number, number, number];
|
|
211
|
+
readonly solve_json: (a: number, b: number, c: number, d: number) => [number, number, number, number];
|
|
212
|
+
readonly study_apply_geo: (a: number, b: number, c: number) => [number, number, number, number];
|
|
213
|
+
readonly study_commit: (a: number, b: number, c: number, d: number, e: number) => [number, number, number, number];
|
|
214
|
+
readonly study_formulation: (a: number) => [number, number];
|
|
215
|
+
readonly study_new: (a: number, b: number, c: number, d: number) => [number, number, number];
|
|
216
|
+
readonly study_preview: (a: number, b: number, c: number, d: number, e: number) => [number, number, number, number];
|
|
217
|
+
readonly study_preview_replacement: (a: number, b: number, c: number, d: number, e: number) => [number, number, number, number];
|
|
218
|
+
readonly study_replace_edits: (a: number, b: number, c: number, d: number, e: number) => [number, number, number, number];
|
|
219
|
+
readonly study_save_package: (a: number) => [number, number, number, number];
|
|
220
|
+
readonly study_solution: (a: number) => [number, number, number, number];
|
|
221
|
+
readonly __wbindgen_free: (a: number, b: number, c: number) => void;
|
|
222
|
+
readonly __wbindgen_malloc: (a: number, b: number) => number;
|
|
223
|
+
readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
|
|
224
|
+
readonly __externref_table_alloc: () => number;
|
|
225
|
+
readonly __wbindgen_externrefs: WebAssembly.Table;
|
|
226
|
+
readonly __externref_table_dealloc: (a: number) => void;
|
|
227
|
+
readonly __wbindgen_start: () => void;
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
export type SyncInitInput = BufferSource | WebAssembly.Module;
|
|
231
|
+
|
|
232
|
+
/**
|
|
233
|
+
* Instantiates the given `module`, which can either be bytes or
|
|
234
|
+
* a precompiled `WebAssembly.Module`.
|
|
235
|
+
*
|
|
236
|
+
* @param {{ module: SyncInitInput }} module - Passing `SyncInitInput` directly is deprecated.
|
|
237
|
+
*
|
|
238
|
+
* @returns {InitOutput}
|
|
239
|
+
*/
|
|
240
|
+
export function initSync(module: { module: SyncInitInput } | SyncInitInput): InitOutput;
|
|
241
|
+
|
|
242
|
+
/**
|
|
243
|
+
* If `module_or_path` is {RequestInfo} or {URL}, makes a request and
|
|
244
|
+
* for everything else, calls `WebAssembly.instantiate` directly.
|
|
245
|
+
*
|
|
246
|
+
* @param {{ module_or_path: InitInput | Promise<InitInput> }} module_or_path - Passing `InitInput` directly is deprecated.
|
|
247
|
+
*
|
|
248
|
+
* @returns {Promise<InitOutput>}
|
|
249
|
+
*/
|
|
250
|
+
export default function __wbg_init (module_or_path?: { module_or_path: InitInput | Promise<InitInput> } | InitInput | Promise<InitInput>): Promise<InitOutput>;
|